Every Flavour Beans

“The time has come…to talk of many [technologies].” –Lewis Carroll(’The Walrus and the Carpenter’)
Development Tools. Web Frameworks. GNU/Linux. Nokia N800. Video Encoding.

January 20, 2008

Step 3(c): Hardcoding Subtitles With MP4 Files Using XviD4PSP

Filed under: Video — tabrez @ 12:27 pm

My search for a tool that could hardcode subtitles into MP4 video files (so that they can be played on handheld devices) resulted in the discovery of an excellent tool called XviD4PSP. XviD4PSP supports true hardcoding of subtitles, as opposed to merging of subtitles into MP4 files as done by Yamb/MP4Box, and it not only supports hardcoding subtitles in only MP4 videos but also in AVI/DivX/XviD videos. It can also convert/re-encode videos to a lot of video formats and comes with an impressive set of presets to suit various handheld device format specifications. Examples include iPod/iPhone, Sony PSP/PS3, Blackberry, XBox 360 and Motorola K1.

In this post I am going to talk only about hardcoding subtitles in MP4 videos(procedure is exactly the same to hardcode subtitles into AVI/DivX/XviD files; I have tested it and it works like a charm, but I have found AVIRecomp to do the same job in lesser time.).

Hardcoding Subtitles With MP4 Files Using XviD4PSP

Download XviD4PSP and install the application on your computer.
NOTE: You need to register with the website and login before you can download the XviD4PSP. Search for the file on the Internet to download from one of the mirrors if you don’t want to go through the hassles of registration.
When the installation is finished, run XviD4PSP from the start menu or desktop shortcut. The main window should look like this:

Hardcode subtitles into MP4/AVI videos using XviD4PSP - Main Window

Open the MP4 file into which you want to hardcode the subtitles from File -> Open File….

Hardcode subtitles using XviD4PSP - Open MP4/AVI File
The format of the video file should be detected and default settings should be properly selected in the Format: panel. You can change some of the format settings if you want to.

XviD4PSP showed me the following message window on Windows Vista(did not get it on Windows XP) and continued reading the information from the input file after I clicked the Yes button.

Use FFmpgegSource on Windows Vista if XviD4PSP can't use DirectShowSource

Add the subtitle file for this MP4 video by going to Subtitles -> Add menu.
Add subtitle file in XviD4PSP to hardcode them into MP4/AVI video files
Select the directory where the output file should be stored by clicking on the Save button on the toolbar.
Specify save location for hardcoded video file
You can now repeat Step 2 to Step 5 if you want to add more subtitle hardcoding jobs to the queue. When you have added all the MP4(or even AVI) videos to the queue, you can click the Encode button on the toolbar to begin the encoding/subtitle hardcoding process.
XviD4PSP encoding/hardcoding subtitle in MP4 file
I tried my best to keep the encoding settings as close to the actual format of the input file as possible. But the re-encoding + hardcoding process still took almost as long as the play time of the video file(i.e. 37 minutes for a 37 minute video). I am still trying to optimize the process. You get the following window with brief information once the encoding is complete.
XviD4PSP completes encoding/subtitle hardcoding
You can click the Info button to view detailed information. Below is an example MP4 video file that I have hardcoded the subtitles into.
An example MP4 video file with subtitles hardcoded into it using XviD4PSP

XviD4PSP is an excellent tool for encoding, re-encoding and subtitle hardcoding jobs. I will try to cover its other features in a future post but do explore it on your own and read more about it on doom9 forums.


If you want to receive future posts by email, enter your email address here:

Related Posts:

January 11, 2008

Step 3(b): Merging Subtitles With MP4 Files Using Yamb/MP4Box

Filed under: Video — tabrez @ 11:48 pm

I am making this post in response to one of the comments left on my previous post explaining how to hard-code (or merge) the subtitles into an AVI(DivX/XviD) video file. I was asked what tools can be used to merge subtitles with MP4 video files and below is the complete procedure to do the merging using MP4Box and Yamb.

To merge subtitles into an MP4 video file, you need to download two very useful tools: MP4Box and its GUI interface called Yamb.

