gst-plugins-bad merge requestshttps://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests2021-11-08T16:52:36Zhttps://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1316autoconvert22021-11-08T16:52:36ZJoel Holdsworthautoconvert2`autovideoconvert2` is a new element (contained within the `autoconvert2` plugin) which aims to automatically convert media from one (or more) formats to another set of one (or more) formats.
The predecessor, `autovideoconvert`, is able...`autovideoconvert2` is a new element (contained within the `autoconvert2` plugin) which aims to automatically convert media from one (or more) formats to another set of one (or more) formats.
The predecessor, `autovideoconvert`, is able to convert a single input format into another by automatically selecting a single transform element that is able to make the conversion.
`autovideoconvert2` takes a more sophisticated approach and is able construct complex branching graphs of multiple transform elements which combine together to make the coYUVnversion in an efficient structure.
For example, in the case where we want to convert a 400x400 bayer image into a 200x200 bayer image, there is no single gstreamer element that can make this conversion; it must be done with a `bayer2rgb` element, a `videoconvert` element and a `rgb2bayer` element. `autovidoeconvert2` is able to construct such a pipeline.
If instead we require two outputs: a 200x200 bayer image, and a 100x100 bayer image, the optimal pipeline structure for this conversion is not trivial to determine. `autovideoconver2` uses a heuristic algorithm to estimate the lowest cost method of producing both outputs reusing the results of intermediate steps where possible.
This example can be tested with the following `gst-launch-1.0` command:
```
gst-launch-1.0 \
videotestsrc ! \
video/x-raw,width=400,height=400 ! \
rgb2bayer ! \
autovideoconvert2 name=avc2 \
avc2. ! \
queue ! \
bayer2rgb ! \
video/x-raw,width=200,height=200 ! \
autovideoconvert2 ! \
xvimagesink \
avc2. ! \
queue ! \
bayer2rgb ! \
video/x-raw,width=100,height=100 ! \
autovideoconvert ! \
xvimagesink
```
In this example, `autovideoconvert2` constructs the following branched pipeline structure:
![20200530-dual-bayer-resize-avc2](/uploads/10d3b84b84e042f973a95452a05231f8/20200530-dual-bayer-resize-avc2.png)
Future work:
* Support encoding, decoding, transcoding and pass-through of coded video formats.