Reputation: 41
Recently I wanted to make a low-latency video call on Android phones, using the mediacodec
class for codecs(e.g. video/avc).
In order to achieve a low-latency video stream, I want to call intra refresh(IR) technology. When I configure the h264 encoder with parameters, I found the parameters which i setting do not work. details as follows:
This parameter has no effect after setting, as can be seen from the results of the bitstream, the encoder did not achieve intra refresh.
Can you give me some guidance? I use linphone-android, the device is Samsung s8(SM-G9500, Android 7.0, API 24), and from the mediacodec.xml file we can see that this device supports intra refresh, Thanks in advance for your help!
Code:
AMediaFormat_setInt32(format, "i-frame-interval", 0);
AMediaFormat_setInt32(format, "bitrate-mode", 1);
AMediaFormat_setInt32(format, "profile", 1); // AVCProfileBaseline
AMediaFormat_setInt32(format, "level", 1024); // AVCLevel32
if(ms_get_android_sdk_version() >= 24)
AMediaFormat_setInt32(format, "intra-refresh-period", 10);//7 0118
Upvotes: 4
Views: 2390
Reputation: 189
You need to use a negative value for I_FRAME_INTERVAL.
See here: https://developer.android.com/reference/android/media/MediaFormat.html#KEY_I_FRAME_INTERVAL
What does the "OutputFormat" contain?
Upvotes: 2