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

Ted Park kumowoon1025 at gmail.com
Sun Mar 1 14:57:06 EET 2020


> 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.

Can you describe these track changes? Not sure what is changing within the same channel, like a new program?

> 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?

There’s literally no information about any timestamp or stream discontinuities in that example… As for the audio it's probably both? (5.1 matrixes into stereo) Just has the lowest common denominator flags for any compatibility issues.

Ted Park

More information about the ffmpeg-user mailing list