Issues with using Qt Multimedia with ffmpeg in Qt 6.5, audio streaming on MacOS
-
Hi! I have a project where I use a QMediaPlayer to play audio files. I have set the "QT_MEDIA_BACKEND=ffmpeg" variable. While playing local files works flawlessly, passing an url to a file hosted in a cloud service with HTTPS protocol fails with the following error: https protocol not found, recompile FFmpeg with openssl, gnutls or securetransport enabled.
How do I resolve this issue? I don't know where to start if I wanted to recompile FFmpeg as suggested in the application output. Below is some more explanation of my actual problem.
I have read that ffmpeg will become the default backend for Qt Multimedia since Qt 6.5. I am interested in using it, since the native backend on MacOS does not seem to work with files streamed from cloud - QMediaPlayer reports a QMediaPlayer::FormatError when I try to play a file. On Windows I have no issues with audio streaming with the native OS backend.
The minimal code-example used to play audio files is as follows (I don't think it is relevant in this case though):
void MainWindow::playAudio(const QUrl &url) { mediaPlayer.setSource(url); mediaPlayer.play(); }
Any input to this issue will be much appreciated.
-
Hi,
You are likely hitting QTBUG-110708.
-
@SGaist Hi! Thank you for the quick reply. I will test it again with Qt 6.5.1 then and mark the thread as solved if this fixes my issues :)
@SGaist Actually further testing shows that it is not the backend of Qt Multimedia that causes the issue, although I have some hope that ffmpeg could resolve it. The problem when using the native OS backend (MacOS = darwin) seems to come from the QUrl I pass to the setSource() method. My URL points to a file hosted online and although it works on Windows when I am streaming the file and I can download the file both on Windows and MacOS, I cannot play it on MacOS as if it is wrongly interpreted. Are there any special requirements for the QUrl passed to the setSource()?
-
@SGaist Sorry for the late reply. What do you mean by "protocol"? I host the files in a cloud service, which I prompt for the file URL. It is always using the HTTPS protocol. Strange that it works on Windows, but not MacOS. Interestingly, using the URL on MacOS in VLC works just fine and I can stream the media. As mentioned in the original question, setting source to such URL results in a QMediaPlayer::FormatError, which is a hint, but too cryptic to understand what the cause is.
-
@SGaist Yes in case of Qt 6.5.0, but this also happens with Qt 6.3.1, although the error I can read from QMediaPlayer is different:
- Qt 6.5.0: QMediaPlayer::ResourceError
- Qt 6.3.1: QMediaPlayer::FormatError
Edit:
The root cause of this issue was connected to file types and the way my url was constructed. I opted to use the native darwin backend with Qt 6.5 instead of the new ffmpeg, at least until 6.5.1 is out and I can do further testing. Thank you for the valuable input (as always!). -
-