Home/News | About | Download | Documentation | Forum | Bug Reports | Contact | Donations | Consulting | Projects | Legal | Security | FATE


This forum has not been maintained for a long time and will probably get deleted in the near future.
For faster responses to your questions, please use StackOverflow instead and tag your questions with "FFmpeg".
If you need a backup of the posts from this forum, please contact me directly.

How to burn subtitles into the video

A collection of useful tutorials for some common tasks.

Re: How to burn subtitles into the video

Postby burek » Thu Feb 07, 2013 11:57 am

bluebike wrote:Actually. After reading all this discussion (and doing some google research).
I have no idea of how to do simple task:

Input: mpeg transport stream (.ts) with DVB-subtitles (bitmap subtitles)
Output: mp4 (or something else) with those subtitles burned in to picture???

There is this dvbsubs module, but what then...


Your best shot with this is to just copy/paste bitmap subtitles to a new video output, like this:
(assuming your input file is "input.ts" and the file with the "picture" (video) to burn subtitles to is "myvideo.mp4")
Code: Select all
ffmpeg -i input.ts -map 0:3 -i myvideo.mp4 -c copy output.mp4

(this also assumes that your bitmap subtitles are the 3rd stream in input.ts, you can check that by typing "ffmpeg -i input.ts" and looking for the "Input:" section, to find something like "#0:3 blah blah bitmap subtitles")

The command above will read the first input (input.ts), take the 3rd stream out of it (-map 0:3) then it will take another input (myvideo.mp4) and copy all that (-c copy) into a new output file (output.mp4).
burek
 
Posts: 864
Joined: Mon May 09, 2011 10:16 pm
Location: Serbia

Re: How to burn subtitles into the video

Postby Starbuck » Thu Jan 16, 2014 10:53 am

I use FFmpeg to burn subtitles with DVDx 4.1, command is visible in process console (works for DVD/Bluray subtitles and text SubRip (.srt)).

Issues are explained (pictured-based, charset encoding).
Starbuck
 
Posts: 1
Joined: Thu Jan 16, 2014 10:49 am

Re: How to burn subtitles into the video

Postby Dapsol » Sat Sep 20, 2014 8:14 pm

Hi,

I'm new to this, i've been reading the forums and documentation and i'm wondering, is it correct that when burning in subtitles to an MKV file, the MKV file always has to be re-encoded and as a result the video quality will always decrease?

This is an example .mkv file of which i want to burn in the subtitles - i've extracted the subtitle to .srt and converted it to .ass, now i'd like to burn it in, if possible without decreasing the video quality:
Code: Select all
General-w mediainfo %s | more
Unique ID                                : 193752124716935148218797534520089260398 (0x91C34D47E215079A851C2CF3CCB0316E)
Complete name                            : s01e01 - The Long Bright Dark.mkv
Format                                   : Matroska
Format version                           : Version 4 / Version 2
File size                                : 1.62 GiB
Duration                                 : 59mn 42s
Overall bit rate                         : 3 896 Kbps
Encoded date                             : UTC 2014-01-16 17:55:12
Writing application                      : mkvmerge v6.7.0 ('Back to the Ground') 64bit built on Jan  8 2014 15:10:52
Writing library                          : libebml v1.3.0 + libmatroska v1.4.1

Video
ID                                       : 2
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4.1
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 5 frames
Codec ID                                 : V_MPEG4/ISO/AVC
Duration                                 : 59mn 42s
Bit rate                                 : 3 434 Kbps
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 23.976 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.155
Stream size                              : 1.43 GiB (88%)
Writing library                          : x264 core 140 r2377 1ca7bb9
Encoding settings                        : cabac=1 / ref=5 / deblock=1:0:0 / analyse=0x3:0x113 / me=umh / subme=8 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trelli
s=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=18 / lookahead_threads=3 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / const
rained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=50
/ rc=crf / mbtree=1 / crf=18.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Language                                 : English
Default                                  : Yes
Forced                                   : No
Matrix coefficients                      : BT.709-5, BT.1361, IEC 61966-2-4 709, SMPTE RP177

Audio
ID                                       : 3
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Mode extension                           : CM (complete main)
Format settings, Endianness              : Big
Codec ID                                 : A_AC3
Duration                                 : 59mn 42s
Bit rate mode                            : Constant
Bit rate                                 : 384 Kbps
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 KHz
Bit depth                                : 16 bits
Compression mode                         : Lossy
Stream size                              : 164 MiB (10%)
Default                                  : Yes
Forced                                   : No

Text
ID                                       : 1
Format                                   : UTF-8
Codec ID                                 : S_TEXT/UTF8
Codec ID/Info                            : UTF-8 Plain Text
Language                                 : Dutch
Default                                  : Yes
Forced                                   : No
Dapsol
 
Posts: 1
Joined: Sat Sep 20, 2014 8:00 pm

Re: How to burn subtitles into the video

Postby llogan » Sun Sep 21, 2014 2:45 am

Hardsubs require encoding. You can use a lossless encoder, but the output can be huge. You can use a lossy encoder, and give it enough bitrate that you may not notice a quality reduction. See the -crf option in the FFmpeg H.264 Video Encoding Guide.

Don't forget to stream copy (re-mux) your audio with "-acodec copy".

When asking questions about ffmpeg the console output from ffmpeg (such as "ffmpeg -i input") is more useful than mediainfo.
llogan
 
Posts: 2339
Joined: Fri Jan 25, 2013 9:47 pm
Location: Alaska

Re: How to burn subtitles into the video

Postby nille » Sun Sep 21, 2014 6:04 pm

if you do it right, you can not see a quality loss.
nille
 
Posts: 7
Joined: Thu Jul 26, 2012 7:52 am

Previous

Return to Tutorials

Who is online

Users browsing this forum: No registered users and 3 guests