[FFmpeg-devel] [PATCH] libavcodec: add bit-rate support to RoQ video encoder

Tomas Härdin git at haerdin.se
Thu Jan 25 00:27:38 EET 2024


tor 2024-01-25 klockan 01:09 +0300 skrev Victor Luchitz:
> In our case, the machine we're targeting (the Sega 32X) has only
> 256KB
> of RAM. Even more modern consoles such as XBOX or even PS3 didn't
> have enough RAM to hold an entire CD-ROM..
> 
> We also have to be concerned about how fast we can move data to the
> main CPU. Say you make the first frame BIG to make it look its best,
> then
> compensate with much smaller delta frames... is the first frame too
> much
> data to move to the CPU quick enough? Well, maybe not an issue for
> the
> first frame, but definitely an issue for keyframes in the middle of
> the
> stream.

Ah, that makes a lot more sense. Yeah I can see that being an issue.
And decoding time probably depends on packet size as well, so even if
you could move data around in advance, this still doesn't help that
keyframe decode any faster. I've seen similar behavior with JPEG2000
where decode time scales linearly with bitrate (plus a fixed overhead).

One thing that strikes me is if you're only aiming for linear playback
then you can set the GOP size large enough that the encoder is never
forced to insert a keyframe.

I think my main issue then comes down to the qscale search being way
too slow, especially the fact that it can effectively hang. I would
suggest a binary search using the heuristic I derived for the first
split, or something similar. Searching between 1 and 100000000 seems
excessive in most cases. It should be possible to box that interval in
quickly, again using the heuristic.

/Tomas


More information about the ffmpeg-devel mailing list