diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/video/encoding/VideoMediaEncoder.java b/cameraview/src/main/java/com/otaliastudios/cameraview/video/encoding/VideoMediaEncoder.java index bc5e98f8..64061a37 100644 --- a/cameraview/src/main/java/com/otaliastudios/cameraview/video/encoding/VideoMediaEncoder.java +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/video/encoding/VideoMediaEncoder.java @@ -53,16 +53,16 @@ abstract class VideoMediaEncoder extends MediaEncoder { protected void onPrepare(@NonNull MediaEncoderEngine.Controller controller, long maxLengthMillis) { MediaFormat format = MediaFormat.createVideoFormat(mConfig.mimeType, mConfig.width, mConfig.height); - // Set some properties. Failing to specify some of these can cause the MediaCodec - // configure() call to throw an unhelpful exception. + // Failing to specify some of these can cause the MediaCodec configure() call to throw an unhelpful exception. + // About COLOR_FormatSurface, see https://stackoverflow.com/q/28027858/4288782 + // This just means it is an opaque, implementation-specific format that the device GPU prefers. + // So as long as we use the GPU to draw, the format will match what the encoder expects. format.setInteger(MediaFormat.KEY_COLOR_FORMAT, MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface); format.setInteger(MediaFormat.KEY_BIT_RATE, mConfig.bitRate); format.setInteger(MediaFormat.KEY_FRAME_RATE, mConfig.frameRate); - format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, 2); + format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, 5); format.setInteger("rotation-degrees", mConfig.rotation); - // Create a MediaCodec encoder, and configure it with our format. Get a Surface - // we can use for input and wrap it with a class that handles the EGL work. try { mMediaCodec = MediaCodec.createEncoderByType(mConfig.mimeType); } catch (IOException e) { diff --git a/demo/src/main/AndroidManifest.xml b/demo/src/main/AndroidManifest.xml index 18f0871a..00e973a9 100644 --- a/demo/src/main/AndroidManifest.xml +++ b/demo/src/main/AndroidManifest.xml @@ -1,5 +1,6 @@ @@ -8,9 +9,9 @@ android:allowBackup="false" android:icon="@mipmap/cameraview" android:label="@string/app_name" - android:roundIcon="@mipmap/cameraview" android:supportsRtl="true" - android:theme="@style/AppTheme"> + android:theme="@style/AppTheme" + tools:ignore="GoogleAppIndexingWarning">