如何计算文件 H264 的 GOP 大小 [英] How to calculate GOP size of a file H264

查看:79
本文介绍了如何计算文件 H264 的 GOP 大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 SVC 软件从 YUV 格式中提取的 h264 文件.现在,我想计算 h264 文件中每个 GOP 的大小.我们知道 GOP 的大小是两个最近的 I 帧之间的距离.此处.您能否建议我如何计算给定 h264 文件的 GOP 大小.最好用C/C++实现.谢谢

I have a h264 file that extract from YUV format using SVC software. Now, I want to caculate size of each GOP in the h264 file. We know that size of GOP is the distance between two nearest I frame. here. Could you suggest to me how to cacluate the GOP size of a given h264 file. It is better when we implement it by C/C++.Thank you

推荐答案

好吧,只是解析比特流来找到每个 I 帧有点棘手;除其他外,编码顺序可能(或不)与显示顺序不同.一种解决方案是使用来自 ffmpeg 的 http://www.ffmpeg.org/ffprobe.html-套房.

Well, just parsing the bitstream to find the each I-frame is a bit tricky; among other things the encode order might be (or not) different from the display-order. One solution is to use http://www.ffmpeg.org/ffprobe.html from the ffmpeg-suite.

示例:

ffprobe -show_frames input.bin | grep key_frame
key_frame=1
key_frame=0
key_frame=0
key_frame=0
key_frame=0
key_frame=0
...

从输出中您可以轻松计算出 GOP 长度

from the output you can easily calculate the GOP-length

另一种解决方案是修补位于 http://iphome.hhi.de/suehring 的参考实现/tml/

Another solution is to patch the reference implementation found at http://iphome.hhi.de/suehring/tml/

如果您需要这部分的帮助,请告诉我:-)

Let me know if you need help with this part :-)

这篇关于如何计算文件 H264 的 GOP 大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