Sunday, April 13, 2014

Mac OSX / Windows : How to create Streaming MP4 from MP4 movie, and SRT subtitles files?

I'm a total newbie at video technologies. So when i had this problem (See title), i looked for solutions and combined opinions from different people. This is thus far the best combo i can make out, all utilising only free tools.

What tools do you need?
Aegisub - http://www.aegisub.org/
Mkvtoolnix - http://www.bunkus.org/videotools/mkvtoolnix/downloads.html
Handbrake - http://handbrake.fr/downloads.php

What files do i have?
Videos: AVI, MP4 or MKV
Subtitles: SRT or ASS

What should i do?
Subtitles
When we create streaming mp4, the subtitles should be hard-subbed. Meaning the subtitles are embedded into the video image, not as a separate external container. If this is not done, it cannot be guaranteed that the subtitles will show at the player. I tried this on Macs and IPads, true enough, the subtitles didn't appear.

That being said, we will need to get the subtitles into the ASS format if you don't already have.
Just open Aegisub and load your srt file. Then save as ass. Simple as that.

Video
In general, your source video can be in the form of the any above (avi, mp4, mkv).
What we are going to do next is to create a new mkv with the video and the ass subtitle as its content. This is where mkvtoolnix comes in.

At the input tab (Input files), simply add the video file and subtitle file (Must be ass format else the last step later won't work). Click the 'Start muxing' and a mkv file would be created. This mkv file contains the video and the subtitle information.

Converting to mp4
This is the last step. We will convert the mkv file into a http streamable mp4.
Open handbrake and then add the mkv file we just created as the source.
Select output setting to be mp4, check on 'Web Optimized'. This option will add Fast Start to the mp4 and thus the http stream can start almost immediately.
Select subtitles tab, make sure the track for the ass subtitle is selected.
Make sure the 'Burned in' option is chosen...most impt step here.
Start the encoding and when its done, you are all set.

No comments: