[FFmpeg-user] how to get each track duration in clips

Moritz Barsnick barsnick at gmx.net
Tue Jul 21 23:34:31 CEST 2015


On Tue, Jul 21, 2015 at 22:52:38 +0800, qw wrote:

> The above command can get whole file's duration. But how to get each
> track duration in clips by using ffmpeg/ffprobe?

With track you probably mean what ffmpeg calls streams. You would parse
the duration field, and instead of using
$ ffmpeg -show_format
you would use
$ ffmpeg -show_streams

Moritz

$ ffprobe -show_streams ~/Downloads/PVR/20150718\ 2307\ -\ Das\ Erste\ HD\ -\ Inas\ Nacht.ts 2>/dev/null | grep -E "(duration|codec_type)="
codec_type=unknown
duration=4200.833022
codec_type=unknown
duration=4200.833022
codec_type=video
duration=4199.580000
codec_type=audio
duration=4199.544000
codec_type=audio
duration=4199.544000
codec_type=subtitle
duration=4199.560000
codec_type=subtitle
duration=4200.833022
codec_type=audio
duration=4199.456000
codec_type=data
duration=4200.833022
codec_type=unknown
duration=4200.833022


More information about the ffmpeg-user mailing list