FFmpeg – Filename Quoting in FFmpeg Concat

ffmpeg

I want to concatenate files with ffmpeg using Concat demuxer as described in this article How to concatenate (join, merge) media files. My files, however contain, single quotes (apostrophes). So my concat.list looks like this:

file 'artist's song.mp3'
file 'artist's song 2 .mp3'

As you can see the apostrophe in the middle of the filename conflicts with the format of the concat file. Putting backslash doesn't help, because ffmpeg reads the filename literary and complains that the file doesn't exist. As additional detail, I'm using ffmpeg with cygwin under Windows 7.

Best Answer

You need to put everything in single quotes, and escape every single quote with

'\''

So,

foo'bar test.mp4

would be specified as:

file 'foo'\''bar test.mp4'

You can imagine it as the string being split where the first pair of single quotes end, and then continued later:

'foo'   \'   'bar test.mp4'

This is also explained in the documentation:

The quote character ' itself cannot be quoted, so you may need to close the quote and escape it.

and this bug report.

Related Question