Android Question Camera2 Video recording compression level

Cadenzo

Active Member
Licensed User
Longtime User
I am recording videos with the Camera2 lib and the CamEx2 class. It works fine, but the size of recorded mp4 files is about 60 MB per minute. This is a bit to large, because I want to upload many of this files to my server.

Is it possibe to use a stronger compression when recording or to do this afer recording with another library? For my needs only the audio is importand. The video does't have to be in this quality. Any suggestions?
 

Cadenzo

Active Member
Licensed User
Longtime User
It seems, I am stucked with that. The CamEx2 class comes with so many parameter settings, like AF_MODE "OFF", "AUTO", ... or EFFECT_MODE "OFF", "MONO", ...
Could it be possible, to set the video quality as explaned here?
Something like intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 0); ?
or CamcorderProfile mProfile = CamcorderProfile.get(CamcorderProfile.QUALITY_LOW);?

Sorry, my knowlige in java is zero. I am not able to do this extension in the CamEx2 by myself. But I think, it would be a great thing, to create also smaller videos, which can be transfered via internet.

The other solution could be, to compress a large video in a second step. But also for this I could not find a way.
 
Upvote 0

moster67

Expert
Licensed User
Longtime User
I am not familiar with the Camera libs but probably my ffmpegencoder-library can help you out:
https://www.b4x.com/android/forum/threads/b4a-ffmpegencoder.70778/

You can work on the saved files and then encode them to a much smaller format, even cancelling the video so only audio is left.

If you are interested, send me a PM
 
Upvote 0

Cadenzo

Active Member
Licensed User
Longtime User
Thanks, it works. I added this FrameRate changing code into the PrepareSurfaceForVideo Sub, just before the line Camera.StartSession(tv, PreviewSize, CaptureSize, 0, 0, True) and also set the PreviewSize to cam.PreviewSize.Initialize(176, 144). Now I get small videos about 1 MB per 10 seconds. Thats great! I'´m only not shure yet, this format will be accepted in every android and also iOS device. Have to test...

@monster67 your lib also sounds super interesting. I will contact you.
 
Upvote 0
Top