aboutsummaryrefslogtreecommitdiff
path: root/voctocore/experiments/avsync.py
blob: 91ac76df654ff3d2fb7b135a1dd8bab82c12f68a (plain)
  1. #!/usr/bin/python3
  2. import gi, time
  3. import socket
  4. # import GStreamer and GTK-Helper classes
  5. gi.require_version('Gst', '1.0')
  6. from gi.repository import GLib, Gst, GObject
  7. # init GObject before importing local classes
  8. GObject.threads_init()
  9. Gst.init(None)
  10. class Example:
  11. def __init__(self):
  12. self.mainloop = GObject.MainLoop()
  13. self.src = Gst.parse_launch("""
  14. tcpserversrc port=10000 !
  15. matroskademux name=demux
  16. demux. !
  17. audio/x-raw,format=S16LE,channels=2,layout=interleaved,rate=48000,channel-mask=(bitmask)0x3 !
  18. queue !
  19. tee name=atee
  20. atee. ! queue ! interaudiosink channel=audio_cam1_mixer
  21. atee. ! queue ! interaudiosink channel=audio_cam1_mirror
  22. demux. !
  23. video/x-raw,format=I420,width=800,height=450,framerate=25/1 !
  24. queue !
  25. tee name=vtee
  26. vtee. ! queue ! intervideosink channel=video_cam1_mixer
  27. vtee. ! queue ! intervideosink channel=video_cam1_mirror
  28. """)
  29. self.sink = Gst.parse_launch("""
  30. interaudiosrc channel=audio_cam1_mirror !
  31. audio/x-raw,format=S16LE,channels=2,layout=interleaved,rate=48000,channel-mask=(bitmask)0x3 !
  32. queue !
  33. mux.
  34. intervideosrc channel=video_cam1_mirror !
  35. video/x-raw,format=I420,width=800,height=450,framerate=25/1 !
  36. queue !
  37. mux.
  38. matroskamux
  39. name=mux
  40. streamable=true
  41. writing-app=Voctomix-AVRawOutput !
  42. tcpserversink port=11000
  43. """)
  44. def run(self):
  45. self.src.set_state(Gst.State.PLAYING)
  46. self.sink.set_state(Gst.State.PLAYING)
  47. self.mainloop.run()
  48. example = Example()
  49. example.run()