[FEATURE] Possible implementation for Streaming
ltbam opened this issue · 5 comments
Possible implementation for streaming in QGIS FMV.
We did some research and tests to support rtp streams, following changes would be necessary for a first implementation.
-
QTMultimedia and FFMPEG need to listen on different ports. Therefore we need a Splitter in front of the stream to separate AV and Data.
|-> A+V on port 8889 --> QMediaPlayer
rtp stream [port 8888] -> FFmpeg Splitter |
|->KLV to output stream --> Data Parser
- The Splitter can be implemented with FFMPEG as follow:
example: Receive AV+Data on port 8857. Forward AV on 8858 and return KLV to output stream.
ffmpeg -re -i rtp://127.0.0.1:8857
-vcodec copy -acodec copy
-map 0:0 -map 0:1
-f rtp_mpegts "rtp://127.0.0.1:8858"
-map 0:2
-f data -
-
Bind QMediaPlayer to port 8858
-
Read KLV from in Memory Buffer
We investigated a bit further and resolved that we had to split the incoming stream to separate AV and Metadata. So AV can be read with QtMultimedia and Meta with FFMPEG.
But we did not investigate further till now.
We did a small Proof of Concept to implement the Splitter and then to read the forwarded stream to QtMultimedia,
The results are encouraging!
I document briefly our work here:
-
Setup a source rtp stream with FFMPEG with A+V and Metadata:
-make a loop, generate time and just copy stream without transcoding
ffmpeg.exe -fflags +genpts -stream_loop -1 -re -i "C:\temp\uav\zentrale däniken.TS" -f rtp_mpegts -c copy -map 0:v -map 0:a -map 0:d rtp://127.0.0.1:8888 -
rename and run qt5_player_test.py
It will spawn a splitter with FFMPEG that
- Copies A+V from src stream to port :8856
- Copies Metadata from src stream to port :8857
Clic on File-> Open and on Play button, it will play the forwarded stream at 127.0.0.1:8856 and you will see the metadata in console.
We can alternatively forward metadata to another port and read later.
For info here are the used commands for the splitter:
:8888 -> A+V 8848 AND Meta -> Stdout
ffmpeg.exe -hide_banner -loglevel panic -i rtp://127.0.0.1:8888 -c copy -map 0:v -map 0:a -f rtp_mpegts rtp://127.0.0.1:8848 -map 0:d -f data -
:8888 -> A+V 8848 AND Meta -> 8849
ffmpeg.exe -i rtp://127.0.0.1:8888 -vcodec copy -acodec copy -map 0:a -map 0:v -f rtp_mpegts rtp://127.0.0.1:8848 -map 0:d -f data rtp://127.0.0.1:8849
Next step will be integration in Qgis_fmv plugin.