jave2 icon indicating copy to clipboard operation
jave2 copied to clipboard

Custom command line dosent work

Open shengtu0328 opened this issue 3 years ago • 4 comments

` 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

shengtu0328 avatar Nov 21 '22 10:11 shengtu0328

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

a-schild avatar Nov 21 '22 10:11 a-schild

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 avatar Nov 21 '22 10:11 shengtu0328

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 avatar Nov 21 '22 13:11 shengtu0328

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

shengtu0328 avatar Dec 01 '22 09:12 shengtu0328