I have a ffmpeg batch crop command that handles all files located in one folder and exports them to a folder named "cropped". Everything works well, however I cannot get ffmpeg to handle videos with blank spaces in the title, for example: "this great video.mpeg". Can someone please let me know what I need to add to this command?
Code:for %%a in ("*.mp4") do "C:\FFmpeg\bin\ffmpeg.exe" -i %%a -vf crop=1280:680:0:0 -c:v libx264 -level 40 -pix_fmt yuv420p -preset medium -crf 20 -threads 8 -c:a aac -strict experimental -ar 48000 -ab 256k -f mp4 "cropped\%%~na.mp4" pause
+ Reply to Thread
Results 1 to 5 of 5
-
-
IMHO even quotation not work 100% - this is cmd nature (it will work if you escape every space in name but i don't know if this is possible within cmd) - safer is to not use blank spaces in a files names. You can substitute blank space with underscore - some multirenamer can be useful - i always recommend total commander, alternatively you may use short (DOS) names.
-
"%%a" is the way to go and as I always stress it is better to call it like call :my_function "%%a" and it becomes %1 within that function, then call it "%~1"
That seems to always work, I could not find a scenario it would not.
windows batch adds quotes if there are gaps in %1, but like in Avisynth you cannot tolerate it or there might be other scenarios , because you have to put quotes there always, so it would double the quotes. So why not to ALWAYS manually put quotes there and forbid batch script to add quotes there in ANY CASE. "%~1" just does that.Code:for %%a in ("*.mp4") do call :my_function "%%a" pause exit :my_function "C:\FFmpeg\bin\ffmpeg.exe" -i "%~1" -vf crop=1280:680:0:0 -c:v libx264 -level 40 -pix_fmt yuv420p -preset medium -crf 20 -threads 8 -c:a aac -strict experimental -ar 48000 -ab 256k -f mp4 "cropped\%~n1.mp4" goto :eof -
Similar Threads
-
windows batch: paste but don't execute command in Windows command prompt
By flashandpan007 in forum ProgrammingReplies: 17Last Post: 23rd Jun 2016, 00:12 -
A small gui to handle batch merges for MKVmerge. (Windows only)
By librarien in forum User guidesReplies: 4Last Post: 14th May 2015, 14:03 -
using the OR command in a batch
By marcorocchini in forum Newbie / General discussionsReplies: 8Last Post: 30th Sep 2014, 18:56 -
DOS batch command variable
By sambat in forum ProgrammingReplies: 6Last Post: 24th Sep 2014, 14:14 -
Command Line Batch File
By agent3lephant in forum Authoring (DVD)Replies: 1Last Post: 28th Apr 2014, 12:24


Quote
