[FFmpeg-user] Dissecting a transport stream (.ts) temporally

grmat grmat at sub.red
Sun Mar 1 14:27:45 EET 2020


Hi there,

I have some .ts files from TV recordings that have additional stuff before and after the desired content.
I used to cut those files manually. However, I saw that often there are track changes within the same stream and I'm wondering if I could use those to get the timestamps for cutting to save me some time.

E.g. say the .ts has three audio streams. Calling 

$ ffmpeg -i file.ts

shows them as

>     Stream #0:2[0x17e9](eng): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s (visual impaired) (descriptions)
>     Stream #0:3[0x17ea](eng): Audio: ac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, fltp, 448 kb/s
>     Stream #0:4[0x17eb](mul): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 192 kb/s

But in fact, during the actually desired content, #0:3 is not a stereo but a 5.1 stream. So e.g. if I extract the audio with 

$ ffmpeg ss 00:02 -t 00:05 -i file.ts -map 0:3 -acodec copy audio.ac3

and then query the new file with 

$ ffmpeg -i audio.ac3

the output is

>     Stream #0:0: Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s

so that's detected correctly. Any ideas of extracting the actual timesttamps from those track changes?

Thanks in advance


More information about the ffmpeg-user mailing list