" ffmpeg":java.io.IOException:error = 24,打开的文件过多 [英] "ffmpeg": java.io.IOException: error=24, Too many open files
问题描述
我正在使用ffmpeg来生成预览,但是在我的程序执行过程中出现这个错误:
$ b
ffmpeg:java.io. IOException:错误= 24,太多的打开的文件
有谁知道如何解决或如何避免它??
我添加我使用ffmpeg的代码:
$ $ $ $ $ $ $ $ $ $ $ $ b if(j == 2){
String preview = temp2 [i] + temp [j] +。jpg;
Process p = Runtime.getRuntime()。exec(ffmpeg -i anotados /+ temp2 [i] +-r 1 -ss 00:00:+ temp [j] +-t 1 - s 158x116 imagenes /+ preview);
TextOut.write(preview +\\\
);
$ div $解析方案
检查您的 ulimit -n
输出来查看允许从该shell生成的打开文件进程的数量。历史上的Unix系统有20个文件的限制,但在我的Ubuntu桌面上默认是1024个打开的文件。
您可能需要提高允许打开的文件的数量 /etc/security/limits.conf
文件。或者,您可能需要修改您的应用程序,以更积极地关闭打开的文件。
另一种可能性是对可能打开的文件数量的系统范围的限制。我不知道哪些现代系统仍然会有这样的限制,但首先要看的是 sysctl -a
输出。 (好吧,也许是系统文档后的第二个地方。)
I am working with ffmpeg to generate previews, but I get this error in the middle of the execution of my program:
"ffmpeg": java.io.IOException: error=24, Too many open files
Does anybody know how to solve or how to avoid it??
I add the piece of code where I use ffmpeg:
for (int j = 0; j < temp.length; j++) {
if(j==2){
String preview = temp2[i] + temp[j] +".jpg";
Process p = Runtime.getRuntime().exec("ffmpeg -i anotados/" +temp2[i] + " -r 1 -ss 00:00:"+temp[j]+" -t 1 -s 158x116 imagenes/" + preview);
TextOut.write(preview+"\n");
}
}
Check your ulimit -n
output to see how many open files processes spawned from that shell are allowed to have. Historical Unix systems had a limit of 20 files, but default on my Ubuntu desktop is 1024 open files.
You may need to raise the number of open files you are allowed in the /etc/security/limits.conf
file. Or, you may need to modify your application to more aggressively close open files.
Another possibility is a system-wide limit on number of files that may be open. I don't know which modern systems would still have such limits in place, but a first place to look would be sysctl -a
output. (Well, maybe second place, after system documentation.)
这篇关于" ffmpeg":java.io.IOException:error = 24,打开的文件过多的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!