Make gstreamer graphs into maps
Ever generated a large gstreamer graph?
Make it a convenient map with OpenLayers.
gStreamer graphs can be large
Take the gst-launch
command from this previous article:
gst-launch-1.0 ximagesrc xid=0x200004c ! video/x-raw,framerate=30/1 ! videoconvert ! vaapih264enc quality-level=1 ! h264parse config-interval=10 ! queue ! mux. pulsesrc device=alsa_output.pci-0000_00_1f.3.analog-stereo.monitor ! "audio/x-raw,rate=16000,channels=2,depth=16" ! audioconvert ! avenc_aac ! aacparse ! queue ! mux. mpegtsmux name=mux ! rtpmp2tpay ! udpsink host=51.13.216.45 port=5000
You can dump a graph of the pipeline by adding GST_DEBUG_DUMP_DOT_DIR=/tmp
in front of the command.
See: gstreamer debug docs
Reminder: the dot graph in converted in to a png image via this command:
dot -Tpng 0.00.02.419736943-gst-launch.PLAYING_PAUSED.dot > pipeline.png
The resulting image of this simple pipeline is already quite wide:
Making large images into maps
gdal is the multipurpose tool to deal with map data. It comes with a Python script gdal2tiles.py
for breaking large data into tiles. Unfortunately, the script is not very convenient for plain images without any geographic references.
Instead, see gdal2tiles-leaflet
at:
https://github.com/commenthol/gdal2tiles-leaflet
This is a modified version of gdal2tiles.py which adds support for raster images as plain 2D maps in leafletjs.
Example use:
./gdal2tiles-leaflet/gdal2tiles.py -p raster -z 0-5 pipeline.png map/
Generating Base Tiles:
0...10...20...30...40...50...60...70...80...90...100 - done.
Generating Overview Tiles:
0...10...20...30...40...50...60...70...80...90...100 - done.
See the interactive result here:
http://vjordan.info/tmp/gstreamer_map_article/map/openlayers.html
Need a quick HTTP server?
While the resulting HTML page can be opened directly, it is sometimes convenient to serve it over HTTP to share it with someone.
python3 -m http.server
Have fun wandering into endless pipeline on your large streaming projects!~