video-streamingh.264video-encodingx264adaptive-bitrate

MP4 H264 VBR, How to get the bitrate for each second of video?


I have some MP4 videos encoded with H264 and displayed on my website.

My concerns is about bandwith consomming. I'm trying to throttle bandwith to not send more than MP4 video data required in a time interval.

For instance, consider that first second of video bitrate is 100KB. In such case, I only need to send to browser 100KB of video data whitin the first second.

My question is to get such value for every second. Is there a way to get such information after video enconding? Is there a way to get such information by grabbing data from ffmpeg encoding console ? Or is there any low-level API (C,C++,...) to do such work ?

Thanks!


Solution

  • I can't imagine possible methods other than actually process the MP4 format data.

    VBR means quality constraint encoding not bandwidth. There is no information about bitrate statistics.

    Reading MP4 format is not that difficult work to do (of course not trivial). Basically we only need sample size information and the frame rate (if it is fixed frame rate).

    For reading and parsing MP4 format, this looks promising: https://code.google.com/p/mp4v2/