[FFmpeg-user] View segment duration for all streams

Tyler Pacheco tyler at frequency.com
Fri Jun 2 20:31:29 EEST 2017


I am a brand new to ffmpeg and video formats in general, so sorry if this
is a really beginner question. I am trying to use ffmpeg to view the
segment durations of each rendition of an HLS file from previously encoded
videos, and make sure that they are valid. From my understanding this means
the the "EXTINF" of each segment is less than or equal to the specified
"EXT-X-TARGETDURATION" in the rendition.

My main m3u8 file looks like the following:

#EXTM3U
>
> #EXT-X-VERSION:4
>
>
>> #EXT-X-STREAM-INF:BANDWIDTH=62000,AVERAGE-BANDWIDTH=65000,
>> CLOSED-CAPTIONS=NONE,CODECS="mp4a.40.2"
>
> -KIu3HfQQH-a-0.m3u8
>
> #EXT-X-STREAM-INF:BANDWIDTH=288000,AVERAGE-BANDWIDTH=
>> 289000,RESOLUTION=480x270,CLOSED-CAPTIONS=NONE,CODECS="
>> avc1.66.13,mp4a.40.2"
>
> -KIu3HfQQH-a-1.m3u8
>
> #EXT-X-STREAM-INF:BANDWIDTH=380000,AVERAGE-BANDWIDTH=
>> 376000,RESOLUTION=640x360,CLOSED-CAPTIONS=NONE,CODECS="
>> avc1.66.13,mp4a.40.2"
>
> -KIu3HfQQH-a-2.m3u8
>
> #EXT-X-STREAM-INF:BANDWIDTH=1464000,AVERAGE-BANDWIDTH=
>> 1249000,RESOLUTION=960x540,CLOSED-CAPTIONS=NONE,CODECS="
>> avc1.4d001e,mp4a.40.2"
>
> -KIu3HfQQH-a-3.m3u8
>
> #EXT-X-STREAM-INF:BANDWIDTH=2093000,AVERAGE-BANDWIDTH=
>> 1799000,RESOLUTION=1280x720,CLOSED-CAPTIONS=NONE,CODECS="
>> avc1.4d001e,mp4a.40.2"
>
> -KIu3HfQQH-a-4.m3u8
>
>
 and each of the renditions look like:

#EXTM3U
>
> #EXT-X-TARGETDURATION:6
>
> #EXT-X-VERSION:4
>
> #EXT-X-MEDIA-SEQUENCE:0
>
> #EXT-X-PLAYLIST-TYPE:VOD
>
> #EXTINF:6,
>
> -KIu3HfQQH-a-1_00000.ts
>
> #EXTINF:6,
>
> -KIu3HfQQH-a-1_00001.ts
>
> #EXTINF:6,
>
> -KIu3HfQQH-a-1_00002.ts
>
> #EXTINF:6,
>
> -KIu3HfQQH-a-1_00003.ts
>
>  ...
>
>

I can't seem to find a way to get all segment durations for each rendition
from the main file. If I know the individual .ts files, I can do `ffprobe
-i "-KIu3HfQQH-a-1_00000.ts" -show_entries format=duration` on each one,
but I don't know how I can get the individual files using ffprobe alone, or
if there is a way I can include them all from the main file or rendition.
The concat demuxer has an option for segment_time_metadata that looks
promising, but I can't find any examples for it and everything I try seems
to do nothing (presumably I am not using it correctly).

Can anyone provide some advice? Also, is there any way I can do this with
ffmpeg instead of ffprobe?

Thanks,
Tyler


More information about the ffmpeg-user mailing list