video - How to get h264 bitrate -



video - How to get h264 bitrate -

tried mediainfo, tried ffprobe -show_streams -i "file.mkv" (or raw file.h264) , gives me bit_rate=n/a. mediainfo gives nil @ all.

the way found out creating .dga file indexing via megui , using bitrate calculator tool , setting same exact size source, shows average bitrate, way ridiculous , knows how accurate.

well, h.264 raw-data not contain timing information. can extract frame size , giving frame-per-second parameter can calculate bitrate. wrote simple bash-script uses awk , ffmpeg (ffprobe).

#!/bin/bash # mimic output of # mplayer -lavdopts vstats file -fps 30 -vo null # illustration usage: # ./vstats.sh file.hevc 30 ffprobe=$home/src/ffmpeg/ffprobe fps=$2 # default 30 fps : ${fps:=30} frames=$3 # numper of frames process : ${frames:=65536} awk -v fps="${fps}" -v frames="${frames}" ' begin{ fs="=" } /pkt_size/ { br=$2/1000.0*8*fps if (br > max_br) max_br=br acc_br+=br acc_bytes+=br i+=1 printf("frame= %6d, f_size= %7d, s_size= %8dkb, br= %8.1fkbits/s, avg_br= %8.1fkbits/s\n", i, $2, int(acc_bytes/1024+0.5), br, acc_br/i) if (i >= frames) exit } end { print "----" printf("peak br: %.1fkbits/s", max_br) } ' <(${ffprobe} -show_frames $1 2>/dev/null)

example output:

frame= 1, f_size= 50805, s_size= 12kb, br= 12193.2kbits/s, avg_br= 12193.2kbits/s frame= 2, f_size= 4749, s_size= 13kb, br= 1139.8kbits/s, avg_br= 6666.5kbits/s frame= 3, f_size= 5781, s_size= 14kb, br= 1387.4kbits/s, avg_br= 4906.8kbits/s frame= 4, f_size= 6135, s_size= 16kb, br= 1472.4kbits/s, avg_br= 4048.2kbits/s frame= 5, f_size= 6239, s_size= 17kb, br= 1497.4kbits/s, avg_br= 3538.0kbits/s frame= 6, f_size= 6487, s_size= 19kb, br= 1556.9kbits/s, avg_br= 3207.8kbits/s frame= 7, f_size= 6550, s_size= 20kb, br= 1572.0kbits/s, avg_br= 2974.1kbits/s frame= 8, f_size= 6567, s_size= 22kb, br= 1576.1kbits/s, avg_br= 2799.4kbits/s frame= 9, f_size= 6390, s_size= 23kb, br= 1533.6kbits/s, avg_br= 2658.7kbits/s frame= 10, f_size= 6540, s_size= 25kb, br= 1569.6kbits/s, avg_br= 2549.8kbits/s frame= 11, f_size= 6929, s_size= 27kb, br= 1663.0kbits/s, avg_br= 2469.2kbits/s frame= 12, f_size= 8037, s_size= 28kb, br= 1928.9kbits/s, avg_br= 2424.2kbits/s frame= 13, f_size= 7965, s_size= 30kb, br= 1911.6kbits/s, avg_br= 2384.8kbits/s frame= 14, f_size= 7833, s_size= 32kb, br= 1879.9kbits/s, avg_br= 2348.7kbits/s frame= 15, f_size= 8281, s_size= 34kb, br= 1987.4kbits/s, avg_br= 2324.6kbits/s frame= 16, f_size= 8235, s_size= 36kb, br= 1976.4kbits/s, avg_br= 2302.8kbits/s frame= 17, f_size= 7969, s_size= 38kb, br= 1912.6kbits/s, avg_br= 2279.9kbits/s frame= 18, f_size= 7953, s_size= 40kb, br= 1908.7kbits/s, avg_br= 2259.3kbits/s frame= 19, f_size= 8867, s_size= 42kb, br= 2128.1kbits/s, avg_br= 2252.4kbits/s frame= 20, f_size= 9686, s_size= 44kb, br= 2324.6kbits/s, avg_br= 2256.0kbits/s ---- peak br: 12193.2kbits/s

video ffmpeg h.264 decoding x264

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -