GStreamer with QT6
-
wrote on 12 Jul 2024, 14:42 last edited by
I want to add gstreamer to my qt6 cmake project. How can I add it? I could not.
-
wrote on 12 Jul 2024, 16:03 last edited by
Linux or Windows?
-
Hi,
Beside the platform as requested by @JoeCFD, do you mean you want to use the QtMultimedia backend or use GStreamer explicitly in your code ?
-
wrote on 15 Jul 2024, 20:33 last edited by
@JoeCFD said in GStreamer with QT6:
Linux or Windows?
for windows.
@SGaist said in GStreamer with QT6:
QtMultimedia backend or use GStreamer explicitly in your code ?
when I use QtMultimedia rtsp stream is lagging or freezing. but If I use gstream there is a no problem. How can I implement my code or how can I watch stream like gstream quality ?
-
wrote on 16 Jul 2024, 10:57 last edited by JoeCFD
I think pkg can be applied in Windows as well. Try the following example
find_package( PkgConfig REQUIRED )
pkg_search_module( GSTREAMER REQUIRED IMPORTED_TARGET gstreamer-1.0 >= 1.22 )
pkg_search_module( GSTREAMER-VIDEO REQUIRED IMPORTED_TARGET gstreamer-video-1.0 >= 1.22 )
target_link_libraries( ${PROJECT_NAME} PkgConfig::GSTREAMER
PkgConfig::GSTREAMER-VIDEO )The path in the pkg files of gstreamer might not be right. However, it can be changed in all pkg files. I guess relative path is good enough and works for me on Linux. You need to figure out how to set pkg path on Windows.
-
I think pkg can be applied in Windows as well. Try the following example
find_package( PkgConfig REQUIRED )
pkg_search_module( GSTREAMER REQUIRED IMPORTED_TARGET gstreamer-1.0 >= 1.22 )
pkg_search_module( GSTREAMER-VIDEO REQUIRED IMPORTED_TARGET gstreamer-video-1.0 >= 1.22 )
target_link_libraries( ${PROJECT_NAME} PkgConfig::GSTREAMER
PkgConfig::GSTREAMER-VIDEO )The path in the pkg files of gstreamer might not be right. However, it can be changed in all pkg files. I guess relative path is good enough and works for me on Linux. You need to figure out how to set pkg path on Windows.
wrote on 17 Jul 2024, 06:34 last edited by Joe von Habsburg@JoeCFD said in GStreamer with QT6:
pkg_search_module(
C:\Users\X\Desktop\XX\XXX\CMakeLists.txt:13: error: A required package was not found
Call stack:
C:\Users\X\Desktop\XX\XXX\CMakeLists.txt:13 (pkg_check_modules)
C:/Qt/Tools/CMake_64/share/cmake-3.27/Modules/FindPkgConfig.cmake:829 (_pkg_check_modules_internal)
C:/Qt/Tools/CMake_64/share/cmake-3.27/Modules/FindPkgConfig.cmake:607 (message) -
wrote on 17 Jul 2024, 07:49 last edited by
Call stack:
C:\Users\X\Desktop\XX\XXX\CMakeLists.txt:13: error: None of the required 'gstreamer-1.0' foundC:\Users\X\Desktop\XX\XXX\CMakeLists.txt:14: error: None of the required 'gstreamer-video-1.0' found
-
Call stack:
C:\Users\X\Desktop\XX\XXX\CMakeLists.txt:13: error: None of the required 'gstreamer-1.0' foundC:\Users\X\Desktop\XX\XXX\CMakeLists.txt:14: error: None of the required 'gstreamer-video-1.0' found
wrote on 17 Jul 2024, 11:20 last edited by JoeCFD@Joe-von-Habsburg I edited my post. You need to figure out how to set pkg path on Windows.
On linux:
export PKG_CONFIG_PATH=/opt/thirdParties/gstreamer/lib/pkgconfig:$PKG_CONFIG_PATHit is easier to use pkg config to add packages into a project because all dependencies are taken care of. But you can add all libs manually as well.
-
@Joe-von-Habsburg I edited my post. You need to figure out how to set pkg path on Windows.
On linux:
export PKG_CONFIG_PATH=/opt/thirdParties/gstreamer/lib/pkgconfig:$PKG_CONFIG_PATHit is easier to use pkg config to add packages into a project because all dependencies are taken care of. But you can add all libs manually as well.
wrote on 17 Jul 2024, 12:43 last edited by -
wrote on 17 Jul 2024, 13:12 last edited by
@Joe-von-Habsburg I think you did not set pkg configure path. If you do not know how to set it, find the pkg files in gstreamer installation and add all the libs inside to your project.
-
@Joe-von-Habsburg I think you did not set pkg configure path. If you do not know how to set it, find the pkg files in gstreamer installation and add all the libs inside to your project.
wrote on 17 Jul 2024, 13:18 last edited by@JoeCFD said in GStreamer with QT6:
I think you did not set pkg configure path. If you do not know how to set it, find the pkg files in gstreamer installation and add all the libs inside to your project.
PKG_CONFIG_PATH=C:/gstreamer/1.0/msvc_x86_64/bin/pkgconfig:$PKG_CONFIG_PATH
-
@JoeCFD said in GStreamer with QT6:
I think you did not set pkg configure path. If you do not know how to set it, find the pkg files in gstreamer installation and add all the libs inside to your project.
PKG_CONFIG_PATH=C:/gstreamer/1.0/msvc_x86_64/bin/pkgconfig:$PKG_CONFIG_PATH
wrote on 17 Jul 2024, 13:55 last edited by JoeCFD@Joe-von-Habsburg pkg config path is under gstreamer lib dir.
For example in Linux
/opt/thirdParties/gstreamer/lib/pkgconfig
Maybe it is different in Windows
and pkg-config.exe has to be in system path of Windows. -
@Joe-von-Habsburg pkg config path is under gstreamer lib dir.
For example in Linux
/opt/thirdParties/gstreamer/lib/pkgconfig
Maybe it is different in Windows
and pkg-config.exe has to be in system path of Windows.wrote on 17 Jul 2024, 13:57 last edited by@JoeCFD said in GStreamer with QT6:
@Joe-von-Habsburg pkg config path is under gstreamer lib dir.
For example in Linux
/opt/thirdParties/gstreamer/lib/pkgconfig
Maybe it is different in WindowsThere is only C:/gstreamer/1.0/msvc_x86_64/bin/pkg-config.exe
-
wrote on 17 Jul 2024, 14:01 last edited by JoeCFD
add C:/gstreamer/1.0/msvc_x86_64/bin to PATH on Windows. This enables you to run pkg-config.exe and use pkg-config. Nice that gstreamer includes it for you.
go to C:/gstreamer/1.0/msvc_x86_64/lib to find dir pkgconfig. Add C:/gstreamer/1.0/msvc_x86_64/lib/pkgconfig to PKG_CONFIG_PATHDo not forget to add gstreamer plugin path as well in your env. Otherwise, you can not run your gstreamer app.
-
add C:/gstreamer/1.0/msvc_x86_64/bin to PATH on Windows. This enables you to run pkg-config.exe and use pkg-config. Nice that gstreamer includes it for you.
go to C:/gstreamer/1.0/msvc_x86_64/lib to find dir pkgconfig. Add C:/gstreamer/1.0/msvc_x86_64/lib/pkgconfig to PKG_CONFIG_PATHDo not forget to add gstreamer plugin path as well in your env. Otherwise, you can not run your gstreamer app.
wrote on 17 Jul 2024, 14:09 last edited by@JoeCFD said in GStreamer with QT6:
C:/gstreamer/1.0/msvc_x86_64/bin to PATH on Window
it already exists
@JoeCFD said in GStreamer with QT6:
C:/gstreamer/1.0/msvc_x86_64/lib to find dir pkgconfig
there is no pkg lib
@JoeCFD said in GStreamer with QT6:
C:/gstreamer/1.0/msvc_x86_64/lib/pkgconfig
its not here.
I have only pkg-config exe in C:/gstreamer/1.0/msvc_x86_64/bin/pkg-config.exe
-
wrote on 17 Jul 2024, 15:54 last edited by
If it does not exist, you are unable to use it. I can check it out later for you in my home Windows.
-
If it does not exist, you are unable to use it. I can check it out later for you in my home Windows.
wrote on 17 Jul 2024, 15:55 last edited by@JoeCFD thank you so much, I will wait and research new solutions
-
@JoeCFD thank you so much, I will wait and research new solutions
wrote on 17 Jul 2024, 15:56 last edited by JoeCFD@Joe-von-Habsburg
https://stackoverflow.com/questions/63026758/cannot-compile-gstreamer-on-windows-because-it-is-missing-glib-2-0it can be there. Try to reinstall it in different ways.
-
@Joe-von-Habsburg I edited my post. You need to figure out how to set pkg path on Windows.
On linux:
export PKG_CONFIG_PATH=/opt/thirdParties/gstreamer/lib/pkgconfig:$PKG_CONFIG_PATHit is easier to use pkg config to add packages into a project because all dependencies are taken care of. But you can add all libs manually as well.
wrote on 18 Jul 2024, 06:25 last edited by Joe von HabsburgI download files with msys :
pacman -S mingw-w64-x86_64-gstreamer mingw-w64-x86_64-gst-plugins-base \ mingw-w64-x86_64-gst-plugins-good mingw-w64-x86_64-gst-plugins-bad \ mingw-w64-x86_64-gst-plugins-ugly mingw-w64-x86_64-gst-libav \ mingw-w64-x86_64-gst-rtsp-server
and I copy the pkgconfig to lib like that
and gsreamer-1.0.pc and gsteamer-video-1.0.pc exist
cmake like that :
PKG_CONFIG_PATH=C:/gstreamer/1.0/msvc_x86_64/lib/pkgconfig:$PKG_CONFIG_PATH find_package( PkgConfig REQUIRED ) pkg_search_module( GSTREAMER REQUIRED IMPORTED_TARGET gstreamer-1.0) pkg_search_module( GSTREAMER-VIDEO REQUIRED IMPORTED_TARGET gstreamer-video-1.0)
but its not work
-
I download files with msys :
pacman -S mingw-w64-x86_64-gstreamer mingw-w64-x86_64-gst-plugins-base \ mingw-w64-x86_64-gst-plugins-good mingw-w64-x86_64-gst-plugins-bad \ mingw-w64-x86_64-gst-plugins-ugly mingw-w64-x86_64-gst-libav \ mingw-w64-x86_64-gst-rtsp-server
and I copy the pkgconfig to lib like that
and gsreamer-1.0.pc and gsteamer-video-1.0.pc exist
cmake like that :
PKG_CONFIG_PATH=C:/gstreamer/1.0/msvc_x86_64/lib/pkgconfig:$PKG_CONFIG_PATH find_package( PkgConfig REQUIRED ) pkg_search_module( GSTREAMER REQUIRED IMPORTED_TARGET gstreamer-1.0) pkg_search_module( GSTREAMER-VIDEO REQUIRED IMPORTED_TARGET gstreamer-video-1.0)
but its not work
wrote on 18 Jul 2024, 10:46 last edited by JoeCFD@Joe-von-Habsburg said in GStreamer with QT6:
PKG_CONFIG_PATH=C:/gstreamer/1.0/msvc_x86_64/lib/pkgconfig:$PKG_CONFIG_PATH
":" is missing in the picture.
PKG_CONFIG_PATH=C:/gstreamer/1.0/msvc_x86_64/lib/pkgconfig:$PKG_CONFIG_PATH
7/24