MINGW-packages icon indicating copy to clipboard operation
MINGW-packages copied to clipboard

FFmpeg: Can't use absolute paths in subtitles fliter

Open wszqkzqk opened this issue 3 years ago • 12 comments

When running -vf "subtitles=C:\xxx\xxx\xxx.srt" (for example), FFmpeg couldn't find it out. Maybe this module still can't recognize the format of windows paths

wszqkzqk avatar Mar 18 '22 09:03 wszqkzqk

Can you provide the whole command?

Biswa96 avatar Mar 18 '22 09:03 Biswa96

Can you provide the whole command?

This happens every time, regardless of the command……

wszqkzqk avatar Mar 18 '22 09:03 wszqkzqk

Can you provide any error output?

Biswa96 avatar Mar 18 '22 09:03 Biswa96

Can you provide any error output?

[subtitles @ 000002bc464ada00] Unable to parse option value "Videotest.srt" as image size
    Last message repeated 1 times
[subtitles @ 000002bc464ada00] Error setting option original_size to value Videotest.srt.
[Parsed_subtitles_0 @ 000002bc4622d840] Error applying options to the filter.
[AVFilterGraph @ 000002bc466e5e40] Error initializing filter 'subtitles' with args 'F:Videotest.srt'
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0
Conversion failed!

The \ between Video and test.srt was missed by ffmpeg.

wszqkzqk avatar Mar 18 '22 09:03 wszqkzqk

use / or \\ instead of \ maybe?

driver1998 avatar Mar 22 '22 02:03 driver1998

use / or \\ instead of \ maybe?

It didn't work.

wszqkzqk avatar Mar 24 '22 06:03 wszqkzqk

I think you might need to escape the : since it uses that to separate between filters, similar to https://github.com/Netflix/vmaf/blob/master/resource/doc/ffmpeg.md#note-about-the-model-path-on-windows

1480c1 avatar Mar 24 '22 13:03 1480c1

-vf subtitles="C:\xxx\xxx\xxx.srt" or -vf subtitles='C:\xxx\xxx\xxx.srt' or -vf 'subtitles="C:\xxx\xxx\xxx.srt"' or -vf "subtitles='C:\xxx\xxx\xxx.srt'" might work.

I think you might need to escape the : since it uses that to separate between filters, similar to https://github.com/Netflix/vmaf/blob/master/resource/doc/ffmpeg.md#note-about-the-model-path-on-windows

-vf subtitles="C:\xxx\xxx\xxx.srt" or -vf subtitles='C:\xxx\xxx\xxx.srt' or -vf 'subtitles="C:\xxx\xxx\xxx.srt"' or -vf "subtitles='C:\xxx\xxx\xxx.srt'" might work.

/c/xxx/xxx.srt, C:\xxx\xxx.srt and C:/xxx/xxx.srt didn't work. '-vf subtitles="xxxx"', -vf subtitles='xxx' , -vf 'subtitles="xxx"', -vf "subtitles='xxx'" didn't, either.

wszqkzqk avatar Mar 27 '22 02:03 wszqkzqk

Can you try running cmd.exe inside MSYS2 and then run ffmpeg there? The MSYS2 bash did some special handing to the command line.

Of course, use Windows path when you try.

See: https://www.msys2.org/wiki/Porting/#filesystem-namespaces

driver1998 avatar Mar 27 '22 02:03 driver1998

Can you try running cmd.exe inside MSYS2 and then run ffmpeg there? The MSYS2 bash did some special handing to the command line. Of course, use Windows path when you try. See: https://www.msys2.org/wiki/Porting/#filesystem-namespaces

I've tried powershell, MSYS2 bash(including zsh and fish) and cmd, all of them didn't work.

wszqkzqk avatar Mar 27 '22 02:03 wszqkzqk

I think you might need to escape the : since it uses that to separate between filters, similar to https://github.com/Netflix/vmaf/blob/master/resource/doc/ffmpeg.md#note-about-the-model-path-on-windows

try -vf subtitles="C\\:/xxx/xxx/xxx.srt"

OK!It works now, thanks! But why can't '/C/xxx/xxx.srt' work?

wszqkzqk avatar Mar 30 '22 11:03 wszqkzqk

Isn't there a way to automatically replace : by \: in a PowerShell/CMD command?

KonoVitoDa avatar Feb 07 '24 08:02 KonoVitoDa