You are not logged in.

#1 2009-06-02 00:04:41

Raccoon1400
Member
From: Ontario, Canada
Registered: 2008-04-14
Posts: 853

compress video for youtube

I have some 500MB .mov files that need to me <30 MB so I can put them on youtube. How can I do this with mencode? I've looked around, but haven't been able to figure it out.


Fustrated Windows users have two options.
1. Resort to the throwing of computers out of windows.
2. Resort to the throwing of windows out of computers.

Offline

#2 2009-06-02 00:10:29

rebugger
Member
From: Germany
Registered: 2007-10-28
Posts: 229

Re: compress video for youtube

mencoder input.avi -o output.avi -oac lavc -ovc xvid -xvidencopts bitrate=1500
should be a good start.
But there are more options for scaling, etc - have a look at
http://davidmalin.blogspot.com/2007/08/ … -with.html
or have a look at avidemux for a gui.

Last edited by rebugger (2009-06-02 00:14:31)

Offline

#3 2009-06-02 01:08:14

Raccoon1400
Member
From: Ontario, Canada
Registered: 2008-04-14
Posts: 853

Re: compress video for youtube

sound doesn't seem to work on output file.


Fustrated Windows users have two options.
1. Resort to the throwing of computers out of windows.
2. Resort to the throwing of windows out of computers.

Offline

#4 2009-06-03 16:56:39

rebugger
Member
From: Germany
Registered: 2007-10-28
Posts: 229

Re: compress video for youtube

you could change "-oac lavc" to "-oac copy"
or check what's available on your system by running
mencoder -oac help

Offline

#5 2009-06-06 16:18:36

ahaslam
Member
Registered: 2007-05-11
Posts: 119

Re: compress video for youtube

This'll do the trick, just a stripped down version of one of my other scripts:

#!/bin/sh

#script to calculate bitrate, scale & encode to mp4
#uses ffmpeg presets within ~/.ffmpeg (-vpre fast/-vpre vhq)
#examples: http://svn.mplayerhq.hu/ffmpeg/trunk/ffpresets
#depends: faac, ffmpeg & x264 (>20081002 recommended)
#use: ./2mp4 sourceVideo requiredWidth requiredSize(MB)

VID="$1"
WID="$2"
MB="$3"
DEST="${1%.*}.mp4"

#info    
ffmpeg -i ${VID} 2> /tmp/$$
TH=`grep Duration /tmp/$$ | cut -d":" -f2 | cut -c 2-3`
TM=`grep Duration /tmp/$$ | cut -d":" -f3`
TS=`grep Duration /tmp/$$ | cut -d":" -f4 | cut -c 1-5`
SEC=$(echo "( ${TH} * 3600 ) + ( ${TM} * 60 ) + ${TS}" | bc)
RESX=`grep Video: /tmp/$$ | grep -o ....x | tr -d 'x '`
RESY=`grep Video: /tmp/$$ | grep -o x.... | tr -d 'x,'`
rm /tmp/$$ && echo ${RESX} ${RESY} ${SEC}

#height
ASPECT=$(echo "scale=3; ${RESX} / ${RESY}" | bc)
HEIGHT=$(echo "${WID} / ${ASPECT}" | bc)
MOD16=$(( ${HEIGHT} / 16 * 16 ))
echo ${MOD16}

#bitrate
RATE=$(echo "(( "$MB" * 1024 ) / ${SEC}) - 16" | bc)
R8=$(echo "(( ${RATE} * 8 ) * 1.02)" | bc)
KBPS=`echo "tmp=${R8}; tmp /= 1; tmp" | bc`
echo ${KBPS}

#encode
ffmpeg -i ${VID} -pass 1 -s ${WID}x${MOD16} -vcodec libx264 -vpre fast \
-b ${KBPS}k -threads 0 -rc_eq 'blurCplx^(1-qComp)' -level 41 -an "$DEST"
ffmpeg -i ${VID} -acodec libfaac -ac 2 -ab 128k -async 2 -pass 2 \
-s ${WID}x${MOD16} -vcodec libx264 -vpre vhq -b ${KBPS}k -threads 0 \
-rc_eq 'blurCplx^(1-qComp)' -level 41 -psnr -y "$DEST"
echo "Finished! Saved as ${DEST}"

You'll need some decent ffmpeg presets in ~/.ffmpeg/, I recommend you start with these. Usage is explained at the top of the script & the repo versions of said dep's are fine.

Hope it helps. wink

PS. Sorry, I missed the mencoder part... I only use it for its filters, ffmpeg seems more efficient with straight encodes.

Last edited by ahaslam (2009-06-06 18:30:26)

Offline

Board footer

Powered by FluxBB