I've got a strange one here that I can't figure out. I basically want to pipe the output from calling ffmpeg to a text file. I am using ffmpeg version SVN-r23607.
If I create a batch file with the following statement it works. All of the output is saved to the text file.
If I then convert the same statement to VBScript it no longer works. It doesn't even run the command.Code:"C:\ffmpeg\ffmpeg.exe" -i "FileInput.mp4" -vcodec copy -acodec copy "FileOutput.mp4" 2> "LogFile.txt"
If I get rid of the part that outputs the info to a text file, then the VBScript works but obviously doesn't save the output to the text file.Code:Set objShell = CreateObject("Wscript.Shell") Cmd = Chr(34) & "C:\ffmpeg\ffmpeg.exe" & Chr(34) & " -i " & Chr(34) & "FileInput.mp4" & Chr(34) & " -vcodec copy -acodec copy " & Chr(34) & "FileOutput.mp4" & Chr(34) & " 2> " & Chr(34) & "LogFile.txt" & Chr(34) objShell.Run Cmd, 10, True
ie
Very confused as to why it works in a batch file but the same cmd doesn't work in VBScript.Code:Set objShell = CreateObject("Wscript.Shell") Cmd = Chr(34) & "C:\ffmpeg\ffmpeg.exe" & Chr(34) & " -i " & Chr(34) & "FileInput.mp4" & Chr(34) & " -vcodec copy -acodec copy " & Chr(34) & "FileOutput.mp4" & Chr(34) objShell.Run Cmd, 10, True
Is there another way to capture this output in VBScript instead of dumping it out to a text file. I've heard "stdOut" could be used but I can't get this to work either. If someone has an example of this it would be great.
+ Reply to Thread
Results 1 to 3 of 3
-
-
For file redirection to work, you have to run the command shell.
Code:Set objShell = CreateObject("Wscript.Shell") Cmd = "cmd.exe /c " & Chr(34) & "C:\ffmpeg\ffmpeg.exe" & Chr(34) & " -i " & Chr(34) & "FileInput.mp4" & Chr(34) & " -vcodec copy -acodec copy " & Chr(34) & "FileOutput.mp4" & Chr(34) & " 2> " & Chr(34) & "LogFile.txt" & Chr(34) objShell.Run Cmd, 10, True
-
Thanks, that solved the problem. I just had to wrap the command up in quotes in order for it to work. As so...
Code:Set objShell = CreateObject("Wscript.Shell") Cmd = "cmd.exe /c " & Chr(34) & Chr(34) & "C:\ffmpeg\ffmpeg.exe" & Chr(34) & " -i " & Chr(34) & "FileInput.mp4" & Chr(34) & " -vcodec copy -acodec copy " & Chr(34) & "FileOutput.mp4" & Chr(34) & " 2> " & Chr(34) & "LogFile.txt" & Chr(34) & Chr(34) objShell.Run Cmd, 10, True
Similar Threads
-
VBScript to read XML. Assistance Needed
By NYPlayer in forum ProgrammingReplies: 11Last Post: 9th Oct 2012, 18:29 -
FFmpeg on Win only - FAQ can ffmpeg realize screen capture
By feelart in forum Capturing and VCRReplies: 1Last Post: 14th Feb 2012, 04:11 -
Can VBscript/Batch read MPEG file?
By Cazz in forum ProgrammingReplies: 11Last Post: 3rd Sep 2010, 07:50 -
VBScript runtime error when installing Perrla software
By budz in forum ComputerReplies: 7Last Post: 27th Aug 2010, 02:53 -
FFMPEG QUESTION :How do I take one frame and make a jpeg with FFMPEG?
By goheadtry in forum Newbie / General discussionsReplies: 1Last Post: 18th Sep 2007, 02:55