1

I am trying to hardsub a video and this is the command i'm using the following command:

ffmpeg -i file 'c:\Users\user1\Desktop\subtitle\2\pod1.mp4' -filter:v subtitles='c:\Users\user1\Desktop\subtitle\2\done.ass' 'c:\Users\user1\Desktop\subtitle\2\pod_result.mkv'

But i get this error:

'c:\Users\user1\Desktop\subtitle\2\pod1.mp4': Invalid argument

I have done these following modification yet i still get the same error:

  1. using forward slash instead of backward slash

  2. escaping backward slashes(\)

  3. using C:\ or c:\ at the beginning of the addresses

ps: i know that i can put my input video and subtitle in the same directory as ffmpeg (or any directory with relative path to ffmpeg) and give the relative path instead of absolute path. But i need to know if giving input and output addresses as absolute path is possible or not.

3 Answers 3

3

Finally I could find the answer by trial and error. As explained in the question, I wanted to hardsub done.ass(subtitle file) to a video

absolute path of subtitle = C:/Users/user1/Desktop/subtitle/2/done.ass

absolute path of video = C:\Users\user1\Desktop\subtitle\2\pod1.mp4

absolute path of result video = C:\Users\sadegh\Desktop\subtitle\2\pod_result.mkv

Now the command to hardsub the video will be:

ffmpeg -i "C:\Users\sadegh\Desktop\subtitle\2\pod 1.mp4" -filter:v subtitles=\'C:/Users/sadegh/Desktop/subtitle/2/done.ass\' "C:\Users\sadegh\Desktop\subtitle\2\pod_result.mkv"

note: absolute path of subtitle must be forward slash separated

note: I had to put the subtitle file absolute path in single quotation and i had to escape those single notation(using \ backslash before the ' character)

1

On Windows use double quote characters and you should wrap the whole parameter belonging together, not just the path:

"subtitles=C:\somefilepath.txt"

You can't use 'for grouping as it will be interpreted to be part of the parameter/path.

3
  • Thank you for your help. i tried this based on your answer: command: ffmpeg -i C:\Users\user1\Desktop\subtitle\2\pod1.mp4 -filter:v "subtitles=C:\Users\user1\Desktop\subtitle\2\done.ass" C:\Users\user1\Desktop\subtitle\2\pod_result.mkv and got this error error: Unable to parse option value "Usersuser1Desktopsubtitle2done.ass" as image size then i tried this: command: ffmpeg -i "C:\Users\user1\Desktop\subtitle\2\pod1.mp4" -filter:v "subtitles=C:\\Users\\user1\\Desktop\\subtitle\\2\\done.ass" "C:\Users\user1\Desktop\subtitle\2\pod_result.mkv"
    – Gandalf
    Aug 20, 2017 at 6:16
  • and got this error: error: Error initializing filter 'subtitles' with args 'C:\Users\user1\Desktop\subtitle\2\done.ass'
    – Gandalf
    Aug 20, 2017 at 6:17
  • @gandalf The backslash will probably be treated as an escape character. Use forward slashes only; Windows understands them too.
    – slhck
    Aug 20, 2017 at 7:59
0

I was able to process a FFmpeg mp4 video with ASS filter using full path under Windows 11, in this way:

ffmpeg -i "E:\2023\202308\20230712 - Bavarian Illuminati-r.mp4"  **-vf "ass=\\'E:\\\2023\\\202308\\\20230712 - Bavarian Illuminati-r.ASS\\'"**  "E:\2023\202308\20230712 - Bavarian Illuminati-rASS.mp4"

And embed, in this way, my ASS subtitles in the original video.

So you need to use ' (single quote) escaped from \ (backslash) plus doubling every path \. A bit "contorted" but it worked!

Just a note: check carefully that in the filename/path of the *.ASS subtitle file, there are NO "," (commas), otherwise the escape solution shown above, won't work!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .