使用 FFmpeg 从视频中提取音频

1. 提取完整音频

ffmpeg -i sample.mp4 -q:a 0 -map a sample.mp3

2. 提取特定时段的音频

ffmpeg -i sample.mp4 -ss 00:03:05 -t 00:00:45.0 -q:a 0 -map a sample.mp3
  • ss 选项指定开始时间戳,使用 t 选项指定编码持续时间,例如从3分钟到5秒钟,持续45秒。
  • 时间戳必须采用 HH:MM:SS.xxx 格式或以秒为单位。
  • 如果你不指定 t 选项,它将会结束。

  • FFmpeg 提取视频的音频

3. 直接提取音频流

ffmpeg -i input.flv -vn -codec copy out.m4a

其中,-i的意思是input,后接输入源。-codec的意思是直接复制流。




    Enjoy Reading This Article?

    Here are some more articles you might like to read next:

  • al-folio 本地部署记录(Ubuntu 24.04)
  • C++ Traits
  • 道格拉斯-普克算法(Douglas–Peucker algorithm)
  • CMake支持库收集
  • QGC代码架构解析:飞行前检查(起飞条件)