Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to extract a subtitle from a Blu-ray disc and it is an hdmv_pgs_subtitle. So I try

ffmpeg -i file.m2ts -map 0:3 -scodec copy rip3/test.sub 

and get

Could not write header for output file #0 (incorrect codec parameters ?): 
Operation not permitted

Then I do

ffmpeg -i file.m2ts -map 0:3 -scodec copy rip3/test.sup 
ffmpeg -i file.m2ts -map 0:3 -scodec copy rip3/test.srt

and a bunch of other different extensions, until I give .mkv a shot, which works.

How can I find what extensions ffmpeg allows? I haven't found one place that e.g. names .mkv as an extension

ffmpeg -formats mentions matroska, but doesn't say that .mkv is the extension. So is there a way to find all supported file extensions for ffmpeg?

EDIT: After reading the answer from slhck I found the extensions by doing this command in the sourcefolder.

find . -type f -iname "*.c" -exec egrep -H ".extensions" {} \;

The filename will give some information about what kind of format it is.

share|improve this question
To my knowledge HDMV PGS subtitles cannot be "exported" to a standalone format. What do you need to do with the subtitles, specifically? –  slhck Sep 23 '13 at 19:58
i've never been much good with ffmpeg but fwiw(prob not much!!)besides -formats there's also ffmpeg -codecs –  barlop Sep 23 '13 at 19:58
@slhck it was for ripping a bluray I had. I wanted to dump audio and subtitles and encode the movie. This was really hard because I wanted to do it incrementally (first movie, audio and subtitles) and I couldn't manage to dump the subtitles because I couldn't find the proper extension. Read a couple of places that it was sup, and know of others that are sub, srt, mpsub and some others I saw doing ffmpeg -codecs and -formats. @ barlop fwiw codecs is what ffmpeg can read from and encode to not necessarily what it can output to. Format in the case of ffmpeg I think is the container of encoding. –  plitter Sep 23 '13 at 20:40

1 Answer 1

up vote 2 down vote accepted

First off, you can see all formats (containers) by calling ffmpeg -formats. That they don't mention extensions is probably for the reason that an extension on its own is often meaningless, and you can override the output format by using the -f option.

Output formats and their extensions are registered in the encoders. So, you'd find this for Matroska, when looking at the ffmpeg source code:

AVOutputFormat ff_matroska_muxer = {
    .name              = "matroska",
    .long_name         = NULL_IF_CONFIG_SMALL("Matroska"),
    .mime_type         = "video/x-matroska",
    .extensions        = "mkv",

Input formats are usually not parsed by their extension but the actual contained data.

The problem is that only two of all the formats ffmpeg can handle support HDMV PGS subtitles:

  • MKV (Matroska)

You cannot use an SRT container because it's a different concept. SRT subtitles are based on text, while HDMV PGS subtitles are actual bitmaps.

So, this should work if all you need to do is store the subtitles somewhere:

ffmpeg -i input.mkv -c:s:0 copy -map 0:s:0 output.mkv
share|improve this answer
Thank you. Would you happen to know how I can find out what "things" you can put into what format? Is there a convenient list saying this format supports these "things"? –  plitter Sep 23 '13 at 20:32
No, unfortunately it's not really that easy. One could, in theory, parse FFmpeg code in order to find out. Wikipedia has a fairly comprehensive list for common containers though. –  slhck Sep 23 '13 at 20:50
Why not? The wiki looks good, but it seems outdated. Pgssub f.ex. isn't there it seems. –  plitter Sep 23 '13 at 21:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.