5 ms·
Something weird (IMO) about ffmpeg is that it doesn't do hardware-accelerated encoding or decoding by default unless you compile it with support and pass it som
by mquander 6y ago
Something weird (IMO) about ffmpeg is that it doesn't do hardware-accelerated encoding or decoding by default unless you compile it with support and pass it some extra command line flags.
If you are using ffmpeg with hardware-accelerated codecs like H.264, remember to take the free 10x speed boost!
- shmerl 6y agoYou don't want to necessarily use it by default.
- kyberias 6y agoYou you do want to explain why and not just tell people not to.
- spython 6y agoAt least on mac the quality of the encoded h264 video is not the same (same bitrate but lower quality but much faster encoding) and the scope of fine tuning is also limited.
- shmerl 6y agoAs below, the quality of the hardware encoder can be different from something you can get otherwise. So I don't see a problem not making it a default for ffmpeg.
- zerocrates 6y agoAccelerated encode in particular is very likely to give inferior quality and a more limited range of encoding options, and also introduce a situation where those factors change from machine to machine (say, based on which codecs and options your particular GPU supports). Of course, if speed and resource consumption are the key factors then it can definitely make sense to use them, but probably not as a default.
- ComodoHacker 6y agoThe boost is not free though. You lose some quality, gain some vendor-specific artifacts, lose the ability to adapt to content, and the ability to trade time for compression ratio or quality.
- bsenftner 6y agoThe default is to use software for the key reason that running ffmpeg on headless servers will often have no GPU to access, when hardware acceleration is present it is specific to certain vendors only, plus the software implementation that would be done by hardware is higher precision, higher quality. So the sensible default is no acceleration.
- Youden 6y ago> If you are using ffmpeg with hardware-accelerated codecs like H.264, remember to take the free 10x speed boost! The speed boost isn't free, hardware accelerated encoders often can't compress as well as software encoders. A video codec isn't a fixed rule book that all the encoders follow to get the same result, it's more akin to CSS: there are a bunch of tools you can use but there's no one way to combine them to get a particular result. If you want to make a chess board with HTML and CSS, just think of how many ways there are to do it, it's similar when it comes to video encoding. So different encoders have different results but why would a hardware encoder compress worse than a software encoder? The answer is simple: a hardware encoder needs to be implemented in hardware. That comes with a ton of constraints that CPU encoders don't have to deal with, such as physical space on silicon, power, heat, limited memory and so on and so forth. This means that the encoder has to make compromises that a software encoder doesn't. So how big is the difference? It depends a bit how you measure it but Moscow State University has a ton [0] of data about different encoders and just last year, they evaluated a bunch of hardware encoders [1] and compared them to software. You can see in their results [2] that relative to x264 (software, which happens to be ffmpeg's default), NVENC (NVIDIA's encoder, present on their GPUs) took 21.3% more bytes to produce the same subjective result. [0]: https://www.compression.ru/video/codec_comparison/index_en.html https://www.compression.ru/video/codec_comparison/index_en.h... [1]: https://www.compression.ru/video/codec_comparison/hevc_2020/fpga_express_report.html https://www.compression.ru/video/codec_comparison/hevc_2020/... [2]: https://i.imgur.com/Smh4v3P.png https://i.imgur.com/Smh4v3P.png
- fomine3 6y agoSome of them depends on proprietary SDK.