Download MP4Box
Download MP4Box for merging subtitles into MP4 files
Download Yamb
Download Yamb - a GUI tool for MP4Box
Both the tools can be extracted to any location of your preference. I have extracted the contents of Yamb-2.0.0.8.zip to H:\PortableApps\Yamb and have extracted and copied MP4Box.exe too to the same folder. This is how it looks on my computer:
Yamb and MP4Box downloaded and extracted
Next thing you need to do is to tell Yamb where MP4Box is located. To do that, run Yamb from its folder, click on the Settings icon, double-click on the entry that starts with “Advanced settings for Yamb…”.
Yamb settings

Enter the path where you have extracted the MP4Box executable in the Location: text box. In my example, it looks like this:
Specify the path of MP4Box executable in Yamb settings
Click Next.

Now you are ready to try merging subtitles into an MP4 file. Select the Creation icon this time and double-click on the first entry that starts with “Click to create and MP4…”.
Select the MP4 and the subtitle file in Yamb and MP4Box to do the merging operation
Click the Add button first time to add the MP4 file and then click the Add button a second time to select the subtitle file. The window should like something like this:
Select the MP4 and the subtitle file in Yamb and MP4Box to do the merging operation
Remember to change the output file name(like I did) in the Output text box located at the bottom of the window if you don’t want to overwrite your input file with the merged output file. Click Next.
The following screenshot shows Yamb processing your request. It took less than 2 minutes on my computer to finish the job of merging subtitles into a 40 minute MP4 video file.
Yamb and MP4Box merging subtitles into MP4 video file

Click Finish when done to quit Yamb or click Back if you want to do more merging operations. The produced MP4 output file with merged subtitles:
Playing a sample MP4 video with subtitles merged using MP4Box and Yamb

End Notes

You can use the MP4Box directly from the command line if you wish: the command syntax is really very simple, and you can actually do a lot more stuff using this tool. So do explore more about it over the Internet.


If you want to receive future posts by email, enter your email address here:

Related Posts:

October 8, 2007

How to Join or Split Video Subtitle Files Using Subtitle Workshop

Filed under: Video — tabrez @ 1:22 pm

Suppose you rip one of your DVD movies to an encoded/compressed format like DivX/XviD file and store it on your hard drive. Now you want to watch it along with the subtitles in your favourite language. You can search for the subtitles on the web but sometimes it is hard to find a subtitle for a less popular movie. If it so happens that you find yourself half-lucky and succeed in finding the subtitles but for a 2 or 3 part version of the video whereas you have ripped the DVD to only one part, you can either rip the DVD again, this time into 2 or 3 parts to exactly match the number of subtitle files available or you can follow the simpler procedure described below and use Subtitle Workshop to join the downloaded files into one subtitle file. How to split the subtitle files in case you have the video in multiple parts but the subtitle file in only one part is described next.

Joining Subtitle Files Using Subtitle Workshop

Download and install Subtitle Workshop. Run it from the start menu.

Joining and Splitting Subtitle files using Subtitle Workshop

Subtitle Workshop main window:

Joining and Splitting Subtitle files using Subtitle Workshop

Go to Tools -> Join Subtitles or press Ctrl-J on the keyboard.

Joining and Splitting Subtitle files using Subtitle Workshop

In “Join Subtitles…” window, use the “Add” button to add as many subtitle files as you want to merge together. I could only find two subtitle file version of Paris, je t’aime but the movie that I have is only one part. So I am going to merge these two SRT files together. After adding the files to Subtitle Workshop, the window looks like this:

Joining and Splitting Subtitle files using Subtitle Workshop

