Showing posts with label mencoder. Show all posts
Showing posts with label mencoder. Show all posts

10 January 2009

Squeezing videos

Sometimes you just need to squish some videos to fit into single sided DVD of 4,482MB. So if you've got a 1hr video file which is 500MB or so, and would like to reduce the size to about 300MB, use this:
mencoder -ovc lavc -lavcopts vcodec=mpeg4:vpass=1:vbitrate=650 -oac copy orig.avi -o squished.avi
Here's a quick rundown of what the flags mean:
-ovc lavc: Use the libavcodec to encode
-lavcopts: sets up the options
vcodec=mpeg4: i.e. Divx
vpass=1: this is not really necessary, but would be useful if you want to re-encode this in the second pass. This generates a file called divx2pass.log, which will be used for vpass=2.
vbitrate=650: here is where I've skipped a stepped, and forced a bitrate for video. Adjust this if you need to squeeze another meg or so.
-oac copy: just copy the audio portion as is.
orig.avi: the original video
-o squished.avi: the squished, output video
This would give something like this:

MEncoder 2:1.0~rc2-0ubuntu17 (C) 2000-2007 MPlayer Team
CPU: AMD Athlon(tm) 64 Processor 3000+ (Family: 15, Model: 47, Stepping: 0)
CPUflags: Type: 15 MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 1
AVI file format detected.
VIDEO: [XVID] 608x336 24bpp 23.976 fps 1267.5 kbps (154.7 kbyte/s)
[V] filefmt:3 fourcc:0x44495658 size:608x336 fps:23.98 ftime:=0.0417
Opening video filter: [expand osd=1]
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
==========================================================================
audiocodec: framecopy (format=55 chans=2 rate=48000 bits=16 B/s=16000 sample-0)
VDec: vo config request - 608 x 336 (preferred colorspace: Planar YV12)
Movie-Aspect is 1.81:1 - prescaling to correct movie aspect.
videocodec: libavcodec (608x336 fourcc=34504d46 [FMP4])

Pos: 120.3s 2884f ( 4%) 76.31fps Trem: 13min 253mb A-V:0.041 [651:123]


The original file was 576MB, while the re-encoded file is projected to be 253MB and all done 13 minutes!

There are more tricks with MEncoder, and this resource is really useful: "Encoding with MEncoder"

yk.

15 May 2008

Converting video: Realmedia to DivX

I have a video which is encoded in rmvb. Realmedia (who they now?). I want to convert it to a divx file so that I can burn it on a DVD and watch it on my DivX-DVD player at home. This is what I tried to view it with ffmpeg:
# ffmpeg -i videofile.rmvb -vcodec mpeg4 out.mpg

FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2007 Fabrice Bellard, et al.
configuration: --enable-gpl --enable-pp --enable-swscaler --enable-pthreads --enable-libvorbis --enable-libtheora --enable-libogg --enable-libgsm --enable-dc1394 --disable-debug --enable-shared --prefix=/usr
libavutil version: 1d.49.3.0
libavcodec version: 1d.51.38.0
libavformat version: 1d.51.10.0
built on Mar 12 2008 14:31:53, gcc: 4.2.3 (Ubuntu 4.2.3-2ubuntu4)
[NULL @ 0xb7e086e8]Unsupported video codec
[NULL @ 0xb7e086e8]Unsupported video codec
Unsupported codec (id=72) for input stream #0.1
So that didn't work. FFmpeg doesnt seem to understand Realmedia. A bit of googling brought me to this command:
# mencoder videofile.rmvb -o outfile.avi -ovc xvid -xvidencopts fixed_quant=5 -oac mp3lame -lameopts abr:br=128

Opening video decoder: [realvid] RealVideo decoder
Error: /usr/lib/win32/drvc.so: cannot open shared object file: No such file or directory
Win32 LoadLibrary failed to load: drvc.so, /usr/lib/win32/drvc.so, /usr/local/lib/win32/drvc.so
Error loading dll
So that doesn't work either; looks like Im missing some DLLs. Abit more googling, and I am recommended to visit this page "MPlayer Codecs", which is a compilation of all the codec dll's for quite a few video formats. So I downloaded essential-20071007.tar.bz2 and windows-all-20071007.zip which was extracted into the /usr/bin/win32 directory as root.

After which, the mencoder command worked without a flaw in converting between Realmedia to DivX.

What joy, this multitude of proprietary file formats.

yk.