Filename quoting in ffmpeg concat

11

2

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.

Tihomir Mitkov

Posted 2014-07-23T18:43:56.320

Reputation: 387

Answers

12

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.

slhck

Posted 2014-07-23T18:43:56.320

Reputation: 182 472