如何从mov文件中提取ffmpeg中的音频

How to extract audio in ffmpeg from mov file

我有一个带有 .mov 容器的 ProRes422 文件:FINAL.mov。我想将音轨保存到一个新文件中(没有编码或任何东西,只需将其保存)。在 QuickTime 中有一个选项可以保存“仅音频”--

ffmpeg 中执行此操作的等效方法是什么?从基础研究来看,似乎是这样的:

$ ffmpeg \
    -i FINAL.mov \
    -vn # remove video? \
    ?? # keep audio \ 
    MYAUDIO_FINAL.mov

$ ffmpeg -i 给出:

Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'FINAL.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    creation_time   : 2016-01-11T19:23:10.000000Z
    com.apple.finalcutstudio.media.uuid: CE6F1278-8982-4B98-9E46-AE7C329436EF
    com.apple.quicktime.player.movie.audio.gain: 1.000000
    com.apple.quicktime.player.movie.audio.treble: 0.000000
    com.apple.quicktime.player.movie.audio.bass: 0.000000
    com.apple.quicktime.player.movie.audio.balance: 0.000000
    com.apple.quicktime.player.movie.audio.pitchshift: 0.000000
    com.apple.quicktime.player.movie.audio.mute:
    com.apple.quicktime.player.movie.visual.brightness: 0.000000
    com.apple.quicktime.player.movie.visual.color: 1.000000
    com.apple.quicktime.player.movie.visual.tint: 0.000000
    com.apple.quicktime.player.movie.visual.contrast: 1.000000
    com.apple.quicktime.player.version: 7.6.6 (7.6.6)
    com.apple.quicktime.version: 7.7.3 (2826.24) 0x7738000 (Mac OS X, 10.9.5, 13F34)
  Duration: 00:01:59.58, start: 0.000000, bitrate: 154872 kb/s
    Stream #0:0(eng): Video: prores (apch / 0x68637061), yuv422p10le(bt709, progressive), 1920x1080, 153307 kb/s, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 23976 tbn, 23976 tbc (default)
    Metadata:
      creation_time   : 2016-01-11T19:23:10.000000Z
      handler_name    : Apple Alias Data Handler
      encoder         : Apple ProRes 422 (HQ)
    Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s (default)
    Metadata:
      creation_time   : 2016-01-11T19:23:10.000000Z
      handler_name    : Apple Alias Data Handler

第二个 8 声道音频文件:

  Duration: 01:10:12.00, start: 0.000000, bitrate: 173231 kb/s
    Stream #0:0(eng): Video: prores (apch / 0x68637061), yuv422p10le(bt709, progressive), 1920x1080, 164007 kb/s, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 24k tbn, 24k tbc (default)
    Metadata:
      handler_name    : Apple Alias Data Handler
      encoder         : Apple ProRes 422 (HQ)
    Stream #0:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels (FL), s32 (24 bit), 1152 kb/s (default)
    Metadata:
      handler_name    : Apple Alias Data Handler
    Stream #0:2(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels (FR), s32 (24 bit), 1152 kb/s (default)
    Metadata:
      handler_name    : Apple Alias Data Handler
    Stream #0:3(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, mono, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      handler_name    : Apple Alias Data Handler
    Stream #0:4(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels (LFE), s32 (24 bit), 1152 kb/s (default)
    Metadata:
      handler_name    : Apple Alias Data Handler
    Stream #0:5(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels (BL), s32 (24 bit), 1152 kb/s (default)
    Metadata:
      handler_name    : Apple Alias Data Handler
    Stream #0:6(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels (BR), s32 (24 bit), 1152 kb/s (default)
    Metadata:
      handler_name    : Apple Alias Data Handler
    Stream #0:7(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels (DL), s32 (24 bit), 1152 kb/s (default)
    Metadata:
      handler_name    : Apple Alias Data Handler
    Stream #0:8(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels (DR), s32 (24 bit), 1152 kb/s (default)
    Metadata:
      handler_name    : Apple Alias Data Handler
At least one output file must be specified
ffmpeg -i input.mov -map 0:a -c copy output.mov
  • -map 0:a 从输入 #0 中选择所有 a 音频流。使用 -map 禁用默认的 stream selection 行为,否则默认情况下会为每种流类型选择一个流。

  • 这使用stream copy模式(-c copy)所以它就像复制粘贴,不会出现re-encoding。