ffmpeg - How to detect video bitrate from HLS/M3U8 file using ffprobe -
we need detect video bitrate of hls
stream ffprobe
using m3u8
file of .ts
.
if use m3u8
, can duration, dimensions, codecs used, audio bitrate, no video bitrate available in response provided ffprobe
.
ffprobe -print_format json -show_format -show_streams -show_error http://gfrmedia-video-platform.s3.amazonaws.com/bumbia/2014/06/06/158217_20160126214307_bumbia-hls/hls1056k/158217_640x360-with-mp4-hls_bumbia-hls.m3u8 ffprobe version 2.8.3 copyright (c) 2007-2015 ffmpeg developers built apple llvm version 7.0.0 (clang-700.1.76) configuration: --prefix=/usr/local/cellar/ffmpeg/2.8.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-vda libavutil 54. 31.100 / 54. 31.100 libavcodec 56. 60.100 / 56. 60.100 libavformat 56. 40.101 / 56. 40.101 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 40.101 / 5. 40.101 libavresample 2. 1. 0 / 2. 1. 0 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 2.101 / 1. 2.101 libpostproc 53. 3.100 / 53. 3.100 { [http @ 0x7fcf09e19420] no trailing crlf found in http header. input #0, hls,applehttp, 'http://gfrmedia-video-platform.s3.amazonaws.com/bumbia/2014/06/06/158217_20160126214307_bumbia-hls/hls1056k/158217_640x360-with-mp4-hls_bumbia-hls.m3u8': duration: 00:00:11.00, start: 9.940500, bitrate: 0 kb/s program 0 metadata: variant_bitrate : 0 stream #0:0: video: h264 (constrained baseline) ([27][0][0][0] / 0x001b), yuv420p, 640x360 [sar 1:1 dar 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc stream #0:1: audio: aac (lc) ([15][0][0][0] / 0x000f), 44100 hz, stereo, fltp, 79 kb/s "streams": [ { "index": 0, "codec_name": "h264", "codec_long_name": "h.264 / avc / mpeg-4 avc / mpeg-4 part 10", "profile": "constrained baseline", "codec_type": "video", "codec_time_base": "1001/60000", "codec_tag_string": "[27][0][0][0]", "codec_tag": "0x001b", "width": 640, "height": 360, "coded_width": 640, "coded_height": 368, "has_b_frames": 0, "sample_aspect_ratio": "1:1", "display_aspect_ratio": "16:9", "pix_fmt": "yuv420p", "level": 30, "chroma_location": "left", "refs": 1, "is_avc": "0", "nal_length_size": "0", "r_frame_rate": "30000/1001", "avg_frame_rate": "30000/1001", "time_base": "1/90000", "start_pts": 900000, "start_time": "10.000000", "bits_per_raw_sample": "8", "disposition": { "default": 0, "dub": 0, "original": 0, "comment": 0, "lyrics": 0, "karaoke": 0, "forced": 0, "hearing_impaired": 0, "visual_impaired": 0, "clean_effects": 0, "attached_pic": 0 } }, { "index": 1, "codec_name": "aac", "codec_long_name": "aac (advanced audio coding)", "profile": "lc", "codec_type": "audio", "codec_time_base": "1/44100", "codec_tag_string": "[15][0][0][0]", "codec_tag": "0x000f", "sample_fmt": "fltp", "sample_rate": "44100", "channels": 2, "channel_layout": "stereo", "bits_per_sample": 0, "r_frame_rate": "0/0", "avg_frame_rate": "0/0", "time_base": "1/90000", "start_pts": 894645, "start_time": "9.940500", "bit_rate": "79931", "disposition": { "default": 0, "dub": 0, "original": 0, "comment": 0, "lyrics": 0, "karaoke": 0, "forced": 0, "hearing_impaired": 0, "visual_impaired": 0, "clean_effects": 0, "attached_pic": 0 } } ], "format": { "filename": "http://gfrmedia-video-platform.s3.amazonaws.com/bumbia/2014/06/06/158217_20160126214307_bumbia-hls/hls1056k/158217_640x360-with-mp4-hls_bumbia-hls.m3u8", "nb_streams": 2, "nb_programs": 1, "format_name": "hls,applehttp", "format_long_name": "apple http live streaming", "start_time": "9.940500", "duration": "11.000000", "size": "281", "bit_rate": "204", "probe_score": 100 } }
in sample above, know video around 520kbps, need find way read programatically either ffprobe
or other way. have can of information needed, i'm missing 1 important value video bitrate.
what other options try?
thanks!
for video bitrate can do:
ffprobe -select_streams v:0 -show_entries frame=pkt_size,pkt_duration_time <input>
to compressed packet sizes , durations (in bytes , respectively seconds) series of frames. run while calculate average bitrate total duration.
Comments
Post a Comment