Mencoder AVI to FLV Conversion

Here is what I am using so far:


#!/bin/sh

mencoder -forceidx \
-lavfopts i_certify_that_my_video_stream_does_not_use_b_frames \
-of lavf -ffourcc FLV1 \
-oac mp3lame -lameopts abr:br=56 -srate 22050 \
-ovc lavc \
-lavcopts vcodec=flv:vbitrate=250:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 \
-vf scale=360:240 \
-o $1.flv $1

UPDATE (07-05-2008):

With newest mencoder versions in Hardy Heron (MEncoder 2:1.0~rc2-0ubuntu13+medibuntu1) it seems this script is broken. New version below.

[geshifilter-code] mencoder -forceidx -of lavf -oac mp3lame -lameopts abr:br=56 -srate 22050 -ovc lavc -lavcopts vcodec=flv:vbitrate=250:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -vf scale=360:240 -o $1.flv $1 [/geshifilter-code]

This seems to work, still testing.

Comments

Ubunto is one of the secure

Ubunto is one of the secure source. I have used this OS for years. Sometimes video files not play in my ubunto OS but audio files were working fine.
onlineslotscasinos ca real money slots

Nice to be here to leave a

Nice to be here to leave a comment.

Thanks for this code. I hope

Thanks for this code. I hope it will work on mine. I'll copy it. Thanks

computer consultants orange county

I'm on Ubuntu trying to convert a lot of AVI files to FLV files and it is successful about most of the time. also, i use this command and also worked properly.

Thank You

hi

very nice - thank you for this great command line

mike

Thank you

I converted mp4 to flv, but audio was not played..

all FLV 28 seconds???

I am using this command and it does not matter how big or how many frames my avi has...the resulting flv is always 28 seconds

Good starting point

It does work for me, but I expanded it a little to have a bit more sophisticated script.
This allows for a -s (small) flag to avoid the upscaling of 160*120 movies (sometimes I set my camera to that mode -- what a shame), allows specifying multiple movies, and renames files ending with .AVI to .flv (it lacks some error checking, though).


#!/bin/sh

sflag=
while getopts s: name
do
case $name in
s) sflag=1;;
?) printf "Usage: %s: [-s] [avifile 2] ...\n" $0
exit 2;;
esac
done
if [ ! -z "$sflag" ]; then
printf "Small file option specified\n"
SCALE="scale=-2:120"
shift 1
else
SCALE="scale=-2:240"
fi

for i in $@
do
INFILE=$i
OUTFILE=`echo $INFILE| sed 's/\.[aA][vV][iI]$/.flv/'`
echo doing conversion: "$INFILE -> $OUTFILE"
mencoder -forceidx -of lavf -oac mp3lame \
-lameopts abr:br=56 -srate 22050 -ovc lavc \
-lavcopts vcodec=flv:vbitrate=250:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 \
-vf $SCALE -o $OUTFILE $INFILE 2>&1 | tee -a /tmp/`basename $0`.log | grep '[0-9]%)'
done

hello there

i was thinking about the following..if mencoder can do avi 2 flv...do you think it's possible to make it with php too? the idea is the following...i have a linux server set up at home. i'm have some divx movies on it and I want to make a video page for it..something that looks like youtube with a list of the available movies on it..when you click one of them the video player opens and the movie starts...since these online players can't play avis, this would be the only solution...correct me if i'm wrong ;)

regards
Tamas

A big THANK YOU!

Been trying to do this on Mint 7 for couple of days now. Not anything Mint deficient, just my ignorance of course. I cut and paste this into a command prompt and BLAM!!! A new flv for my blog. Thanks a whole bunch!

thanks

it was just copy and paste to a file and it worked perfectly

hi friend

ubuntu 8.10 ok, thanks, great work

Made my night

Thank you!

Spent the last 3 hours trying to go from a non-encrypted DVD to an FLV.
Tried at least 6 wrapper tools, including k9copy, etc (head spinning at this point, can't remember).

With ffmpeg directly, there was no audio (48000 audio in the original) or if I downsampled, it would clip.

This actually worked! (I used acidrip to rip to Xvid avi)

The only downside is that with the updated command as is, the audio is slightly out of sync over time (my video is only 8min long). Not sure if that's an encoder bug or a function of configuration, but it's good enough for this time of night.

mencoder avi 2 flv

Keep us posted.
Interested in what you work out.
Ed

Post new comment

  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.

Check out Gangster Politics Montreal.