QMediaPlayer Problems with H265 and H264 Streams.
-
I am attempting to display a stream broadcast with the following gstreamer pipeline:
gst-launch-1.0 nvarguscamerasrc sensor-id=0 ! 'video/x-raw(memory:NVMM), width=4056, height=3040, framerate=30/1' ! nvvidconv ! 'video/x-raw(memory:NVMM), width=507, height=380' ! nvv4l2h265enc insert-sps-pps=true iframeinterval=30 ! h265parse ! rtph265pay ! queue ! udpsink host=192.168.0.130 port=5100
I am able to view the output of that stream using the following gstreamer pipeline on a second computer:
gst-launch-1.0 udpsrc port=5100 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H265" ! rtph265depay ! h265parse ! avdec_h265 ! videoconvert ! autovideosink
Additionally, I can view the stream using ffmpeg:
ffmpeg -protocol_whitelist file,udp,rtp -buffer_size 1000000 -i testing.sdp -f sdl "Output"
The testing.sdp looks like the following:
v=0 o=- 123456 1 IN IP4 127.0.0.1 s=Sample c=IN IP4 127.0.0.1 t=0 0 m=video 5100 RTP/AVP 96 a=rtpmap:96 H265/90000
I can also open that .sdp with vlc and view the stream.
I am having substantial trouble with trying to get this working in Qt6.6.0. Here is my mainwindow.cpp:
#include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); // Initialize player and video widget player = new QMediaPlayer(this); videoWidget = new QVideoWidget(this); // Set video widget as central widget setCentralWidget(videoWidget); // Set video output to the video widget player->setVideoOutput(videoWidget); // Set the media source URL with your UDP stream //player->setSource(QUrl("http://username:password@192.168.0.207/axis-cgi/mjpg/video.cgi")); // Set the media source URL with your SDP file //player->setSource(QUrl::fromLocalFile("/path/to/testing.sdp")); // Set the media source URL with your UDP stream player->setSource(QUrl("udp://@:5100")); // Start playing player->play(); } MainWindow::~MainWindow() { delete ui; }
I have validated the the first commented out stream for another ip camera works as intended but I have problems with attempting the 2 different ways to read for the stream I want to. I have additionally tried with both the ffmpeg and gstreamer backends, swapping with the following:
export QT_DEFAULT_MEDIA_BACKEND=gstreamer export QT_MEDIA_BACKEND=gstreamer
or
export QT_DEFAULT_MEDIA_BACKEND=ffmpeg export QT_MEDIA_BACKEND=ffmpeg
I have additionally tried changing to h264 instead with no effect. The ffmpeg backend gives me the following errors that I can seem to fix:
qt.multimedia.ffmpeg.libsymbolsresolver: Couldn't load OpenSsl library qt.multimedia.ffmpeg.libsymbolsresolver: Couldn't load VAAPI library
and the gstreamer backend gives me the following errors:
qt.multimedia.player: Unable to set the pipeline to the paused state.
or when trying the .sdp method:
qt.multimedia.player: Warning: "No decoder available for type 'application/sdp'."
Any help would be greatly appreciated, I have been struggling with this for a few days. Additionally my understanding is the custom gstreamer pipelines aren't supported in qt 6.6.0, but I may try a custom pipeline on an old version of qt 5 instead.
-
Hi and welcome to devnet,
It seems you are missing the libva package on your system.
Also, which version of OpenSSL do you have installed ?