Android - What is mediarecorder's maximum maxfilesize?

做~自己de王妃 提交于 2019-12-12 18:44:10

问题


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


回答1:


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.




回答2:


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.




回答3:


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




回答4:


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.



来源:https://stackoverflow.com/questions/2793471/android-what-is-mediarecorders-maximum-maxfilesize

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!