How to Convert Videos Using Qt and FFmpeg

In this post I’m going to describe how you can use FFmpeg library to convert videos in your Qt applications, or even write a Video Conversion program that uses FFmpeg as its underlying powerful conversion engine.

Unfortunately you can’t use Qt Framework out-of-the-box to convert video files and formats to each other (at least that is the case until the time this post was published, or in other words until Qt5.10.1). One of the most practical workarounds for this missing capability is using 3rd party video conversion libraries and tools such as FFmpeg.

Continue reading “How to Convert Videos Using Qt and FFmpeg”

How to Make a Qt Widget Transparent to Mouse Events

Before I come up with the current title of this post, I thought of many other titles including:

  • How to send mouse clicks and events to a Qt widget behind another widget
  • How to make a Qt widget ignore mouse events
  • and so on …

Although the answer was very straightforward and easy, I struggled a lot with it since I wasn’t asking the right question.



Continue reading “How to Make a Qt Widget Transparent to Mouse Events”

How to Create an Image Classifier Using Qt, OpenCV and TensorFlow

[Updated this post on April 04, 2019, to make sure this tutorial is compatible with OpenCV 4.x and TensorFlow 2.0]

In this post we’re going to learn how to create an image classifier application with a proper GUI that allows the users to choose a camera or a video file as the input and classify the incoming images (video or camera frames) in real time. We’ll be using the power of Qt for cross-platform GUI creation and anything related to visualizing the output and allowing a seamless experience for the user. We’ll also be using TensorFlow and OpenCV to handle the actual classification task, along with accessing cameras and video files.


With the more recent versions of OpenCV, a new module was introduced for handling Deep Learning problems, which is getting better and better by each release. This module is called “dnn” and I recommend getting the latest version of OpenCV (3.4.1 at the time of writing this article) to make sure you face no issues at all (or less issues if any). Using this new module, we can load and use deep learning models from popular 3rd party libraries such as TensorFlow, Caffe, DarkNet and so on. In our example project we’ll use pre-trained TensorFlow models, namely ssd_mobilenet_v1_coco, however, you can easily use other models too if you get a firm grasp on all of the information provided here.

Continue reading “How to Create an Image Classifier Using Qt, OpenCV and TensorFlow”

How to Use CMake with Qt5 and OpenCV 3 Projects

Following a number of questions that appear before me every now and then, I decided to write a post about using CMake to create and build projects using Qt5 and OpenCV 3. For those of you who are qmake fans, using CMake doesn’t mean you can’t use Qt Creator to create and build your projects. In fact, after the release of more recent versions of Qt Creator, CMake support is getting better and better, and it’s fair to say that using CMake with Qt Creator 4.5.1 is almost as easy as using qmake.

Continue reading “How to Use CMake with Qt5 and OpenCV 3 Projects”

How to Access Windows Event Log Using C++ with Qt and Win32 API

In this post I’ll share a method you can use to access and read events in Windows operating system, using C++. Note that this method is modified to be used with Qt, but you can easily replace the few Qt classes used in this example and remove the dependency on Qt if you are using any other frameworks. In any case, this method relies on Win32 APIs and will work only on Windows operating system.

Continue reading “How to Access Windows Event Log Using C++ with Qt and Win32 API”

How to Build Qt 5.9.2 Static Using MinGW

You can follow the instructions below to build Qt 5.9.2 from sources using MinGW, and statically. To be able to proceed further, you need to make sure you have all the prerequisites on your PC, which are mentioned in this post, then return here.Assuming that you have taken care of all the requirements, you can start by downloading MinGW and Qt 5.9.2 source codes, or take the better and “recommended” route and simply download both of them using the Qt 5.9.2 all-in-one installer for Windows.

Continue reading “How to Build Qt 5.9.2 Static Using MinGW”