This article, in portuguese, Criando vídeo DVD no Linux, is about videotrans projects, a tool that I like use ( and I am thinking convert to python)

To add subtitles, a document explaining how to master a DVD with various subtitles (using dvdauthor).


* for single play (no fix): mplayer -idx myvideo.avi
* fix it: mencoder -oac copy -ovc copy infile.avi -o outfile.avi
* in case of serious damage use ffmpeg which is more fault tolerant: ffmpeg -i infile.avi -acodec copy -vcodec copy
* -o outfile.avi
* save index: mplayer -idx myvideo.avi -saveidx myvideo.idx
* use saved index: mplayer myvideo.avi -loadidx myvideo.idx

Watch tv
mplayer tv:// -tv channel=E7:driver=v4l2:input=0:outfmt=YUY2:norm=pal:height=240:width=320
grab dv or tv
mencoder tv:// -tv channel=E6:driver=v4l2:input=0:outfmt=YUY2:norm=pal:height=240:width=320 -oac lavc -ovc lavc
-lavcopts vcodec=mpeg4:mbd=1:vbitrate=1800 -o title4.avi -frames 10000
with capture stereo sound if came in other device use alsa option: mencoder tv:// -tv channel=E6:driver=v4l2:input=0:outfmt=YUY2:norm=pal:amode=1:alsa -oac copy -ovc lavc -lavcopts vcodec=mpeg4:mbd=1:vbitrate=1800 -o title3.avi -frames 10000
download streaming movies
mplayer -dumpstream -dumpfile filename url
Example:mplayer -dumpstream -dumpfile 20072003.wmv mms://

Convert from .flv to .avi
ffmpeg -i "$1".flv -f avi -sameq -vcodec mpeg4 -acodec libmp3lame "$1.avi"
(usually, .flv have mp3 audio codec you may try -acodec copy)
ffmpeg -i "$1".flv -q:v 0 "$1".mp4
Put subtitles on xdiv
mencoder film.avi -sub -o filmewithsub.avi -oac copy -ovc xvid -xvidencopts bitrate=1200:hq_ac
ffmpeg -ss 00:06:25 -i input.avi -vcodec copy -acodec copy -t 00:57:40 new_video_1.avi
fmpeg -ss 00:57:25 -i input.avi -vcodec copy -acodec copy -t 00:58:50 new_video_2.avi
mencoder videoh0* videoh10.avi -ovc copy -oac copy -o videohf.avi 
avimerge -i unnamed-044-C0*avi -o output.avi (for separeated vidos)
for v in unnamed-044-*avi; do tccat -i $v; done > stream.avi (for vob)
Fix grab dv videos in two 2phases
mencoder title3.avi -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vpass=1:vbitrate=1800 -o output2.avi
mencoder title3.avi -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vpass=2:vbitrate=1800 -o output2.avi
Fix wmv with delay sound
 mencoder $name.wmv -ovc lavc -oac mp3lame -lameopts vbr=3 -o $count-$name.avi 
Special audio-only file
mencoder input.mpg -ovc frameno -oac mp3lame -lameopts vbr=3 -o frameno.avi
ffmpeg to mix the 5.1 channels down to two, and encode them into mp3
ffmpeg -i DVDRip.ac3 -acodec libmp3lame -ar 48000 -ab 128k -ac 2 output.mp3
How to Extract Audio Tracks from Videos
ffmpeg -i VideoRip.avi -acodec copy AudioRip.mp3