How to extract subtitle from video using ffmpeg?Extracting subtitles from mp4 videoffmpeg encode...

Can you use Vicious Mockery to win an argument or gain favours?

Which Article Helped Get Rid of Technobabble in RPGs?

Delete multiple columns using awk or sed

Can I say "fingers" when referring to toes?

Is there a nicer/politer/more positive alternative for "negates"?

Make a Bowl of Alphabet Soup

Did the UK lift the requirement for registering SIM cards?

Why is the Sun approximated as a black body at ~ 5800 K?

Quoting Keynes in a lecture

Review your own paper in Mathematics

What is the English pronunciation of "pain au chocolat"?

Is this toilet slogan correct usage of the English language?

How to draw a matrix with arrows in limited space

Will number of steps recorded on FitBit/any fitness tracker add up distance in PokemonGo?

When were female captains banned from Starfleet?

What does "Scientists rise up against statistical significance" mean? (Comment in Nature)

Non-trope happy ending?

What features enable the Su-25 Frogfoot to operate with such a wide variety of fuels?

Does the reader need to like the PoV character?

Is my low blitz game drawing rate at www.chess.com an indicator that I am weak in chess?

Why is so much work done on numerical verification of the Riemann Hypothesis?

PTIJ: Why is Haman obsessed with Bose?

Why Shazam when there is already Superman?

How to preserve electronics (computers, iPads and phones) for hundreds of years



How to extract subtitle from video using ffmpeg?


Extracting subtitles from mp4 videoffmpeg encode subtitleCombining video and subtitle files as one video?Using ffmpeg, can I burn in subtitles directly from an mkv subtitle track instead of a subtitle file?FFmpeg: Exporting subtitle stream to .ass filecreate video from jpg images using ffmpegFFmpeg quality setting for subtitleffmpeg extract lossless image from videoChanging subtitle format with ffmpegHow to extract PGS subtitle from m2ts using ffmpeg?Shifting subtitle start time making a .gif from .mkv in ffmpeg













26















I am trying to extract subtitle from video as .srt file, I used the following command:




FFMPEG -i mytestmovie.mkv -vn -an -codec:s:0.1 srt sub.srt




But, I got an error as Unrecognized option codec:s:0:1
So, can you tell me the exact command and how to extract a subtitle as .srt file in video?










share|improve this question

























  • umair:shall u tell me in command prompt

    – vijay
    Apr 16 '13 at 8:11











  • I have the same problem. Did you get this to eventually work?

    – Maxime Labelle
    Dec 19 '13 at 8:23
















26















I am trying to extract subtitle from video as .srt file, I used the following command:




FFMPEG -i mytestmovie.mkv -vn -an -codec:s:0.1 srt sub.srt




But, I got an error as Unrecognized option codec:s:0:1
So, can you tell me the exact command and how to extract a subtitle as .srt file in video?










share|improve this question

























  • umair:shall u tell me in command prompt

    – vijay
    Apr 16 '13 at 8:11











  • I have the same problem. Did you get this to eventually work?

    – Maxime Labelle
    Dec 19 '13 at 8:23














26












26








26


12






I am trying to extract subtitle from video as .srt file, I used the following command:




FFMPEG -i mytestmovie.mkv -vn -an -codec:s:0.1 srt sub.srt




But, I got an error as Unrecognized option codec:s:0:1
So, can you tell me the exact command and how to extract a subtitle as .srt file in video?










share|improve this question
















I am trying to extract subtitle from video as .srt file, I used the following command:




FFMPEG -i mytestmovie.mkv -vn -an -codec:s:0.1 srt sub.srt




But, I got an error as Unrecognized option codec:s:0:1
So, can you tell me the exact command and how to extract a subtitle as .srt file in video?







ffmpeg extract subtitles






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 18 '16 at 17:48









Rubens Mariuzzo

36738




36738










asked Apr 16 '13 at 7:50









vijayvijay

136125




136125













  • umair:shall u tell me in command prompt

    – vijay
    Apr 16 '13 at 8:11











  • I have the same problem. Did you get this to eventually work?

    – Maxime Labelle
    Dec 19 '13 at 8:23



















  • umair:shall u tell me in command prompt

    – vijay
    Apr 16 '13 at 8:11











  • I have the same problem. Did you get this to eventually work?

    – Maxime Labelle
    Dec 19 '13 at 8:23

















umair:shall u tell me in command prompt

– vijay
Apr 16 '13 at 8:11





umair:shall u tell me in command prompt

– vijay
Apr 16 '13 at 8:11













