PDA

View Full Version : CAVLC and/or Lossless Encoders


ItsInTheCave
27th March 2007, 04:54
I've been trying to find the best way to losslessly encode DVDs with MPEG-4/H.264 and from what I've found the best way is to use CAVLC in H.264. If there are other, better, methods however please let me know.

CAVLC apparentely is compatible with all profiles however certain sources claim it works best with the High 4:4:4 Predictive Profile. I've also read that although CAVLC is compatible with all profiles only High 4:4:4 Predictive Profile can do predictive lossless encoding. Can this profile be read by most software? Or would it be easier instead to use CAVLC in a different profile?

The most important question I have however is how exactely does one encode losslessly with H.264?

check
27th March 2007, 05:12
CAVLC is just one of two possible compression types used in h264 streams. The other is CABAC.
After the h264 stream is created, it is compressed one final time before being written out, the compression format here (CAVLC or CABAC). CAVLC is the low compression option, which has lower CPU requirements, and is allowable in all profiles. CABAC is allowed in all profiles apart from base & extended.

Finally, to encode lossslessly, this is equivalent to setting a quantizer of 0. In x264, --qp 0.

cacepi
27th March 2007, 05:34
I've also read that although CAVLC is compatible with all profiles only High 4:4:4 Predictive Profile can do predictive lossless encoding. Can this profile be read by most software?

No, as High 4:4:4 Predictive is still in the planning stages; it doesn't exist as part of the published standard yet. It's expected that Amendment II will include it.

foxyshadis
27th March 2007, 13:54
The old High 4:4:4 is readable by most decoders, though. Presumably it would be a simple matter to translate from the old to the new, but you never know how compatible they'll make it.

Anyway, the question is confusing, because CAVLC is compatible with all profiles, but lossless is not. It requires the (deprecated) High 4:4:4 or the (forthcoming) High 4:4:4 Predictive, so lossless is some kind of non-standard limbo at the moment.

--qp 1 is guaranteed compatible with all decoders if you're within their level requirements, though, and might well be close enough for you.

akupenguin
27th March 2007, 15:35
I don't see what's non-standard about the old High 4:4:4 profile. It was and will remain compliant to H.264-2005, and decoders aren't going to drop support for it just because there's a better version.

Sergey A. Sablin
28th March 2007, 09:11
I don't see what's non-standard about the old High 4:4:4 profile. It was and will remain compliant to H.264-2005, and decoders aren't going to drop support for it just because there's a better version.

It seems like "Amendment 1: Support of additional colour
spaces and removal of the High 4:4:4 Profile" was published 9 month ago and it removes High 4:4:4 profile and thus lossless coding too. So old lossless isn't more compliant to the current spec.
Amd2 will introduce new High 4:4:4 Predictive profile (draft already available on jvt site), so there is no reason for decoders to keep old deprecated profile. (cause this will confuse users when new one become available)

foxyshadis
28th March 2007, 18:16
Is it compatible with the old profile? I read the minutes of the various meetings, but none mentioned it, and I can't find the text of the Amendment available. (If that even mentions compatibility.) I'm just wondering if current lossless encodes will be readable in the future, because of some small change in the decoding. I suppose a proper decoder will check the profile flag first, though.

Sergey A. Sablin
29th March 2007, 08:36
Is it compatible with the old profile? I read the minutes of the various meetings, but none mentioned it, and I can't find the text of the Amendment available. (If that even mentions compatibility.) I'm just wondering if current lossless encodes will be readable in the future, because of some small change in the decoding. I suppose a proper decoder will check the profile flag first, though.

http://forum.doom9.org/showthread.php?p=964156&highlight=amendment#post964156

akupenguin
29th March 2007, 09:04
Amd2 will introduce new High 4:4:4 Predictive profile (draft already available on jvt site), so there is no reason for decoders to keep old deprecated profile. (cause this will confuse users when new one become available)

The reason to keep the old profile is because there are files out there which use it. You're saying that if ffmpeg were to suddenly stop decoding files that worked before, that would be less confusing to users than retaining support?
Anyway, the design criteria for the old lossless profile was to be really easy to implement. There's probably less than 50 lines of code involved.

Sergey A. Sablin
30th March 2007, 08:43
The reason to keep the old profile is because there are files out there which use it. You're saying that if ffmpeg were to suddenly stop decoding files that worked before, that would be less confusing to users than retaining support?
probably yes - anyone could just translate old lossless to some other format (which will be supported in the future or just as temp format) he wants, but currently (1 year from official notes about removal of high444!) users still produce already non-compliant stream with x264 and most of them believe that it is fully compliant and will be supported in the future.

akupenguin
30th March 2007, 18:44
probably yes - anyone could just translate old lossless to some other format (which will be supported in the future or just as temp format) he wants,
Not if he doesn't have a decoder that supports it anymore. Or if the only decoder that supports it is in an old version of the transcoding program that doesn't have the new encoder to produce the new format. Yes, given that libavcodec and x264 are separated you could compile a custom version of $app that has new x264 and old libavcodec, but that's a lot of trouble, especially as neither one has a frozen api.

but currently (1 year from official notes about removal of high444!) users still produce already non-compliant stream with x264 and most of them believe that it is fully compliant and will be supported in the future.

What do you expect people to do, stop using lossless h264 when it was announced that a new version would be decided upon some time in the future, and just wait until the new version is finalized before encoding anything? Or until then, use some other codec like huffyuv, ffv1, msu, etc that don't even have a standard? A deprecated standard has to a be better guarantee of future compatibility than no standard at all.
I might be convinced to remove the old lossless from x264 as soon as the new version is standardized, implemented in x264 and libavcodec, and is at least as fast and at least as good compression ratio. Not before then. And I'll never remove it from a decoder.

bond
31st March 2007, 14:17
what is the reason for the removal of the old profile and creation of the new one?

akupenguin
31st March 2007, 23:06
Because the old profile was designed to be really easy to implement, but not particularly good at compression.

bond
1st April 2007, 14:04
:thanks: