Thanks to my recent experiments with code coverage tools, I have a powerful new — admittedly somewhat specious — method of comparing programs. For example, I am certain that I have read on more than one occasion that Apple’s H.264 encoder sucks compared to x264 due, at least in part, to the Apple encoder’s alleged inability to exercise all of H.264’s features. I wonder how to test that claim?
Experiment
Use code coverage tools to determine which H.264 encoder uses the most features.
Assumptions
- Movie trailers hosted by Apple will all be encoded with the same settings using Apple’s encoder.
- Similarly, Yahoo’s movie trailers will be encoded with consistent settings using an unknown encoder.
- Encoding a video using FFmpeg’s libx264-slow setting will necessarily throw a bunch of H.264’s features into the mix (I really don’t think this assumption holds much water, but I also don’t know what “standard” x264 settings are).
Methodology
- Grab a random Apple-hosted 1080p movie trailer and random Yahoo-hosted 1080p movie trailer from Dave’s Trailer Page.
- Use libx264/FFmpeg with the ‘slow’ preset to encode Big Buck Bunny 1080p from raw PNG files.
- Build FFmpeg with code coverage enabled.
- Decode each file to raw YUV, ignore audio decoding, generate code coverage statistics using gcovr, reset stats after each run by deleting *.gcda files.
Results
- x264 1080p video: 9968 / 134203 lines
- Apple 1080p trailer: 9968 / 134203 lines
- Yahoo 1080p trailer: 9914 / 134203 lines
I also ran this old x264-encoded file (ImperishableNightStage6Low.mp4) through the same test. It demonstrated the most code coverage with 10671 / 134203 lines.
Conclusions
Conclusions? Ha! Go ahead and jump all over this test. I’m already fairly confident that it’s impossible (or maybe just very difficult) to build a single H.264-encoded video that exercises every feature that FFmpeg’s decoder supports. For example, is it possible for a file to use both CABAC and CAVLC entropy methods? If it’s possible, does any current encoder do that?