F Firpas Active Member Licensed User Longtime User Oct 24, 2017 #1 Hello to everybody I`m trying to execute a command from my application through JShell but i can`t, however if i write it in system symbol window it run ok. With this code: Code: Copy If File.Exists(FM.FotoDir, "test.mp4") Then File.Delete(FM.FotoDir, "test.mp4") End If Dim Sh As Shell Sh.Initialize("Shell", File.Combine("C:\ffmpeg64\bin", "ffmpeg.exe"), Array As String(" -r 10", "-f image2", "-s 640x480", "-i "& File.Combine(FM.TempDir, "%08d.png"), "-vcodec libx264", "-crf 25", "-pix_fmt yuv420p " & File.Combine(FM.FotoDir, "test.mp4"))) Sh.WorkingDirectory = "C:\ffmpeg64" Sh.Run(100) Here is the result Waiting for debugger to connect... Program started. ffmpeg version N-87871-g7480f232d2 Copyright (c) 2000-2017 the FFmpeg developers built with gcc 7.2.0 (GCC) configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth --enable-libmfx libavutil 55. 79.100 / 55. 79.100 libavcodec 57.108.100 / 57.108.100 libavformat 57. 84.100 / 57. 84.100 libavdevice 57. 11.100 / 57. 11.100 libavfilter 6.108.100 / 6.108.100 libswscale 4. 9.100 / 4. 9.100 libswresample 2. 10.100 / 2. 10.100 libpostproc 54. 8.100 / 54. 8.100 Unrecognized option 'r 10'. Error splitting the argument list: Option not found Click to expand... It seems the option "-r 10" is passed as "r 10" And with this code: Code: Copy If File.Exists(FM.FotoDir, "test.mp4") Then File.Delete(FM.FotoDir, "test.mp4") End If Dim Sh As Shell Sh.Initialize("Shell", File.Combine("C:\ffmpeg64\bin", "ffmpeg.exe") & " -r 10 -f image2 -s 640x480 -i "& File.Combine(FM.TempDir, "%08d.png") & " -vcodec libx264 -crf 25 -pix_fmt yuv420p " & File.Combine(FM.FotoDir, "test.mp4"),Null) Sh.WorkingDirectory = "C:\ffmpeg64" Sh.Run(100) The result is: org.apache.commons.exec.ExecuteException: Execution failed (Exit value: -559038737. Caused by java.io.IOException: Cannot run program "C:\ffmpeg64\bin\ffmpeg.exe -r 10 -f image2 -s 640x480 -i C:\Users\Fran\AppData\Roaming\IpCam\Temp\%08d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p C:\Users\Fran\AppData\Roaming\IpCam\Images\test.mp4" (in directory "C:\ffmpeg64"): CreateProcess error=2, El sistema no puede encontrar el archivo especificado) Click to expand... But if i copy and paste the command "C:\ffmpeg64\bin\ffmpeg.exe -r 10 -f image2 -s 640x480 -i C:\Users\Fran\AppData\Roaming\IpCam\Temp\%08d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p C:\Users\Fran\AppData\Roaming\IpCam\Images\test.mp4" in a system symbol window it run ok. Thank in advance
Hello to everybody I`m trying to execute a command from my application through JShell but i can`t, however if i write it in system symbol window it run ok. With this code: Code: Copy If File.Exists(FM.FotoDir, "test.mp4") Then File.Delete(FM.FotoDir, "test.mp4") End If Dim Sh As Shell Sh.Initialize("Shell", File.Combine("C:\ffmpeg64\bin", "ffmpeg.exe"), Array As String(" -r 10", "-f image2", "-s 640x480", "-i "& File.Combine(FM.TempDir, "%08d.png"), "-vcodec libx264", "-crf 25", "-pix_fmt yuv420p " & File.Combine(FM.FotoDir, "test.mp4"))) Sh.WorkingDirectory = "C:\ffmpeg64" Sh.Run(100) Here is the result Waiting for debugger to connect... Program started. ffmpeg version N-87871-g7480f232d2 Copyright (c) 2000-2017 the FFmpeg developers built with gcc 7.2.0 (GCC) configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth --enable-libmfx libavutil 55. 79.100 / 55. 79.100 libavcodec 57.108.100 / 57.108.100 libavformat 57. 84.100 / 57. 84.100 libavdevice 57. 11.100 / 57. 11.100 libavfilter 6.108.100 / 6.108.100 libswscale 4. 9.100 / 4. 9.100 libswresample 2. 10.100 / 2. 10.100 libpostproc 54. 8.100 / 54. 8.100 Unrecognized option 'r 10'. Error splitting the argument list: Option not found Click to expand... It seems the option "-r 10" is passed as "r 10" And with this code: Code: Copy If File.Exists(FM.FotoDir, "test.mp4") Then File.Delete(FM.FotoDir, "test.mp4") End If Dim Sh As Shell Sh.Initialize("Shell", File.Combine("C:\ffmpeg64\bin", "ffmpeg.exe") & " -r 10 -f image2 -s 640x480 -i "& File.Combine(FM.TempDir, "%08d.png") & " -vcodec libx264 -crf 25 -pix_fmt yuv420p " & File.Combine(FM.FotoDir, "test.mp4"),Null) Sh.WorkingDirectory = "C:\ffmpeg64" Sh.Run(100) The result is: org.apache.commons.exec.ExecuteException: Execution failed (Exit value: -559038737. Caused by java.io.IOException: Cannot run program "C:\ffmpeg64\bin\ffmpeg.exe -r 10 -f image2 -s 640x480 -i C:\Users\Fran\AppData\Roaming\IpCam\Temp\%08d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p C:\Users\Fran\AppData\Roaming\IpCam\Images\test.mp4" (in directory "C:\ffmpeg64"): CreateProcess error=2, El sistema no puede encontrar el archivo especificado) Click to expand... But if i copy and paste the command "C:\ffmpeg64\bin\ffmpeg.exe -r 10 -f image2 -s 640x480 -i C:\Users\Fran\AppData\Roaming\IpCam\Temp\%08d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p C:\Users\Fran\AppData\Roaming\IpCam\Images\test.mp4" in a system symbol window it run ok. Thank in advance
stevel05 Expert Licensed User Longtime User Oct 24, 2017 #2 I haven't used it for a while, but I think you need to pass all the arguments using the Arguments method. Code: Copy sh.Arguments = Edit : Sorry, you need to pass them to the intialize method as a list. Code: Copy Dim L As List = Array As String("-r 10","-f image2") 'etc. sh.Initialize("Shell",File.Combine("C:\ffmpeg64\bin", "ffmpeg.exe"),L) Last edited: Oct 24, 2017 Upvote 0
I haven't used it for a while, but I think you need to pass all the arguments using the Arguments method. Code: Copy sh.Arguments = Edit : Sorry, you need to pass them to the intialize method as a list. Code: Copy Dim L As List = Array As String("-r 10","-f image2") 'etc. sh.Initialize("Shell",File.Combine("C:\ffmpeg64\bin", "ffmpeg.exe"),L)
F Firpas Active Member Licensed User Longtime User Oct 24, 2017 #3 Checked. It isn't the problem Thanks for you reply Upvote 0
OliverA Expert Licensed User Longtime User Oct 24, 2017 #4 Remove the space in front of the -r? You have " -r 10", try "-r 10". Upvote 0
F Firpas Active Member Licensed User Longtime User Oct 24, 2017 #5 Thank for your reply The problem persists Upvote 0
OliverA Expert Licensed User Longtime User Oct 24, 2017 #6 Firpas said: "-pix_fmt yuv420p " & File.Combine(FM.FotoDir, "test.mp4") Click to expand... I think this should be Code: Copy "-pix_fmt yuv420p", File.Combine(FM.FotoDir, "test.mp4") making it Code: Copy Sh.Initialize("Shell", File.Combine("C:\ffmpeg64\bin", "ffmpeg.exe"), Array As String("-r 10", "-f image2", "-s 640x480", "-i "& File.Combine(FM.TempDir, "%08d.png"), "-vcodec libx264", "-crf 25", "-pix_fmt yuv420p", File.Combine(FM.FotoDir, "test.mp4"))) Upvote 0
Firpas said: "-pix_fmt yuv420p " & File.Combine(FM.FotoDir, "test.mp4") Click to expand... I think this should be Code: Copy "-pix_fmt yuv420p", File.Combine(FM.FotoDir, "test.mp4") making it Code: Copy Sh.Initialize("Shell", File.Combine("C:\ffmpeg64\bin", "ffmpeg.exe"), Array As String("-r 10", "-f image2", "-s 640x480", "-i "& File.Combine(FM.TempDir, "%08d.png"), "-vcodec libx264", "-crf 25", "-pix_fmt yuv420p", File.Combine(FM.FotoDir, "test.mp4")))
F Firpas Active Member Licensed User Longtime User Oct 25, 2017 #7 Yes, i know the destination file is another option. I've tried as you say, but it does not work. Here is the log: Waiting for debugger to connect... Program started. 0 ffmpeg version 3.4 Copyright (c) 2000-2017 the FFmpeg developers built with gcc 7.2.0 (GCC) configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth --enable-libmfx libavutil 55. 78.100 / 55. 78.100 libavcodec 57.107.100 / 57.107.100 libavformat 57. 83.100 / 57. 83.100 libavdevice 57. 10.100 / 57. 10.100 libavfilter 6.107.100 / 6.107.100 libswscale 4. 8.100 / 4. 8.100 libswresample 2. 9.100 / 2. 9.100 libpostproc 54. 7.100 / 54. 7.100 Unrecognized option 'r 10'. Error splitting the argument list: Option not found Click to expand... Thanks for you reply Last edited: Oct 25, 2017 Upvote 0
Yes, i know the destination file is another option. I've tried as you say, but it does not work. Here is the log: Waiting for debugger to connect... Program started. 0 ffmpeg version 3.4 Copyright (c) 2000-2017 the FFmpeg developers built with gcc 7.2.0 (GCC) configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth --enable-libmfx libavutil 55. 78.100 / 55. 78.100 libavcodec 57.107.100 / 57.107.100 libavformat 57. 83.100 / 57. 83.100 libavdevice 57. 10.100 / 57. 10.100 libavfilter 6.107.100 / 6.107.100 libswscale 4. 8.100 / 4. 8.100 libswresample 2. 9.100 / 2. 9.100 libpostproc 54. 7.100 / 54. 7.100 Unrecognized option 'r 10'. Error splitting the argument list: Option not found Click to expand... Thanks for you reply
OliverA Expert Licensed User Longtime User Oct 25, 2017 #8 It's this Code: Copy Array As String("-r","10", "-f", "image2", "-s", "640x480", "-i", File.Combine(File.DirTemp, "%08d.png"), "-vcodec", "libx264", "-crf", "25", "-pix_fmt", "yuv420p", File.Combine(File.DirApp, "test.mp4") Anytime you have a space between parameters, even if they are values for the previous parameter, they are separate parameters. And no, it's not just FFmpeg (I also tried GraphicsMagick) and it's not just the new 1.5 version of JShell (the same happens with 1.3). In the end this really makes sense if you think about it. Upvote 0
It's this Code: Copy Array As String("-r","10", "-f", "image2", "-s", "640x480", "-i", File.Combine(File.DirTemp, "%08d.png"), "-vcodec", "libx264", "-crf", "25", "-pix_fmt", "yuv420p", File.Combine(File.DirApp, "test.mp4") Anytime you have a space between parameters, even if they are values for the previous parameter, they are separate parameters. And no, it's not just FFmpeg (I also tried GraphicsMagick) and it's not just the new 1.5 version of JShell (the same happens with 1.3). In the end this really makes sense if you think about it.
F Firpas Active Member Licensed User Longtime User Oct 25, 2017 #9 Ok. Solved! Now run OK! Thank you for your collaboration. Upvote 0
Alexander Vallecillo Member Licensed User Nov 2, 2017 #10 alguien que me ayude con este problema porfa Upvote 0
OliverA Expert Licensed User Longtime User Nov 2, 2017 #11 Alexander Vallecillo said: alguien que me ayude con este problema porfa Click to expand... Should this be a new thread? Google translate--> ¿Debería ser este un nuevo hilo? Upvote 0
Alexander Vallecillo said: alguien que me ayude con este problema porfa Click to expand... Should this be a new thread? Google translate--> ¿Debería ser este un nuevo hilo?