mirror of
https://github.com/matthew1000/gstreamer-cheat-sheet.git
synced 2024-11-24 09:11:00 +00:00
31 lines
735 B
Python
31 lines
735 B
Python
#!/usr/bin/env python
|
|
#
|
|
# Plays a test screen to screen.
|
|
#
|
|
# Equivalent to:
|
|
# gst-launch-1.0 videotestsrc ! videoconvert ! autovideosink
|
|
#
|
|
|
|
import gi
|
|
gi.require_version('Gst', '1.0')
|
|
from gi.repository import GObject, Gst
|
|
import os
|
|
|
|
Gst.init()
|
|
mainloop = GObject.MainLoop()
|
|
|
|
pipeline = Gst.Pipeline.new("pipe")
|
|
|
|
videotestsrc = Gst.ElementFactory.make("videotestsrc", "videotestsrc")
|
|
videoconvert = Gst.ElementFactory.make("videoconvert", "videoconvert")
|
|
autovideosink = Gst.ElementFactory.make("autovideosink", "autovideosink")
|
|
|
|
pipeline.add(videotestsrc)
|
|
pipeline.add(videoconvert)
|
|
pipeline.add(autovideosink)
|
|
|
|
videotestsrc.link(videoconvert)
|
|
videoconvert.link(autovideosink)
|
|
|
|
pipeline.set_state(Gst.State.PLAYING)
|
|
mainloop.run()
|