Hi I'm using FFMPEG 6 to add subtitles to MKV H264 files and output subtitled PNG frames. With the video and the .srt file in the same sub directory the following command line works perfectly.
ffmpeg -i sample.mkv -vf subtitles=sample.srt -f image2 d:\png\%08d.png"
However if i add a path even if the srt file is in the same subfolder i run into problems
ffmpeg -i D:\dennervision\sample.mkv -vf subtitles=D:\dennervision\sample.srt -f image2 d:\png\%08d.png"
The following error is generated.
Input #0, matroska,webm, from 'D:\dennervision\sample.mkv':
encoder : libebml v1.2.3 + libmatroska v1.3.0
creation_time : 2012-05-17T17:56:37.000000Z
Duration: 00:01:00.24, start: 0.000000, bitrate: 14797 kb/s
Stream #0:0(eng): Video: h264 (High), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn (default)
Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 640 kb/s (default)
title : English DD 5.1 640 Kbps
Stream #0:0 -> #0:0 (h264 (native) -> png (native))
Press [q] to stop, [?] for help
[Parsed_subtitles_0 @ 00000196e4b07740] Unable to parse option value "dennervisionsample.srt" as image size
Error applying option 'original_size' to filter 'subtitles': Invalid argument
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0
The path to the input and output folders work fine, but not the path to the srt file. if i change it to -vf subtitles=sample.srt -f it then works again but i don't want to keep the srt files in the ffmpeg folder. can anyone show me where i'm going wrong or is this a bug in ffmpeg? it seems to be ignoring the backslashes. Thanks
+ Reply to Thread
Results 1 to 9 of 9
Hi October262 thank you, your a star, totaly nailed it! Someone else had exact same problem. Changed it to the following and it works fine:-
ffmpeg -i D:\dennervision\sample.mkv -vf subtitles='d\:\\sample.srt' -f image2 d:\png\%08d.png
Can't see any logical reason to have to add the extra inverted commas and back slashes, looks more like a bug with a work arround to me. Who know perhaps theres a good reason for it deep in the inner workings..
Last edited by Cineman; 26th May 2023 at 00:22. Reason: got user name wrong !
Can't see any logical reason to have to add the extra inverted commas and back slashes
Instead of backslashes, using slashes in the path should work on newer Windows systems (Win7 and newer iirc.), but the colon would still need escaping.users currently on my ignore list: deadrats, Stears555
Thank you Selur for explaning, I'll try it just escping the d and see what happens would simply the processing on the path to add the extra slashes automaticly.
you don't need to escape the d you need to escape the colon (, and is you use backslashes those too.users currently on my ignore list: deadrats, Stears555
Can't see any logical reason to have to add the extra inverted commas
Then you'll need to wrap double quotes around the "D:\path to\My Movie.mkv"...... "D:\png folder\%08d.png" strings.
Last edited by pcspeak; 26th May 2023 at 15:37. Reason: Clarity
Ah so thats why other commandline programs fall over when they encounter spaces in the file names, ive been replacing tany spaces in file names with _ before running my program. media info dll being a case in point.
Splitting SRT fileBy RussellW in forum SubtitleReplies: 2Last Post: 16th Jun 2021, 18:21
Remux matching .srt file into video file Try DVDFab Video Downloader and riBy agon024 in forum Video ConversionReplies: 5Last Post: 26th Mar 2021, 02:57
MeGui - How to get path/name of current file in the queue dynamically ?By untymage in forum Video ConversionReplies: 5Last Post: 16th May 2020, 08:51
Replace subtitle in a sub/srt fileBy Adhyskonydh Bobobobo in forum SubtitleReplies: 2Last Post: 15th Apr 2020, 02:45
How to set ffmpeg File Path on Batch FileBy Daringbaaz in forum Newbie / General discussionsReplies: 2Last Post: 28th Jul 2019, 05:55