Realize low-latency transmission of rtsp video stream, and ' Application provided invalid, non monotonically increasing dts to muxer in stream 0' problem
Hello, I want to achieve low-latency transmission of rtsp video streams through ffmpeg-python, here is my code: ` process1 = ( ffmpeg .input('rtsp://localhost/test',format='rtsp') .output('pipe:', vcodec='copy') .run_async(pipe_stdout=True) )
process2 = ( ffmpeg .input('pipe:', format='rawvideo', s='{}x{}'.format(width, height)) .output('rtsp://localhost/test', format='rtsp', vcodec='copy') .overwrite_output() .run_async(pipe_stdin=True) )
while True: in_bytes = process1.stdout.read(width * height * 3) if not in_bytes: break in_frame = ( np.frombuffer(in_bytes, np.uint8) # numpy.ndarry .reshape([height, width, 3]) ) out_frame = in_frame * 0.3 process2.stdin.write(out_frame.astype(np.uint8).tobytes())
process2.stdin.close() process1.wait() process2.wait() ` One problem is that I set vcodec='copy' in process1 at the receiving end (local rtsp server) of the video stream, and the streaming delay drops significantly (<0.5s), but there will be 'Application provided invalid, non monotonically increasing dts to muxer in stream 0' (error or warning?), But the program can still continue to execute. How should I modify the code and parameters, or is there a better solution? Thanks!