Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- # -*- coding:utf-8 -*-
- import sys
- import gi
- gi.require_version('Gst', '1.0')
- from gi.repository import Gst
- Gst.init(None)
- pipeline = Gst.parse_launch("v4l2src device=/dev/video0 ! capsfilter name=mycapsfilter caps=video/x-raw,width=1280,height=720 ! x264enc tune=zerolatency ! mp4mux ! filesink location=/tmp/file.mp4")
- # Start playing
- pipeline.set_state(Gst.State.PLAYING)
- aaa = pipeline.get_by_name('mycapsfilter')
- while True:
- print "+ [1], - [2], end [0]"
- x = raw_input()
- if x=='0':
- print "END"
- bus = pipeline.get_bus()
- bus.add_signal_watch()
- pipeline.send_event(Gst.Event.new_eos())-
- msg = bus.timed_pop_filtered(Gst.CLOCK_TIME_NONE, Gst.MessageType.ERROR | Gst.MessageType.EOS)
- pipeline.set_state(Gst.State.NULL)
- sys.exit()
- elif x=='1':
- print "+"
- aaa.set_property("caps", 'video/x-raw,width=1280,height=720')
- elif x=='2':
- print "-"
- aaa.set_property("caps", 'video/x-raw,width=320,height=240')
- elif x=='4':
- print"RESOLUTION +"
- else:
- print "wtf"
Advertisement
Add Comment
Please, Sign In to add comment