Because the videodata recorded by dunerec is in some strange mpeg flavour it occupied quite a bit of diskspace. 2 hours approximately 5 GB. that is why I was looking for an easy way to convert the mpeg into divx. After unsuccessfully palying with transcode, I managed with mencoder. Mencoder is included with Mplayer and there is an RPM for Suse Linux 9.1. My first try was to encode a TV recording. I did in 2 passes, meaning I execute the first command and wait until it finished and then execute the second command. The only difference between the two commands is the vpass=1 versus vpass=2. In the first pass the encoder uses apparently a constant bitrate, but writes data to a temporary file on which parts of the movie more detail has to be preserved. In the second pass the encoder uses that data to make a qualitiatively better data allocation but using the same total filesize. I only used default options and the quality was quite miserable: mencoder YLE1.mpeg -ovc lavc -lavcopts vcodec=mpeg4:vpass=1 -oac mp3lame -lameopts vbr=3 -o /tmp/encode/output.avi mencoder YLE1.mpeg -ovc lavc -lavcopts vcodec=mpeg4:vpass=2 -oac mp3lame -lameopts vbr=3 -o /tmp/encode/output.avi
Then I tried some more elaborate options. I also cropped the image because there were black stripes on all sides (it was a wide screen movie and additionally my TV card seems to add some black borders). mencoder -of avi -oac mp3lame -lameopts q=5:vbr=2:abr=128:aq=5:ratio=50:mode=1:vol=0 -ovc lavc -lavcopts vcodec=mpeg4 -vf crop=640:480:40:48 /home/jeltsch/YLE1.mpeg -o /tmp/encode/output.avi
Somehow I calculated the cropping wrongly. dunerec records in 720x576 pixel format if one choses DVD quality. The following cropping chops of 40 pixels from both left and right, 78 pixels from the top and 48 pixels from the bottom: mencoder -of avi -oac mp3lame -lameopts q=5:vbr=2:abr=128:aq=5:ratio=50:mode=1:vol=0 -ovc lavc -lavcopts vcodec=mpeg4 -vf crop=640:450:40:78 /home/jeltsch/YLE1.mpeg -o /tmp/encode/output.avi
Finally I used the following settings. Encoding lasted an eternity, but the quality was very good (file size was reduced from 5.1 to 1.3 GB): mencoder -of avi -oac mp3lame -lameopts q=5:vbr=2:abr=128:aq=5:ratio=50:mode=1:vol=0 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1200:v4mv:mbd=2:trell:cmp=3:subcmp=3:mbcmp=3:autoaspect:vpass=1 -vf crop=680:430:20:88,hqdn3d=2:1:2 /home/jeltsch/YLE1.mpeg -o /tmp/encode/output.avi
Here some explanations for the flags and options: -of avi: encode into format avi -oac mp3lame: encode with mp3 audio codec using lame -lameopts: options for lame q: quality from 0-9 vbr: variable bitrate abr: average bitrate aq: ratio: mode: vol: -ovc lavc: encode with codecs from libavcodec library -lavcopts: options for libavcodec vcodec: video codec vbitrate: variable bitrate (useful range between 500 and 3000, rarely more than 2000 needed) -vf hqdn3d=2:1:2 use denoise filter (swith very light denoising) -vf crop=680:430:20:88 crop the (originally 720x576) video to 680x430; cut from both left and right 20 pixels and from the top 88 pixels and from the bottom 58 pixels v4mv:mbd=2:trell increase quality in expense of encoding time cmp=3:subcmp=3:mbcmp=3 nonstandard comparison function vpass=1 run the first pass of a two-pass encoding (you have to repeat the same command again, only changing vpass=1 into vpass=2) For streaming encoding I used the following command: dunerec -i 0 -a 479250 -t dvd -R - | mencoder - -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1200 -oac mp3lame -lameopts vbr=3 -o /tmp/encode/streaming.avi
If cropping is necessary (which is the case almost always): dunerec -i 0 -a 479250 -t dvd -R - | mencoder - -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1200 -vf crop=680:476:20:50 -oac mp3lame -lameopts vbr=3 -o /tmp/encode/streaming.avi
I recorded a TV documentary and wanted to convert the mpeg file into different formats/qualities for download. I choose a low quality mpeg and a high and a low quality DivX. Here are the commands: High quality DivX: mencoder -of avi -oac mp3lame -lameopts q=5:vbr=2:abr=128:aq=5:ratio=50:mode=1:vol=0 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=300:v4mv:mbd=2:trell:cmp=3:subcmp=3:mbcmp=3:autoaspect:vpass=1 -vf crop=680:426:20:76,hqdn3d=2:1:2 /tmp/movies/tutkittu_juttu_cut.mpg -o /home/jeltsch/smaller.avi
Low quality DivX: mencoder -of avi -oac mp3lame -lameopts q=5:vbr=2:abr=128:aq=5:ratio=50:mode=1:vol=0 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=300:v4mv:mbd=2:trell:cmp=3:subcmp=3:mbcmp=3:autoaspect:vpass=1 -vf crop=680:426:20:76,scale=340:213,hqdn3d=2:1:2 /tmp/movies/tutkittu_juttu_cut.mpg -o /home/jeltsch/smaller.avi
Low quality mpeg: mencoder -of mpeg -oac copy -ovc lavc -lavcopts vcodec=mpeg1video:vpass=1 -vf crop=680:426:20:76,scale=340:213,hqdn3d=2:1:2 /tmp/movies/tutkittu_juttu_cut.mpg -o /home/jeltsch/smaller.mpg