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.