Android - mediarecorder 的最大 maxfilesize 是多少?
Android - 对于 Android 媒体记录器,setMaxFileSize 可以设置的最大文件大小是多少?我知道它在 4147483650 和 5147483650 之间。为什么首先要有限制?
我正在录制到 SDCARD,在运行之前检测卡空间的大小。
“错误/AuthorDriver(31):setParameter(max-filesize = 7270309850) 失败,结果为 -5” “错误/AuthorDriver(31):Ln 903 handleSetParameters(“max-filesize = 7270309850”)错误“ “错误/AndroidRuntime(409):java.lang.RuntimeException:setMaxFileSize 失败。”
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."
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
SD 卡使用 msdos (FAT16) 文件系统,该系统有文件大小限制。这不是 Android 的限制,而是 SD 卡的一般限制。
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.
如果您查看 AuthorDriver.cpp,您会发现它会执行检查以查看您传入的时间值是否适合 16 位 int。有一条评论写着“PV API 希望它适合 uint16”。所以,是的,目前似乎没有办法解决这个问题。
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.
我尝试过 GS5、华为 Y550、Note 3,它们都无法录制超过 4096 MB 的文件(即使使用其官方相机应用程序)。这会将 1080p 视频的时长限制为 35 分钟,将 4K 视频的时长限制为 20 分钟以内。原因是Shane-Kirk提供的(除了它是32位的)。
我已经在 Android 源代码上打开了一个包含所有详细信息的增强问题,如果您有兴趣,请考虑给它加星标,我们越多,他们就越有可能对 AuthorDriver.cpp 进行补丁。
https://code.google.com/p/android/issues/detail?id=145618&q=mediarecorder&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars
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
我也在开发 Android 录音机。
使用 StatFs 并将外部存储目录的路径传递给构造函数,您可以在 StatFs 对象上调用 getAvailableBlocks() 和 getBlockSize() 等函数。
这样您就可以知道 SD 卡上还有多少可用空间。
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.