LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   resize movie 700mb (https://www.linuxquestions.org/questions/linux-newbie-8/resize-movie-700mb-79320/)

SchwipSchwap 08-05-2003 05:58 PM

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

acid_kewpie 08-06-2003 04:15 AM

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.

acid_kewpie 08-06-2003 04:20 AM

if you look at http://acidrip.sf.net you can see how I do it for dvd's.

SchwipSchwap 08-06-2003 09:57 AM

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.