Skip to content

Commit 8a47d52

Browse files
authored
Adjust real time stream analysis to work on windows (#3028)
1 parent 1aff598 commit 8a47d52

File tree

1 file changed

+30
-20
lines changed
  • demos/real_time_stream_analysis/python

1 file changed

+30
-20
lines changed

demos/real_time_stream_analysis/python/README.md

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ In the demo will be used two gRPC communication patterns which might be advantag
2424

2525
## Requirements
2626
- on the client side it could be Windows, Mac or Linux. FFMPEG should be preinstalled in order to follow the scenario with RTSP client. Python3.7+ is needed.
27-
- the server can be deployed on Linux, MacOS (only with CPU execution on x86_64 arch) or inside WSL on Windows operating system.
27+
- the server can be deployed on Linux, MacOS (only with CPU execution on x86_64 arch) or on Windows operating system (including inside WSL).
2828
- images sent over gRPC are not encoded, so there should be good network connectivity between the client and the server. At least 100Mb/s for real-time video analysis at high rate.
2929

3030
## gRPC streaming with MediaPipe graphs
@@ -42,13 +42,8 @@ Using the streaming API has the following advantages:
4242
The [holistic graph](https://github.com/openvinotoolkit/model_server/blob/releases/2025/0/demos/mediapipe/holistic_tracking/holistic_tracking.pbtxt) is expecting and IMAGE object on the input and returns an IMAGE on the output.
4343
As such it doesn't require any preprocessing and postprocessing. In this demo the returned stream will be just visualized or sent to the target sink.
4444

45-
The model server with the holistic use case can be deployed with the following steps:
46-
```bash
47-
git clone https://github.com/openvinotoolkit/model_server.git
48-
cd model_server/demos/mediapipe/holistic_tracking
49-
./prepare_server.sh
50-
docker run -d -v $PWD/mediapipe:/mediapipe -v $PWD/ovms:/models -p 9000:9000 openvino/model_server:latest --config_path /models/config_holistic.json --port 9000
51-
```
45+
The model server with the holistic use case can be deployed using steps from [this](../../mediapipe/holistic_tracking/README.md#server-deployment) article.
46+
5247
[Check more info about this use case](../../mediapipe/holistic_tracking/README.md)
5348

5449
> **Note** All the graphs with an image on input and output can be applied here without any changes on the client application.
@@ -57,7 +52,7 @@ docker run -d -v $PWD/mediapipe:/mediapipe -v $PWD/ovms:/models -p 9000:9000 ope
5752
### Start the client with real time stream analysis
5853

5954
Prepare the python environment by installing required dependencies:
60-
```bash
55+
```console
6156
cd ../../real_time_stream_analysis/python/
6257
pip install -r ../../common/stream_client/requirements.txt
6358
```
@@ -69,7 +64,7 @@ docker build ../../common/stream_client/ -t rtsp_client
6964
```
7065

7166
Client parameters:
72-
```bash
67+
```console
7368
python3 client.py --help
7469
usage: client.py [-h] [--grpc_address GRPC_ADDRESS]
7570
[--input_stream INPUT_STREAM]
@@ -111,40 +106,55 @@ The parameter `--input_stream 0 ` indicates the camera ID `0`.
111106

112107
#### Reading from the encoded video file and saving results to a file
113108

114-
```bash
115-
wget -O video.mp4 "https://www.pexels.com/download/video/3044127/?fps=24.0&h=1080&w=1920"
109+
```console
110+
curl -L "https://www.pexels.com/download/video/3044127/?fps=24.0&h=1080&w=1920" -o video.mp4
116111
python3 client.py --grpc_address localhost:9000 --input_stream 'video.mp4' --output_stream 'output.mp4'
117112
```
118113

114+
119115
#### Inference using RTSP stream
120116

121117
The rtsp client app needs to have access to RTSP stream to read from and write to. Below are the steps to simulate such stream with the video.mp4 and the content source.
122118

123-
Example rtsp server [mediamtx](https://github.com/bluenviron/mediamtx)
119+
Example rtsp server [mediamtx](https://github.com/bluenviron/mediamtx) using docker image.
124120

125121
```bash
126-
docker run --rm -d -p 8080:8554 -e RTSP_PROTOCOLS=tcp bluenviron/mediamtx:latest
122+
docker run --rm -d -p 8554:8554 -e RTSP_PROTOCOLS=tcp bluenviron/mediamtx:latest
123+
```
124+
125+
or, download and extract a standalone binary from the [mediamtx release page](https://github.com/bluenviron/mediamtx/releases/) that corresponds to your operating system and architecture
126+
alternatively you can install it for windows using `winget`.
127+
128+
```bat
129+
winget install mediamtx --silent --accept-source-agreements
130+
```
131+
132+
and start the server.
133+
134+
135+
```bat
136+
mediamtx
127137
```
128138

129139
Then write to the server using ffmpeg, example using video or camera
130140

131-
```bash
132-
ffmpeg -stream_loop -1 -i ./video.mp4 -f rtsp -rtsp_transport tcp rtsp://localhost:8080/channel1
141+
```console
142+
ffmpeg -stream_loop -1 -i ./video.mp4 -f rtsp -rtsp_transport tcp rtsp://localhost:8554/channel1
133143
```
134144

135145
```
136146
ffmpeg -f dshow -i video="HP HD Camera" -f rtsp -rtsp_transport tcp rtsp://localhost:8080/channel1
137147
```
138148

139149
While the RTSP stream is active, run the client to read it and send the output stream
140-
```bash
141-
python3 client.py --grpc_address localhost:9000 --input_stream 'rtsp://localhost:8080/channel1' --output_stream 'rtsp://localhost:8080/channel2'
150+
```console
151+
python3 client.py --grpc_address localhost:9000 --input_stream 'rtsp://localhost:8554/channel1' --output_stream 'rtsp://localhost:8554/channel2'
142152
```
143153

144154
The results can be examined with ffplay utility which reads and display the altered content.
145155

146-
```bash
147-
ffplay -pixel_format yuv420p -video_size 704x704 -rtsp_transport tcp rtsp://localhost:8080/channel2
156+
```console
157+
ffplay -pixel_format yuv420p -video_size 704x704 -rtsp_transport tcp rtsp://localhost:8554/channel2
148158
```
149159

150160

0 commit comments

Comments
 (0)