I have the same problem. Did you get this to eventually work?

– Maxime Labelle
Dec 19 '13 at 8:23





I have the same problem. Did you get this to eventually work?

– Maxime Labelle
Dec 19 '13 at 8:23










2 Answers
2






active

oldest

votes


















40














Simple:



ffmpeg -i Movie.mkv -map 0:s:0 subs.srt




  • -i: Input file URL/path.


  • -map: Designate one or more input streams as a source for the output file.


  • s:0: Select the subtitle stream.






share|improve this answer





















  • 1





    This worked for me with a MP4 file with embedded subtitles.

    – Rubens Mariuzzo
    Sep 18 '16 at 17:21






  • 9





    This would download the first subtitle track. If there are several, use 0:s:1 to download the second one, 0:s:2 to download the third one, and so on.

    – Fabien Snauwaert
    Nov 10 '16 at 19:06






  • 4





    @jm3 Would you happen to know any way to automatically extract all subtitle streams from a file, naming them after their language identifier (e.g. eng, fre, dut etc.)?

    – Fr.
    Dec 1 '17 at 0:30











  • why is it so slow when extracting from big MKV container (~4 gb)?

    – user25
    Jun 2 '18 at 16:24



















8














-codec:s:0:1 is incorrect. If you use -codec:s:0 then ffmpeg will use the stated codec for the first subtitle stream being passed to the output, if you use -codec:s:1 then it will use it for the second subtitle stream, etc.



You can also use -codec:s to select all output subtitle streams, or -codec:2 to select the third output stream, regardless of what it is.



You are probably confused because the -map option behaves in a different way - there, you have to select which input the selected stream comes from. (so, -map 0:s:0 would take the first subtitle stream from the first input, and feed it to the output). However, -map is for selecting which streams you want to take from the inputs; whereas most of the other options that use stream mapping are for use on the streams after they have been selected (so there's no need to specify which input file they're from), as they are passed to the output.






share|improve this answer
























  • evilsoup:i would using the following command E:FFMpeg_Latest>ffmpeg -i E:Routineroutine.mkv -vn -an -map 0:s:0 srt E:Routinesub.srt,it seems an error i got Unable to find a suitable output format for 'srt',can u tell me the command for extracting an subtitle in video...

    – vijay
    Apr 16 '13 at 9:38






  • 2





    Try: ffmpeg -i E:Routineroutine.mkv -map 0:s:0 E:Routinesub.srt (ffmpeg should detect that you want srt subtitles from the output file name)

    – evilsoup
    Apr 16 '13 at 14:31













  • I used: ffmpeg -i film.mp4 -vn -an -codec:s srt film.srt that should copy all the subtitles to the srt file.

    – Stuart
    Apr 5 '16 at 19:05











  • @Stuart it doesn't extract all subtitles

    – user25
    Jun 2 '18 at 17:28






  • 1





    @evilsoup -codec:s is equal to -codec:s:0 so it doesn't select all subtitles... it will extract first text track

    – user25
    Jun 2 '18 at 18:15













Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f583393%2fhow-to-extract-subtitle-from-video-using-ffmpeg%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









40














Simple:



ffmpeg -i Movie.mkv -map 0:s:0 subs.srt




  • -i: Input file URL/path.


  • -map: Designate one or more input streams as a source for the output file.


  • s:0: Select the subtitle stream.






share|improve this answer





















  • 1





    This worked for me with a MP4 file with embedded subtitles.

    – Rubens Mariuzzo
    Sep 18 '16 at 17:21






  • 9





    This would download the first subtitle track. If there are several, use 0:s:1 to download the second one, 0:s:2 to download the third one, and so on.

    – Fabien Snauwaert
    Nov 10 '16 at 19:06






  • 4





    @jm3 Would you happen to know any way to automatically extract all subtitle streams from a file, naming them after their language identifier (e.g. eng, fre, dut etc.)?

    – Fr.
    Dec 1 '17 at 0:30











  • why is it so slow when extracting from big MKV container (~4 gb)?

    – user25
    Jun 2 '18 at 16:24
















40














Simple:



ffmpeg -i Movie.mkv -map 0:s:0 subs.srt




  • -i: Input file URL/path.


  • -map: Designate one or more input streams as a source for the output file.


  • s:0: Select the subtitle stream.






