qmediaplayer

Modifing and displaying QVideoFrames obtained in QAbstractVideoSurface

前提是你 提交于 2020-06-03 16:02:01
问题 I have very a simply application written in QT in which I want to display a movie by using QMediaPlayer , but before I will display any frame I would like to detect on it some objects and mark them by drawing a rectangle over it. I've read in http://doc.qt.io/qt-5/videooverview.html that I can access each frame by subclassing QAbstractVideoSurface and so I dit it. class VideoSurface : public QAbstractVideoSurface { Q_OBJECT bool present(const QVideoFrame &frame) override { if (surfaceFormat()

Using a resource file in QMediaPlayer

喜欢而已 提交于 2020-01-02 07:06:20
问题 How do I load a .mp3 file to use in a QMediaPlayer from a .qrc resource file? This is what I have so far QMediaPlayer *player = new QMediaPlayer; player->setMedia(QUrl::fromLocalFile(":/audio/theme.mp3")); player->play(); resources.qrc: <RCC> <qresource prefix="/audio"> <file>theme.mp3</file> </qresource> </RCC> theme.mp3 is located in the project directory. 回答1: Use m_player->setMedia(QUrl("qrc:/audio/theme.mp3")); If you are using Qt Creator, you can copy this url to clipboard by pressing

QMediaPlayer doesn't produce audio

走远了吗. 提交于 2019-12-31 05:35:12
问题 I am starting out in C++ and I am trying to play an mp3 file with Qt. I wrote this code but it is not working for some reason. I have searched the internet but was unable to find something that would help. Here's my code: #include <iostream> #include <QMediaPlayer> #include <QMediaPlaylist> #include <QFileInfo> #include <QUrl> int main() { QMediaPlaylist *list = new QMediaPlaylist; list->addMedia(QUrl::fromLocalFile(QFileInfo("Filename.mp3").absoluteFilePath())); QMediaPlayer *music; music =

How to save a frame using QMediaPlayer?

只愿长相守 提交于 2019-12-29 09:22:05
问题 I want to save an image of a frame from a QMediaPlayer . After reading the documentation, I understood that I should use QVideoProbe. I am using the following code : QMediaPlayer *player = new QMediaPlayer(); QVideoProbe *probe = new QVideoProbe; connect(probe, SIGNAL(videoFrameProbed(QVideoFrame)), this, SLOT(processFrame(QVideoFrame))); qDebug()<<probe->setSource(player); // Returns true, hopefully. player->setVideoOutput(myVideoSurface); player->setMedia(QUrl::fromLocalFile("observation

[Windows, Qt5, QMediaPlayer, QMediaPlaylist]: Tiny duration black screen when the current video source changed

佐手、 提交于 2019-12-25 12:52:25
问题 I'm writing a Video Player with Qt5::QMediaPlayer to play randomly some videos for a randomly duration as this: int main(int argc, char *argv[]) { QApplication a(argc, argv); QMediaPlaylist* playlist = new QMediaPlaylist(&a); playlist->addMedia(QUrl::fromLocalFile("./Resources/fractal-files/A-060405V4651.WMV")); playlist->addMedia(QUrl::fromLocalFile("./Resources/fractal-files/E-102604.WMV")); playlist->addMedia(QUrl::fromLocalFile("./Resources/fractal-files/C-102304.WMV")); QMediaPlayer*

[Windows, Qt5, QMediaPlayer, QMediaPlaylist]: Tiny duration black screen when the current video source changed

∥☆過路亽.° 提交于 2019-12-25 12:52:10
问题 I'm writing a Video Player with Qt5::QMediaPlayer to play randomly some videos for a randomly duration as this: int main(int argc, char *argv[]) { QApplication a(argc, argv); QMediaPlaylist* playlist = new QMediaPlaylist(&a); playlist->addMedia(QUrl::fromLocalFile("./Resources/fractal-files/A-060405V4651.WMV")); playlist->addMedia(QUrl::fromLocalFile("./Resources/fractal-files/E-102604.WMV")); playlist->addMedia(QUrl::fromLocalFile("./Resources/fractal-files/C-102304.WMV")); QMediaPlayer*

Play mp3 file in the resource with QMediaPlayer

删除回忆录丶 提交于 2019-12-22 11:01:11
问题 I try to play mp3 files declared in the resource, but it show: Btn clicked current media: "qrc://sound/sound/FarAway.mp3" Error : QMediaPlayer::FormatError Media state : QMediaPlayer::InvalidMedia Here's how I set media: player = new QMediaPlayer(this); player->setMedia(QUrl(mediaFilePath)); qDebug() << "current media: " << player->currentMedia().canonicalUrl().toString(); connect(player, SIGNAL(stateChanged(QMediaPlayer::State)), SLOT(handleStateChanged(QMediaPlayer::State))); connect(player

QMediaplayer streaming from a custom QIODevice with encryption on Mac OS (10.9)

爷,独闯天下 提交于 2019-12-19 10:32:26
问题 i'm currently porting an application from Qt4(.8.4) to Qt5(.2.0). I'm nearly done with all the known changes like deprecated toAscii()-function, missing QtGui and so on. Now we had a music player using the phonon framework which is not supported any more and got replaced by the QtMultimedia module including the QMediaPlayer and a bunch of Audio-Handling classes. Our implementation of the player takes a custom QIODevice. This device provides an interface to encrypted audiofiles on the disk.

Disable showing subtitle file in QMediaPlayer

这一生的挚爱 提交于 2019-12-12 14:13:08
问题 How to disable QMediaPlayer autoload subtitles with DirectVobSub which is tools of K-Lite Codec Pack? i don't want to show subtitle in QMediaPlayer if the subtitle file be in same directory of the video file? 回答1: Answer As QMediaPlayer relies on external frameworks for rendering video, it has limited control over how those frameworks decide to render it. In this case, as George Y. mentioned, the subtitles are probably not possible to control without resorting to win32 API. Another option

How to make a proxy working with QMediaPlayer in Qt5?

你。 提交于 2019-12-12 02:37:55
问题 I have a little problem with my project on Qt. I am trying to play a web-radio directly with QMediaPlayer like this : QMediaPlayer player; player.setMedia(QUrl("http://listen.42fm.ru:8000/stealkill")); player.play(); It works but another constraint I have is to setup an SSH tunneling (port 8000 is blocked on the network of deployment). So i set up my port forwarding on my device and I configured Qt proxy like this: QNetworkProxy proxy; proxy.setType(QNetworkProxy::Socks5Proxy); proxy