From b961f568c6cb226c82c112ae1624722956e25bbe Mon Sep 17 00:00:00 2001 From: Vishwa2684 Date: Wed, 8 Jul 2026 18:36:36 +0530 Subject: [PATCH 1/2] Add ffmpeg_output_width and ffmpeg_output_height inorder to prevent tearing of output in rtsp sink --- demos/real_time_stream_analysis/python/client.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/demos/real_time_stream_analysis/python/client.py b/demos/real_time_stream_analysis/python/client.py index 00e76e6561..5a0ce18f7e 100755 --- a/demos/real_time_stream_analysis/python/client.py +++ b/demos/real_time_stream_analysis/python/client.py @@ -23,6 +23,8 @@ parser = argparse.ArgumentParser() parser.add_argument('--grpc_address', required=False, default='localhost:9022', help='Specify url to grpc service') +parser.add_argument('--ffmpeg_output_width', required=False, default=None, type=int, help='Width of the output video') +parser.add_argument('--ffmpeg_output_height', required=False, default=None, type=int, help='Height of the output video') parser.add_argument('--input_stream', required=False, default="rtsp://localhost:8080/channel1", type=str, help='Url of input rtsp stream') parser.add_argument('--output_stream', required=False, default="rtsp://localhost:8080/channel2", type=str, help='Url of output rtsp stream') parser.add_argument('--model_name', required=False, default="holisticTracking", type=str, help='Name of the model') @@ -54,6 +56,12 @@ def postprocess(frame, result): backend = StreamClient.OutputBackends.cv2 exact = True -client = StreamClient(postprocess_callback = postprocess, preprocess_callback=preprocess, output_backend=backend, source=args.input_stream, sink=args.output_stream, exact=exact, benchmark=args.benchmark, verbose=args.verbose) +if args.output_stream[:4] == "rtsp": + if(args.ffmpeg_output_width is None or args.ffmpeg_output_height is None): + print("Please specify output width (--ffmpeg_output_width) and height (--ffmpeg_output_height) for ffmpeg output") + sys.exit(-1) + client = StreamClient(postprocess_callback = postprocess, preprocess_callback=preprocess, output_backend=backend, source=args.input_stream, sink=args.output_stream, exact=exact, benchmark=args.benchmark, verbose=args.verbose,ffmpeg_output_width=args.ffmpeg_output_width, ffmpeg_output_height=args.ffmpeg_output_height) +else: + client = StreamClient(postprocess_callback = postprocess, preprocess_callback=preprocess, output_backend=backend, source=args.input_stream, sink=args.output_stream, exact=exact, benchmark=args.benchmark, verbose=args.verbose) client.start(ovms_address=args.grpc_address, input_name=args.input_name, model_name=args.model_name, datatype = StreamClient.Datatypes.uint8, batch = False, limit_stream_duration = args.limit_stream_duration, limit_frames = args.limit_frames, streaming_api=True) From 450e759529274b6070bb1818a3f9e2b0997a5bff Mon Sep 17 00:00:00 2001 From: Vishwa2684 <115179890+Vishwa2684@users.noreply.github.com> Date: Mon, 13 Jul 2026 13:05:35 +0530 Subject: [PATCH 2/2] Simplify StreamClient initialization logic Removed conditional handling for RTSP output stream parameters and simplified StreamClient initialization. --- demos/real_time_stream_analysis/python/client.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/demos/real_time_stream_analysis/python/client.py b/demos/real_time_stream_analysis/python/client.py index 5a0ce18f7e..39934f6e80 100755 --- a/demos/real_time_stream_analysis/python/client.py +++ b/demos/real_time_stream_analysis/python/client.py @@ -56,12 +56,6 @@ def postprocess(frame, result): backend = StreamClient.OutputBackends.cv2 exact = True -if args.output_stream[:4] == "rtsp": - if(args.ffmpeg_output_width is None or args.ffmpeg_output_height is None): - print("Please specify output width (--ffmpeg_output_width) and height (--ffmpeg_output_height) for ffmpeg output") - sys.exit(-1) - client = StreamClient(postprocess_callback = postprocess, preprocess_callback=preprocess, output_backend=backend, source=args.input_stream, sink=args.output_stream, exact=exact, benchmark=args.benchmark, verbose=args.verbose,ffmpeg_output_width=args.ffmpeg_output_width, ffmpeg_output_height=args.ffmpeg_output_height) -else: - client = StreamClient(postprocess_callback = postprocess, preprocess_callback=preprocess, output_backend=backend, source=args.input_stream, sink=args.output_stream, exact=exact, benchmark=args.benchmark, verbose=args.verbose) +client = StreamClient(postprocess_callback = postprocess, preprocess_callback=preprocess, output_backend=backend, source=args.input_stream, sink=args.output_stream, exact=exact, benchmark=args.benchmark, verbose=args.verbose,ffmpeg_output_width=args.ffmpeg_output_width, ffmpeg_output_height=args.ffmpeg_output_height) client.start(ovms_address=args.grpc_address, input_name=args.input_name, model_name=args.model_name, datatype = StreamClient.Datatypes.uint8, batch = False, limit_stream_duration = args.limit_stream_duration, limit_frames = args.limit_frames, streaming_api=True)