Is it possible to produce compressed Video/Audio streams using Qt6 Multimedia
-
It took me some days for learning new Qt6 classes such as QVideoSink and QAudioSink. With these classes, raw media frames can be mapped into memory bytes. How ever, for the next step , raw bytes may need to be compressed first , just before pushing them to QTcpSocket. Low network bandwidth can not support multi users streaming uncompressed frames together.
Is it possible to redirect QMediaRecorder's QUrl location to a TCP socket or an SDP/RTP stream ? Such as "rtp://192.168.1.100:12345"
Or any method to call low-level compress algs in QVideoSink ? openCV or ffpmeg may be good, but using pure Qt6 is more elegant.
Thanks a lot !
-
Oh,I think I solved this problem temporarily through ffmpeg.
user@localhost$ ffmpeg -re -i /dev/video2 -f v4l2 -framerate 30 -video_size 1280x768 -c:v libx264 -f rtp rtp://192.168.1.100:10000
In this way, I can start ffpmeg in QProcess and then push the video frames to another machine. VLC player can open .sdp file (Text file ^V from ffmpeg stderr output ) and handle the RTP stream correctly.
However, is there any purer method just using Qt C++ interface?
-
Hi,
I don't know it will be part of its capabilities but there's a new ffmpeg based backed for QtMultimedia that you should take a look at.
Otherwise, ffmpeg is also a set of libraries that you can use directly.