After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 784160 - Add AV1 encoder/decoder based on reference implementation
Add AV1 encoder/decoder based on reference implementation
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal enhancement
: 1.13.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-06-24 12:30 UTC by Aaron Boxer
Modified: 2017-12-15 16:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add AV1 to gst-plugins-good/matroska (3.39 KB, patch)
2017-12-13 09:24 UTC, Sean-Der
none Details | Review
Add AV1 support with gst-plugins-bad/aom (31.57 KB, patch)
2017-12-15 07:22 UTC, Sean-Der
none Details | Review

Description Aaron Boxer 2017-06-24 12:30:00 UTC
http://aomedia.org/about-us/

https://aomedia.googlesource.com/aom/

Open source, royalty free HEVC replacement !
Comment 1 Sebastian Dröge (slomo) 2017-06-24 13:51:25 UTC
What's the status of container format support, are there specs for Matroska/WebM, MP4, ...?
Comment 2 Aaron Boxer 2017-06-24 15:37:47 UTC
Good question, I am not sure. I think for WebM there is, but need to do some digging.
Comment 3 Aaron Boxer 2017-06-24 15:39:14 UTC
So, to start off, I guess I can make a copy of the .265 encoder and decoder, and work from there.
Comment 4 Sebastian Dröge (slomo) 2017-06-25 06:44:45 UTC
That doesn't seem like the best approach, those are quite complicated. As this comes also from Google and seems to include various VP8/9/10 tech, maybe the encoder/decoder for those would be a good start.
Comment 5 Aaron Boxer 2017-06-25 12:49:14 UTC
Good idea. By the way, at this stage in development, encoding speed is measured in frames per minute (!) - will a pipeline even run at this very slow encoding rate ?
Comment 6 Sebastian Dröge (slomo) 2017-06-25 16:48:39 UTC
Sure, as long as you don't have live input that is all not a problem.
Comment 7 Sean-Der 2017-06-30 07:38:12 UTC
Just to keep everyone updated I have been chipping away at this.

There ended up being a large amount of changes (VPX vs AOM), so it ended being easier to start a new plugin in -bad

https://github.com/Sean-Der/gst-plugins-bad/tree/av1

Currently I just have everything linking, init'ing everything AV1 and then having the GstVideoEncoder spitting out empty buffers. Hopefully this weekend I will have something generic working (we will see!)

If anyone is interested I am more then happy to put this somewhere where the work can be shared, but I have a long way to go before this is review worthy.
Comment 8 Aaron Boxer 2017-06-30 16:53:36 UTC
Awesome! Let me know how it goes : I would like to help, time permitting.
Comment 9 Sebastian Dröge (slomo) 2017-11-15 11:48:07 UTC
The API is basically like libvpx, so ideally we can share code with that (and not just copy&paste).
Comment 10 Tim-Philipp Müller 2017-11-15 11:54:23 UTC
We should review the API to make sure it doesn't force unnecessary copies and can handle strides and stuff - has someone done that yet?
Comment 11 Aaron Boxer 2017-11-15 12:04:26 UTC
I don't think any work has been done since initial plugin work by Sean-Der in the summer. I've played around with the AV1 encoder, using the Xiph.org sample video set, but haven't had time to do anything more.
Comment 12 Sean-Der 2017-11-19 19:39:02 UTC
Hey All!

I have a version on my Github that can encode and I updated webmmux to support it, I was able to use ffplay on a file that GStreamer created (videotestsrc ! av1enc ! webmmux ! filesink)

However, I had questions about the best way to write things and wasn't able to get anyone on IRC so gave up. If someone was willing to 'mentor' on this one I would love to do it! I assume that this is going to be big enough that someone bigger in GStreamer dev is going to want it.

Also @slomo I don't know how much we can really share (or should) while it is similar to VPX there are substantial differences in the API. It seems like the plan was to make a big break for AV1 (and then in the future there will be AV2..AV3) which we can share code between. Little questions like these are what I need help with, to make sure I am writing code that will land.

Would love to take a couple days off from work and hack on this, happy to see it all the way through if I can get someone to approve/tell me the right way. I just don't want to work on this and not be able to get it merged/rewritten by someone else.

thanks!
Comment 13 Sebastian Dröge (slomo) 2017-11-20 08:55:50 UTC
Sean, that's great to hear. If you can provide your code as a patch against gst-plugins-bad (place it in the ext/av1 directory), we can get it reviewed here and merged. As long as you're interested in updating the patch until it's ready, which seems to be the case :)

