Adding subtitles to AVI movies and converting them to Dreambox .TS format

Here are the commands I use to add subtitles to a movie, and then convert that resulting file into .TS format so you can FTP it to /hdd/movie  and watch it on your dreambox.

Usage:  avi-to-ts-subst name_of_movie

(type the name of the movie without extension)

UPDATE: Here is an improved version. The only requirement, is that you save the .srt subtitle file with the SAME filename, in the same directory. You call this script, (which I called avi-to-ts2-subst) like this:
$ avi-to-ts2-subst my-movie
(that is, do NOT specify an extension)

Subtitling is a two-step process.. First with mencoder, then with ffmpeg.
It creates a temporary .out file between these two programs.

mencoder -sub $1.srt -subfont-autoscale 1 \
-subpos 90 -vf expand=720:576 -fps 24000/1001 -ovc lavc \
-lavcopts vcodec=mpeg2video:vbitrate=2500:threads=2 \
-channels 2 -oac copy -o $1.out $1.avi
ffmpeg -y -threads 2 -i "$1.out" -ab 128k -b 2500k \
-r 25 -maxrate 8000k -bufsize 1000k -s 720x576\
-vcodec mpeg2video -ac 2 -s 4cif -acodec mp2 -map 0:0 -map 0:1 "$1.ts"

AVI to Dreambox file conversion

I finally mastered the art of converting any file to Dreambox, so you can FTP a movie to dreambox and watch it on TV.

I’m using Linux, and using FFMPEG for the conversion.

Here is the general command you need to convert high definition movies to dreambox:


ffmpeg -y -threads 2 -i "$1.avi" -ab 192k -b 2500k  \
-r 25  -maxrate 9000k  -bufsize 1000k -s 720x576\
-vcodec mpeg2video  -s 4cif -acodec  mp2  -map 0:0  -map 0:1  "$1.ts"

This creates quasi-perfect movies.

UPDATE: The above gives errors for some movies. If that happens, try this:

ffmpeg -y -threads 2 -i "$1.avi" -ab 192k -b 2500k \
-r 25 -maxrate 9000k -bufsize 1000k -s 720x576\
-vcodec mpeg2video -s 4cif -acodec mp2 -map 0:0 -map 0:1 "$1.ts"

I hope it helps someone!

-turgut