Playing *.avi files with Qt - c++

I am trying to play *.avi file (~900MB) with this code:
QMediaPlayer* player = new QMediaPlayer(this);
player->setMedia(QUrl::fromLocalFile("mes1.avi"));
player->setVideoOutput(ui->videoWidget);
player->play();
where ui->videoWidget is QVideoWidget and every time I play it I am getting this error code (in Application Output console)
Since google doesn't help, this is my only choice...
DirectShowPlayerService::doRender: Unresolved error code 0x80040266 (IDispatch error #102)
EDIT1:
I have installed K-Lite Codec Pack 12.2.6.
EDIT2:
My application is 32bit, but it shouldn't be a problem since K-Lite include 32bit (source).

Use vlc-qt, and you will find it is so easy to play all sorts of video on all platforms, even XP, which has been abandoned by qt long time ago.

Related

Media playback error : Could not initialize Xv output

I found a simple media player on github : https://github.com/wxWidgets/wxWidgets/blob/master/samples/mediaplayer/mediaplayer.cpp
I copied it in a new project and ran it. It seemed to go well until I tried to open a .mp3 file. I got this error: "Media Playback error. Could not initialize Xv output".
I work on Ubuntu in a virtual machine so I thought that maybe I'm missing something. I opened Rhythmbox and tried to play the same file and I got the same error. I searched on google and found this:
https://askubuntu.com/questions/750418/my-rhythmbox-not-playing-mp3
I installed gstreamer plugins-ugly and plugins-bad, ubuntu-restricted-extra. Also, I installed libxv-dev because I thought it may have something to do with all of this. It didn't work. I reinstalled Rhythmbox and it works just fine now. I thought I had solved the problem I had with the code (mediaplayer) as well but I didn't. I still get the same error.
How can i make it work? And why do I get this error in the first place?
I forgot to mention. I'm also getting these messages :

Error: Qt5 Video render error code 80040218

When running an application in Qt5 made ​​using the QWebView, I accessed a page with a video player in HTML5, but the video does not play and qt/directshow shows the following error:
DirectShowPlayerService::doRender: Unresolved error code 80040218
DirectShowPlayerService::doRender: Unresolved error code 80040218
Details:
Qt5.1.1 MingW4.8 32bit
Windows 7 64bit
I suspect that is why my Windows is 64bit, but the *QT/MingW** runs on 32bit and maybe miss some DLL/LIB.
How can I resolve this?
Thanks.
The error code is rather generic: 0x80040218 VFW_E_CANNOT_RENDER "No combination of filters could be found to render the stream." and the typical cause is that the application cannot decode media feed because it lacks decoding components, such as codec for this video feed is not installed/available.
install K-Lite_Codec_Pack_1540_Basic in your machine, this error not related to pyqt5 and any other
You may check out 'LAV Filters'. It solved my rendering problem: 'DirectShowPlayerService::doRender: Unresolved error code 80040266'.
Download installer: http://forum.doom9.org/showthread.php?t=156191 And the source code: https://github.com/Nevcairiel/LAVFilters
If you are a developer, you can download and use ffmpeg to decode and encode your file to avi(windows) or mov(mac).

EDSDK cpp error: 10 EDS_ERR_MISSING_SUBCOMPONENT

I am trying to get started with EDSDK to control my Canon 500D. I'm new to cpp, and windows XP apps and I'm using visual studio. After a great deal of blind trial and error I have finally managed to get the app to compile the basic sample code from the documentation. To do this I have the EDSDK.h, EDSDKTypes.h and EDSDKErrors.h headers in the right places and the EDSDK.dll and EDSDK.lib in the same folder as the code. It seems to be picking these up. I have got the 500D to be recognised by the PC so I believe the USB drivers are there.
The code is just trying to pick up the camera:
EdsError err=EDS_ERR_OK;
EdsCameraListRef cameraList=NULL;
err = EdsGetCameraList(&cameraList);
if(err == EDS_ERR_OK)
{...}
However, when I run this console app the error is picked up as 10 - which suggests, according to the document, that there is a missing subcomponent. This happens both if the camera is connected or not, so I'm thinking this is something missing from the compile. But I am getting nowhere with the documentation.
I have installed the edsdk 2.4 Windows version from a download not the official route, so this may be an issue.
Can anyone help? Specifically how can I find out what the missing subcomponent might be so I might include it. Is this a subcmponent of the build like a header file or something like a driver?
I know, old question but still it might help someone with the same problem.
From the documentation:
All DLLs are required in order to execute an EDSDK client application.
All of the modules in the DLL folder must be copied into the same folder where the EDSDK client application is in.
This means you'll have to have all DLLs beside your *.exe. Namely these DLLs:
DPPDLL.dll
DPPLibCom.dll
DPPRSC.dll
EDSDK.dll
EdsImage.dll
Mlib.dll
Ucs32P.dll

QMediaPlayer resource error

I'm using Qt Creator 2.7.2 (Qt 5.1) on Windows 8 Pro x64. I'm having trouble with QMediaPlayer. There are some MP3 files on my PC which run fine on Windows Media Player, but QMediaPlayer can't play them. Following statement:
void MainWindow::onPlayerStateChanged(QMediaPlayer::State state)
{
qDebug() << "onPlayerStateChanged" << state
<< media_player.error() << media_player.errorString();
// ....
}
is the slot connected to media player's stateChanged signal throws following output:
onPlayerStateChanged QMediaPlayer::PlayingState QMediaPlayer::NoError ""
DirectShowPlayerService::doRender: Unresolved error code 80040266
onPlayerStateChanged QMediaPlayer::StoppedState QMediaPlayer::ResourceError ""
DirectShowPlayerService::doRender: Unresolved error code 80040266
Any idea what's wrong?
It might have something to to with the ID3 tags of the file.
I had a similar problem: I was trying to play some MP3 files with QMediaPlayer. One of the files generated that error while the others played fine (on Windows 7). On Linux though, they all played fine.
So I ran the 'file' command on my MP3 files and noticed that the problematic MP3 file had a ID3 version 2.4.0 tag while all the others had ID3 version 2.3.0. I deleted the ID3 tag of that file completely using an ID3 tag editor and after that the file played successfully.
A wild guess here: DirectShow, which is used by QMediaPlayer as backend on Windows, chokes on ID3 version 2.4 and only recognizes older versions. And QMediaPlayer on Linux uses GStreamer as backend, which does not have that problem.

qt 5 QMediaPlayer error: Gstreamer unable to play

I just installed QT 5 and am trying to run the example for playing video. The code snippet looks like:
QMediaPlayer *player = new QMediaPlayer;
player->setMedia( QUrl::fromLocalFile(fileUrl) );
QVideoWidget *videoWidget = new QVideoWidget;
player->setVideoOutput(videoWidget);
videoWidget->show();
player->play();
It compiles fine, but when I run it I get the following error:
GStreamer; Unable to play - "file:sample.avi"
Im on Ubuntu 12.04 and have installed all of the extra gstreamer packages in case gstreamer was missing codecs. Ive tried with a few different video formats to no avail. I can play the videos using vlc just fine. Does anyone have any idea why this isnt working?
It needs absolute path. Try
player->setMedia( QUrl::fromLocalFile(QFileInfo(fileUrl).absoluteFilePath()));