msys2 / MINGW-packages

Package scripts for MinGW-w64 targets to build under MSYS2.
https://packages.msys2.org
BSD 3-Clause "New" or "Revised" License
2.3k stars 1.22k forks source link

FFmpeg: Can't use absolute paths in subtitles fliter #11018

Open wszqkzqk opened 2 years ago

wszqkzqk commented 2 years ago

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

Biswa96 commented 2 years ago

Can you provide the whole command?

wszqkzqk commented 2 years ago

Can you provide the whole command?

This happens every time, regardless of the command……

Biswa96 commented 2 years ago

Can you provide any error output?

wszqkzqk commented 2 years ago

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.

driver1998 commented 2 years ago

use / or \\ instead of \ maybe?

wszqkzqk commented 2 years ago

use / or \\ instead of \ maybe?

It didn't work.

1480c1 commented 2 years ago

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

wszqkzqk commented 2 years ago

-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.

driver1998 commented 2 years ago

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

wszqkzqk commented 2 years ago

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 commented 2 years ago

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?

KonoVitoDa commented 9 months ago

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