use*_*103 7 media video multimedia h.264 svc
我有一个使用SVC软件从YUV格式中提取的h264文件.现在,我想计算h264文件中每个GOP的大小.我们知道GOP的大小是两个最接近的I帧之间的距离.在这里.你能告诉我如何解决给定h264文件的GOP大小.我们用C/C++实现它会更好.谢谢
mys*_*egg 11
我个人更喜欢用pict_type过滤:
ffprobe -show_frames input.h264 | grep pict_type
Run Code Online (Sandbox Code Playgroud)
这将显示框架结构:
pict_type=I
pict_type=P
pict_type=P
pict_type=P
pict_type=P
pict_type=P
...
Run Code Online (Sandbox Code Playgroud)
好吧,只是解析比特流来找到每个I帧有点棘手; 除其他外,编码顺序可能(或不)与显示顺序不同.一种解决方案是使用ffmpeg-suite中的http://www.ffmpeg.org/ffprobe.html.
例:
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
...
Run Code Online (Sandbox Code Playgroud)
从输出中,您可以轻松计算GOP长度
另一种解决方案是修补http://iphome.hhi.de/suehring/tml/上的参考实现.
如果您需要这方面的帮助,请告诉我们:-)
#!/bin/sh
ffprobe -show_frames $1 > output.txt
GOP=0;
while read p; do
if [ "$p" = "key_frame=0" ]
then
GOP=$((GOP+1))
fi
if [ "$p" = "key_frame=1" ]
then
echo $GOP
GOP=0;
fi
done < output.txt
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
21489 次 |
| 最近记录: |