#1813 closed defect (invalid)
ASS filter does not accept filenames with '
Reported by: | Atarikid | Owned by: | |
---|---|---|---|
Priority: | important | Component: | documentation |
Version: | 1.0 | Keywords: | syntax quoting escaping |
Cc: | stefasab@gmail.com | Blocked By: | |
Blocking: | Reproduced by developer: | yes | |
Analyzed by developer: | yes |
Description
When using a filename including the character ' within the .ass filename FFmpeg gives an error 'Error opening filter'
Example with escaping
-vf ass="/Volumes/Data/Movies/Crime\ d\'Amour.srt"
or without escaping:
-vf ass="/Volumes/Data/Movies/Crime d'Amour.srt"
Both gives an error.
When removing the ' character (and renaming the file to Crime dAmour.srt) it works fine.
I did not test this with other filters (watermark etc..) but I guess it the same would happen.
BTW with FFmpeg 1.0 compiled to OS X
Change History (8)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
No problem.
Command line:
/Users/Atari/Library/FFmpeg/ffmpeg -i /Volumes/Data/Movies/Gaming\ test\:\ Galaxy\ S\ II\ vs.\ Galaxy\ S\ Plus\ vs.\ Optimus\ 2X\ \-\ YouTube.mp4 -c:a aac -b:a 128k -strict experimental -async 1 -c:v libx264 -b:v 2416k -bt 171k -bufsize 966.4k -r 29.97 -s 640x360 -aspect 640:360 -vf ass="/volumes/data/movies/crime\ d\'amour.ass" -threads 8 -y "/Users/Atari/Movies/Gaming test Galaxy S II vs. Galaxy S Plus vs. Optimus 2X - YouTube.mp4"
Output:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Volumes/Data/Movies/Gaming test: Galaxy S II vs. Galaxy S Plus vs. Optimus 2X - YouTube.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2011-06-01 17:20:19
Duration: 00:03:18.25, start: 0.000000, bitrate: 620 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x360, 518 kb/s, 29.97 fps, 29.92 tbr, 1k tbn, 59.83 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, s16, 96 kb/s
Metadata:
creation_time : 2011-06-01 17:20:20
handler_name : IsoMedia File Produced by Google, 5-11-2011
[Parsed_ass_0 @ 0x101b0ef20] ass_read_file(/volumes/data/movies/crime damour.ass): fopen failed
[Parsed_ass_0 @ 0x101b0ef20] Could not create a libass track when reading file '/volumes/data/movies/crime damour.ass'
[AVFilterGraph @ 0x101b0c6e0] Error initializing filter 'ass' with args '/volumes/data/movies/crime d'amour.ass'
Error opening filters!
It seems FFmpeg cuts the ' character when reading the .ass file
comment:3 by , 12 years ago
Analyzed by developer: | set |
---|---|
Component: | avfilter → documentation |
Keywords: | syntax quoting escaping added |
Priority: | normal → important |
Reproduced by developer: | set |
Status: | new → open |
That's a problem related to the quoting mechanism employed by FFmpeg.
Let's start from the string:
/Volumes/Data/Movies/Crime? d'Amour.srt
"'" is a special character (since it is used for quoting), so the first level of escaping should be:
/Volumes/Data/Movies/Crime? d\'Amour.srt
Add to this a second level of escaping (which may required by your shell), and you get:
"Volumes/Data/Movies/Crime? d\'Amour.srt"
As for the second string:
/Volumes/Data/Movies/Gaming test: Galaxy S II vs. Galaxy S Plus vs. Optimus 2X - YouTube.mp4
it contains the ":" special character (used to separate options), so proper escaping would be:
/Volumes/Data/Movies/Gaming test\: Galaxy S II vs. Galaxy S Plus vs. Optimus 2X - YouTube.mp4
or alternatively:
'/Volumes/Data/Movies/Gaming test: Galaxy S II vs. Galaxy S Plus vs. Optimus 2X - YouTube.mp4'
which with shell-escaping becomes:
"'/Volumes/Data/Movies/Gaming test: Galaxy S II vs. Galaxy S Plus vs. Optimus 2X - YouTube.mp4'"
I'm aware that the quoting syntax is not currently documented (and we may add some tools for performing automatic escaping/quoting), this is a WIP, for the moment check the av_get_token() doxy.
comment:4 by , 12 years ago
Sorry to say but the issue remains.
When using the following command line, FFmpeg still gives the same issue. This IS a bug.
ffmpeg -i /Volumes/Data/Movies/Gaming.mp4 -c:a aac -b:a 128k -strict experimental -async 1 -c:v libx264 -b:v 2416k -bt 171k -bufsize 966.4k -r 29.97 -s 640x360 -aspect 640:360 -trellis 1 -coder ac -subq 7 -me_range 16 -i_qfactor 0.71 -bf 3 -b_strategy 1 -refs 3 -partitions partb8x8+partp4x4+partp8x8+parti8x8 -flags +loop -me_method hex -direct-pred 1 -rc_lookahead 40 -g 240 -qmin 3 -qmax 51 -qdiff 4 -weightb 1 -8x8dct 1 -fast-pskip 1 -b-pyramid 1 -sc_threshold 40 -sn -vf ass="'/volumes/data/movies/crime\ d\'amour.ass'" -threads 8 -y "/Volumes/Data/Movies/Gaming.mkv"
Output:
ffmpeg version 1.0 Copyright (c) 2000-2012 the FFmpeg developers
built on Sep 28 2012 18:59:19 with gcc 4.2.1 (GCC) (Apple Inc. build 5666) (dot 3)
configuration: --prefix=/Volumes/tempdisk/sw --as=yasm --enable-gpl --enable-pthreads --disable-ffplay --disable-ffserver --disable-shared --enable-static --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-zlib --enable-avfilter --enable-libspeex --enable-libfreetype --enable-libass --enable-filters --enable-postproc --arch=x86 --enable-runtime-cpudetect
libavutil 51. 73.101 / 51. 73.101
libavcodec 54. 59.100 / 54. 59.100
libavformat 54. 29.104 / 54. 29.104
libavdevice 54. 2.101 / 54. 2.101
libavfilter 3. 17.100 / 3. 17.100
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Volumes/Data/Movies/Gaming.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2011-06-01 17:20:19
Duration: 00:03:18.25, start: 0.000000, bitrate: 620 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x360, 518 kb/s, 29.97 fps, 29.92 tbr, 1k tbn, 59.83 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, s16, 96 kb/s
Metadata:
creation_time : 2011-06-01 17:20:20
handler_name : IsoMedia File Produced by Google, 5-11-2011
[Parsed_ass_0 @ 0x101b0dc40] ass_read_file(/volumes/data/movies/crime damour.ass): fopen failed
[Parsed_ass_0 @ 0x101b0dc40] Could not create a libass track when reading file '/volumes/data/movies/crime damour.ass'
[AVFilterGraph @ 0x101b0cba0] Error initializing filter 'ass' with args '/volumes/data/movies/crime\ d\amour.ass'
Error opening filters!
comment:5 by , 12 years ago
Cc: | added |
---|
Keep in mind that you need two levels of escaping (which I myself forgot in my first reply), the first one for separating arguments for the filter description, separated by the ":" special char, second level for separating filter descriptions in the filtergraph, separated by ";,".
First level (you escape the '):
crime d\'amour.ass
Second level (you quote the string):
ass='crime d'\''amour.ass'
or alternatively you keep escaping again:
ass=crime d\\\'amour.ass
Finally you embed it in a string for the shell (e.g. you double each \ - depends on the shell):
-vf "ass=crime d\\\\\\'amour.ass"
Unfortunately there is no elegant solution to this problem, I tried to document the escaping/quote rules in the manual, and added a tool (tools/ffescape) to help automation, but the truth is that the filtergraph syntax was not designed to be handy when embedding generic strings which may contain special characters.
comment:7 by , 12 years ago
Resolution: | → invalid |
---|---|
Status: | open → closed |
comment:8 by , 12 years ago
See also commit:
commit 14f1fa56b2aef1f4b2036ebdc7c6665ef68052c0 Author: Stefano Sabatini <stefasab@gmail.com> Date: Tue Oct 30 22:02:29 2012 +0100 doc/filters: add "Notes on filtergraph escaping" section Should help to clarify escaping issues in the filtergraph syntax. In particular, should address trac ticket #1813.
Replying to Atarikid:
Please provide your command line together with complete, uncut console output.