fyhertz / libstreaming

A solution for streaming H.264, H.263, AMR, AAC using RTP on Android
Apache License 2.0
3.49k stars 1.08k forks source link

MediaCodec: MediaFormat KEY_I_FRAME_INTERVAL not working for H264codec #291

Open Midhun9638 opened 5 years ago

Midhun9638 commented 5 years ago

I'm setting MediaFormat.KEY_I_FRAME_INTERVAL value as 1 (below given code) but it's not generating Key frame every second but it is generating every 66 second. I'm using Libstreaming library. can anyone please help why is not working ?

mMediaCodec = MediaCodec.createByCodecName(debugger.getEncoderName()); MediaFormat mediaFormat =MediaFormat.createVideoFormat("video/avc", 640,480); mediaFormat.setInteger(MediaFormat.KEY_BIT_RATE, 1000000); mediaFormat.setInteger(MediaFormat.KEY_FRAME_RATE, 15); mediaFormat.setInteger(MediaFormat.KEY_COLOR_FORMAT, debugger.getEncoderColorFormat()); mediaFormat.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, 1); //here mMediaCodec.configure(mediaFormat, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE); mMediaCodec.start();

Midhun9638 commented 5 years ago

@fyhertz can you please help?