Opened 13 years ago

Last modified 11 years ago

#244 open defect

rm muxer fails with frames larger than 64k byte

Reported by: ami_stuff Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: real
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description

pbm file: https://ffmpeg.org/trac/ffmpeg/ticket/193

When I convert "bikerace.pbm" file to rv10

ffmpeg -i C:\bikerace.pbm -vcodec rv10 out.rm

everything works ok, but when I try to decode it I get error:

C:\>ffmpeg -i out.rm out.avi
ffmpeg version git-N-30155-g01a73d6, Copyright (c) 2000-2011 the FFmpeg develope
rs
  built on May 23 2011 03:43:18 with gcc 4.5.3
  configuration: --enable-gpl --enable-version3 --enable-memalign-hack --enable-
runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libo
pencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --
enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger
 --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enabl
e-libx264 --enable-libxavs --enable-libxvid --enable-zlib --pkg-config=pkg-confi
g
  libavutil    51.  2. 1 / 51.  2. 1
  libavcodec   53.  6. 0 / 53.  6. 0
  libavformat  53.  2. 0 / 53.  2. 0
  libavdevice  53.  0. 0 / 53.  0. 0
  libavfilter   2. 10. 0 /  2. 10. 0
  libswscale    0. 14. 0 /  0. 14. 0
  libpostproc  51.  2. 0 / 51.  2. 0
Input #0, rm, from 'out.rm':
  Metadata:
    title           :
    author          :
    copyright       :
    comment         :
  Duration: 00:00:00.04, start: 0.000000, bitrate: 33538 kb/s
    Stream #0.0: Video: rv10, yuv420p, 550x423, 200 kb/s, 25 tbr, 1k tbn, 25 tbc

[buffer @ 01DE1620] w:550 h:423 pixfmt:yuv420p tb:1/1000000 sar:0/1 sws_param:
Output #0, avi, to 'out.avi':
  Metadata:
    INAM            :
    author          :
    ICOP            :
    ICMT            :
    ISFT            : Lavf53.2.0
    Stream #0.0: Video: mpeg4, yuv420p, 550x423, q=2-31, 200 kb/s, 25 tbn, 25 tb
c
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop, [?] for help
[rv10 @ 02360780] illegal ac vlc code at 15x7
[rv10 @ 02360780] ERROR at MB 15 7
frame=    0 fps=  0 q=0.0 Lsize=       6kB time=10000000000.00 bitrate=   0.0kbi
ts/s
video:0kB audio:0kB global headers:0kB muxing overhead 1.#INF00%

I think this is a bug in RV10 / RV20 encoder that it doesn't check which picture sizes are valid for this
codec, so probably a check like for H263 codec should be added to these codecs as well (I don't know
which picture sizes are valid for RV10 and RV10, but for example 320x240 resolution seems to work correctly, but for example is not allowed for h263).

libavcodec/mpegvideo_env.c:

    case CODEC_ID_H263:
        if (!CONFIG_H263_ENCODER)  return -1;
        if (ff_match_2uint16(h263_format, FF_ARRAY_ELEMS(h263_format), s->width, s->height) == 8) {
            av_log(avctx, AV_LOG_ERROR, "The specified picture size of %dx%d is not valid for the H.263 codec.\nValid sizes are 128x96, 176x144, 352x288, 704x576, and 1408x1152. Try H.263+.\n", s->width, s->height);
            return -1;
        }
        s->out_format = FMT_H263;
        s->obmc= (avctx->flags & CODEC_FLAG_OBMC) ? 1:0;
        avctx->delay=0;
        s->low_delay=1;
        break;

[...]

    case CODEC_ID_RV10:
        s->out_format = FMT_H263;
        avctx->delay=0;
        s->low_delay=1;
        break;
    case CODEC_ID_RV20:
        s->out_format = FMT_H263;
        avctx->delay=0;
        s->low_delay=1;
        s->modified_quant=1;
        s->h263_aic=1;
        s->h263_plus=1;
        s->loop_filter=1;
        s->unrestricted_mv= 0;
        break;

Change History (3)

comment:1 by Michael Niedermayer, 13 years ago

Analyzed by developer: set
Component: undeterminedavformat
Keywords: rm muxer added
Reproduced by developer: set
Status: newopen
Summary: add a check for input picture size in rv10/rv20 encodersrm muxer fails with frames larger than 64k byte

The problem is in the RM muxer which does not fully support frames that need more than 64k byte

comment:2 by Carl Eugen Hoyos, 11 years ago

Keywords: real added; rm muxer removed

comment:3 by Carl Eugen Hoyos, 11 years ago

Version: unspecifiedgit-master

The original issue (rv10 needs dimensions that are multiples of 16, rv20 needs multiples of 4) was fixed by you in 388241ef and fef75ef.

The issue with too large frames is apparently reproducible with the following command line:
$ ffmpeg -i matrixbench_mpeg2.mpg -vf scale=512:512,noise=100:100 -qscale 2 test.rm

Note: See TracTickets for help on using tickets.