ffmpeg:从.mxf流复制到NLE兼容格式

时间:2013-05-31 00:09:24

标签: ffmpeg

由于我的NLE软件不支持Canon XF100的.mxf文件,我需要将它们转换为支持的格式。

据我所知,mxf文件只是mpeg2流的另一种容器格式,所以提取流并将它们放入另一个容器(没有重新编码)会非常好。

我认为ffmpeg可以做到这一点 - 如果我错了,请纠正我 - 运行以下命令:

ffmpeg -i in.mxf -vcodec copy out.m2ts (or .ts, .mts, ...)

ffmpeg在大约2秒后完成没有错误(in.mxf接近170mb):

c:\video>c:\ffmpeg\bin\ffmpeg -i in.MXF -vcodec copy out.m2ts
ffmpeg version N-53680-g0ab9362 Copyright (c) 2000-2013 the FFmpeg developers
  built on May 30 2013 12:14:03 with gcc 4.7.3 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-
amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --
enable-libxvid --enable-zlib
  libavutil      52. 34.100 / 52. 34.100
  libavcodec     55. 12.102 / 55. 12.102
  libavformat    55.  8.100 / 55.  8.100
  libavdevice    55.  2.100 / 55.  2.100
  libavfilter     3. 73.100 /  3. 73.100
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
Guessed Channel Layout for  Input Stream #0.1 : mono
Guessed Channel Layout for  Input Stream #0.2 : mono
Input #0, mxf, from 'in.MXF':
  Metadata:
    uid             : 1bb23c97-6205-4800-80a2-e00002244ba7
    generation_uid  : 1bb23c97-6205-4800-8122-e00002244ba7
    company_name    : CANON
    product_name    : XF100
    product_version : 1.00
    product_uid     : 060e2b34-0401-010d-0e15-005658460100
    modification_date: 2013-01-06 11:05:02
    timecode        : 01:42:14:22
  Duration: 00:00:28.32, start: 0.000000, bitrate: 51811 kb/s
    Stream #0:0: Video: mpeg2video (4:2:2), yuv422p, 1920x1080 [SAR 1:1 DAR 16:9
], 25 fps, 25 tbr, 25 tbn, 50 tbc
    Stream #0:1: Audio: pcm_s16le, 48000 Hz, mono, s16, 768 kb/s
    Stream #0:2: Audio: pcm_s16le, 48000 Hz, mono, s16, 768 kb/s
Output #0, mpegts, to 'out.m2ts':
  Metadata:
    uid             : 1bb23c97-6205-4800-80a2-e00002244ba7
    generation_uid  : 1bb23c97-6205-4800-8122-e00002244ba7
    company_name    : CANON
    product_name    : XF100
    product_version : 1.00
    product_uid     : 060e2b34-0401-010d-0e15-005658460100
    modification_date: 2013-01-06 11:05:02
    timecode        : 01:42:14:22
    encoder         : Lavf55.8.100
    Stream #0:0: Video: mpeg2video, yuv422p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-3
1, 25 fps, 90k tbn, 25 tbc
    Stream #0:1: Audio: mp2, 48000 Hz, mono, s16, 128 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (pcm_s16le -> mp2)
Press [q] to stop, [?] for help
frame=  532 fps=0.0 q=-1.0 size=  143511kB time=00:00:21.25 bitrate=55314.1kbits
frame=  561 fps=435 q=-1.0 size=  151254kB time=00:00:22.42 bitrate=55242.0kbits
frame=  586 fps=314 q=-1.0 size=  158021kB time=00:00:23.41 bitrate=55288.0kbits
frame=  609 fps=255 q=-1.0 size=  164182kB time=00:00:24.34 bitrate=55235.4kbits
frame=  636 fps=217 q=-1.0 size=  171463kB time=00:00:25.42 bitrate=55235.1kbits
frame=  669 fps=194 q=-1.0 size=  180133kB time=00:00:26.72 bitrate=55226.3kbits
frame=  699 fps=173 q=-1.0 size=  188326kB time=00:00:27.92 bitrate=55256.6kbits
frame=  708 fps=169 q=-1.0 Lsize=  190877kB time=00:00:28.30 bitrate=55233.6kbit
s/s
video:172852kB audio:442kB subtitle:0 global headers:0kB muxing overhead 10.1461
18%

不幸的是,输出文件只能由vlc播放器正确显示。 我的NLE软件(Cyber​​link Power Director)能够打开文件,但大部分图片都是绿色的。左边缘只有几个像素显示原始视频:

output file

任何想法如何解决这个问题?有没有更好的方法在没有本机支持的情况下在NLE软件中使用.mxf文件?

提前致谢

1 个答案:

答案 0 :(得分:3)

Thanks to Carl

ffmpeg -fflags +genpts -i in.MXF -c copy out.mkv