java video recording
-
In the Android M platform, there will be an exception
java.lang.UnsatisfiedLinkError: org.bytedeco.javacpp.avutil
to this problem corresponding Issue:
https://github.com/bytedeco/javacv/issues/245
https://github.com/bytedeco/javacv/issues/579
My solution is to found in this post, but encountered the problem of too many people, the cause of the problem will be more, such as version, platform. I encountered this situation, in the following versions of Android M is normal, it will not be javacv editions and packaging issues.
Ultimately by ReLinker solve
this is unexpected, he said before never thoughtSystem.loadLibrary("")
would be unreliable, but only replacedReLinker.recursively().loadLibrary()
, the problem is solved. -
Parameter settings when recording
initialization parameters Frame:
private int frameDepth = Frame.DEPTH_UBYTE; //DEPTH_UBYTE=8 private int frameChannels = 2;
FFmpegFrameRecorder supports many recording format, so it is necessary to specify the format of the data during recording, these formats are defined in org.bytedeco.javacpp.avutil.AV_PIX_FMT_XXX
, and if the camera preview callback YUV format, you only need to use the default. If you need to specify the RGBA mVideoRecorder.record(mFrameData, AV_PIX_FMT_RGBA);
when recording video preview size and the need to pay attention to the video recording size confusing, especially the width and height of the camera preview reversed problem.
- javacv library is relatively large, so do not try to gradle integrated way
- Recording time-consuming
recording 540 * 960 video takes about 60ms, this performance has been less able to accept, so try to use a separate thread for recording.