LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-05-2003, 05:58 PM   #1
SchwipSchwap
Member
 
Registered: Aug 2002
Distribution: Suse8.0, Mandrake, Knoppix
Posts: 92

Rep: Reputation: 15
Lightbulb 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

--------------------------------------------------------------------------------------
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
 
Old 08-06-2003, 04:15 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975
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.
 
Old 08-06-2003, 04:20 AM   #3
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975
if you look at http://acidrip.sf.net you can see how I do it for dvd's.
 
Old 08-06-2003, 09:57 AM   #4
SchwipSchwap
Member
 
Registered: Aug 2002
Distribution: Suse8.0, Mandrake, Knoppix
Posts: 92

Original Poster
Rep: Reputation: 15
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?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help burning Mandriva 10.1 to a CD of 700mb IanPappas Mandriva 1 08-03-2005 06:04 AM
Suse 9.1 Personal 716MB on 700MB CD-R? That's impossible ... LLinuXX Linux - Software 2 02-04-2005 09:29 AM
Will the SuSE 9.1 personal ISO fit on a 700mb CD? niima SUSE / openSUSE 3 12-06-2004 10:11 PM
How do I copy Mandrake 10 CD's if cds only go up to 700mb/80mins?? r3dhatter Mandriva 5 11-22-2004 02:31 AM
movie doesn't resize in mplayer guhase Linux - Software 4 11-15-2003 09:34 PM


All times are GMT -5. The time now is 04:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration