FFmpeg: Exporting subtitle stream to .ass file

5,667

Solution 1

try this

ffmpeg -i input.mkv -map 0:{subtitle_stream_index} -c copy output_subtitle.ass

assuming the subtitle stream index is 7 from your question then the command will be

ffmpeg -i input.mkv -map 0:7 -c copy output_subtitle.ass

Solution 2

You should try this: ffmpeg -i input.mkv -vn -an -codec:s:0.7 ass output_subtitle.ass assuming you have found out the stream identifier to be 0:7.

Share:
5,667

Related videos on Youtube

YourMJK
Author by

YourMJK

Updated on September 18, 2022

Comments

  • YourMJK
    YourMJK almost 2 years

    What I'm trying to do is exporting the subtile stream of a MKV-file to a ASS-subtitle-file. I'm not really experienced with ffmpeg so I'm sorry if I miss something obvious

    This is what I've got so far:

    ffmpeg -i input.mkv -map 0:7 -c:s ass output_subtitle.ass
    

    But when I try to run it, it gives me the error "Only SUBTITLE_ASS type supported"

    • Kard Nails
      Kard Nails over 10 years
      By the way, why not use str?
    • Kard Nails
      Kard Nails over 10 years
      Lighter, simpler, more widely supported and it's not like ass has that much to offer that str hasn't. Unless you want some really fancy formatting.
    • YourMJK
      YourMJK over 10 years
      Well, how do you define "fancy formatting"? The subtitle got a custom font and color :D
    • Elisa Cha Cha
      Elisa Cha Cha over 10 years
      Please include the complete ffmpeg console output.
    • YourMJK
      YourMJK over 10 years
      Too long to post here...
    • Elisa Cha Cha
      Elisa Cha Cha over 10 years
      Nobody has said that before. You may, of course, omit multiple repeating lines. If you are unsure just provide the first ~50 and last ~50 lines.
    • YourMJK
      YourMJK over 10 years
      Well I found a line that may be interesting: [matroska,webm @ 0x7fb421018600] Could not find codec parameters for stream 7 (Subtitle: hdmv_pgs_subtitle): unspecified size Consider increasing the value for the 'analyzeduration' and 'probesize' options'
    • YourMJK
      YourMJK over 10 years
      And the last lines: Chapter #0.1: start 325.575250, end 612.278333 Metadata: title : Chapter 02 […] (Lots of chapters) Stream #0:0(eng): Subtitle: ass Metadata: title : Untertitel Stream mapping: Stream #0:4 -> #0:0 (pgssub -> ass) Press [q] to stop, [?] for help [ass @ 0x7fb422417c00] Only SUBTITLE_ASS type supported. Subtitle encoding failed
  • YourMJK
    YourMJK over 10 years
    Thanks for the answer but somehow it still gives me the same error. Maybe it is relevant that the subtitle stream has a pgssub codec?
  • Kard Nails
    Kard Nails over 10 years
    Have you tried to export str instead?
  • YourMJK
    YourMJK over 10 years
    Yes, I did but it leaves me with a new error: "Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height" Command I used: ffmpeg -i input.mkv -vn -an -codec:s:0.7 srt output_subtitle.srt
  • YourMJK
    YourMJK over 10 years
    Wait, I'm confused. Is it "SRT" or "STR"?!