LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxQuestions.org Member Success Stories
User Name
Password
LinuxQuestions.org Member Success Stories Just spent four hours configuring your favorite program? Just figured out a Linux problem that has been stumping you for months?
Post your Linux Success Stories here.

Notices


Reply
  Search this Thread
Old 09-17-2014, 11:45 AM   #1
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Transcoding MKV files with embedded subtitles to MP4's with 'burned in' subtitles


If you have an MKV (Matroska Video) file, and it has embedded subtitles, you are in a bit of a quandry if you want to convert it to some other format. Handbrake will DETECT the subtitles, but won't burn them into the output file...apparently, the 'passthru' option for the subtitles won't work between those formats.

So, it becomes a multi-step process...still painless, and the quality remains good.

First, you need to determine the file info. You need to install the mkvtoolnix program set for whatever distro you're using. After that, run
Code:
mkvinfo <filename>
You'll see output that includes track numbers. One will be audio, one will be video, and you'll see subtitles, if there are any. The languages won't be noted, though.

Second step: extract the subtitle(s) from the file. You do this by running:
Code:
mkvextract tracks <filename.mkv> X:<filename.srt>
Replace the X with whatever track # you're after. This only takes a minute or so, and you'll be left with the 'text' subtitle file.

Third step: burn the subtitle into the video file, creating one that has both. While you COULD play the file with a media player before, you'd have to manually select the subtitle...if the player allowed it. This will leave you with a file that has it on by default. Run:
Code:
ffmpeg -i <filename.mkv> -acodec copy -vf subtitles=<filename.srt> <new-output-filename.mkv>
This leaves you with one new MKV file, with the same audio/video quality as the first, except with the subtitles burned in.

Fourth step, and this is optional: convert it to another format. Since the subtitles are burned in, Handbrake, ffmpeg, or any other tool can easily convert it.

If there's a one-step process to do this, I'd love to know what it is. I tried several tools, and none seemed to work. MP4 is fairly tight compression, and a 3GB file went down to under 1GB after conversion, plus they play on my tablet/phone as well.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Set Totem subtitle to "None" or remove subtitles from mp4? jsteel Linux - General 6 08-16-2014 09:40 AM
MediaTomb Transcoding with subtitles TiNik Linux - Software 4 02-28-2011 04:32 PM
mkv subtitles problem Dillius Linux - Software 1 09-19-2006 02:52 PM
How to display MKV subtitles using a certain key? ryan123 Linux - Software 0 07-01-2004 02:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxQuestions.org Member Success Stories

All times are GMT -5. The time now is 09:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration