[Ffmpeg-devel] rawvideo rgba32 AVI file always says yuv420p

collada at ono.com collada
Fri Aug 11 09:21:49 CEST 2006


Hello,

I'm trying to generate AVI rawvideo rgba32 movies to be able to store alpha
values. I have managed to generate the video, but the output when i try to
reproduce it is wrong (green screen with a displaced small area of the original
frames).

I have been cheking the code, and i realized that there is not value for
codec_tag  that matches the pixel format PIX_FMT_RGBA32. raw_init_decode
rutine checks bits_per_pixel if codec_tag is equal to 0.

 if (avctx->codec_tag)
        avctx->pix_fmt = findPixelFormat(avctx->codec_tag);
    else if (avctx->bits_per_sample){
        switch(avctx->bits_per_sample){
        case  8: avctx->pix_fmt= PIX_FMT_PAL8  ; break;
        case 15: avctx->pix_fmt= PIX_FMT_RGB555; break;
        case 16: avctx->pix_fmt= PIX_FMT_RGB565; break;
        case 24: avctx->pix_fmt= PIX_FMT_BGR24 ; break;
        case 32: avctx->pix_fmt= PIX_FMT_RGBA32; break;
        }

But avi_write_header in avienc.c always seems to write a value  

/* FourCC should really be set by the codec itself */
        if (! stream->codec_tag) {
            stream->codec_tag = codec_get_bmp_tag(stream->codec_id);
        }

As there is not entry for pixel format RGBA32, a default YUV420P value is
stored. As a result, if I execute ffmpeg -i mymovie_rgba32.avi, the output
says that the video format is YUV420P.

To test if my application was wrong, y tryied just to convert using ffmpeg
from a valid raw rgba32 movie (mplayer displays it) to a new raw rgba32.
This is the output and the line comand:

ffmpeg -i esfera.avi -vcodec rawvideo -pix_fmt rgba32 mymovie_rgba32.avi

FFmpeg version SVN-r5970, Copyright (c) 2000-2004 Fabrice Bellard
  configuration:
  libavutil version: 49.0.0
  libavcodec version: 51.11.0
  libavformat version: 50.5.0
  built on Aug 10 2006 18:24:31, gcc: 4.0.3 (Ubuntu 4.0.3-1ubuntu5)
Input #0, avi, from 'esfera.avi':
  Duration: 00:00:07.0, start: 0.000000, bitrate: 125843 kb/s
  Stream #0.0: Video: rawvideo, rgba32, 256x256, 60.00 fps(r)
Output #0, avi, to 'mymovie_rgba32.avi':
  Stream #0.0: Video: rawvideo, rgba32, 256x256, q=2-31, 200 kb/s, 60.00
fps(c)
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
frame=  420 q=0.0 Lsize=  107534kB time=7.0 bitrate=125845.9kbits/s
video:107520kB audio:0kB global headers:0kB muxing overhead 0.013355%

ffmpeg -i mymovie_rgba32.avi

FFmpeg version SVN-r5970, Copyright (c) 2000-2004 Fabrice Bellard
  configuration:
  libavutil version: 49.0.0
  libavcodec version: 51.11.0
  libavformat version: 50.5.0
  built on Aug 10 2006 18:24:31, gcc: 4.0.3 (Ubuntu 4.0.3-1ubuntu5)
Input #0, avi, from 'mymovie_rgba32.avi':
  Duration: 00:00:07.0, start: 0.000000, bitrate: 125845 kb/s
  Stream #0.0: Video: rawvideo, yuv420p, 256x256, 60.00 fps(r)
Must supply at least one output file

I'm still wondering if this is really a bug or just my mistake using libavcodec/libavformat
and ffmpeg.

Best regards,
Javi






More information about the ffmpeg-devel mailing list