I am trying to do a basic hardsub work with FFmpeg in a Powershell script. Here is the code:
$subfile = ".\test\sub.srt"ffmpeg -i in.mp4 -c:v h264 -vf "subtitles=${subfile}:'force_style=fontsize=20'" out.mp4
When I run this, I got following error in FFmpeg:
"Unable to open .testsub.srt"
Strangely FFmpeg cut the backlashes from $subfile
variable.
If I change the command like below (remove curly braces for $subfile
variable):
$subfile = ".\test\sub.srt"ffmpeg -i in.mp4 -c:v h264 -vf "subtitles=$subfile:'force_style=fontsize=20'" out.mp4
This time PowerShell gets me an error like this:
"Variable reference is not valid. ':' was not followed by a valid variable name character. Consider using ${} to delimit the name."
In FFmpeg command above all of the "
'
and :
symbols are necessary, so I can't change that unfortunetly. What should I do?
Thank you.