Opened 9 years ago

Closed 9 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


In ./libavcodec/libtheoraenc.c:

t_info.target_bitrate = avc_context->bit_rate;

It's wrong!

Right way is:
From ffmpeg2theora (

/*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
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 9 years ago.

Download all attachments as: .zip

Change History (5)

Changed 9 years ago by igor

comment:1 Changed 9 years ago by cehoyos

  • Priority changed from important to normal
  • Status changed from new to open

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

comment:2 Changed 9 years ago by igor

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 Changed 9 years ago by cehoyos

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 Changed 9 years ago by michael

  • Resolution set to worksforme
  • Status changed from open to closed

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.