Pergunta

I'm trying to make a multimedia database system using Qt. I'm using QMultimedia to play back videos in a QVideoWidget.

The following is the code I am using to play a video file in a QVideo Widget:

 mMediaPlayer = new QMediaPlayer();
  mMediaPlaylist = new QMediaPlaylist();
  QMediaContent content(QMediaResource())
  mMediaPlaylist->addMedia(QUrl::fromLocalFile(QDir(QString("data")).absoluteFilePath(QString("%1.dat").arg(mMedia.GetUID()))));
    mMediaPlayer->setPlaylist(mMediaPlaylist);


    mVideoWidget = new QVideoWidget();
    mMediaPlayer->setVideoOutput(mVideoWidget);
    this->setCentralWidget(mVideoWidget);
    mVideoWidget->show();
    mMediaPlayer->play();

Basically, it plays a file called 1.dat for example, which is just a renamed video file (video.mp4 for example). However, playing the video never works, and the following error is produced:

DirectShowPlayerService::doRender: Unresolved error code 80040266

With some google searching, I found that this error is because QMultimedia doesn't have the required codecs/filters to play the format of the video. I've tried converting my videos to many different formats using ffmpeg, while trying formats specified at Supported Formats in DirectShow and Supported Media Formats in Media Foundation. I've also tried installing Directshow Filters for Ogg Vorbis, Speex, Theora, FLAC, and WebM, and converting my video to theora/vorbis in an ogg container. Still no go.

I should note that I did manage to play one mpg file, so I do know QMultimedia is working. But I tried converting another video to mimic the properties of that mpg file, and it didn't seem to work, so it seems QMultimedia is extremely specific in what formats it supports.

What system is QMultimedia using for its backend decoding? How can I find out what types of encodings and containers it supports? Is it possible to write my own decoder in Qt?

Thanks

Foi útil?

Solução

this document describe features supported by QMultimedia backends. Render to widget is not supported now. I recommend to use another library for encoding/decoding multimedia(f.e. ffmpeg) - QMultimedia now is not stable and I think that correct work only examples from documentation :(

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top