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 245 forks source link

Custom command line dosent work #220

Open shengtu0328 opened 1 year ago

shengtu0328 commented 1 year ago

` String s = "-i /Users/videopls/develop/ffmpeg/input.avi /Users/videopls/develop/ffmpeg/output/output.mp4";

DefaultFFMPEGLocator locator = new DefaultFFMPEGLocator();
ProcessWrapper localFFMPEG = locator.createExecutor();
localFFMPEG.addArgument(s);
try {
    localFFMPEG.execute();
}catch (Exception e){
    e.printStackTrace();
}`

the log is

18:19:28.900 [main] DEBUG ws.schild.jave.process.ffmpeg.DefaultFFMPEGLocator - Os name is <mac os x> isWindows: false isMac: true 18:19:28.907 [main] DEBUG ws.schild.jave.process.ffmpeg.DefaultFFMPEGLocator - Jave temp folder exists in </var/folders/fp/fg__cpln099g08625c1vf0xm0000gn/T/jave> 18:19:28.908 [main] DEBUG ws.schild.jave.process.ffmpeg.DefaultFFMPEGLocator - Executable path: /var/folders/fp/fg__cpln099g08625c1vf0xm0000gn/T/jave/ffmpeg-x86_64-3.2.0-osx 18:19:28.908 [main] DEBUG ws.schild.jave.process.ffmpeg.DefaultFFMPEGLocator - Executable exists in </var/folders/fp/fg__cpln099g08625c1vf0xm0000gn/T/jave/ffmpeg-x86_64-3.2.0-osx> 18:19:28.993 [main] DEBUG ws.schild.jave.process.ffmpeg.DefaultFFMPEGLocator - ffmpeg executable found: /var/folders/fp/fg__cpln099g08625c1vf0xm0000gn/T/jave/ffmpeg-x86_64-3.2.0-osx 18:19:29.010 [main] DEBUG ws.schild.jave.process.ProcessWrapper - About to execute /var/folders/fp/fg__cpln099g08625c1vf0xm0000gn/T/jave/ffmpeg-x86_64-3.2.0-osx -i /Users/videopls/develop/ffmpeg/input.avi /Users/videopls/develop/ffmpeg/output/output.mp4 -hide_banner

if i put " /var/folders/fp/fg__cpln099g08625c1vf0xm0000gn/T/jave/ffmpeg-x86_64-3.2.0-osx -i /Users/videopls/develop/ffmpeg/input.avi /Users/videopls/develop/ffmpeg/output/output.mp4 -hide_banner " in terminal ,it worked

a-schild commented 1 year ago

This are 3 arguments

String s = "-i /Users/videopls/develop/ffmpeg/input.avi /Users/videopls/develop/ffmpeg/output/output.mp4";

  1. -i
  2. /Users/videopls/develop/ffmpeg/input.avi
  3. /Users/videopls/develop/ffmpeg/output/output.mp4

You have to pass them a separate arguments, not one big argument

shengtu0328 commented 1 year ago

This are 3 arguments

String s = "-i /Users/videopls/develop/ffmpeg/input.avi /Users/videopls/develop/ffmpeg/output/output.mp4";

  1. -i
  2. /Users/videopls/develop/ffmpeg/input.avi
  3. /Users/videopls/develop/ffmpeg/output/output.mp4

You have to pass them a separate arguments, not one big argument

It seems still not worked.

DefaultFFMPEGLocator locator = new DefaultFFMPEGLocator(); ProcessWrapper localFFMPEG = locator.createExecutor(); localFFMPEG.addArgument("-i"); localFFMPEG.addArgument("/Users/videopls/develop/ffmpeg/input.avi"); localFFMPEG.addArgument("/Users/videopls/develop/ffmpeg/output/output.mp4"); try { localFFMPEG.execute(); }catch (Exception e){ e.printStackTrace(); }

i will try it on my windows os later。

shengtu0328 commented 1 year ago

This are 3 arguments

String s = "-i /Users/videopls/develop/ffmpeg/input.avi /Users/videopls/develop/ffmpeg/output/output.mp4";

  1. -i
  2. /Users/videopls/develop/ffmpeg/input.avi
  3. /Users/videopls/develop/ffmpeg/output/output.mp4

You have to pass them a separate arguments, not one big argument

I really appreciate your answer, but I still failed,there is no output file。It feels like the command is ready, but it is not executed successfully。 https://github.com/shengtu0328/jave2-demo/blob/main/src/main/java/com/example/jave2demo/TestDefaultFFMPEGLocator.java

encoder.encode(new MultimediaObject is succees。 https://github.com/shengtu0328/jave2-demo/blob/main/src/main/java/com/example/jave2demo/TestEncoder.java

shengtu0328 commented 1 year ago

https://github.com/a-schild/jave2/issues/169 This issues solves the problem