使用“ -t”的FFMPEG输出持续时间太长10 ms

时间:2018-10-09 14:43:33

标签: ffmpeg

我正在使用此命令从35秒的QuickTime文件中获取视频,并将音频替换为WAV:

ffmpeg -i 'video.mov' -i 'audio.wav' -c:v copy -c:a copy -map 0:v:0 -map 1:a:0 -t 35.0000 'output.mov'

但是音频比视频稍长,我正在尝试使用-t 35使ffmpeg将输出精确调整为精确 35秒,但输出为 35.01 < / strong>秒。

我也尝试了-t 35.000-to 35以及其他几个选项,但是它总是10毫秒长。

ffmpeg输出:

ffmpeg version N-91789-g11cec34829 Copyright (c) 2000-2018 the FFmpeg developers
  built with Apple LLVM version 9.1.0 (clang-902.0.39.2)
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-appkit --enable-avfoundation --enable-coreimage --enable-audiotoolbox
  libavutil      56. 19.100 / 56. 19.100
  libavcodec     58. 27.101 / 58. 27.101
  libavformat    58. 17.106 / 58. 17.106
  libavdevice    58.  4.101 / 58.  4.101
  libavfilter     7. 26.100 /  7. 26.100
  libswscale      5.  2.100 /  5.  2.100
  libswresample   3.  2.100 /  3.  2.100
  libpostproc    55.  2.100 / 55.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    creation_time   : 2018-10-09T13:41:49.000000Z
  Duration: 00:00:35.00, start: 0.000000, bitrate: 172467 kb/s
    Stream #0:0(eng): Video: prores (apch / 0x68637061), yuv422p10le(tv, bt709, progressive), 1920x1080, 170692 kb/s, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 25 tbn, 25 tbc (default)
    Metadata:
      creation_time   : 2018-10-09T13:41:49.000000Z
      handler_name    : Apple Video Media Handler
      encoder         : Apple ProRes 422 (HQ)
      timecode        : 00:01:12:22
    Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s (default)
    Metadata:
      creation_time   : 2018-10-09T13:41:49.000000Z
      handler_name    : Apple Sound Media Handler
      timecode        : 00:01:12:22
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      creation_time   : 2018-10-09T13:41:49.000000Z
      handler_name    : Time Code Media Handler
      timecode        : 00:01:12:22
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, wav, from 'audio.wav':
  Metadata:
    encoded_by      : Pro Tools
    originator_reference: aaygKpJ1bvMk
    date            : 2018-10-02
    creation_time   : 12:29:34
    time_reference  : 172800000
  Duration: 00:00:35.04, bitrate: 2316 kb/s
    Stream #1:0: Audio: pcm_s24le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s32 (24 bit), 2304 kb/s
Output #0, mov, to 'output.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    encoder         : Lavf58.17.106
    Stream #0:0(eng): Video: prores (apch / 0x68637061), yuv422p10le(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 170692 kb/s, 0.04 fps, 25 tbr, 12800 tbn, 25 tbc (default)
    Metadata:
      creation_time   : 2018-10-09T13:41:49.000000Z
      handler_name    : Apple Video Media Handler
      encoder         : Apple ProRes 422 (HQ)
      timecode        : 00:01:12:22
    Stream #0:1: Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, stereo, s32 (24 bit), 2304 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #1:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=  875 fps=479 q=-1.0 Lsize=  739138kB time=00:00:34.99 bitrate=173024.6kbits/s speed=19.2x    
video:729276kB audio:9846kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.002153%

1 个答案:

答案 0 :(得分:1)

解决方案:将-t 35放在-i audio.wav之前:

ffmpeg -i 'video.mov' -t 35 -i 'audio.wav' -c:v copy -c:a copy -map 0:v:0 -map 1:a:0 'output.mov'