audiofx: Implement an audio overlay element
Would be nice to have a GStreamer element that draws a widget to show the audio information over the video. This could be some colored bars over the video feed, so we can see the audio activity.
Something like:
- 1 bar for mono audio
- 2 bars for stereo audio (left/right)
Implementation
We can create a new plugin called audiooverlay
.
- Pads:
- static src pad
src
:video/x-raw
- static sink pad
sink
:video/x-raw
- template sink pad
audio_%u
:audio/x-raw,channels=1..MAX
- pad attribute:
position
(left
,right
,top
,bottom
)
- pad attribute:
- static src pad
The element internal bin would hold an instance of the cairooverlay
to draw over the video buffers.
Simplified future element usage example
We send a video stream and then multiple audio streams to the audiooverlay
, the audio overlay draws the audio widget on the video stream and keeps animating the audio widgets using the audio information it is capturing from the audio pads.
videotestsrc ! audiooverlay name=ao audio_1::position=left audio_0::position=right ! autovideosink \
audiotestsrc name=audio1 ! queue ! ao. \
audiotestsrc name=audio2 ! queue ! ao.