View Full Version : Any way to losslessly add CABAC to video?
gamebox
12th March 2015, 20:54
I have a video encoded with x264, but the CABAC option was switched off - presumably to shorten encoding time or lower computing demands for playback systems. Can I "reprocess" the stream to losslessly add CABAC to it and reduce it's size - without fully re-encoding the frames (I don't want to process the image blocks again and add distortion of repeated compression to them)? :thanks:
mandarinka
12th March 2015, 21:49
It is possible in theory. Problem is that nobody ever made a tool to do that, although based on lot's of people's accounts it would be fairly trivial to do. I have heard lots of people say "I could do that easily". Some were prolly bragging, some maybe not, but in the end nobody bothered to write such a tool.
gamebox
13th March 2015, 06:47
:(
Well, I also guess it is not extremely complicated to make such tool - a day or two for an experienced programmer - but, sadly, I can't write it myself as I don't have enough knowledge to do so, and have to rely on and hope for some good will of some good people. It is a shame not to use computing power of tons of dedicated hardware to save some bits, bytes, gigabytes on video data, just because someone decided to make his video compatible with some ancient hardware that will probably never be used to play it anyway...
benwaggoner
16th March 2015, 19:35
And yes, it isn't that hard in theory, yet we seem to have this conversation every year or so, without anyone having done it :).
The main use I see for this would be to losslessly shrink files made by camera/tablet video recorders that still seem to use CAVLC pretty often. I don't know that anyone makes CAVLC on purpose unless they're doing Baseline for compatibility with some ancient device or something. Last I recall, the most recent version of Android that didn't REQUIRE Main Profile decode was still in relatively wide use.
vivan
16th March 2015, 20:08
Last I recall, the most recent version of Android that didn't REQUIRE Main Profile decode was still in relatively wide use.This document (http://static.googleusercontent.com/media/source.android.com/ru//compatibility/android-cdd.pdf) says that main might not be supported even in the latest (5.0) version.Android device implementations with H.264 decoders, MUST support Baseline Profile Level 3 and the following SD video decoding profiles and SHOULD support the HD decoding profiles.Terrifying.
benwaggoner
17th March 2015, 19:28
This document (http://static.googleusercontent.com/media/source.android.com/ru//compatibility/android-cdd.pdf) says that main might not be supported even in the latest (5.0) version.Terrifying.
Yes, the min bar media features in Android are remarkably light/
Most devices, particularly the high profile ones, do more than the min bar, but talking about "Android" or even "Android 4.4" as a platform isn't really that useful when it comes to knowing what built-in media features are there. Which is why you see media apps whitelisting known-good devices, or just including their whole software DRM and decoder stack. Or companies encode 100+ variants of each title. Older Android versions can't even reliably change frame size mid-stream, so adaptive bitrate stream switching can only switch between different bitrates of the same frame size. Plus Baseline versus Main.
It bugs me how often the lowest bitrates are Baseline because it's meant for "low-end." When you have low bandwidth is EXACTLY when you want advanced codec features. Main can be 20%+ more efficient than Baseline at low bitrates; CABAC's efficiency improvement goes up as bitrates go down. I think sub 300 Kbps sustained bandwidth happens with all phones, and way more of them can do Main than not.
For companies that have big libraries of Baseline content, a simple CABAC converter to add another variant could be helpful.
Of course, companies should plan to reencode their entire library from source every 12-24 months anyway, since there are always significant changes in encoder quality (although x264 compression efficiency improvements have really slowed down), device capabilities (HEVC?) and delivery technologies (DASH?) on around that cadence.
Selur
21st March 2015, 15:03
And yes, it isn't that hard in theory, yet we seem to have this conversation every year or so, without anyone having done it
so true: http://forum.doom9.org/showthread.php?t=104619
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.