share|improve this answer





















  • 1





    This worked for me with a MP4 file with embedded subtitles.

    – Rubens Mariuzzo
    Sep 18 '16 at 17:21






  • 9





    This would download the first subtitle track. If there are several, use 0:s:1 to download the second one, 0:s:2 to download the third one, and so on.

    – Fabien Snauwaert
    Nov 10 '16 at 19:06






  • 4





    @jm3 Would you happen to know any way to automatically extract all subtitle streams from a file, naming them after their language identifier (e.g. eng, fre, dut etc.)?

    – Fr.
    Dec 1 '17 at 0:30











  • why is it so slow when extracting from big MKV container (~4 gb)?

    – user25
    Jun 2 '18 at 16:24














40












40








40







Simple:



ffmpeg -i Movie.mkv -map 0:s:0 subs.srt




  • -i: Input file URL/path.


  • -map: Designate one or more input streams as a source for the output file.


  • s:0: Select the subtitle stream.






share|improve this answer















Simple:



ffmpeg -i Movie.mkv -map 0:s:0 subs.srt




  • -i: Input file URL/path.


  • -map: Designate one or more input streams as a source for the output file.


  • s:0: Select the subtitle stream.







share|improve this answer














share|improve this answer



share|improve this answer








edited 9 mins ago









JakeGould

32.1k1098141




32.1k1098141










answered Jun 13 '15 at 16:18









jm3jm3

65867




65867








  • 1





    This worked for me with a MP4 file with embedded subtitles.

    – Rubens Mariuzzo
    Sep 18 '16 at 17:21






  • 9





    This would download the first subtitle track. If there are several, use 0:s:1 to download the second one, 0:s:2 to download the third one, and so on.

    – Fabien Snauwaert
    Nov 10 '16 at 19:06






  • 4





    @jm3 Would you happen to know any way to automatically extract all subtitle streams from a file, naming them after their language identifier (e.g. eng, fre, dut etc.)?

    – Fr.
    Dec 1 '17 at 0:30











  • why is it so slow when extracting from big MKV container (~4 gb)?

    – user25
    Jun 2 '18 at 16:24














  • 1





    This worked for me with a MP4 file with embedded subtitles.

    – Rubens Mariuzzo
    Sep 18 '16 at 17:21






  • 9





    This would download the first subtitle track. If there are several, use 0:s:1 to download the second one, 0:s:2 to download the third one, and so on.

    – Fabien Snauwaert
    Nov 10 '16 at 19:06






  • 4





    @jm3 Would you happen to know any way to automatically extract all subtitle streams from a file, naming them after their language identifier (e.g. eng, fre, dut etc.)?

    – Fr.
    Dec 1 '17 at 0:30











  • why is it so slow when extracting from big MKV container (~4 gb)?

    – user25
    Jun 2 '18 at 16:24








1




1





This worked for me with a MP4 file with embedded subtitles.

– Rubens Mariuzzo
Sep 18 '16 at 17:21





This worked for me with a MP4 file with embedded subtitles.

– Rubens Mariuzzo
Sep 18 '16 at 17:21




9




9





This would download the first subtitle track. If there are several, use 0:s:1 to download the second one, 0:s:2 to download the third one, and so on.

– Fabien Snauwaert
Nov 10 '16 at 19:06





This would download the first subtitle track. If there are several, use 0:s:1 to download the second one, 0:s:2 to download the third one, and so on.

– Fabien Snauwaert
Nov 10 '16 at 19:06




4




4





@jm3 Would you happen to know any way to automatically extract all subtitle streams from a file, naming them after their language identifier (e.g. eng, fre, dut etc.)?

– Fr.
Dec 1 '17 at 0:30





@jm3 Would you happen to know any way to automatically extract all subtitle streams from a file, naming them after their language identifier (e.g. eng, fre, dut etc.)?

– Fr.
Dec 1 '17 at 0:30













why is it so slow when extracting from big MKV container (~4 gb)?

– user25
Jun 2 '18 at 16:24





why is it so slow when extracting from big MKV container (~4 gb)?

– user25
Jun 2 '18 at 16:24













8














-codec:s:0:1 is incorrect. If you use -codec:s:0 then ffmpeg will use the stated codec for the first subtitle stream being passed to the output, if you use -codec:s:1 then it will use it for the second subtitle stream, etc.



You can also use -codec:s to select all output subtitle streams, or -codec:2 to select the third output stream, regardless of what it is.



You are probably confused because the -map option behaves in a different way - there, you have to select which input the selected stream comes from. (so, -map 0:s:0 would take the first subtitle stream from the first input, and feed it to the output). However, -map is for selecting which streams you want to take from the inputs; whereas most of the other options that use stream mapping are for use on the streams after they have been selected (so there's no need to specify which input file they're from), as they are passed to the output.






