FFmpegMC264Kit is a ffmpeg android library module built over android MediaCodec HW accelated encoders.
Now, you can use two new encoders - 'mc264' / 'mcaac' - instead of 'libx264' / 'aac' in runing ffmpeg command in your code.
This library module has one java helper class - LibFFmpegMC264.java - for the native ffmpeg library. And one java utility class - MC264ScreenRecorder.java - which can cast/save android screen to Netowrk/File.
- mc264 YUV Input : yuv420p only
- MediaCodec YUV Input :
NV12 (MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420SemiPlanar),
YV12 (MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420Planar)
Therefor the INPUT stream of ffmpeg should have the color format of YUV420Planar. Or use '-pix_fmt yuv420p' option with INPUT.
The MediaCodec of your device should have the color format YV12 [NV12]. (Other formats will be supported later)
https://github.com/iocaster/ffmpeg-4.0.mc264
- MediaCodec example :
- Handling H.264 SPS / PPS :
- https://stackoverflow.com/questions/24884827/possible-locations-for-sequence-picture-parameter-sets-for-h-264-stream/24890903#24890903
- https://stackoverflow.com/questions/20909252/calculate-pts-before-frame-encoding-in-ffmpeg
- http://leo.ugr.es/elvira/devel/Tutorial/Java/native1.1/implementing/index.html
- Color Format :
- VideoKit :
- Cross Compiling FFmpeg 4.0 for Android :