如何使用KEY_I_FRAME_INTERVAL参数在MediaCodec中配置特定的GOP大小? [英] How to configure specific GOP size in MediaCodec with KEY_I_FRAME_INTERVAL parameter?

查看:2727
本文介绍了如何使用KEY_I_FRAME_INTERVAL参数在MediaCodec中配置特定的GOP大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下一个问题是我:我知道MediaFormat.KEY_I_FRAME_INTERVAL是I帧将要出现的时间间隔(整数).

My issue is the next: I know MediaFormat.KEY_I_FRAME_INTERVAL is the interval in seconds (Integer) where the I-Frame is going to appear.

因此,如果我将值设置为1,并且帧速率为15,则GOP大小将为15,如果帧速率为30,则GOP大小将为30.

So if i give the value to 1, and my frame rate is 15, then the GOP size is going to be 15, and if the frame rate is 30, the GOP size is going to be 30.

因此,在参数MediaFormat.KEY_I_FRAME_INTERVAL是一个整数的情况下(无法使用30的帧速率将值0.5设为gopsize 15帧),是否有任何解决方案可以将其配置为特定的GOP大小?

So, being in the situation that the parameter MediaFormat.KEY_I_FRAME_INTERVAL is one integer (not being able to give the value 0.5 to be the gopsize 15 frames using a framerate of 30), Is there any solution to configure it to an specific GOP size?

推荐答案

正如您在问题中指出的那样,关键帧每KEY_I_FRAME_INTERVAL * KEY_FRAME_RATE个帧出现一次.因此,如果您希望GOP大小为15,请指定间隔1和15的帧速率,然后以30fps的速度发送视频.

As you note in the question, the key frames appear every KEY_I_FRAME_INTERVAL * KEY_FRAME_RATE frames. So if you want a GOP size of 15, specify an interval of 1 and a frame rate of 15, and then just send it video at 30fps.

这引起了一个问题:关于帧速率的说谎对编解码器满足比特率目标的能力有什么影响?我知道有些设备会根据演示时间戳记而不是固定的每秒帧数来调整质量.一切正常.似乎并非所有设备都以这种方式工作.

This begs the question: what effect does lying about the frame rate have on the codec's ability to meet the bit-rate target? I know that some devices adjust the quality based on the presentation time stamps rather than a fixed notion of frames per second, which would allow everything to work out fine. It appears that not all devices work this way however.

不幸的是,MediaCodec没有提供更灵活的方式来指定GOP大小.

Unfortunately, MediaCodec doesn't provide a more flexible way to specify the GOP size.

这篇关于如何使用KEY_I_FRAME_INTERVAL参数在MediaCodec中配置特定的GOP大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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