Adding Text Overlays

See also

Encoding Audio and Video
This description extends encoding audio and video data into a video container file.
Common Environment Variables
RSB-specific environment variables can be used to control the transport configuration used by the GStreamer scripts.
bag-play
bag-play is used to obtain event s from log file s and transport them into a GStreamer :pipeline.

Script

The rsb-gstreamer project includes the script record_subtitles.sh which is sufficient for cases in which audio data, video data and a single text overlay should be renderer into a video container file. The script is used as follows:

$ record_subtitles.sh OUTPUTFILE VIDEOSCOPE ( AUDIOSCOPE | _ ) ( TEXTSCOPE | _ )

_ can be used to indicate that a particular component should not be recorded.

Steps

Assuming audio data, video data and some sort of textual controller state messages have been recorded into a log file named state_transitions.tide, this example demonstrates overlaying the video with the textual controller state messages.

  1. Start the recording and overlay rendering pipeline:

    $ record_subtitles.sh state_visualization.ogv /video/camera1 /audio/mic1 /controller/states
    

    Note

    This part of the example assumes an configuration that enables the Spread transport for a Spread daemon listening on port 4803 of localhost, see Common Environment Variables.

  2. Replay audio, video and text data from a suitable log file:

    $ bag-play -r as-fast-as-possible state_transitions.tide 'spread://localhost:4803'
    

GStreamer Pipeline

The following diagram contains a simplified illustration of a minimal GStreamer pipeline that can be used to generate videos with text overlays from RSB event s. The vorbisenc, theoraenc and oggmux elements can be replaced with different encoders and container multiplexers as required:

audio source---> ,~~~~,--->rsbaudiosrc------------------->vorbisenc---+
                /     \                                               v
                \     /--->rsbvideosrc--------+                     oggmux--->filesink
video source--->/ RSB \                       v                       ^
                \     /                subtitleoverlay--->theoraenc---+
                /     \                       ^
text source---->`~~~~~'--->rsbtextsrc---------+