I executed the below FFMPEG terminal command in command prompt successfully. But I am unable to execute this command in my java program. I can execute all other ffmpeg commands which doesn't have double quotation marks, in my java program. Here I have confusing only with double quotation marks("...").
ffmpeg -i "concat:C:\\journalism\\videos\\vid1.ts|C:\\journalism\\videos\\vid2.ts" -c copy C:\\journalism\\videos\\output.mp4
I can execute above in command prompt successfully. But I tried as below in my java code.
Runtime.getRuntime().exec("C:\\ffmpeg\\bin\\ffmpeg -i 'concat:C:\\journalism\\videos\\vid1.ts|C:\\journalism\\videos\\vid2.ts' -c copy C:\\journalism\\videos\\output.mp4");
Even I tried by replaced the double quotation marks("...") with single quotation marks('...'). But not succeeded.
Can anyone please help me to get out of this issue...
Thanks in advance...
I found answer for myself. Instead of using String object, I used String array as below, then the command executed successfully.
String[] cmd={"C:\\ffmpeg\\bin\\ffmpeg","-i", "concat:C:\\journalism\\videos\\vid1.ts|C:\\journalism\\videos\\vid2.ts", "-c", "copy", "C:\\journalism\\videos\\output.mp4"};
Runtime.getRuntime().exec(cmd);
My program is running, i just use as below. Hope it help you :
String cmd = "ffmpeg -i http://117.103.224.78/videoinput/Video1.mp4 -s 1920x1080 -c:a copy D:\\tmp\\Video2.mp4";
Process p = Runtime.getRuntime().exec(cmd);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With