[FFmpeg-user] Best way to get a average bit rate per stream?

Peter van den Houten petervdh at gmail.com
Tue Sep 3 20:46:36 EEST 2019


On 03/09/2019 19:29, August Johansson wrote:
> Btw that gets overall bit rate all streams together. I need the average bit
> rate for each stream.
> 
> Den tis 3 sep. 2019 19:26August Johansson <augustperson25 at gmail.com> skrev:
> 
>> Hi,
>> No i dont like this. It adds another dependency to my software. If this
>> really is the only way, i will try not to not use it
>> Thanks anyway
>>
>> Den tis 3 sep. 2019 19:23William Caulfield <
>> william.caulfield at contentbridge.tv> skrev:
>>
>>> On Tue, Sep 3, 2019 at 9:38 AM August Johansson <augustperson25 at gmail.com
>>>>
>>> wrote:
>>>
>>>> Hi,
>>>> I would like to store the average bit rate of every stream in my
>>> database.
>>>> I tested using ffprobe -print_format json -show_streams but this
>>>> information does not seem to be there. What would be the best way to
>>> return
>>>> this information?
>>>> Thanks
>>>> _______________________________________________
>>>
>>>
>>> A bit off topic, but I would use mediainfo for this:
>>>
>>> mediainfo --Inform="General;%OverallBitRate%" file.ext
>>>
>>> That would get you the overall bitrate in bps, eg:  10236425
>>>
>>> mediainfo --Inform="General;%OverallBitRate/String%" file.ext
>>>
>>> That would get you the overall bitrate in a more Human readable form, eg:
>>> 10.2 Mb/s
>>>
>>>

Try this and grep out the bits you need. It will accommodate files that
don't report their bit rates but there is an overhead as it does a short
scan of each file.

mediainfo --ParseSpeed=1 file.ext


More information about the ffmpeg-user mailing list