[FFmpeg-user] Dissecting a transport stream (.ts) temporally
Carl Eugen Hoyos
ceffmpeg at gmail.com
Sun Mar 1 18:45:45 EET 2020
Am So., 1. März 2020 um 13:28 Uhr schrieb grmat <grmat at sub.red>:
>
> 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?
(For future questions: Never post extracts of the console output,
always the command
line you tested together with the complete, uncut console output.)
Once upon a time, a java tool called ProjectX did what you need, to
some degree it also
worked with h264 video.
I believe there is a specific ts tool that replaces it today, I never used it.
You should be able to remux with FFmpeg (although h264 timestamps sometimes
prevent this).
Carl Eugen
More information about the ffmpeg-user
mailing list