How to play h.264 video in Qt
-
Hello guys I want to play a video in QMediaplayer whose codec is H.264. I build a video player and tried to play the h.264 file and got the following error with blank screen
"DirectShowPlayerService::doRender: Unresolved error code 80040266"could anyone please help me how I can play the video.
Thanks
-
Hi,
Do you have a h264 codec installed on your system ?
-
IIRC, the K-Lite codec pack was pretty common for that task.
-
So you want to play h.264 files but don't want to install any codecs for that ?
-
The VLC-Qt website provides the documentation for that.
Note that VLC-Qt depends on libVLC which itself depends on x264 for h264 handling. x264 is free to use under the GPL license. If you want to create a closed source commercial product you can buy a license.
-
Hi,
Yes, you need a h.264 decoder. x264 does both encode and decode.As you are apparently working on a closed source project, you need to get a commercially licensed h.264 decoder. x264 is also available under a commercial license, see here https://licensing.x264.org/en/
Free decoders are generally under the GPL license, which will not work for your closed source program, as the licenses are incompatible.
-
An alternative would be to use a free format like
webm
. -
Thank you for the information.
I have one more question I have downloaded the x264 codec from the website below. Could you help me in installing or building it in my desktop so that i can use it for Qt application
http://www.videolan.org/developers/x264.html -
Do you mean using it through the VLC Qt project ?
-
You can either build it from sources or download the pre-built binary. It's all on the project's web page.