On Win32 systems, the escape_chars function turns berserk and hyper-escapes some symbols.
This result in an invalid parameter in ffmpeg and fails to run.
import ffmpeg
testcase = ffmpeg.input("Wildlife.wmv").filter('scale',"320:-2").output("wontwork.mp4")
print(testcase.compile())
testcase.run()
['ffmpeg', '-i', 'Wildlife.wmv', '-filter_complex', '[0]scale=320\\\\\\\\\\\\:-2[s0]', '-map', '[s0]', 'wontwork.mp4']
<some ffmpeg output>
[Parsed_scale_0 @ 00000000005c6c80] Invalid size '320\:-2'
[AVFilterGraph @ 00000000028c6500] Error initializing filter 'scale' with args '320\\\:-2'
Error initializing complex filters.
Invalid argument
: is escaped by escape_chars although it shouldn't (at least on win32 systems).testbench.compile() to a .bat file, manually removing the six \ and running the command solves the issue.\ is unclear (would default to 6 passed to Popen, then 3 when parsed by ffmpeg)-ffmpeg.input("Wildlife.wmv").filter('scale',"320:-2").output("wontwork.mp4")
+ffmpeg.input("Wildlife.wmv").filter('scale', 320, -2).output("wontwork.mp4")
The reason there are so many \ characters is because of ffmpeg's recursively nested escaping rules. Try using the drawtext filter manually from the command line and see how many backslash escapes it takes to draw the text ":" over a video. It's intended behavior - see the escape_chars test cases.
Understood!
This is more of a filter documentation problem to me then.
Thanks for your answer!
Thanks for the feedback about documentation. We'll keep that in mind as the documentation is improved.
Also big props for such a well-written ticket. I appreciate the thought you put into keeping the ticket organized so that it was easy to see what's going on.
Most helpful comment
Also big props for such a well-written ticket. I appreciate the thought you put into keeping the ticket organized so that it was easy to see what's going on.