a-schild / jave2

The JAVE (Java Audio Video Encoder) library is Java wrapper on the ffmpeg project
GNU General Public License v3.0
1.2k stars 246 forks source link

Cannot run program "/tmp/jave/ffmpeg-amd64-3.2.0" #236

Open boyangc opened 11 months ago

boyangc commented 11 months ago

We deploy on linux.This error occurs : java.io.IOException: Cannot run program "/tmp/jave/ffmpeg-amd64-3.2.0": error=13, 权限不够 at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) at java.lang.Runtime.exec(Runtime.java:593) at java.lang.Runtime.exec(Runtime.java:458) at ws.schild.jave.process.ProcessWrapper.execute(ProcessWrapper.java:103) at ws.schild.jave.process.ProcessWrapper.execute(ProcessWrapper.java:135) at com.alipay.zark.avatar.service.FileUploadServer.ffmpegExecut(FileUploadServer.java:464) at com.alipay.zark.avatar.service.FileUploadServer.generateBackgroundImage(FileUploadServer.java:686) at com.alipay.zark.avatar.service.FileUploadServer.afterProcess(FileUploadServer.java:340) at com.alipay.zark.avatar.service.FileUploadServer.onMessage(FileUploadServer.java:130) at org.java_websocket.server.WebSocketServer.onWebsocketMessage(WebSocketServer.java:703) at org.java_websocket.drafts.Draft_6455.processFrameText(Draft_6455.java:963) at org.java_websocket.drafts.Draft_6455.processFrame(Draft_6455.java:887) at org.java_websocket.WebSocketImpl.decodeFrames(WebSocketImpl.java:401) at org.java_websocket.WebSocketImpl.decode(WebSocketImpl.java:233) at org.java_websocket.server.WebSocketServer$WebSocketWorker.doDecode(WebSocketServer.java:1096) at org.java_websocket.server.WebSocketServer$WebSocketWorker.run(WebSocketServer.java:1077) Caused by: java.io.IOException: error=13, 权限不够 at java.lang.UNIXProcess.forkAndExec(Native Method) at java.lang.UNIXProcess.<init>(UNIXProcess.java:247) at java.lang.ProcessImpl.start(ProcessImpl.java:134) at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)

a-schild commented 11 months ago

Is that file existing in /tmp/jave/ folder? Is it executable by the user which the server is running under?

boyangc commented 11 months ago

file exists in /tmp/jave/ folder, but i cant run it throw cmd , it shows Insufficient Permissions

boyangc commented 11 months ago

Is that file existing in /tmp/jave/ folder? Is it executable by the user which the server is running under?

and i have chown 777 , but it not works

a-schild commented 11 months ago

Then you have to look at your server envrionemnt, Perhaps some SELINUX settings or similar blocking the executable

boyangc commented 11 months ago

Then you have to look at your server envrionemnt, Perhaps some SELINUX settings or similar blocking the executable

i find that it fails in /tmp/ directory, but when i copied ffmpeg-amd54-3.2.0 to /data/ directory , it is executable. So how do I specify the location where the ffmpeg file is generated or the location my program call when use ffmpeg in the system? I didn't do anything at the beginning, it was to automatically generate ffmpeg in /tmp/ directory

a-schild commented 11 months ago

Jave uses the system temp location

https://github.com/a-schild/jave2/blob/master/jave-core/src/main/java/ws/schild/jave/process/ffmpeg/DefaultFFMPEGLocator.java

Line 57 File dirFolder = new File(System.getProperty("java.io.tmpdir"), "jave/");

So you can either set another temp location in the properties of the JVM, or implement you own ProcessLocator class, which point's to the location you desire. If you wish to use a "static" ffmpeg version, you can put it in a known place and then implement the ProcessLocatorfor your environment