
Rav1e, an AV1 encoder written in Rust and assembly - mindfreeze
https://github.com/xiph/rav1e
======
lukevp
For others like me who are curious and haven't heard of AV1, some main
features:

* Open & Royalty Free (no licensing required to use)

* Backed by Mozilla, Google, Microsoft, Cisco, etc. [1]

* Approximately 50% higher compression than x264 [1] and 30% higher than H.265 (HEVC) [2]

* Supported in current versions of Chrome, Firefox, Opera, and Edge [3]

* Slower encoders than HEVC, so not typically used for live streaming [2]

[1]: [https://en.wikipedia.org/wiki/AV1](https://en.wikipedia.org/wiki/AV1)

[2]: [https://www.theoplayer.com/blog/av1-hevc-comparative-look-
vi...](https://www.theoplayer.com/blog/av1-hevc-comparative-look-video-codecs)

[3]: [https://caniuse.com/#feat=av1](https://caniuse.com/#feat=av1)

~~~
cthor
Still no support in any mobile browser. 35% isn't a lot of coverage. And of
course Safari is a holdout -- they haven't even adopted VP9 yet.

~~~
masklinn
> And of course Safari is a holdout -- they haven't even adopted VP9 yet.

Given Apple is an AOM governing member it's pretty likely Apple will
eventually support AV1 (and AVIF).

VP9 is simply not on their roadmap at all, it's not a "yet" thing.

------
natemcintosh
"The fastest and safest AV1 encoder" but it's also 62.1% assembly? Is the
assembly as safe as rust? I'm confused

~~~
m00x
Is Rust really safer? It's memory safe, but you can still have all the other
fuck ups and vulnerabilities that other apps have.

~~~
psexec
How many times are we going to have this discussion?

> ~70% of the vulnerabilities Microsoft assigns a CVE each year continue to be
> memory safety issues

[https://msrc-blog.microsoft.com/2019/07/16/a-proactive-
appro...](https://msrc-blog.microsoft.com/2019/07/16/a-proactive-approach-to-
more-secure-code/)

There are similar reports from other organizations.

------
Flow
I see that Safari does not support this (yet).

Might it be possible to compile this to wasm and decode it that way on the
client?

~~~
ducaale
Is Safari becoming the new Internet Explorer?

~~~
stock_toaster
Nah, pretty sure Chrome is. I'm apparently not alone[1][2][3] in believing so.

[1]: [https://www.theverge.com/2018/1/4/16805216/google-chrome-
onl...](https://www.theverge.com/2018/1/4/16805216/google-chrome-only-sites-
internet-explorer-6-web-standards)

[2]: [https://www.computerworld.com/article/3199425/top-web-
browse...](https://www.computerworld.com/article/3199425/top-web-
browsers-2020-chrome-snaps-up-more-share-new-edge-again-gains-ground.html)

[3]: [https://erik.itland.no/chrome-is-the-new-internet-
explorer-4...](https://erik.itland.no/chrome-is-the-new-internet-
explorer-4-stages)

~~~
lern_too_spel
GP is comparing it to IE6 in terms of being behind other browsers in
implementing features, not in terms of publishers only checking that their
pages render correctly in that browser.

~~~
Flow
IE was both the browser that were first with features and had lots of features
the others didn't have, and the browser that lagged with new features.

------
devwastaken
We really need focus on embedded GPU av1 as well. It's amazing how fast pure
GPU transcoding is. H265 is supported well in modern GPU's and can transcode
at dozens of times the speed. But av1 for some reason isn't getting the same
treatment is seems.

~~~
th3typh00n
GPU:s are generally terrible for video encoding. I think you're confusing the
GPU with a dedicated "hardware encoder" ASIC (which may be located on the same
die as other silicon components such as a CPU or a GPU).

~~~
fluffything
An off-the-shelf GPU can encode / decode thousands of channels of video and
audio in real-time.

There are some cloud providers that offer this as a service, allowing you to
have the end-points of, e.g., video calls to use different audio and video
codecs.

This is quite useful, e.g., when some people join the call only using audio
via a cell phone in a different country using a different audio standard (or a
land line, etc.). Or when somebody joins the video call from laptop tethering
from a phone on a train. Or for switching video codecs depending on whether
somebody is sharing their desktop or using a webcam to record their face.

The client can picks the codecs that are the best fit for the current
situation (content, bandwidth, latency, etc.) and a could server transcodes
the video from everyone else in the meeting to their clients format.

~~~
robert_foss
The point the parent poster was trying to make was that the GPU cores
themselves are not a great match for video codec work.

However most consumer/server GPUs include hardware IP blocks specifically for
doing codec work.

~~~
fluffything
And that point is wrong, since there are some cloud providers using normal GPU
cores for exactly this.

The codecs that NVEnc supports are just a few bunch, there is no real-time
audio, no nothing.

All of this is implemented in CUDA, using normal CUDA implementations of audio
and video codecs, and running on normal GPUs using normal GPU cores. In real
time. Supporting thousands of audio and video channels concurrently.

Also, even for NVEnc and NVDec themselves, in some of the GPUs they do not use
any specialized hardware and use normal GPU cores instead (e.g. see the older
GM20x GPUs).

~~~
vlovich123
Are any of these transcoding libraries open source?

~~~
fluffything
None of the ones I know are. They are all proprietary.

I'm not sure they are for sale either (probably for the right price), since
they sell these "as a service", which pays better. I also don't think these
are on sale for "small" customers.

------
dang
See also

2018
[https://news.ycombinator.com/item?id=17539361](https://news.ycombinator.com/item?id=17539361)

2019
[https://news.ycombinator.com/item?id=19746392](https://news.ycombinator.com/item?id=19746392)

------
kzrdude
How is there constantly so much compression ratio improvement in video codecs?
New algorithms imrpove so much upon the old.

~~~
aaronblohowiak
“Compression is understanding”. As our understanding of the problem domain
increases, so too will our ability to compress it. Video has three key things:
the still images that approximate the input, the relationship of one image to
the prior and next and a human bean who is sensitive to some kinds of
distortion and not others, depending on context :) To have effective and good
compression, you have to understand all three.

Note: while I work at Netflix, I do not work on anything related to video
encoding, these are just my semi-informed understandings :)

~~~
sephamorr
I would also add computational complexity. We're increasingly willing to throw
more transistors at video decoding and encoding due to their reduced cost and
increased performance, so the algorithms can become more complicated, have
larger perform larger searches, etc. If you think about it from a power
perspective, the power cost of a bit of data transmitted to a mobile device is
pretty large. I would expect to see video compression formats increase in
complexity until the power cost of compressing away one more bit approaches
the cost of transmitting one more bit over the network.

~~~
aaronblohowiak
Well with the compression vs transmission/decompression ratio of video for
stuff in the Netflix catalog, I think the inflection point is different than
you suggest (not sure about YouTube.)

~~~
sephamorr
You're right. I was thinking about the decoding side (where total power for
displaying the video should be minimized) but was unclear above.

------
Ptilopsis
With AV1 encoders I have to ask myself every time whether I should read the 1
as 'i' or as 'l'. Dav1d was still easy to guess, but here I really have a hard
time.

Apart from that, I am really glad to see how Rust is slowly making an
appearance in such fundamental multimedia libraries.

~~~
PBnFlash
A V ONE

AVI is already a container so it would just be confusing.

~~~
StavrosK
I think he means "ravie" or "ravle".

------
saagarjha
Any major projects using this yet?

~~~
mindfreeze
Vimeo: Vimeo's staff pick is encoded using rav1e, FFmpeg is having it

~~~
mindfreeze
[https://medium.com/vimeo-engineering-blog/behind-the-
scenes-...](https://medium.com/vimeo-engineering-blog/behind-the-scenes-of-
av1-at-vimeo-a2115973314b)

[https://vimeo.com/blog/post/av1-new-standard-
codecs/](https://vimeo.com/blog/post/av1-new-standard-codecs/)

~~~
FullyFunctional
Great link (and I love Vimeo). The blog goes hyperbolic though: "In other
words, if you happen to be in a part of the world where you might not have the
best internet connection, AV1 will still provide you with an impeccable
viewing experience."

No, AV1 is evolutionary. You'll "just" better quality for the same amount of
bits (just like going from MPEG2 -> H.264 -> H.265 etc). The license of AV1
however _is_ revolutionary.

------
jimmar
The developers say it's the fastest, but does anybody have a link to
benchmarks?

------
LockAndLol
Is it worth using as a default encoder for home movie libraries? Or would it
soebd the next decade encoding everything?

------
loeg
Anyone know how the "fastest" claim stacks up against SVT-AV1?

~~~
mcraiha
[https://www.researchgate.net/publication/340351958_MSU_Video...](https://www.researchgate.net/publication/340351958_MSU_Video_Codec_Comparison_2019_part_IV_High-
Quality_Encoding_aom_rav1e_SVT-AV1_SVT-HEVC_SVT-
VP9_x264_x265_ENTERPRISE_VERSION) according to that (5. ENCODING SPEED
section) SVT-AV1 is a bit faster, but since they are both VERY slow it doesn't
really matter. That was released in March so recent updates might have changed
things.

~~~
loeg
Thanks.

------
pkulak
Is it multithreaded???

~~~
mindfreeze
Yes, by default it is, You can use `--threads` to hack around,

We are using Rayon for multi threading, and also tiling to boost the output

~~~
pkulak
Wonderful. Thanks!

------
Erlangen
> The fastest and safest AV1 encoder.

Is it faster than dav1d?

~~~
mindfreeze
dav1d is a decoder while rav1e is an encoder

rav1e = _rav1e_ is an _AV1_ _E_ ncoder

dav1d = _dav1d_ is an _AV1_ _D_ ecoder

~~~
deathgrips
Coders can't come up with a good name to save their lives.

~~~
StavrosK
What's your proposal?

~~~
deathgrips
Since I am a fellow coder I cannot in good conscience suggest another terrible
name.

------
Thaxll
"The fastest and safest AV1 encoder." quick search on unsafe:
[https://github.com/xiph/rav1e/search?q=unsafe&unscoped_q=uns...](https://github.com/xiph/rav1e/search?q=unsafe&unscoped_q=unsafe)

[https://github.com/xiph/rav1e/issues/2378](https://github.com/xiph/rav1e/issues/2378)

[https://github.com/xiph/rav1e/issues/2310](https://github.com/xiph/rav1e/issues/2310)

Does not seems safe at all, definitly not the "safest"encoder out there.

~~~
IshKebab
Aren't the only other encoders written in C?

~~~
mcraiha
SVT-AV1 is written in C (and lots of assembly). libaom-av1 is written in C
(and lots of assembly). libgav1 (which is decoder) is written in C++ (and lots
of assembly). So yes, lots of C/C++ in open source AV1 encoders/decoders.

~~~
IshKebab
So it sounds to me like it might be the safest encoder... except for the fact
that it is 60% assembly. Maybe they can improve that.

