[theora-dev] Fast quality reduction transcoding

Timothy B. Terribrery tterribe at xiph.org
Wed Aug 29 19:39:34 PDT 2007


Tim Starling wrote:
> * Is this a reasonable way to reduce the quality and bitrate of a
> stream? Will it be comparable in quality to a complete decode to YUV and
> re-encode at similar bitrate?

Yes, it is called open-loop transcoding, and has been researched for
over a decade (the original papers were in the 94-96 range) with MPEG
streams. Most of this applies directly to Theora as well. Expect about a
1 dB penalty in PSNR when compared to encoding the original source at
the target bitrate directly. How well it compares to a complete decode
and re-encode depends on how good the first encode was and how much
you're attempting to reduce the bitrate by. The main problem is that you
suffer from drift, because the previous frame you're predicting from is
not the same as the one the original encoder thought it was using for
prediction, so you end up smearing out the high frequency components of
the signal as you get farther from a keyframe, even if you have a high
enough bitrate to represent some of them. This drift will be eliminated
at the next keyframe, which can cause popping artifacts, where
everything suddenly becomes sharp again, and are subjectively very
noticeable. Also keep in mind that mode decisions and how many bits it
is worth spending on motion vectors will be very different at the target
bitrate than in the original encode, and so all of that side-information
will be sub-optimal as well.

> * Will it indeed be much faster than a complete re-encode?

Yes. However, not so much faster as you might think. A good re-encoder
will still take advantage of side information from the decoder to do a
faster motion search or faster mode decision without much loss in
quality, but not having to reconstruct the decoded frames at all will
still be 2-3 times faster than such an approach.

> * How hard a task would it be to develop?

For someone with video codec experience, it would probably not be too
challenging. theora-exp already has a good start, if you look at
http://svn.xiph.org/trunk/theora-exp/lib/ for recode.[ch]
These files implement a decoder that stops after all of the quantized
coefficients are decoded, and then re-encodes the packets using a new
set of codebooks, as part of Theora's experimental rehuff tool (in
examples/rehuff.c). It would not be a great stretch to modify them to
requantize the coefficients as well.

Transcoding is a well-researched and mature field. I would suggest
consulting
A. Vetro, C. Christopoulos, and H. Sun, "Video Transcoding Architectures
and Techniques: An Overview," 2003,
or
J. Xin, C.-W. Lin, and M.-T. Sun, "Digital Video Transcoding," 2005,
for a good overview.


More information about the theora-dev mailing list