I have two *.mpg files. I'd like to concatenate them by picking the video stream (MPEG-2) and the MP2 audio stream. My problem is that the streams are always reencoded. I'd like to avoid this, but I'm failing for many hours now trying different kind of things.
Input #0, mpeg, from 'D:\a.mpg': Duration: 01:25:54.05, start: 0.500000, bitrate: 4528 kb/s Stream #0:0[0x1bf]: Data: dvd_nav_packet Stream #0:1[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16p, 192 kb/s Stream #0:2[0x80]: Audio: ac3, 48000 Hz, stereo, fltp, 384 kb/s Stream #0:3[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, top first), 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc Input #1, mpeg, from 'D:\b.mpg': Duration: 00:12:53.11, start: 0.500000, bitrate: 4486 kb/s Stream #1:0[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16p, 192 kb/s Stream #1:1[0x80]: Audio: ac3, 48000 Hz, stereo, fltp, 384 kb/s Stream #1:2[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, top first), 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
FFmpeg args: (one of the many tried)
-i "d:\a.mpg" -i "d:\b.mpg" -filter_complex "[0:3][0:1][1:2][1:0]concat=n=2:v=1:a=1[v][a]" -map [v] -map [a] "d:\c.mpg"
Stream mapping: Stream #0:1 (mp2) -> concat:in0:a0 Stream #0:3 (mpeg2video) -> concat:in0:v0 Stream #1:0 (mp2) -> concat:in1:a0 Stream #1:2 (mpeg2video) -> concat:in1:v0 concat:out:v0 -> Stream #0:0 (mpeg1video) concat:out:a0 -> Stream #0:1 (mp2)
As you can see, the output is "mpeg1video" even though the stream should just be copied. However, specifying "-c copy" isn't valid with a complex filter. "-f mpeg" and "-f dvd" for the output file also do not work. The latter does create an MPEG-2 video stream, but it causes reencoding, too, even though it's not necessary.
I do know the "-f concat" input format, but what am I missing trying to go this way? I know that FFmpeg is able to mux MPEG-2 video and MP2 audio into an .mpg file (PS format, not TS) because, if I just remux from input.ts to output.mpg specifying -c copy, it just copies the streams as intended. This shows that, if there's an MPEG-2 video stream, an MP2 audio stream and the destination file name's extension is ".mpg" it automatically uses the right muxer w/o reencoding. However, not in the case above.
Thanks for reading so far.