[FFmpeg-user] Subtitle filter and filename with quotes and spaces

Pavel Koshevoy pkoshevoy at gmail.com
Mon Jan 20 21:25:39 CET 2014


On 1/20/2014 12:28 PM, James Darnley wrote:
> On 2014-01-20 19:39, Ramit Bhalla wrote:
>> Okay will try it. But then help me understand a simple quotes around the path and file works fine for the -i parameter. No escaping etc.
> Sorry to invalidate everyone's previous work here but this problem is is
> the fault of ffmpeg and libavfilter's escaping hell!
>
> Windows correctly passes your command line to ffmpeg.  The problem comes
> when ffmpeg tries to parse the filename.  ':' separates options
> for filters so you need to escape that.  '\' (backslash) in the filename
> also need to be escaped.  ffmpeg's escape character is '\' (backslash).
>   This means that the filename for the subtitle filter needs to be, with
> the quotes:
>> "D\\:\\\\MCEBuddy\\\\MCEBuddy 2.x\\\\MCEBuddy.ServiceCMD\\\\bin\\\\x86\\\\Debug\\\\working0\\\\HD Small\\\'.srt"
> And the full command line:
>> C:\Users\James>ffmpeg.exe -loglevel verbose -probesize 100M -analyzeduration 300M -threads 0 -drc_scale 0.8 -y -i "D:\MCEBuddy\MCEBuddy 2.x\MCEBuddy.ServiceCMD\bin\x86\Debug\working0\HD Small'.ts" -ss 3 -vf yadif=0:-1:1,hqdn3d,crop=1920:1072:0:4,scale=720:400,subtitles="D\\:\\\\MCEBuddy\\\\MCEBuddy 2.x\\\\MCEBuddy.ServiceCMD\\\\bin\\\\x86\\\\Debug\\\\working0\\\\HD Small\\\'.srt" -vcodec libx264 -b 1400000 -x264opts me=hex:trellis=1:subq=8:partitions=all:8x8dct=1:ref=3:rc-lookahead=50:keyint=25:min-keyint=20:bframes=1:weightb=1:level=4.0:b-pyramid=normal:direct=auto:mixed-refs=1:deblock=-1,-1:no-fast-pskip=1:no-dct-decimate=1:b-adapt=0:threads=auto -sn -acodec libfdk_aac -ab 256k -cutoff 18000  -ac 2 "D:\MCEBuddy\MCEBuddy 2.x\MCEBuddy.ServiceCMD\bin\x86\Debug\working0\HD Small'-converted.mp4"


I am sorry to have mislead Ramit earlier.  I've used the ^ escape 
sequence myself in a batch file (not with ffmpeg), so I know it works 
for me.

However, I tried dir C:\Program^ Files\ and it didn't work, so my 
suggestion was wrong.
Still, I've googled this up just now, maybe it will help: 
http://www.robvanderwoude.com/escapechars.php

Sorry for causing the confusion,
     Pavel



More information about the ffmpeg-user mailing list