Logo image
TOOTIPS

|Short tips, great ideas

How To Hardsub Videos Using Mencoder [How To]

0 comments


Mencoder is a command line tool designed to encode videos. It is based on the same code as Mplayer so it supports all the formats that Mplayer reads.

In this short tutorial, i will show you how to use Mencoder to burn subtitles into a video using a simple script:


mencoder INPUT.avi -fontconfig -font 'Ubuntu Mono:style=Bold' -subpos 96 -subfont-outline 2 -subfont-text-scale 3 -sub SUBTITLEFILE.srt -o OUTPUT.avi -oac copy -ovc lavc -lavcopts vbitrate=1200

Now, we will explain the code in details:

The -font option lets you specify the font type. As you can see in the example above, we have chosen Ubuntu Mono as a font type. If you want to use another font, you can get a list by using this command: fc-list | sort | less.

-subpos 96 is used to set the subtitle position.

-subfont-outline 2 is self-explanatory.

-subfont-text-scale 3 lets you define the font size.

-sub tells Mencoder the location of the subtitle file.

The -oac option stands for "output audio codec". It lets you choose the audio codec. To list the output audio codecs, run: mencoder -oac help. Similarly, you can use -ovc and mencoder -ovc help to specify the video codec and to list the output video codecs respectively.

Finally, the vbitrate=1200 is used to specify the video bitrate.

Here is the result of our script:



Mencoder is a very powerful encoding tool that offers a lot of possibilities. To explore these possibilities, you can visit this page (ArchWiki):

Mencoder is available in the Official Ubuntu Repositories. To install it, run:

sudo apt-get install mencoder

0 comments:

Post a Comment