1

I've made a pan/tilt device with a raspberry pi 3 and I'm looking for a way to flip the stream when the camera tilts past 90 degrees. I'm using mjpg-streamer with motion, but wondering if streaming from python to motion is possible. That way I can do things like cam.vflip = true. Is this possible? Is there a better way?

Thanks in advance.

Update: I have been testing with this code

from picamera import *
from http.server import BaseHTTPRequestHandler, HTTPServer

with PiCamera() as cam:
    stream = PiCameraCircularIO(cam, seconds=10)## I have tested with multiple types of streams, all the same reasult.
    cam.start_recording(stream, format='h264')
    cam.wait_recording(10)
    cam.stop_recording()

class MyHandler(BaseHTTPRequestHandler):
    def do_GET(self):
        self.send_response(200)
        self.send_header('Content-type', 'video/h264')
        self.end_headers()
        stream.copy_to(self.wfile)
        return

def start():
    server_address = ('192.168.1.200', 7878)
    httpd = HTTPServer(server_address, MyHandler)
    print('server starting')
    httpd.serve_forever()
start()

The server works and the file comes across, but when I play it with vlc media player on my windows 10 pc it just looks black.

jath03
  • 426
  • 1
  • 4
  • 13
  • I don't know much about motion (I've no idea how it takes its input), but it's easy to have the camera output an MJPEG stream to a pipe for another process to read (or a socket, or whatever else you're using to connect mpg-streamer to motion). – Dave Jones Aug 08 '16 at 21:11
  • @DaveJones Here are the docs for motion. I have no experience with subprocess so I don't know what that program does. I have been feeding input to motion via the netcam setting in the config. – jath03 Aug 09 '16 at 17:44

0 Answers0