[FFmpeg-user] Remux TS to MPG: spedify stream order

Dmpfbck xbtw0hx96ql8t8aj_ffmpeg at freenet.de
Fri Feb 26 00:37:56 CET 2016


Hi,

whenever I remux a .TS file to an .MPG file, the video stream in the
resulting file is not stream #0.

Command line:
    ffmpeg.exe -i infile.ts -map 0:v -map 0:a -vcodec copy -acodec copy outfile.mpg


Streams within the .ts file:
    Stream #0:0[0xa3]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv), [...]
    Stream #0:1[0x68](ger): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 192 kb/s (clean effects)
    Stream #0:2[0x6c]: Unknown: none ([5][0][0][0] / 0x0005)
    Stream #0:3[0x69](ger): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
    Stream #0:4[0x6a](ger): Audio: ac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, fltp, 384 kb/s (clean effects)
    Stream #0:5[0x6e](deu): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
    Stream #0:6[0x6f]: Unknown: none ([11][0][0][0] / 0x000B)
    Stream #0:7[0x70]: Unknown: none ([12][0][0][0] / 0x000C)

Stream order in the resulting .mpg file:
    Stream #0:0[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16p, 192 kb/s
    Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv), 720x576 [...]
    Stream #0:2[0x80]: Audio: ac3, 48000 Hz, stereo, fltp, 384 kb/s

Q: As some applications (AviDemux, MkvMerge) seem to have a problem with
this[*], is there a way to specify the stream order so that the video
stream is always stream #0? I've found the same question here,

http://ffmpeg.org/pipermail/ffmpeg-user/2014-May/021663.html

but the suggestion does not work for me. This means, the order of the
-map options has no influence on the stream order in the resulting file.
In this case, if I specify

    -map 0:0 -map 0:1 -map 0:4

the stream order in the .mpg file is still as shown above. So, is there
a way to make the video track always be stream #0?

Thanks.

Dmpfbck

[*] They recognize only the video track and the mp2 track but not the
ac3 track even though it's contained. So far I am _guessing_ only this
is because of the stream order. They do find both audio streams in the
original .ts file.
Other programs like MPC-HC do find both audio channels in the .mpg file.


More information about the ffmpeg-user mailing list