Vitavonni

Sun, 19 Nov 2006

Video transcoding

My camera has a video function. Nothing special, but it works okay. Actually the image quality maybe is even better than a typical PAL or NTSC camera. There are other drawbacks - tiny microphone, and I can't zoom while recording or handle light changes. So it can't replace a real camera, but it's okay for some limited use cases.

Last weekend there was a Balboa workshop in Munich, with excellent teachers. At the end of the days we recorded the teachers repeating the moves they tought us during the day. A perfect situation to use my camera: good lighting, no lighting changes, no zoom changing needed.

These videos are quite big, due to the limited compression capabilities of the camera. (the video codec they used is MJPG, i.e. the camera just saves 30 jpg images per second). So I decided to recompress them.

I tried transcode first, but it messed up the audio (which played back at double speed). Mencoder worked like a charm. Size savings of a factor of 8-12 are easily possible (well, depending on your camera, YMMV) without much tuning or serious loss in image quality.

Here's the commandline I used:

mkdir out
for nam in *.avi; do
  mencoder "$nam" -ovc lavc -oac lavc -vf hqdn3d \
  -lavcopts acodec=mp3:abitrate=48:vb_strategy=1:vbitrate=600 \
  -o "out/$nam"
done

Notice that I also enabled a noise filter. Due to the nature of MJPEG, there is a certain amount of noise in dark areas, which I don't really care about. Filtering noise both improves compression and image quality IMHO. Depending on your video, of course. Here the dancers are well-lit, just the background isn't; I don't want to see noise in the background amplified by a compression trying to adopt to it. :-)

[category: /en/linux | Permalink]
Menu
[planet.debian]
[planet.xmlhack]
[planet SELinux]
[munichblogs]
[email]
[RSS 2 feed]
[English RSS 2]
Categories
< November 2006 >
SuMoTuWeThFrSa
    1 2 3 4
5 6 7 8 91011
12131415161718
19202122232425
2627282930  
Archives
2010-Mar
2010-Feb
2010-Jan
2009-Dec
2009-Nov
2009-Oct
2009-Sep
2009-Aug
2009-Jul
2009-Jun
2009-May
2009-Apr
2009-Mar
2009-Feb
2009-Jan
2008-Dec
2008-Nov
2008-Oct
2008-Sep
2008-Aug
2008-Jul
2008-May
2008-Apr
2008-Mar
2008-Feb
2008-Jan
2007-Dec
2007-Nov
2007-Oct
2007-Sep
2007-Aug
2007-Jul
2007-Jun
2007-May
2007-Apr
2007-Mar
2007-Feb
2007-Jan
2006-Dec
2006-Nov
2006-Oct
2006-Sep
2006-Aug
2006-Jul
2006-Jun
2006-May
2006-Apr
2006-Mar
2006-Feb
2006-Jan
2005-Dec
2005-Nov
2005-Oct
2005-Sep
2005-Aug
2005-Jul
2005-Jun
2005-May
2005-Apr
2005-Mar
2005-Feb
2005-Jan
2004-Dec
2004-Nov
2004-Oct
2004-Sep
2004-Aug
2004-Jul
Other links:
Swing and the City - Lindy Hop in Munich