You can select what format the joined subtitle file should be created in “Output Format:” field((select “SubRip” if you are not sure). You can also check the “Load file after joining and saving” checkbox if you want the joined file to be opened in Subtitle Workshop for further editing(Subtitle Workshop is a powerful tool to do all kind of subtitle editing, only we are going to talk about splitting and joining operations).

Now comes the only hard part of the process: you need to know or need to find out the frame rate of the movie for which the subtitle was extracted. As only the person who created the subtitle file would know what framerate he was targeting for, chances are that the place you have downloaded the subtitle file from can tell you the framerate of the subtitle file(subscene mostly does). Sometimes it is noted in the file name itself. If you are unable to find out the correct framerate to be used with the subtitle file, your only hope is to guess it from popular framerate values and try them out one after the other. You can try the order as present in the dropdown box which is right to the “Clear” button in the second image in Step 2. I have never seen a subtitle being made for any other framerate. After selecting the framerate of both the movie and the subtitle files, you are ready to go. Select your favourite Subtitle file format and click the “Join” button and select a location for the output file and enter a name for it in the pop-up “Save As…” dialog box. The joined file will be created at the selected location which you can use to play with the movie using a media player like VLC. (If you find that the subtitle text keeps getting unsynchronised as the movie plays, then read Step 3 again and try another frame rate. You can also select a custom frame rate directly from “Advanced Settings” in File -> Open File… dialog box of VLC Media Player).

Splitting Subtitle Files Using Subtitle Workshop

If you have a video file in two parts but the subtitle for it is available in only one part then we need to either join the video files into one or split the subtitle file in two parts. Merging two video files is a very time consuming process, what would be far more easier is to split the subtitle file using Subtitle Workshop.

Start by loading the subtitle file in Subtitle Workshop using File -> Load Subtitle menu item.

Joining and Splitting Subtitle files using Subtitle Workshop

Next go to Tools -> Split Subtitle (this menu item will be disabled until a subtitle file is loaded)

Joining and Splitting Subtitle files using Subtitle Workshop

The Split Subtitle window looks like this:

Joining and Splitting Subtitle files using Subtitle Workshop

In this window you can select one of many ways to determine exactly at which point to split the subtitle file. In most cases the simplest way to find this out is to select “End of Video” radio button and browse to the first part of the video file using the “Browse” button. You can also specify the duration of the video file in “Given Time” field if you know it(you can find it out from file properties or by playing the video in a media player). If you want to split the file exactly in half by number of lines in the subtitle file or the duration of the entire video, then click the “Advanced” button to see the options(these are rarely of any use).

After selecting one of the options above(End of Video/Given Time/Given Frame/Advanced), click the “Split” button to split the file into two parts. The values in “Naming,” “Output Directory” and “Output Format” fields can be left with the default values.

The above methods of joining and splitting subtitle files should work without a hitch unless there is a discrepancy between the framerate of your video file and the framerate for which the subtitle was created. Because the split and join operations take no time at all you can always experiment with different framerates(it’s easy to find out the framerate of the video file from its file properties, you need to worry about the subtitle file only). You can also first synchronise the framerates of video file(s) and the subtitle file(s) and then attempt the joining or the splitting operations. Or you can also try different framerates right when you are playing the video in a media player like VLC(I mostly do just this). I will perhaps make another post on how to do such synchronisations using the sameSubtitle Workshop application in the future.


If you want to receive future posts by email, enter your email address here:

Related Posts:

June 11, 2007

Step 4(b): Converting DVD(VOB) Format to iPod Format in One Step Using HandBrake

Filed under: Video — tabrez @ 11:55 am

HandBrake is the easiest to use DVD to iPod converter application that does the job in one simple step. It’s an actively developed, well supported GPL’ed application and is available for Windows, Mac OS X and GNU/Linux platforms, in GUI and command line forms. The GUI version has good user interface, is stable and supports conversions to MPEG as well as XviD format. Refer its website to see the long list of features it supports. It is one of my most favourite media conversion applications.

Download and install HandBrake from its website. The procedure below is for the PC version; a very easy to follow procedure for the Mac version is available here. After the installation is complete, run HandBrake from the Start menu, the main window looks like this.
Main Window of HandBrake DVD to iPod Converter
In the “Source” panel, select the folder where the ripped DVD files are stored by clicking the “Browse” button. HandBrake parses the selected DVD folder and fills the “DVD Title” drop-down box with all the available titles. Select the title you want to convert to iPod format.
Select Source DVD in HandBrake DVD to iPod Converter
If it’s a movie DVD, the longest title should be the main movie.
Select the Title in HandBrake DVD to iPod Converter
Select a folder where the converted video files should be stored by clicking the “Browse” button in the “Destination” panel. The two drop-down boxes allow the video and audio encoder to be specified. To convert to the iPod format, select the following settings:
Video: H.264(iPod)
Audio: ACC
Width x Height: 320 x 240 (you can select any resolution supported by your iPod here)
Select Destination in HandBrake DVD to iPod Converter
As noted earlier, HandBrake can be used to convert DVD format to non-iPod formats too.
Select Encoder in HandBrake DVD to iPod Converter

The basic configuration is finished now. The many tabs available in the lower part of the window can be used for more fine tuning of the settings.
In the “Picture Settings” tab, select any subtitle if you want and also set any crop settings if required(”Auto Crop” should work fine in most cases).
Picture Settings in HandBrake DVD to iPod Converter
Now go to the “Video Settings” tab and enter a value preferably greater than 400 as the video bitrate. I usually select a bitrate around 700kbps but for iPod a lesser bitrate will also do fine. Higher bitrates result in larger output files, but with relatively higher output quality. 2-pass encoding takes longer time to get the conversion done but results in better output quality without any increase in the size.
Video Settings in HandBrake DVD to iPod Converter
Similarly modify the settings in the other tabs too, but the defaults should be fine if you don’t have specific requirements.

When ready, either click the button “Encode Video” to immediately start the encoding process or click the button “Add to Queue” if you want to create more conversion jobs by repeating the above steps and add all of them to a job queue and process them together.
Start Encoding in HandBrake DVD to iPod Converter
If you are happy with the quality of the output video file you get using the above entered settings, you can save this profile under a name to use it with later projects by going to File->Save Profile or by pressing Ctrl-S. To later open a saved profile, use File->Open Profile or press Ctrl-O.
Create Profiles in HandBrake DVD to iPod Converter
You can also select one of the available preset configuration profiles iPod, Apple TV, PS3 etc from the “Presets” menu.
Presets in HandBrake DVD to iPod Converter

HandBrake also has a command-line version for windows. It also supports conversion to XviD and other formats. All in all, it is one of the most diverse conversion tools available today.


If you want to receive future posts by email, enter your email address here:

Related Posts:

May 29, 2007

Step 4(a): Converting AVI Format to iPod Format Using Videora iPod Converter

Filed under: Video — tabrez @ 7:41 pm

This post describes how to convert an AVI(DivX/XviD) compressed file to iPod compatible format. If the source video files are in DVD format, read this first. I will write about converting DVD format directly to the iPod format using a single application(eg: StaxRip) in future posts.

Converting AVI to iPod Format Using Videora iPod Converter

Download and Install Videora iPod Converter by googling for it.
Run the application from the Start menu. The main window looks like this.
Videora iPod Converter Main Window
Click the ‘Settings’ button(top menu) and select the preferred output format. After you are satisfied with the settings, click the ‘Save Settings’ button at the bottom. This step has to be done only one time. The settings can be further customised for each conversion job separately.
Settings Window in Videora iPod Converter
All the formats listed in the ‘Profile’ drop-down box are compatible with iPod player (and Sony PSP), so they affect only the output size and quality. A 2-pass encoding takes more time to get processed.
Output Formats supported by Videora iPod Converter
To change the paths where the output files should be stored, go to the ‘Devices’ tab in the Settings window.
Output File Paths in Videora iPod Converter
Click the ‘Convert’ button in the menu to go to the file conversion window.
Menu in Videora iPod Converter
Then click the ‘Select File’ button(located at the bottom of the window) to select the file to be converted. After selecting the source file, wait for a while for the settings to be shown in the middle panel of the window.
Open Source File in Videora iPod Converter
Once the settings appear, change the ones you want to for this particular conversion job and then press the ‘Next’ button to go to the next step.
Quick Settings in Videora iPod Converter
Optionally set a title for the job and finally click ‘Start Converting’ button to start the conversion process.
Start Conversion in Videora iPod Converter
The progress of the conversion process will be shown in the displayed window.
Conversion Progress in Videora iPod Converter

The existing MP4 files that are not compatible with iPod player can also be converted using Videora iPod Converter. If you want subtitles to be hardcoded in the video file before you transfer it to iPod using iTunes, then read how to merge subtitles with AVI files and do the Videora conversion after doing the subtitle merging process.

All the above tasks can be accomplished using just a single application too(these applications might use multiple applications behind-the-scenes to get the job done), like StaxRip, Handbrake etc. But the advantage of the above procedure is that it allows the DVDs to be compressed and stored in AVI format as the primary goal and then to convert these AVIs to the specific format of whatever device(iPod, PSP, Zen Vision, N800 etc) the files need to be played on as per requirements.


If you want to receive future posts by email, enter your email address here:

Related Posts:

Next Page »

Copyright (c) 2006, 2007 Tabrez Iqbal.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. Verbatim copying and distribution of this entire article is permitted in any medium without royalty provided this notice is preserved. A copy of the license is included in the section entitled "GNU Free Documentation License".


Powered by WordPress
This website is hosted by Dreamhost


You are viewing a mobilized version of this site...
View original page here

Mobilized by Mowser Mowser
Mobilytics