For sharing code with libvpx, if it's not possible it's not possible. That's perfectly fine. A similar structure with some private base class as in the libvpx plugin might make sense though (if AV2, AV3, etc might be added later), which you probably have if you started from that plugin instead from scratch again?
Comment 14 Sebastian Dröge (slomo) 2017-12-12 10:41:52 UTC
Sean, are you working on this still and would be ready to share it? Otherwise someone else might take this up in the future
Comment 15 Sean-Der 2017-12-13 09:24:55 UTC
Created attachment 365476 [details] [review]
Add AV1 to gst-plugins-good/matroska
Comment 16 Sean-Der 2017-12-13 09:29:06 UTC
Hey slomo, sorry about that got pulled in another direction. My goal is to put ~2 hours of work into this daily until is done.

Patch wise, am I able to do a MVP (av1enc and av1dec) that has no flags, and then add them later?

How complete does that patch have to be? I promise I will see it all the way through but I would like to do things in as small of chunks as possible. The less churn, the more likely things are to land (and then I can continue providing patches from there)

sorry not familiar with how the development of large features and GStreamer go.

If I can do minimal av1enc/av1dec patches will have them ready next day or so

thanks!
Comment 17 Edward Hervey 2017-12-13 15:49:36 UTC
(In reply to Sean-Der from comment #16)
> Patch wise, am I able to do a MVP (av1enc and av1dec) that has no flags, and
> then add them later?

  What do you mean by "flags" ? Properties ? I think it's fine to get a piece of concept working first and then extending it afterwards.

> 
> How complete does that patch have to be? I promise I will see it all the way
> through but I would like to do things in as small of chunks as possible. The
> less churn, the more likely things are to land (and then I can continue
> providing patches from there)
> 

  The patch should be "functional". It doesn't need to have all the bells and whistles (extra configuration properties, etc....), but we should be able to feed raw video and get a (compatible) encoded bitstream. And a decoder that be fed the bitstream and output raw video.

> 
> If I can do minimal av1enc/av1dec patches will have them ready next day or so
> 
> thanks!

 Sounds good ! Thank you
Comment 18 Sean-Der 2017-12-15 07:22:33 UTC
Created attachment 365570 [details] [review]
Add AV1 support with gst-plugins-bad/aom
Comment 19 Sean-Der 2017-12-15 07:30:13 UTC
I finished the VERY basic MVP. av1enc and av1dec work.

Also here is a Dockerfile that pulls my fork and AOM and builds everything, and an example gst-launch! So it should be really easy with just three commands to see it all working.

https://gist.github.com/Sean-Der/2cb7656db4002fea6b20ff7840863b96

I will go through and fill out the error codes/handling and cleanup everything in the next day or two. 

This has no properties, and is just the bare minimum I imagine even the most basic of edge cases would blow it up but I can get it powering an autovideosink so I am super excited.

I don't want to waste anyones time, but just want to know what is the bare minimum that is needed to merge. I want to get to that finish line as soon as possible, and not have the patch fall out of date etc...

thanks!
Comment 20 Edward Hervey 2017-12-15 07:53:34 UTC
Nice work ! At a glance it does seem correct and sufficient for initial integration into -bad, I'll do some testing and see if we can merge it.

I didn't see any out-of-band information (codec_data or sth like that) handling, is the stream self-contained ?
Comment 21 Sean-Der 2017-12-15 16:12:16 UTC
Edward,

Thank you so much for the review (and hopefully merge)

If you see any quick fixes I wouldn’t be offended at all if you modify the patch and commit (some people get fussy about that I have seen)

And as soon as it gets in bad I will start a bug/thread about ‘the road to good’ itemizing what needs to be done I will do my best to get it all the way.
Comment 22 Edward Hervey 2017-12-15 16:47:13 UTC
And it's in !

In terms of things to do:
* Properly handle EOS:
** av1enc: in the finish vmethod you want to drain out the remaining frames
** av1dec: Same thing, but in both the finish and drain vmethod
* gobject properties for configuring the encoder :)
* Maybe have some "sane" default settings on the encoder
* I tried, but failed, tu get the encoder to use multiple-threads for encoding. Might be worth checking what happens there.
* As asked before, I didn't see any "out-of-band" data that needs to be passed around. Is that normal for av1 ?
* ...
* world domination :)
Comment 23 Edward Hervey 2017-12-15 16:56:19 UTC
Closing bug. You can open a new one for the features to be added.