From 9e4369a3b3824a74b027da1dd10a8c4e59704c0c Mon Sep 17 00:00:00 2001 From: KenwoodFox Date: Thu, 7 Apr 2022 10:53:09 -0400 Subject: [PATCH] try this --- Software/houston/RobotStreamer.py | 41 ++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/Software/houston/RobotStreamer.py b/Software/houston/RobotStreamer.py index f0081fc..5a06d4d 100644 --- a/Software/houston/RobotStreamer.py +++ b/Software/houston/RobotStreamer.py @@ -16,7 +16,7 @@ class Streamer: # ffmpeg command - # ffmpeg --stream_loop -1 -re -i ~/INPUT_FILE -vcodec libx264 -profile:v main -preset:v medium -r 30 -g 60 -keyint_min 60 -sc_threshold 0 -b:v 2500k -maxrate 2500k -bufsize 2500k -sws_flags lanczos+accurate_rnd -acodec aac -b:a 96k -ar 48000 -ac 2 -f flv rtmp://rtmp.robotstreamer.com/live/123?key=123 + # ffmpeg --stream_loop -1 -re -i ~/INPUT_FILE -vcodec libx264 -profile:v main -preset:v medium -r 20 -g 60 -keyint_min 60 -sc_threshold 0 -b:v 2500k -maxrate 2500k -bufsize 2500k -sws_flags lanczos+accurate_rnd -acodec aac -b:a 96k -ar 48000 -ac 2 -f flv rtmp://rtmp.robotstreamer.com/live/123?key=123" cmd_out = [ "ffmpeg", "-f", @@ -28,10 +28,40 @@ class Streamer: "-i", "-", # Indicated input comes from pipe "-vcodec", - "png", - "-qscale", + "libx264", + "-profile:v", + "main", + "-pix_fmt", + "yuv420p", + "-preset:v", + "medium", + "-r", + "30", + "-g", + "60", + "-keyint_min", + "60", + "-sc_threshold", "0", - "/tmp/robotstreamer.mp4", + "-b:v", + "2500k", + "-maxrate", + "2500k", + "-bufsize", + "2500k", + "-sws_flags", + "lanczos+accurate_rnd", + "-acodec", + "aac", + "-b:a", + "96k", + "-ar", + "48000", + "-ac", + "2", + "-f", + "flv", + "rtmp://rtmp.robotstreamer.com/live/topcec", ] # This is the ffmpeg pipe streamer! @@ -45,6 +75,8 @@ class Streamer: raw = self.root.get_image(0, 0, self.x1, self.y1, X.ZPixmap, 0xFFFFFFFF) image = Image.frombytes("RGB", (self.x1, self.y1), raw.data, "raw", "BGRX") + image = image.crop((0, 200, self.x1, self.y1)) + return image def stream(self): @@ -65,4 +97,5 @@ class Streamer: if __name__ == "__main__": myStreamer = Streamer() + # myStreamer.getFrame().show() myStreamer.stream()