I have tested with different settings all the result is about the same delay of 500 ms.
Tests:
create_video_configuration set to buffer_count=1, Delay of 500 ms
create_video_configuration set to encode="lores", Delay of 500 ms
H264Encoder set to different bitrate only image quality is affected with delay of 500 ms
H264Encoder set to iperiod=1, default is 6 but the change do not affect the delay
picam2.start_encoder set quality=Quality.VERY_LOW and VERY_HIGH but the change do not affect the delay
Is there a other way to stream direct to VLC with latency below 100ms?
Tests:
create_video_configuration set to buffer_count=1, Delay of 500 ms
create_video_configuration set to encode="lores", Delay of 500 ms
H264Encoder set to different bitrate only image quality is affected with delay of 500 ms
H264Encoder set to iperiod=1, default is 6 but the change do not affect the delay
picam2.start_encoder set quality=Quality.VERY_LOW and VERY_HIGH but the change do not affect the delay
Is there a other way to stream direct to VLC with latency below 100ms?
Code:
import socketimport timefrom picamera2 import Picamera2from picamera2.encoders import H264Encoder, Qualityfrom picamera2.outputs import FileOutputpicam2 = Picamera2()video_config = picam2.create_video_configuration(buffer_count=1, encode="main", queue=False, main={"size": (1536, 864)}, lores={"size": (320, 240)}) picam2.configure(video_config)encoder = H264Encoder(bitrate=10000000, iperiod=1)with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock: sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) sock.bind(("0.0.0.0", 10001)) sock.listen() picam2.encoders = encoder conn, addr = sock.accept() stream = conn.makefile("wb") encoder.output = FileOutput(stream) picam2.start_encoder(encoder, quality=Quality.MEDIUM) picam2.start() time.sleep(20) picam2.stop() picam2.stop_encoder() conn.close()
Statistics: Posted by GlennGB — Sun Oct 27, 2024 8:20 am