Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- import time
- import sys
- import gi
- gi.require_version("Gst", "1.0")
- from gi.repository import Gst
- def main():
- Gst.init(sys.argv) # init gstreamer
- Gst.debug_set_default_threshold(Gst.DebugLevel.WARNING)
- serial = None
- pipeline = Gst.parse_launch("tcambin name=bin"
- " ! video/x-raw,format=BGRx,width=1920,height=1080,framerate=1/1"
- " ! videoconvert"
- " ! avimux"
- " ! filesink name=fsink")
- # serial is defined, thus make the source open that device
- if serial is not None:
- camera = pipeline.get_by_name("bin")
- camera.set_property("serial", serial)
- names = camera.get_tcam_property_names()
- for name in property_names:
- try:
- base = self.source.get_tcam_property(name)
- print("{}\t{}".format(base.get_display_name(), name))
- except Exception as error:
- raise RuntimeError(f"Failed to get property '{name}'") from error
- file_location = "/root/recordings/test-sdr-" + str(int(time.time())) + ".avi"
- fsink = pipeline.get_by_name("fsink")
- fsink.set_property("location", file_location)
- pipeline.set_state(Gst.State.PLAYING)
- print("recording 5 secs..")
- time.sleep(5)
- print("stop recording")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement