Android - choose between MediaRecorder, MediaCodec and Ffmpeg

I am working on an Android video recording and sharing application. The application specifications are as follows: -

  • Record 10-second (maximum) video from the application (without using the device’s camera application)
  • Further video editing
  • Save video to Firebase Cloud Storage (GCS)
  • Download and play specified video by other users

From the research that I did for SO and other sources for this, I found the following ( please correct me if I am wrong ): -

Three parameters and their respective functions: -

1. Ffmpeg

  • Able to achieve the above goal and has extensive answers and explanations on sites like SO, however
  • Increases the size of the APK by 20-30mb (large library)
  • Performs the risk of inoperability of some 64-bit devices

2. MediaRecorder

  • Reliability and support for most devices
  • Will store files in .mp4 format (if not converted to h264)
  • Easier to play (no decoding)
  • Adds mp4 and 3gp headers
  • Increases the delay in accordance with this issue.

3. MediaCodec

  • Low level
  • Requires MediaCodec, MediaMuxer, and MediaExtractor
  • Exit to h264 (without using MediaMuxer to play)
  • Good for video manipulation (although not necessarily in my use case)
  • Not supported by pre 4.3 devices (API 18)
  • The code is also more difficult to implement (my opinion - please correct me if I am wrong)
  • , , ( Bigflake.com)

, , . , , . , .

, , , , , .

, , Firebase Storage, .

! , .

+4
1

. 2 , , , :

1.FFMpeg

  • +/- SO, 2-3 MB usecae, . 6000 ,

  • ++ ( )

  • ++

  • ++

  • - , SW-En-/Decoding, . lib-stagefright, ( 2016 ).

  • - . , , .

2. MediaRecorder

  • ++ ( mediacodec/libstagefright) ,

  • ++ HW . .

  • ++

  • - HW-

  • -

  • ++

3.MediaCodec

  • +/- 2.MediaRecorder ( )

  • ++ HW-en-/decoding

  • - , (, )

  • +/- ( , )

  • - HW (, Samsung Galaxy S5 SIG-SEV, DLSR. SIG-SEV. dslr, SIG-SEV , - ;))

  • - MediaMuxer, -, .

, , , . , , .

, MediaRecorder, , , . FFMpeg , ( , DSLR 30 ) . usecase, MediaCodec, .

VP8 9, . , H264 , .

, .

+6

Source: https://habr.com/ru/post/1672062/


All Articles