Linux tip, Fedora tip / howto: Adding subtitles to a movie file |
Try my online puzzle page with Calcudoku, Killer Sudoku and online Sudoku.
Adding subtitles to a movie file This is if you have a separate text file (for example, an .srt file) with the subtitles, and you want to add them to the video stream. Note that your subtitle file has to contain text, not images (here's a list of common subtitle file formats).You can use mencoder for this, which is part of the mplayer package (get mplayer here).
subtitle fontMake sure there is a font for subtitles in your ~/.mplayer directory, to check:ls -l ~/.mplayer/subfont.ttf If there isn't, you can locate TrueType fonts on your system as follows: If that command doesn't work, then maybe you've never run updatedb, so run it (as root), and try again. Pick a font that sounds reasonable, for example /usr/share/fonts/bitstream-vera/Vera.ttf and copy it: You can see what the font looks like by running:
running mencoderLet's say your video is 640 pixels wide and 272 pixels high (mplayer will tell you the dimensions, run:mplayer mymovie.avi | grep VIDEO ). We'd like to add a black border below the image to put the subtitles: for that we'll use the expand video filter. Assuming your subtitles are in a file mymovie.srt, and your movie in mymovie.avi, now run: Some notes on the parameters:
converting to a file for the Humax HDR5200CFor this particularly picky HD tuner/recorder we convert to xvid video and mp3 audio:mencoder -sub mymovie.srt -ovc xvid -xvidencopts bitrate=1000 -oac mp3lame -lameopts preset=standard -o mymovie2.avi mymovie.avi (so here I'm not doing anything fancy with the subtitle position and video size) This has been tested to work :-)
|
Send me your comments!
Something didn't work as expected? You'd like to add some useful info to this tip? Use the form below to send me your comments. (Don't forget to fill out the super-lame CAPTCHA below..)