## MEncoder reference # Standard two-pass encode command, with high-quality denoise filter set to # documented standard setting (recommended for most captured video). # Pass 2 takes the nearly identical command, as shown, despite other options. # XViD notes: # gmc, hq_ac, and chroma_me are recommended, though each slows encoding # qpel slows encoding a lot, and sometimes makes things worse. Use only if # nothing else fixed ugly video # vhq=0-4, 4 may produce better video, but 2 seems to be fine mostly. # max_bframes=0-4, 3-4 seems to make most videos worse, 2 is recommended. # bitrate is, of course, the eventual size of the video. Use that calculator. # 384 is nice for little music vids. 768 is decent for movies. mencoder -oac copy -ovc xvid -xvidencopts qpel=on:gmc=on:hq_ac=on:chroma_me=on:max_bframes=2:vhq=2:bitrate=384:pass=1 -vf hqdn3d=2:1:2 -o _x.avi "$q" mencoder -oac copy -ovc xvid -xvidencopts qpel=on:gmc=on:chroma_me=on:hq_ac=on:max_bframes=2:vhq=2:bitrate=384:pass=2 -vf hqdn3d=2:1:2 -o "$q.avi" "$q" # Pass 1 (no qpel) for an MPEG-2 source, with the "filmdint" filter # (de-telecine, de-interlace, etc), and a framerate hack, in case output # framerate is bad. (Check your output.) Also scales the video to 320x240. mencoder -oac copy -ovc xvid -xvidencopts gmc=on:hq_ac=on:chroma_me=on:max_bframes=2:vhq=2:bitrate=384:pass=1 -vf filmdint,scale=320:240,hqdn3d=2:1:2 -fps 29.97 -ofps 23.976 -o "$q.avi" "$q" # Pass 1, same as above, but with a crop/scale combination more suitable for a # DVD video. (A lot of them seem to have little borders at the edges.) The FPS # hack seems to be safe on DVDs, and ALWAYS remember to de-interlace! mencoder -oac copy -ovc xvid -xvidencopts qpel=off:gmc=on:hq_ac=on:chroma_me=on:max_bframes=2:vhq=2:bitrate=768:pass=1 -vf filmdint,crop=704:464:8:6,scale=624:348,hqdn3d=2:1:2 -fps 29.97 -ofps 23.976 -o "$q.avi" "$q" # These commands output the audio track of the video to PCM WAV, then encode the # audio to Ogg-Vorbis with oggenc. (Is there a way around the temp file?) mplayer -vo null -vc null -ao pcm -hardframedrop -aofile "$q.wav" "$q" && oggenc "$q.wav" -q 3 -o "$q.ogg" && rm "$q.wav" # Finally, multiplex the video and audio together into a Matroska container. # (mkvmerge has many options, explore them for big movie-sized videos! Get # some chapters in there!) mkvmerge -o "$q.mkv" -A "$q.avi" -a 0 "$q.ogg"