FFMPEG conversion to MXF
Solution 1
In your command, video codec is specified as the output file format. As a result, the audio is stripped, and the output file is mpeg
, not mxf
.
The conversion can be done with the following command:
ffmpeg -i input.mpg -vcodec mpeg2video -acodec pcm_s16le -ar 48000 -ac 2 output.mxf
The output file format will be guessed from the file extension. Alternatively, option -f mxf
can be used. Due to MXF
format limitations, frame rate may need to be specified -r 25
. Options -vcodec
and -acodec
can be omitted to the same result.
Solution 2
I think you're overspecifying things. Try:
ffmpeg -i input.mpg -vcodec copy -acodec pcm_s16le -ar 48000 -ac 2 output.mxf
You shouldn't need -map
with simple input and output files having only one audio and one video stream. These days ffmpeg also knows how to format mxf files and can guess to use that format based on the extension.
I suspect that your problem was a result of specifying mpeg2video
('raw MPEG-2 video'), a format that doesn't appear to include audio.
Comments
-
MFB over 4 years
I have to wrap an MPEG2 video file in an MXF container and convert the audio in the process. I have the MXF wrapping working but it won't convert the audio stream (which needs to be 16bit, 48kHz Linear PCM).
Here's what I'm trying:
ffmpeg -i input.mpg -map 0:0 -map 0:1 -vcodec copy -f mpeg2video -acodec pcm_s16le -ar 48000 -ac 2 output.mxf
Results:
ffmpeg version 0.10 Copyright (c) 2000-2012 the FFmpeg developers built on Jan 30 2012 17:49:23 with gcc 4.2.1 (Apple Inc. build 5666) (dot 3) configuration: *{snipped}* runtime-cpudetect libavutil 51. 34.101 / 51. 34.101 libavcodec 53. 60.100 / 53. 60.100 libavformat 53. 31.100 / 53. 31.100 libavdevice 53. 4.100 / 53. 4.100 libavfilter 2. 60.100 / 2. 60.100 libswscale 2. 1.100 / 2. 1.100 libswresample 0. 6.100 / 0. 6.100 libpostproc 52. 0.100 / 52. 0.100 [mpeg @ 0x10201ae00] max_analyze_duration 5000000 reached at 5000000 Input #0, mpeg, from '/Volumes/Extra/test.mpg': Duration: 00:00:59.97, start: 0.192911, bitrate: 6513 kb/s Stream #0:0[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16, 384 kb/s Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x576 [SAR 16:15 DAR 4:3], 12000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc Output #0, mpeg2video, to 'video.mxf': Metadata: encoder : Lavf53.31.100 Stream #0:0: Video: mpeg2video, yuv420p, 720x576 [SAR 16:15 DAR 4:3], q=2-31, 12000 kb/s, 25 fps, 90k tbn, 25 tbc Stream mapping: Stream #0:1 -> #0:0 (copy) Press [q] to stop, [?] for help frame= 1500 fps= 0 q=-1.0 Lsize= 43949kB time=00:00:59.96 bitrate=6004.6kbits/s video:43949kB audio:0kB global headers:0kB muxing overhead 0.000000%
The video plays fine as the MXF, but there is no audio stream at all. Any help would be great.
-
MFB over 12 yearsThanks blahdiblah but still no go. I tried your suggestion and then took it one step further
ffmpeg -i input.mpg output.mxf
and still no audio stream. Any other ideas? -
thvs86 over 5 yearsI know this is a late answer, but I had good results with
ffmpeg -i INPUT.mov -vcodec mpeg2video -qscale 1 -qmin 1 -ar 48000 OUTPUT.mxf
You can select a video quality level with -qscale:v n (or the alias -q:v n), where n=a number from 1-31, 1 being high-q/largest filesize & 31 being low-q/smallest filesize. This is a variable bit rate mode. [trac.ffmpeg.org/wiki/Encode/MPEG-4] qmax&qmin are the 'quality-ranges' to encode.qmin 50,qmax 51=low-q.qmin 0,qmax 1=high-q [stackoverflow.com/questions/18563764/…