resize movie 700mb
hi!
i need help with a script resizing all kind of movies (avi or mpg) full automatically to 700MB my script i have right now only works with avi files THX for help SchwipSchwap :p -------------------------------------------------------------------------------------- my script: #!/bin/bash #********************************************************************* #* WHAT YOU NEED: * #* * #* transcode tcprobe * #* mplayer --> mencoder * #* mp3lame / divx * #* bc / perl / grep ... * #* * #********************************************************************* #--------------------------------------------------------------------- #GET FILM LENGTH #--------------------------------------------------------------------- tcprobe -i "$*" > movieinfo.tmp FRAMES=`grep '\[avilib\] V:' movieinfo.tmp | \ perl -e ' $line=<STDIN> ; $line =~ /frames=(\d+)/ ; print $1' ` MIN_TOTAL=`echo "scale=0 ; ($FRAMES / 1440)"| bc -l` #echo $MIN_TOTAL rm movieinfo.tmp -f #--------------------------------------------------------------------- # GET MAX VIDEO BITRATE #--------------------------------------------------------------------- MAXSIZE=700000 SEGUNDOS=$(($MIN_TOTAL*60)) MINUTOS=$MIN_TOTAL #Audio rate is 128bits/s which is 16kbytes/s AUDIOSIZE=$((16*$SEGUNDOS)) LIBRE=$(($MAXSIZE - $AUDIOSIZE)) RATE=$((($LIBRE*8) / $SEGUNDOS)) echo $RATE #--------------------------------------------------------------------- # ENCODE MOVIE #--------------------------------------------------------------------- #mencoder "$*" -ovc lavc \ # -lavcopts vcodec=mpeg4:vhq:vbitrate=$RATE \ # -vop scale -zoom -xy 640 -oac mp3lame \ # -lameopts abr:br=128 -o "$*".resize.avi |
well it's just a case of bitrates.... take the length in seconds and multiply it by the bitrate to get the expected file size, then manipulate the bitrate accordingly.
|
if you look at http://acidrip.sf.net you can see how I do it for dvd's.
|
thx my problem is how i can figure out the length of the movie
automatically does the header from avi and mpg contain the length? are there any tools with easy parseable print? |
All times are GMT -5. The time now is 03:37 PM. |