Video recording java

java video recording

 

  1. 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 thought System.loadLibrary("")would be unreliable, but only replaced ReLinker.recursively().loadLibrary(), the problem is solved.

  2. 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.

  1. javacv library is relatively large, so do not try to gradle integrated way
  2. 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.

 

Guess you like

Origin www.cnblogs.com/itpy/p/11825835.html