2
I have a DVD containing 4 recorded mpeg2 video files with pcm_dvd encoded audio. I want to concat these 4 files together, including the audio streams. However, when I concat these files with ffmpeg and the concat demuxer, the output .mpg file has a corrupted audio stream that now claims to be in mp2 format.
Here's the output of ffprobe on one of the 4 input files:
Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv), 720x480 [SAR 32:27 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn
Stream #0:1[0xa0]: Audio: pcm_dvd, 48000 Hz, 2 channels, s16, 1536 kb/s
And here's the command I used to concat these files:
ffmpeg -f concat -safe 0 -i /tmp/files.txt -c copy -y out.mpg
where /tmp/files.txt is a list of the 4 file parts as defined in the concat documentation.
The output file then looks like this:
[mp2 @ 0x2af9d00] Header missing
Last message repeated 282 times
[mpeg @ 0x2af66e0] decoding for stream 1 failed
[mpeg @ 0x2af66e0] Could not find codec parameters for stream 1 (Audio: mp2, 0 channels, s16p): unspecified frame size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mpeg, from 'out.mpg':
Duration: 03:15:36.75, start: 0.533367, bitrate: 7184 kb/s
Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv), 720x480 [SAR 32:27 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn
Stream #0:1[0x1c0]: Audio: mp2, 0 channels, s16p
The mp2 header is missing (don't know why it's now mp2) and when playing the video with vlc, the audio is certainly corrupted. How should I concatenate these files to correctly encode audio? Note that I have also tried using the concat protocol instead of the demuxer, with the same result
Thank you. A question - is this issue present for all LPCM streams? Is it a problem for MPEG-4, too? I receive many different kinds of video/audio from customers that I have to re-encode. – tyleha – 2017-11-29T22:03:30.343
1Yes, ffmpeg only writes encoded pcm_s16be to mpeg-1/2 containers. For MP4, LPCM isn't supported at all. – Gyan – 2017-11-30T04:46:58.877