示例#1
0
 def test_tee(self):
     """Test that a basic tee works fine."""
     p = Part('fakesrc') + gs.Tee('t', Part('fakesink'), Part('fakesink'))
     e = 'fakesrc ! tee name=t ! queue ! fakesink t. ! queue ! fakesink'
     self.assertEqual(p, e)
示例#2
0
import networking.messages as m
from processing.tapecontours import get_corners_from_image
Gst = gs.Gst

if __name__ == '__main__':
    conf = config.configfor('Vision')

    logging.config.dictConfig(conf.logging)
    logger = logging.getLogger(__name__)

    gs.delete_socket()

    pipeline = gs.pipeline(
        gs.RaspiCam(**conf.params) +
        gs.Tee('t',
               gs.Valve('valve') + gs.H264Video() +
               gs.H264Stream(), gs.SHMSink()))

    pipeline.set_state(Gst.State.PLAYING)

    # Start debugging the gstreamer pipeline
    debuggingThread = gs.MessagePrinter(pipeline)
    debuggingThread.start()

    # TODO: Find a better method to wait for playback to start
    logger.debug(pipeline.get_state(
        Gst.CLOCK_TIME_NONE))  # Wait for pipeline to play

    caps = gs.get_sink_caps(pipeline.get_by_name(gs.SINK_NAME))
    cap_string = gs.make_command_line_parsable(caps)
示例#3
0
from processing.stereo import process

Gst = gs.Gst

if __name__ == '__main__':
    conf = config.configfor('Vision')

    logging.config.dictConfig(conf.logging)
    logger = logging.getLogger(__name__)

    gs.delete_socket('/tmp/foo0')
    gs.delete_socket('/tmp/foo1')

    leftpipeline = gs.pipeline(
        gs.Webcam(device='/dev/video0') +
        gs.Tee('t', gs.SHMSink(socket_path='/tmp/foo0'),
               gs.H264Video() + gs.TSFile(gs.ts_filename(), False)))

    rightpipeline = gs.pipeline(
        gs.Webcam(device='/dev/video1') +
        gs.Tee('t', gs.SHMSink(socket_path='/tmp/foo1'),
               gs.H264Video() + gs.TSFile(gs.ts_filename(), False)))
    leftpipeline.set_state(Gst.State.PLAYING)
    rightpipeline.set_state(Gst.State.PLAYING)

    leftdebuggingThread = gs.MessagePrinter(leftpipeline)
    rightdebuggingThread = gs.MessagePrinter(rightpipeline)
    leftdebuggingThread.start()
    rightdebuggingThread.start()

    # TODO: Find a better method to wait for playback to start
    logger.debug(leftpipeline.get_state(Gst.CLOCK_TIME_NONE))
示例#4
0
    conn, _ = s.accept()
    logger.debug('Got incoming time socket connection')
    time = conn.recv(200)
    logger.info('Got time %s', time)

    pipeline = gs.pipeline(
        # gs.PipelinePart('v4l2src device=/dev/video0 name=pipe_src ! video/x-h264,width=1280,height=720,framerate=15/1,profile=baseline') + gs.H264Stream(port=5002) # Default to port 5002
        gs.PipelinePart((
            'uvch264src device=/dev/video{} name=pipe_src auto_start=true initial-bitrate=1500000 '
            # 'initial-bitrate=3000000 average-bitrate=3000000 peak-bitrate=5000000 '
            # 'rate-control=vbr iframe-period=1000 '
            'pipe_src.vfsrc ! queue ! video/x-raw,format=YUY2,width=320,height=240,framerate=10/1 ! fakesink '
            'pipe_src.vidsrc ! queue ! video/x-h264,width=1280,height=720,framerate=30/1 '
        ).format(camera)) + gs.Valve('valve') + gs.Tee(
            'tee',
            gs.H264Stream(port=5002),  # Default to port 5002
            gs.PipelinePart('filesink append=true location=/mnt/usb/video/' +
                            gs.ts_filename())))

    # Alternative:
    # gst-launch-1.0 -v -e

    pipeline.set_state(Gst.State.PLAYING)

    # Start debugging the gstreamer pipeline
    debuggingThread = gs.MessagePrinter(pipeline)
    debuggingThread.start()

    # TODO: Find a better method to wait for playback to start
    logging.debug(pipeline.get_state(
        Gst.CLOCK_TIME_NONE))  # Wait for pipeline to play
示例#5
0
gs.delete_socket()

pipeline = gs.pipeline(
    gs.RaspiCam(vflip=True,
                hFlip=True,
                expmode=6,
                framerate=30,
                ec=10,
                awb=False,
                ar=1,
                ab=2.5,
                width=1280,
                height=960) + gs.PipelinePart('videoconvert') +
    gs.Tee(
        't',
        gs.Valve('valve') + gs.H264Video() + gs.H264Stream(),
        gs.PipelinePart('videoscale ! video/x-raw, width=640, height=480') +
        gs.SHMSink()))

# Start debugging the gstreamer pipeline
debuggingThread = gs.MessagePrinter(pipeline)
debuggingThread.start()

pipeline.set_state(Gst.State.PLAYING)

logger.debug(pipeline.get_state(Gst.CLOCK_TIME_NONE))

caps = gs.get_sink_caps(pipeline.get_by_name(gs.SINK_NAME))
cap_string = gs.make_command_line_parsable(caps)

vc = VideoCapture(gs.SHMSrc(cap_string))