share|improve this answer
























  • evilsoup:i would using the following command E:FFMpeg_Latest>ffmpeg -i E:Routineroutine.mkv -vn -an -map 0:s:0 srt E:Routinesub.srt,it seems an error i got Unable to find a suitable output format for 'srt',can u tell me the command for extracting an subtitle in video...

    – vijay
    Apr 16 '13 at 9:38






  • 2





    Try: ffmpeg -i E:Routineroutine.mkv -map 0:s:0 E:Routinesub.srt (ffmpeg should detect that you want srt subtitles from the output file name)

    – evilsoup
    Apr 16 '13 at 14:31













  • I used: ffmpeg -i film.mp4 -vn -an -codec:s srt film.srt that should copy all the subtitles to the srt file.

    – Stuart
    Apr 5 '16 at 19:05











  • @Stuart it doesn't extract all subtitles

    – user25
    Jun 2 '18 at 17:28






  • 1





    @evilsoup -codec:s is equal to -codec:s:0 so it doesn't select all subtitles... it will extract first text track

    – user25
    Jun 2 '18 at 18:15


















8














-codec:s:0:1 is incorrect. If you use -codec:s:0 then ffmpeg will use the stated codec for the first subtitle stream being passed to the output, if you use -codec:s:1 then it will use it for the second subtitle stream, etc.



You can also use -codec:s to select all output subtitle streams, or -codec:2 to select the third output stream, regardless of what it is.



You are probably confused because the -map option behaves in a different way - there, you have to select which input the selected stream comes from. (so, -map 0:s:0 would take the first subtitle stream from the first input, and feed it to the output). However, -map is for selecting which streams you want to take from the inputs; whereas most of the other options that use stream mapping are for use on the streams after they have been selected (so there's no need to specify which input file they're from), as they are passed to the output.






share|improve this answer
























  • evilsoup:i would using the following command E:FFMpeg_Latest>ffmpeg -i E:Routineroutine.mkv -vn -an -map 0:s:0 srt E:Routinesub.srt,it seems an error i got Unable to find a suitable output format for 'srt',can u tell me the command for extracting an subtitle in video...

    – vijay
    Apr 16 '13 at 9:38






  • 2





    Try: ffmpeg -i E:Routineroutine.mkv -map 0:s:0 E:Routinesub.srt (ffmpeg should detect that you want srt subtitles from the output file name)

    – evilsoup
    Apr 16 '13 at 14:31













  • I used: ffmpeg -i film.mp4 -vn -an -codec:s srt film.srt that should copy all the subtitles to the srt file.

    – Stuart
    Apr 5 '16 at 19:05











  • @Stuart it doesn't extract all subtitles

    – user25
    Jun 2 '18 at 17:28






  • 1





    @evilsoup -codec:s is equal to -codec:s:0 so it doesn't select all subtitles... it will extract first text track

    – user25
    Jun 2 '18 at 18:15
















8












8








8







-codec:s:0:1 is incorrect. If you use -codec:s:0 then ffmpeg will use the stated codec for the first subtitle stream being passed to the output, if you use -codec:s:1 then it will use it for the second subtitle stream, etc.



You can also use -codec:s to select all output subtitle streams, or -codec:2 to select the third output stream, regardless of what it is.



You are probably confused because the -map option behaves in a different way - there, you have to select which input the selected stream comes from. (so, -map 0:s:0 would take the first subtitle stream from the first input, and feed it to the output). However, -map is for selecting which streams you want to take from the inputs; whereas most of the other options that use stream mapping are for use on the streams after they have been selected (so there's no need to specify which input file they're from), as they are passed to the output.






share|improve this answer













-codec:s:0:1 is incorrect. If you use -codec:s:0 then ffmpeg will use the stated codec for the first subtitle stream being passed to the output, if you use -codec:s:1 then it will use it for the second subtitle stream, etc.



You can also use -codec:s to select all output subtitle streams, or -codec:2 to select the third output stream, regardless of what it is.



You are probably confused because the -map option behaves in a different way - there, you have to select which input the selected stream comes from. (so, -map 0:s:0 would take the first subtitle stream from the first input, and feed it to the output). However, -map is for selecting which streams you want to take from the inputs; whereas most of the other options that use stream mapping are for use on the streams after they have been selected (so there's no need to specify which input file they're from), as they are passed to the output.







share|improve this answer












share|improve this answer



share|improve this answer










