7 ms·
Anime Video Encoding Guide for X265 (HEVC) & AAC/Opus (2019)
- backspace_ 5y agoSo basically, how can we use free and open technology to make the smallest file size while trying to retain as much quality as possible? This also doesnt touch on what the anime is being sourced from. Furthermore, it only touches on encoder usage but not having to process the source such as using avisynth in some cases.
- thrdbndndn 5y agoYeah from the my experience the "hard" part is always about finding the right (albeit subjective) filtering in AVS/VapourSynth depending on the source. Most of major release and fansub teams don't really vary their encoding parameters much. Still a good article though.
- Jiro 5y agoThe format is patented. It absolutely is not free and open technology. The anime encoders are copying things illegally anyway, so they're not going to care about violating the patent licenses.
- astrange 5y agoThese tools are used to produce official BDs as well.
- judge2020 5y ago> free and open technology Doesn't using h265 invalidate this? I know it's seem to have won in current-gen consumer hardware support, but there's hope that AV1 grows.
- CameronNemo 5y agoA lot of hardware that I've seen has both h265 and VP9. So you often do have the option of using the codecs that are royalty free.
- hansel_der 5y ago6-gen mobile intel running ubuntu-lts can decode h264, h265 and av1 with vaapi but not vp9/vp10.
- wwalexander 5y agox265 [1] is licensed under the GPLv2. [1] https://bitbucket.org/multicoreware/x265_git/src/master/ https://bitbucket.org/multicoreware/x265_git/src/master/
- KMnO4 5y agoI’ve wondered about this a lot. Anime (and many hand drawn animations in general) is typical fairly predictable. Objects, expressions, and even motions are reused frequently. Shapes are often basic enough that a “vector” graphic could adequately represent their structure (in far fewer bytes). If there were a way to structure anime into their core components, could we compress the video more like LZMA?
- Wowfunhappy 5y agoI think this would be like trying to turn a png back into an svg. The pixels on your screen might be exactly the same, but once it's rasterized, you can't really go backwards. Image trace exists but doesn't work well.
- pizza 5y agoThere are a number of models trying to basically do just that https://paperswithcode.com/task/vector-graphics https://paperswithcode.com/task/vector-graphics
- 0-_-0 5y agoNow that I think about it, once a vector representation is extracted, shouldn't that make frame interpolation in anime easier as well?
- thrdbndndn 5y agoYou're describing flash. As other said, they have to be rasterized inevitably for various reasons. (Hand drawn animations aren't really vectors to begin with; computer-aided ones probably are better examples.)
- Retr0id 5y agoThe JPEG XL bitstream format contains a "spline" primitive. Unfortunately, these don't get encoded particularly efficiently, and there aren't any encoders that can take advantage of it yet. JPEG XL can do animations, but it's not supposed to replace video codecs. It would be interesting to see similar features put into an actual video codec.
- Wowfunhappy 5y ago> Bonus conversation: Due to x264 being much less complex, presets can pretty much maintain only a slight loss in quality as you encode faster. This gives an illusion that slower presets are slower due to spending more time compressing. The more correct way to see this is that slower presets are slower due to doing more motion calculations and finding the best scheme that best describes the frame, which in x264 just so happens benefits compression too. However, x265 is waaay more complex with motion algorithms, meaning that accurately describing motion actually increases bitrate. This is totally confusing me. If the scheme that best describes the frame actually uses more data, and the user is targeting a lower bitrate/quality, shouldn't the encoder realize that the less accurate description is a more efficient choice, and select that?
- astrange 5y agoIt only targets a bitrate if you tell it to. Constant quality/crf mode doesn't care about bitrate, it just applies a quality level to whatever makes it to intra prediction (which is the stage after inter prediction, where all the motion compensation is).
- prvc 5y agoLower crf will lead to higher bitrates, everything else being equal. It makes no sense to compare this figure between different presets.
- brigade 5y agoThe author is pretty confused. x264’s slower presets enable searching more points in ME and a more accurate RDO (among other things), just like x265’s. But in all cases for any modern encoder, all mode decisions are done baed on the estimated bitcost relative to distortion, so the slower presets are just evaluating more options. (kinda) That said, it is the case across all codecs that more accurate motion vector fields (e.g. using optical flow) are not generally optimal. A simple way of reasoning about that is that one block reusing the same motion vector as a neighboring block is much cheaper than encoding a marginal difference, which often more expensive than the bits saved in the residual. Anyway, CRF was never designed to map to the same quality across different encoder settings, which having actually read the article, is what I think they’re actually complaining about.
- prvc 5y ago>What I’m more excited about is AV1. AV1 is a next gen codec with members from many tech giants (Apple, Google, MS, etc.) to create a royalty free codec. IIRC some of its baseline is based on VP10, which Google scrapped and had its code donated to developing AV1. Unfortunately the reference encoder libaom is in a very early stage and takes forever to encode. SVT-AV1 is Intel’s (and joined by Netflix) scalable implementation. It performs not as well as libaom, but quality is still better than x265 (SSIM), and encode times are way more reasonable. For now, they look promising, and I am excited to see results in a few years. HEVC took 3-4 years before it was more widely accepted by Anime encoders, and took 5 years until 2018 before I began experimenting with it. AV1 began major development in mid-2018 so by that logic we got 2-3 more years to go. Well, it's 2021 now, would be interesting to see a guide for AV1 encoding in the same vein. As I understand it, both of the leading AV1 encoders are still undergoing frequent changes and improvements, but it still would be nice to have a guide to help one to get a handle on things.
- llampx 5y agoIf I have an AMD Ryzen processor, am I SOL when it comes to AV1 encoding?
- DiabloD3 5y agoThe reverse, if you had Intel, you'd be SOL. AMD is a huge AV1 supporter, both with improving speed of software decoding and encoding, but also granting the ability to the Radeon's video ASIC to handle it.
- paol 5y agoIf you have a processor without integrated graphics (more common on AMD than Intel, although Intel also sells some) you don't get hardware accelerated encoding anyway, since that's a feature of the GPU.
- IshKebab 5y agoHardware accelerated encoding is usually lower quality anyway so you probably wouldn't use it for this sort of thing.
- ww520 5y agoJust a note. H.265 (HEVC) is laden with patents. That's a reason Google didn't add H.265 support in Chrome.
- prvc 5y ago>The more threads you add into a pool, the more encode overhead you will experience, since every row of encode requires the upper right CTU block to complete before it can proceed. Nowadays, we don't have to worry about that, since we can use scene-based encoding instead. [1][2] In addition to allowing for full use of all cores, without any loss of encoding or processing efficiency, different encoding settings may be chosen for each scene, increasing potential efficiency. [1] https://netflixtechblog.com/optimized-shot-based-encodes-for-4k-now-streaming-47b516b10bbb https://netflixtechblog.com/optimized-shot-based-encodes-for... [2] https://github.com/master-of-zen/Av1an https://github.com/master-of-zen/Av1an
- donatj 5y agoOh interesting. I reference this article all the time.
- ttoinou 5y agoWhat is "cough" in italics in this article ?
- Bayart 5y agoThe sound of coughing.
- moreati 5y agoThe author is choosing not to name names, i.e. they aren't pointing a finger at the specific person/site they're criticizing. "cough" or mumble is a slightly humorous shorthand/convention for this. It suggests an audio transcript mistake, that conveniently doesn't reveal the guilty party.
- ttoinou 5y agoThanks ! I thought about this but then I read "Providing remux/RAWs for cough." and it didn't make sense to me anymore
- FeepingCreature 5y agoPirate sites.
- aaron695 5y agoIs this compatible with Warez standards? https://en.wikipedia.org/wiki/Standard_(warez) https://en.wikipedia.org/wiki/Standard_(warez) I think it would be good for the scene to move to H.265. It's been a while since they moved to H.264 (2012) and that made a big difference - https://torrentfreak.com/bittorrent-pirates-go-nuts-after-tv-release-groups-dump-xvid-120303/ https://torrentfreak.com/bittorrent-pirates-go-nuts-after-tv... The sooner someone invents a way to get standard committees to work at a faster pace the sooner we'll all get to Mars and solve world poverty.
- webmobdev 5y agoThis is an interesting insight to piracy culture - I didn't know they had some kind of unofficial understanding between them on tech standards. Kind of funny! (I think the biggest hurdle for HEVC is that it isn't available on a lot of devices. Sure, if you want to watch a video on a computer, HEVC will work. But if you want to watch the same video on your TV, chances are that it won't work. H.264 / AVC however is now near universal on most LED TVs sold).
- deleted 5y ago[deleted]
- prvc 5y ago>There is no simple answer to fix these 2 problems due to crf targets. Traditionally in x264 such scene will simply end up in blocking artifacts. x265 chooses to eliminate artifacts at the cost of detail loss. The down side is that even at lower crf targets it is tough to eliminate x265’s tendency to blur. To truly eliminate such effects, you will first need no-sao:no-strong-intra-smoothing:deblock=-1,-1 to make x265 behave more like x264, then raise psy-rd and psy-rdoq accordingly (2 and 5 respectively should do the trick). However, this reintroduces unpleasant artifacts x265 aimed to eliminate in the first place, thus I do not recommend such encode parameters unless encoding crf <16 (in which case file sizes are so big just use x264, why even bother x265?). There might be something to be said for perceptible degradation: the characteristic macroblock vomit produced by bit-starvation gives a sure signal to the viewer that something went wrong with the video encoding, whereas a smooth looking image with some details omitted can produce a false impression of what the video signal is, with no indication as to whether or not this is taking place (imagine this happening, for example in security camera footage).
- ZeroGravitas 5y agoThat quote sounds like someone trying to justify something to themselves. Otherwise it's a very long-winded way of saying, use the x265 defaults, which doesn't really need said at all. Presumably it's a leftover from the x264 community where blur (a valid compression technique that can be overused) was demonized probably beyond what was supported by evidence so now they need to rein that bias in when blur is actually the best option available.
- thrdbndndn 5y agoI don't mind blur in anime at all but it's very noticable (without using pause or magnifying glass) in live action footages, even when using low CRF. I have to turn off `SAO` and `strong-intra-smoothing` when using x265 for this reason.
- idoubtit 5y agoMy experience is that VP9 is often a better choice than HEVC. The article mostly compared x265 to x264 because vp9 was not endorsed by Apple. That is no more the case, and I've found VP9 anime videos to have better quality at similar bitrate. Recent VPx encoders are also better at multi-threading. For instance with ffmpeg: `-c:v vp9 -row-mt 1 -crf 26`
- goblin89 5y ago> It was a re-encode at crf=22.5, with zero encoder tuning and preset at fast. Needless to say, it was blocking and artifacts galore. The icing on the cake? The audio was FLAC “to preserve audio quality”… I’m pretty sure there are more people in this world with 1080p screens than high-end headphones lol. Not to say the author is wrong, as their example is very drastic, but I don’t think this matter is so black-and-white. 1) Audio quality matters more than the quality of the video in terms of viewing satisfaction (this one is my subjective opinion). 2) The better your audio system, the more important the source material quality. 3) Lossy compression is a one-way road. Did the distributor recode from lossless, or applied their own lossy encoding on top of an already lossy stream because they couldn’t be bothered to reconfigure their tools? You don’t even have the data to tell how messed up your sound is. Meanwhile, with lossless there are straightforward ways to tell whether it’s “true lossless” (i.e., wasn’t up-coded from a lossy format). 4) Distributing truly lossless video is currently just plain impossible (from obtaining the requisite master files to dealing with such volumes of data), so we are choosing between “different degrees of evil” out of necessity. Distributing lossless audio ultimately is feasible, at the expense of a couple hundred megabytes. In the end, if we’re speaking about a work of value (e.g., a good classic film), I wouldn’t mind spending extra megabytes on preserving the original audio.
- MrRadar 5y agoAs the article points out, if the source is already lossy (which is (almost) all broadcast, DVD, and web sources) then you should just copy that bitstream into the resulting video (transcoding lossy to FLAC gives you the same quality at higher bitrate and is the worst of both worlds). The only common source you would get true lossless audio from is BluRay discs and even in that case the recommended audio encoding settings the author gives should be well into transparency for all but the most golden-eared listeners, and they would likely only be able to detect the difference in an AB comparison with the original source.
- goblin89 5y agoAgreed that up-coding is bad. Still think preserving lossless, if it is available in the first place, is worth it, and a couple hundred megabytes probably don’t matter to someone who chose a quality download rather than streaming. The point that “the entirety of one’s experience is fully available to one’s conscious mind, so if one can’t tell the difference then it doesn’t matter” can be a philosophical question on which we’ll disagree.
- PaulHoule 5y agoLooking at a number of device manuals (my car, my Garmin watch, ...) many of them claim to only support AAC files "encoded by the Apple encoder". I think that's because AAC supports a wide range of coding tools on paper and off-brand encoders might use them, but everybody supports the ones the Apple encoder uses.
- strogonoff 5y agoIf one is listing expensive IEMs and amps/DACs, IMO one would be amiss not to mention Shure KSE1200.