[Libav-user] Write raw RGB frames to file

Max Göttner - d.stream max.goettner at dstream.de
Fri Nov 25 15:37:36 CET 2011

>Assuming you are only interested in mkv: Did you look into matroskaenc.c?
>I suspect you have to set an appropriate codec_tag for the pix_fmt.
>http://www.matroska.org/technical/specs/index.html "ColourSpace"
>Looking at http://fourcc.org/rgb.php at least RGBA should work fine.

Thanks for your help so far.
Opening a mkv format and setting codec_id to rawvideo seems to work. I did
not see, that I must not set any codec-parameters except colorplane,
resolution, fps when using rawvideo. I tried different colorformats like
BGR24, YUV420p and RGBA like you suggested. 

Resulting files seem ok, when analyzing them with mkvinfo (from mkvtoolnix),
filesize is also like you'd expect. However no player is able to replay
them. Libav succeeds in opening and recognizing the format but fails in
decoding and delivers the following message:

[matroska,webm @ 003EA5E0] parser not found for codec rawvideo, packets or
times may be invalid.
Input #0, matroska,webm, from 'raw.mkv':
    ENCODER         : Lavf53.14.0
  Duration: 00:00:01.65, start: 0.000000, bitrate: 670267 kb/s
    Stream #0:0: Video: rawvideo (BGR[24] / 0x18524742), bgr24, 1280x720,
SAR 1:1 DAR 16:9, 30 fps, 30 tbr, 1k tbn, 30 tbc (default)

Since vlc uses libav for decoding when displaying it's no surprise that it
doesn’t play the files either. Does this simlpy mean that the mkv-demuxer is
not able to read the packets deliver rawvideo-frames to the decoder because
it's not implemented? Or is it a bug? Or am I missing something again? Is
this a known issue?


More information about the Libav-user mailing list