Question

Android - What is the maximum file size that setMaxFileSize can be set to in respect to Androids mediarecorder? I know it's somewhere between 4147483650 and 5147483650. Why is there a limit in the first place?

I'm recording on to a SDCARD, detecting the size of the cards space before we run.

"ERROR/AuthorDriver(31): setParameter(max-filesize = 7270309850) failed with result -5" "ERROR/AuthorDriver(31): Ln 903 handleSetParameters("max-filesize=7270309850") error" "ERROR/AndroidRuntime(409): java.lang.RuntimeException: setMaxFileSize failed."

Was it helpful?

Solution

Why is there a limit in the first place?

SD cards use the msdos (FAT16) filesystem, which has a file size limit. This is not an Android limitation, but a limitation of SD cards in general.

OTHER TIPS

If you look in AuthorDriver.cpp, you'll see that it performs a check to see if the time value you passed in will fit into a 16bit int. There's a comment that reads "PV API expects this to fit in a uint16". So, yeah, there doesn't appear to be a way to get around this for now.

I have tried on GS5, Hauwei Y550, Note 3 and they all can't record files longer than 4096 MB (even with their official camera application). This limits 1080p videos to 35 minutes and 4K videos to less than 20 minutes. The reason is the one provided by Shane-Kirk (except it is 32bit).

I have opened an enhancement issue on Android source code with all details, if you are interested please consider starring it, the more we are the more likely they will make a patch to AuthorDriver.cpp.

https://code.google.com/p/android/issues/detail?id=145618&q=mediarecorder&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars

I'm working on an android recorder as well.

use StatFs and pass the path of the external storage directory to the constructor and you can call functions such as getAvailableBlocks() and getBlockSize() on the StatFs object.

So that way you know how much more space is available on the SD card.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top