Skip to Content

Revision of Video encoding for dummies from Wed, 19/01/2005 - 3:04pm

The revisions let you track differences between multiple versions of a post.

Hmm ok, so if you've read anything I wrote before you, then should already know that writing isn't my thing..

(Yep and grammar isn't my thing either)

Before we start you need :

ID_VIDEO_ID=0 ID_AUDIO_ID=1 ID_FILENAME=/media/movies/DareDevil.Directors.Cut.DVDRip.XviD-DoNE.CD1.avi ID_VIDEO_FORMAT=XVID ID_VIDEO_BITRATE=1148520 ID_VIDEO_WIDTH=640 ID_VIDEO_HEIGHT=272 ID_VIDEO_FPS=23.976 ID_VIDEO_ASPECT=0.0000 ID_AUDIO_CODEC=a52 ID_AUDIO_FORMAT=8192 ID_AUDIO_BITRATE=448000 ID_AUDIO_RATE=48000 ID_AUDIO_NCH=2 ID_LENGTH=3649

Well There're 2 ways so lets see : -rw-r--r-- 1 oneofone users 26M Jan 7 18:05 Bill Gates Failure.mpg MEncoder dev-CVS-050109-00:59-3.4.3 (C) 2000-2005 MPlayer Team ---cut--- Video stream: 1401.710 kbit/s (175213 bps) size: 18830952 bytes 107.474 secs 3223 frames The value 99.99dB is a special value and represents the upper range limit xvid: Min PSNR y : 39.62 dB, u : 46.56 dB, v : 47.19 dB, in frame 2178 xvid: Average PSNR y : 43.91 dB, u : 48.28 dB, v : 49.08 dB, for 3216 frames xvid: Max PSNR y : 52.63 dB, u : 56.58 dB, v : 56.72 dB, in frame 0 747 Number of frames : 3214 Frames == b : 2097 / i : 18 / p : 1099 -oac mp3lame -lameopts preset=standard -o Bill\ Gates\ Failure.avi Bill\ Gates\ Failure.mpg MEncoder dev-CVS-050109-00:59-3.4.3 (C) 2000-2005 MPlayer Team ---cut--- Video stream: 727.332 kbit/s (90916 bps) size: 9771172 bytes 107.474 secs 3223 frames Audio stream: 130.982 kbit/s (16372 bps) size: 1767072 bytes 107.928 secs Bill Gates Failure.avi: RIFF (little-endian) data, AVI, 352 x 480, ~30 fps, video: XviD, audio: MPEG-1 Layer 3 (stereo, 48000 Hz) -rw-r--r-- 1 root root 12M Jan 19 14:17 Bill Gates Failure.avi

Now you can do the vectory dance, you've just encoded your first high quality video! under construction.

Easy, use the cropdetect filter! --cut-- --repeat-- --other crap-- then simply append the crop value from that output to your pass2 command line : mencoder -ovc xvid -xvidencopts $XVIDOPTS:pass=2:bitrate=747 \ -oac mp3lame -lameopts preset=standard -vf crop=336:224:8:8 \ -o Bill\ Gates\ Failure.avi Bill\ Gates\ Failure.mpg xvidpass1(){ time mencoder -nosound -ovc xvid -xvidencopts turbo:stats:${1}:pass=1 -o /dev/null "${2}" } idmedia(){ mplayer -identify -frames 0 -ao null -vo null -vc dummy "$@" 2>/dev/null | grep ID_ } perl scripts :

  1. !/usr/bin/perl use strict; open(XVID_LOG, '<:mmap', 'xvid-twopass.stats') or die "xvid-twopass.stats doesn't exist!!!!111oneoneone"; my ($br, $frames, $i, $b, $p); while(<XVID_LOG>){ next if /^#/; next unless split (/\s+/) && $#_ == 6; } printf ("%d\n",$br / $frames); print STDERR "Number of frames : $frames\n"; print STDERR "Frames == b : $b / i : $i / p : $p\n";



Dr. Radut | book