1

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).

carobnodrvo
  • 1,021
  • 1
  • 9
  • 32
  • I googled the error and found this - https://stackoverflow.com/questions/20287688/qt5-video-render-error-code-80040218. You need to install codecs on your computer – sashoalm Jul 25 '16 at 16:09
  • 1
    You can try vlc-qt – Zen Jul 25 '16 at 16:23
  • @sashoalm I've already installed K-Lite Codec Pack 12.2.6 and it didn't do much... – carobnodrvo Jul 25 '16 at 16:42
  • @Zen could you tell me what that is, I am not sure. – carobnodrvo Jul 25 '16 at 16:42
  • [VLC-Qt - a simple library to connect Qt application with libVLC](https://github.com/vlc-qt/vlc-qt). Its usage is very easy. And you don't need to worry about codecs anymore. – Zen Jul 25 '16 at 16:46
  • It sounds nice, but I wouldn't really like to use an extra library if I can do it only with Qt. – carobnodrvo Jul 25 '16 at 17:18
  • Have you tried other formats? Like .mp4 oder .mkv? – Felix Jul 25 '16 at 18:51
  • @Felix Yes, I have no problem with two that you have mentioned. – carobnodrvo Jul 25 '16 at 19:40
  • Well, in that case the codec itself works, it's just avi... maybe your video file is corrupted? Or your installation of the codec? – Felix Jul 25 '16 at 20:24
  • @Felix I've just installed K-Lite Mega and Update (removed previous version) and still same issue... Video is fine since I am able to play it even in Windows Media Player... – carobnodrvo Jul 25 '16 at 20:37
  • @Zen I've ended up using your solution because it seems that it's the only solution. If you want answer a question so I can accept your answer. – carobnodrvo Jul 27 '16 at 20:57

1 Answers1

4

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.

Zen
  • 5,065
  • 8
  • 29
  • 49