Cody
Cody

Reputation: 639

How to extract subtitles from a .mkv file using GStreamer?

If gst-discover-1.0 verified a .mkv has subtitles, then how to extract the subtitles with gst-launch-1.0? Thanks.

Upvotes: 1

Views: 1379

Answers (1)

Sebastian Dröge
Sebastian Dröge

Reputation: 2143

What kind of subtitles? You'll have to get the caps from gst-discoverer-1.0 and then do something like

gst-launch-1.0 filesrc location=/path/to/mkv ! matroskademux ! "text/x-raw" ! filesink location=subtitles

where "text/x-raw" is replaced by the caps of the subtitle stream. Alternatively you can also specify the link by pad name

gst-launch-1.0 filesrc location=/path/to/mkv ! matroskademux name=demux   demux.subtitle_%u ! filesink location=subtitles

where %u should be the track number of the subtitle stream.

Upvotes: 5

Related Questions