如何在没有视频卡顿的情况下使用FFMPEG将QuickTime MOV重新封装(直通)到MP4?


4

我一直试图用ffmpeg将QuickTime中的一些视频重新封装到MP4中,但结果有点搞砸了。编解码器都兼容MP4,因此一切正常。问题是生成的MP4文件都有大量的视频卡顿。例如,它将播放,然后跳回半秒,然后返回到它应该的位置,然后再跳过,依此类推。

我尝试了以下标志的各种组合: -c copy -vcodec copy -acodec copy -copyts,但我还没有找到任何有用的东西。那么在重新封装时我需要做些什么来避免口吃呢?

我在这里试试 -c copy -copyts

$ ffmpeg -i in.mov -c copy -copyts out2.mp4
ffmpeg version 1.2.2 Copyright (c) 2000-2013 the FFmpeg developers
  built on Aug 13 2013 00:49:34 with Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
  configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-libtheora --enable-libschroedinger --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libspeex --enable-libass --enable-libbluray --enable-gnutls --enable-libfreetype --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/clang --arch=x86_64 --enable-yasm --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid --enable-nonfree --enable-libfaac
  libavutil      52. 18.100 / 52. 18.100
  libavcodec     54. 92.100 / 54. 92.100
  libavformat    54. 63.104 / 54. 63.104
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 42.103 /  3. 42.103
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'in.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    creation_time   : 2013-02-13 06:40:06
  Duration: 00:45:10.08, start: 0.040000, bitrate: 503 kb/s
    Stream #0:0(eng): Video: h264 (High) (H264 / 0x34363248), yuv420p, 644x364 [SAR 1:1 DAR 23:13], 402 kb/s, 25 fps, 25 tbr, 1k tbn, 50 tbc
    Metadata:
      creation_time   : 2013-02-13 06:40:06
      handler_name    : Apple Alias Data Handler
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 95 kb/s
    Metadata:
      creation_time   : 2013-02-13 06:40:06
      handler_name    : Apple Alias Data Handler
Output #0, mp4, to 'out2.mp4':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    encoder         : Lavf54.63.104
    Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 644x364 [SAR 1:1 DAR 23:13], q=2-31, 402 kb/s, 25 fps, 16k tbn, 1k tbc
    Metadata:
      creation_time   : 2013-02-13 06:40:06
      handler_name    : Apple Alias Data Handler
    Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo, 95 kb/s
    Metadata:
      creation_time   : 2013-02-13 06:40:06
      handler_name    : Apple Alias Data Handler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=67751 fps=15817 q=-1.0 Lsize=  166739kB time=00:45:10.04 bitrate= 504.0kbits/s    
video:133281kB audio:31756kB subtitle:0 global headers:0kB muxing overhead 1.031415%

在这里,我尝试设置要复制的音频和视频编解码器:

$ ffmpeg -i in.mov -vcodec copy -acodec copy out4.mp4
ffmpeg version 1.2.2 Copyright (c) 2000-2013 the FFmpeg developers
  built on Aug 13 2013 00:49:34 with Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
  configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-libtheora --enable-libschroedinger --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libspeex --enable-libass --enable-libbluray --enable-gnutls --enable-libfreetype --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/clang --arch=x86_64 --enable-yasm --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid --enable-nonfree --enable-libfaac
  libavutil      52. 18.100 / 52. 18.100
  libavcodec     54. 92.100 / 54. 92.100
  libavformat    54. 63.104 / 54. 63.104
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 42.103 /  3. 42.103
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'in.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    creation_time   : 2013-02-13 06:40:06
  Duration: 00:45:10.08, start: 0.040000, bitrate: 503 kb/s
    Stream #0:0(eng): Video: h264 (High) (H264 / 0x34363248), yuv420p, 644x364 [SAR 1:1 DAR 23:13], 402 kb/s, 25 fps, 25 tbr, 1k tbn, 50 tbc
    Metadata:
      creation_time   : 2013-02-13 06:40:06
      handler_name    : Apple Alias Data Handler
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 95 kb/s
    Metadata:
      creation_time   : 2013-02-13 06:40:06
      handler_name    : Apple Alias Data Handler
Output #0, mp4, to 'out4.mp4':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    encoder         : Lavf54.63.104
    Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 644x364 [SAR 1:1 DAR 23:13], q=2-31, 402 kb/s, 25 fps, 16k tbn, 1k tbc
    Metadata:
      creation_time   : 2013-02-13 06:40:06
      handler_name    : Apple Alias Data Handler
    Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo, 95 kb/s
    Metadata:
      creation_time   : 2013-02-13 06:40:06
      handler_name    : Apple Alias Data Handler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=67751 fps=15495 q=-1.0 Lsize=  166739kB time=00:45:10.00 bitrate= 504.0kbits/s    
video:133281kB audio:31756kB subtitle:0 global headers:0kB muxing overhead 1.031400%

它是否适用于所有MOV文件或只是特定的MOV文件?如果是后者,你能提供样品吗?你能试一下吗 mp4box -add in.mov out.mp4 并查看是否会产生可播放的文件?
slhck

我在哪里可以获得mp4box?
CyberSkull

gpac.wp.mines-telecom.fr/mp4box 例如 - 虽然不是特别难找。很抱歉再次提问,但它是否与所有文件或仅一个文件一起发生,您是否碰巧有样品?
slhck

@slhck在除一个文件之外的所有文件上发生。
CyberSkull

@slhck我需要获得整个GPAC包还是我可以获得mp4box?
CyberSkull

Answers:


0

我认为源文件有点被破坏了。 如果仅重新编码音频流,输出文件的行为是否相同? 如果是,那么您还必须重新编码视频流。 您可以使用我的应用程序进行快速测试, dmMediaConverter 这是一个ffmpeg GUI。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.