answered Apr 16 '13 at 9:06









evilsoupevilsoup

8,93714465




8,93714465













  • evilsoup:i would using the following command E:FFMpeg_Latest>ffmpeg -i E:Routineroutine.mkv -vn -an -map 0:s:0 srt E:Routinesub.srt,it seems an error i got Unable to find a suitable output format for 'srt',can u tell me the command for extracting an subtitle in video...

    – vijay
    Apr 16 '13 at 9:38






  • 2





    Try: ffmpeg -i E:Routineroutine.mkv -map 0:s:0 E:Routinesub.srt (ffmpeg should detect that you want srt subtitles from the output file name)

    – evilsoup
    Apr 16 '13 at 14:31













  • I used: ffmpeg -i film.mp4 -vn -an -codec:s srt film.srt that should copy all the subtitles to the srt file.

    – Stuart
    Apr 5 '16 at 19:05











  • @Stuart it doesn't extract all subtitles

    – user25
    Jun 2 '18 at 17:28






  • 1





    @evilsoup -codec:s is equal to -codec:s:0 so it doesn't select all subtitles... it will extract first text track

    – user25
    Jun 2 '18 at 18:15





















  • evilsoup:i would using the following command E:FFMpeg_Latest>ffmpeg -i E:Routineroutine.mkv -vn -an -map 0:s:0 srt E:Routinesub.srt,it seems an error i got Unable to find a suitable output format for 'srt',can u tell me the command for extracting an subtitle in video...

    – vijay
    Apr 16 '13 at 9:38






  • 2





    Try: ffmpeg -i E:Routineroutine.mkv -map 0:s:0 E:Routinesub.srt (ffmpeg should detect that you want srt subtitles from the output file name)

    – evilsoup
    Apr 16 '13 at 14:31













  • I used: ffmpeg -i film.mp4 -vn -an -codec:s srt film.srt that should copy all the subtitles to the srt file.

    – Stuart
    Apr 5 '16 at 19:05











  • @Stuart it doesn't extract all subtitles

    – user25
    Jun 2 '18 at 17:28






  • 1





    @evilsoup -codec:s is equal to -codec:s:0 so it doesn't select all subtitles... it will extract first text track

    – user25
    Jun 2 '18 at 18:15



















evilsoup:i would using the following command E:FFMpeg_Latest>ffmpeg -i E:Routineroutine.mkv -vn -an -map 0:s:0 srt E:Routinesub.srt,it seems an error i got Unable to find a suitable output format for 'srt',can u tell me the command for extracting an subtitle in video...

– vijay
Apr 16 '13 at 9:38





evilsoup:i would using the following command E:FFMpeg_Latest>ffmpeg -i E:Routineroutine.mkv -vn -an -map 0:s:0 srt E:Routinesub.srt,it seems an error i got Unable to find a suitable output format for 'srt',can u tell me the command for extracting an subtitle in video...

– vijay
Apr 16 '13 at 9:38




2




2





Try: ffmpeg -i E:Routineroutine.mkv -map 0:s:0 E:Routinesub.srt (ffmpeg should detect that you want srt subtitles from the output file name)

– evilsoup
Apr 16 '13 at 14:31







Try: ffmpeg -i E:Routineroutine.mkv -map 0:s:0 E:Routinesub.srt (ffmpeg should detect that you want srt subtitles from the output file name)

– evilsoup
Apr 16 '13 at 14:31















I used: ffmpeg -i film.mp4 -vn -an -codec:s srt film.srt that should copy all the subtitles to the srt file.

– Stuart
Apr 5 '16 at 19:05





I used: ffmpeg -i film.mp4 -vn -an -codec:s srt film.srt that should copy all the subtitles to the srt file.

– Stuart
Apr 5 '16 at 19:05













@Stuart it doesn't extract all subtitles

– user25
Jun 2 '18 at 17:28





@Stuart it doesn't extract all subtitles

– user25
Jun 2 '18 at 17:28




1




1





@evilsoup -codec:s is equal to -codec:s:0 so it doesn't select all subtitles... it will extract first text track

– user25
Jun 2 '18 at 18:15







@evilsoup -codec:s is equal to -codec:s:0 so it doesn't select all subtitles... it will extract first text track

– user25
Jun 2 '18 at 18:15




















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f583393%2fhow-to-extract-subtitle-from-video-using-ffmpeg%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...

Tribunal Administrativo e Fiscal de Mirandela Referências Menu de...

looking for continuous Screen Capture for retroactivly reproducing errors, timeback machineRolling desktop...