[MEncoder-users] How to convert from uncompressed yuv420 video to rgb 24?

gerlos gerlosgm at gmail.com
Mon Feb 23 04:36:41 CET 2009

The Wanderer ha scritto:
> gerlos wrote:
>> Hello everyone!
>> I captured  many uncompressed videos (tens of GBs) from my webcam for
>> astronomical processing.
>> The format is YUV420, but my processing software doesn't understand
>> this format, and need rgb24, so I need a way (possibly an automatic
>> way) to convert all these files.
>> Reading the documentation it seems to me that it's possible with
>> mencoder, but so far I couldn't find how... any clue?
> I've never had occasion to do this myself, but from searching the man
> page for 'colorspace', I think that '-vf scale' (and possibly '-vf
> format') might be what you want.

I'm not sure, but maybe I'm almost there...

I tried this command:
mencoder Dark_20090222_0139_011.avi -ovc raw -o out.avi -vf format=rgb24

Here's the output I get from mencoder:
MEncoder 1.0-69.1.rc2.13plf.mib2008.1-4.2.3 (C) 2000-2007 MPlayer Team
CPU: Intel(R) Pentium(R) 4 CPU 2.60GHz (Family: 15, Model: 2, Stepping: 9)
CPUflags: Type: 15 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.
success: format: 0  data: 0x0 - 0xb03ae90
AVI file format detected.
[aviheader] Video stream found, -vid 0
AVI: No audio stream found -> no sound.
VIDEO:  [I420]  640x480  12bpp  5.000 fps  18432.0 kbps (2250.0 kbyte/s)
[V] filefmt:3  fourcc:0x30323449  size:640x480  fps: 5.00  ftime:=0.2000
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
Opening video filter: [format fmt=rgb24]
Opening video decoder: [raw] RAW Uncompressed Video
VDec: vo config request - 640 x 480 (preferred colorspace: Planar I420)
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
VDec: using Planar I420 as output csp (no 0)
Movie-Aspect is undefined - no prescaling applied.
[swscaler @ 0x8868670]No accelerated colorspace conversion found
[swscaler @ 0x8868670]SwScaler: using unscaled yuv420p -> rgb24 special
Selected video codec: [rawi420] vfm: raw (RAW I420)
New_Face failed. Maybe the font path is wrong.
Please supply the text font file (~/.mplayer/subfont.ttf).
subtitle font: load_sub_face failed.
Writing header...
ODML: vprp aspect is 4:3.
Writing header...
ODML: vprp aspect is 4:3.
File not found: 'scale=640,480'fps Trem:   0min 353mb  A-V:0.000 [36863:0]
Failed to open scale=640,480.
Cannot open file/device.


Reading the output, it seems to me that some comversion to rgb24 is
done... I can play the resulting video, out.avi using mplayer, but not
using my processing software neither with vlc.
Here's (part of) the output from vlc, for example:

[00000408] main decoder error: no suitable decoder module for fourcc `▒BGR'.
VLC probably does not support this sound or video format.

And here's what ffmpeg has to say about my output file:

$ ffmpeg -i out.avi
FFmpeg version SVN-r14161, Copyright (c) 2000-2008 Fabrice Bellard, et al.
  configuration: --prefix=/usr --enable-shared --libdir=/usr/lib
--shlibdir=/usr/lib --incdir=/usr/include --enable-liba52
--enable-postproc --enable-gpl --enable-pthreads --enable-libnut
--enable-libtheora --enable-libvorbis --enable-x11grab --enable-swscale
--enable-libmp3lame --enable-libfaad --enable-libfaac --enable-libx264
  libavutil version: 49.7.0
  libavcodec version: 51.60.0
  libavformat version: 52.17.0
  libavdevice version: 52.0.0
  built on Jan 16 2009 00:30:15, gcc: 4.3.2
Input #0, avi, from 'out.avi':
  Duration: 00:00:00.00, start: 0.000000, bitrate: -2147483 kb/s
    Stream #0.0: Video: 0x52474218, 640x480 [PAR 1:1 DAR 4:3],  5.00 tb(r)
Must supply at least one output file

So, it seems something is happening, but not everything I want... What
to do next?


More information about the MEncoder-users mailing list