Opened 10 years ago

Closed 10 years ago

#288 closed defect (worksforme)

Theora encode bitrate bug.

Reported by: igor Owned by:
Priority: normal Component: avcodec
Version: Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

In ./libavcodec/libtheoraenc.c:

t_info.target_bitrate = avc_context->bit_rate;

It's wrong!

Right way is:
From ffmpeg2theora (http://svn.xiph.org/trunk/ffmpeg2theora/src/ffmpeg2theora.c)

/*Account for the Ogg page overhead.
              This is 1 byte per 255 for lacing values, plus 26 bytes per 4096 bytes for
               the page header, plus approximately 1/2 byte per packet (not accounted for
               here).
         */
t_info.target_bitrate = (int) (64870 * (ogg_int64_t)avc_context->bit_rate >> 16);

Attach small path

Attachments (1)

libtheora.c.patch (1015 bytes ) - added by igor 10 years ago.

Download all attachments as: .zip

Change History (5)

by igor, 10 years ago

Attachment: libtheora.c.patch added

comment:1 by Carl Eugen Hoyos, 10 years ago

Priority: importantnormal
Status: newopen

FFmpeg allows to mux theora into other containers (avi, mkv, nut): Isn't the patch wrong assuming only ogg?

comment:2 by igor, 10 years ago

This parameter is used only for bitrate in theora coder. It doesn't affect the container. In other words, we specify the quality of a coded frame we would like to get from encoder.

comment:3 by Carl Eugen Hoyos, 10 years ago

So you are saying the overhead applies even if not muxing into ogg?
Doesn't that mean the comment in the ffmpeg2theora source is wrong?

comment:4 by Michael Niedermayer, 10 years ago

Resolution: worksforme
Status: openclosed

the matrix lobby scene with 1000kbps without patch: bitrate=1001.6kbits/s
the matrix lobby scene with 1000kbps with patch: bitrate= 991.8kbits/s
Thus i cannot reproduce this bug

Note: See TracTickets for help on using tickets.