Tune gstreamer encoder for each architecture
We should figure out the best encoder (alternative to vp8enc) for each platform. Maybe we can get some hints from how encodebin chooses the encoder.
Some notes that may be helpful to whoever takes this up:
- gstreamer has an internal rank for each element, and that's how encodebin chooses them along with the capabilities (caps)
- there is this code here that's one of the few examples using encodebin that i've found: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/tree/master/tests/examples/encoding of interest, while reading the source, is this section here. Those code snippets are how you can get all elements of a minimum rank. The documentation is here for c and here for python.:
If you're unfamiliar with GObject C, g_class_name_method_name(instance, param1, param2) becomes instance.method_name(param1, param2) in python. Since C was not designed with object oriented programming in mind, this is the convention used.
There are prettier languages that wrap this ugliness and write the GObject C for you (and manage memory). There are examples in that documentation there for Vala. Vala is also really easy to bind for python (bindings are "free"). It's only real downside is it only plays well with GObject, but GStreamer is written in GObject, so it's perfect for that. If anybody chooses this admittedly eccentric language, lmk if you need any help (eg. with build files or cryptic error messages out of valac).
More notes on encoders:
- Nano/Tx1 do not support vp9 but do support vp8
- Tx2/Xavier does support vp9 but Xavier does not support vp8
- the plugin guide for Nvidia with some examples is here.
- the webm container format only supports vp8/vp9
- the mp4 ~conainer does not support vp8/vp9~ but does support avc (h264) / hevc (h265) edit: i double checked the table and it does support vp8/vp9 as well.
- edit: mp4 has patent issues which could be an issue, which is why Google uses webm.
- a support table of which container support which codecs is here.
Also, I found out that the Googler I know closely worked on the vp8 encoder and he said it's every effecient even in software (and I've seen it run on a potato), so if we have to have a software fallback, it's a good one. Edit: also mp4/h26* is patent encumbered while vp8/9 is designed specifically not to be.