Is it possible to give input and output files's absolute path?

6,829

Solution 1

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)

Solution 2

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.

Share:
6,829

Related videos on Youtube

Cid
Author by

Cid

The name's Hosseini... Sadegh Hosseini

Updated on September 18, 2022

Comments

  • Cid
    Cid almost 2 years

    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.

  • Cid
    Cid almost 7 years
    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"
  • Cid
    Cid almost 7 years
    and got this error: error: Error initializing filter 'subtitles' with args 'C:\Users\user1\Desktop\subtitle\2\done.ass'
  • slhck
    slhck almost 7 years
    @gandalf The backslash will probably be treated as an escape character. Use forward slashes only; Windows understands them too.