Qt播放音視頻文件報錯DirectShowPlayerService::doRender: Unresolved error code 0x80040266或DirectShowPlayerServi

使用QMediaPlayer和QVideoWidget
QHBoxLayout *m_layout=
newQHBoxLayout(this);php

QMediaPlayer *m_player = new QMediaPlayer(this);
m_player->setMedia(QUrl::fromLocalFile(QString::fromLocal8Bit("d:/QtTest/111.mp4")));git

QVideoWidget *m_videoW = new QVideoWidget(this);
m_layout->addWidget(m_videoW);
this->setLayout(m_layout);github

m_player->setVideoOutput(m_videoW);
m_videoW->show();ide

m_player->play();

代碼寫起來很簡單,編譯也能經過,可是運行就會出錯
DirectShowPlayerService::doRender: Unresolved error code 0x80040266

若是文件路徑不對或者文件名是中文的,則會顯示以下錯誤:
DirectShowPlayerService::doSetUrlSource: Unresolved error code 0x80004005 ()


網上查了下,
Qt 中的多媒體播放,底層是使用DirectShowPlayerService,因此安裝一個DirectShow解碼器,例如LAV Filters,就能夠解決運行出錯問題
相關帖子
http://bbs.csdn.net/topics/391040873this

https://github.com/qyvlik/Flat.qml/issues/4

下載LAV Filters地址
http://forum.doom9.org/showthread.php?t=156191 裏的
Binaries for the most recent version are available here:
Version 0.68.1:
Installer (both x86/x64) -- Zips:
32-bit &
64-bit
Download 3D Plugin:
32-bit &
64-bit
選擇32bit或者64bit下
下載完安裝後,再運行程序,運行無錯誤,可以正常播放視頻。.net

轉自:https://blog.csdn.net/qqwangfan/article/details/52469859code

相關文章
相關標籤/搜索