How to burn in DVB subtitles

 

 http://ffmpeg.gusari.org/viewtopic.php?f=11&t=813

 

Btw, by "How can I burn in this subtitles to the out file.", do you mean:
1) Produce the output video that has the subtitles drawn/merged/encoded together with the video (burn-in)
2) Produce the output video stream + subtitle stream (2 streams), so that media player can decide whether or not to display the subtitles
Also, 3) do you intend to edit/correct spelling in the subtitles or you just want to copy/paste it?

If 1) then you would probably end up using something like this:

Code: Select all
ffmpeg -i video.mpg -vf subtitles=subs.srt output.mpg


That will burn the subtitles into the video, so you won't be able to extract those later from that output file (encoded in the video images frames)

If you want 2) then you should use something like this:

Code: Select all
ffmpeg -i video.mpg -i subs.srt -c copy -map 0 -map 1 output.mpg


That will take two inputs (0=video.mpg and 1=subs.srt) and copy them to the output (-c copy). Options "-map 0 -map 1" just tell ffmpeg to use both inputs to create the output.

The 3) is important to know because the subtitles in your source are "dvb_subtitle" which means they are bitmap images, so if you want to edit that thing, you'll probably need some tool for doing OCR or something. If you don't need to edit them, you could just copy/paste them into your new output, with a command like this:

Code: Select all
ffmpeg -i myvideo.mpg -i "http://.../Mittagsmagazin.ts" -c copy -map 0 -map 1:7 output.mpg


That will take the first input (0) from myvideo.mpg (some of your files that you want to attach subtitles to) and it will take the second input (1) from your http url, then it will tell ffmpeg that you don't want any re-encoding, just copy/pasting stuff, and then you'll tell ffmpeg that you want a complete first input (0) and just the stream number 7 from the input number 1 (if you take a look at your log, you'll see that your subtitles are located as #0:7, which means it's the stream number 7).

Now, try doing some tests on your own, to see if you can make it work and also consult ourWiki documentation, because it contains a lot of usage examples for ffmpeg.

burek
 
Posts: 732
Joined: Mon May 09, 2011 10:16 pm
Location: Serbia

Top

 

Re: How to burn in DVB subtitles

byrelaht » Sun Feb 03, 2013 11:01 pm

Thanks a lot. Now I have something to start with. Will come back with the results. 
relaht
 
Posts: 12
Joined: Fri Jan 25, 2013 2:29 pm
Top

 

Re: How to burn in DVB subtitles

byrelaht » Tue Feb 05, 2013 11:03 am

No I found out how to do it:
Code: Select all
-i in_file.ts -filter_complex '[0:v][0:s:1]overlay[v]' -map [v] -map 0:a -strict -2  out_file.mp4


This line works perfectly for me.

I used: [0:s:1] because my In_file has got two subtitle streams and I use the second one.

Thanks again!
FFmpeg is a real powerful tool!

 

你可能感兴趣的:(How to burn in DVB subtitles)