ithewei / hplayer Goto Github PK
View Code? Open in Web Editor NEWA multi-screen player using Qt + FFmpeg.
Home Page: https://hewei.blog.csdn.net/article/category/9275796
License: GNU Lesser General Public License v2.1
A multi-screen player using Qt + FFmpeg.
Home Page: https://hewei.blog.csdn.net/article/category/9275796
License: GNU Lesser General Public License v2.1
大佬的作品真的很棒。要是有音频功能,那就完美无缺了。
请问一下大佬,有计划加入音频功能吗
我试着打开RTMP和RTSP的都打不开,日志里报解码错误
Is there any option for keeping the aspect ration of the video image? If not, can you please add this option to hplayer please?
I noticed that if I set renderer = opengl
then the aspect ratio settings work but when I set renderer = sdl
they don't work.
Project MESSAGE: ARCH=x86_64
Project MESSAGE: QT_VERSION=5.14.1
Project MESSAGE: QMAKE=/Users/cievon/Qt5.14.1/5.14.1/clang_64/bin/qmake
Project MESSAGE: QMAKESPEC=/Users/cievon/Qt5.14.1/5.14.1/clang_64/mkspecs/macx-clang
Project MESSAGE: CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
Project MESSAGE: CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
Project MESSAGE: LINK=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
Project MESSAGE: CFLAGS=-pipe -std=c99
Project MESSAGE: CXXFLAGS=-pipe -stdlib=libc++ -std=c++11
Project MESSAGE: PWD=/Users/cievon/Documents/debug/hplayer
Project MESSAGE: TARGET=/Users/cievon/Documents/debug/hplayer/bin/mac/hplayer
Project MESSAGE: DEFINES=QT_DEPRECATED_WARNINGS HV_SOURCE GLEW_STATIC
Project MESSAGE: CONFIG=lex yacc debug exceptions depend_includepath testcase_targets import_plugins import_qpa_plugin asset_catalogs rez file_copies qmake_use qt warn_on release link_prl app_bundle incremental global_init_link_order lib_version_first sdk clang_pch_style shared shared qt_framework release macos osx macx mac darwin unix posix gcc clang llvm debug x86_64 qml_debug sdk_no_version_check
Project MESSAGE: INCLUDEPATH=src src/hv src/hv/base src/hv/utils src/qt src/ui src/GL src/video src/win32 src/util -I /opt/homebrew/Cellar/ffmpeg/5.0.1_2/include -I /opt/homebrew/Cellar/sdl2/2.0.22/include
Project MESSAGE: LIBS=-L /opt/homebrew/Cellar/sdl2/2.0.22/lib -lSDL2 -L /opt/homebrew/Cellar/ffmpeg/5.0.1_2/lib -lavutil -lavfilter -lavcodec -lswscale -lavformat -lavdevice -lswresample -L/Users/cievon/Documents/debug/hplayer/3rd/lib/mac -L/Users/cievon/Documents/debug/hplayer/bin/mac/hplayer.app/Contents/Frameworks
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -stdlib=libc++ -headerpad_max_install_names -arch x86_64 -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -mmacosx-version-min=10.13 -Wl,-rpath,@executable_path/../Frameworks -Wl,-rpath,@executable_path/../Frameworks -Wl,-rpath,/Users/cievon/Qt5.14.1/5.14.1/clang_64/lib -o ../hplayer/bin/mac/hplayer.app/Contents/MacOS/hplayer tmp/obj/hversion.o tmp/obj/hbase.o tmp/obj/herr.o tmp/obj/htime.o tmp/obj/hlog.o tmp/obj/hstring.o tmp/obj/iniparser.o tmp/obj/qtrcloader.o tmp/obj/HGLWidget.o tmp/obj/htable.o tmp/obj/MainWindow.o tmp/obj/CentralWidget.o tmp/obj/HMultiView.o tmp/obj/HVideoWidget.o tmp/obj/HVideoTitlebar.o tmp/obj/HVideoToolbar.o tmp/obj/HVideoWnd.o tmp/obj/HOpenMediaDlg.o tmp/obj/HMediaInfoDlg.o tmp/obj/GLWnd.o tmp/obj/LsideWidget.o tmp/obj/RsideWidget.o tmp/obj/glew.o tmp/obj/hffplayer.o tmp/obj/hdevice.o tmp/obj/hframe.o tmp/obj/SDL2Wnd.o tmp/obj/main.o tmp/obj/qrc_skin.o tmp/obj/qrc_image.o tmp/obj/moc_MainWindow.o tmp/obj/moc_CentralWidget.o tmp/obj/moc_HMultiView.o tmp/obj/moc_HVideoWidget.o tmp/obj/moc_HVideoTitlebar.o tmp/obj/moc_HVideoToolbar.o tmp/obj/moc_HOpenMediaDlg.o tmp/obj/moc_HMediaInfoDlg.o -F/Users/cievon/Qt5.14.1/5.14.1/clang_64/lib -L /opt/homebrew/Cellar/sdl2/2.0.22/lib -lSDL2 /opt/homebrew/Cellar/ffmpeg/5.0.1_2/lib -lavutil -lavfilter -lavcodec -lswscale -lavformat -lavdevice -lswresample -L/Users/cievon/Documents/debug/hplayer/3rd/lib/mac -L/Users/cievon/Documents/debug/hplayer/bin/mac/hplayer.app/Contents/Frameworks -framework QtWidgets -framework QtGui -framework AppKit -framework Metal -framework QtCore -framework DiskArbitration -framework IOKit -framework OpenGL -framework AGL
ld: warning: directory not found for option '-L/Users/cievon/Documents/debug/hplayer/3rd/lib/mac'
ld: warning: directory not found for option '-L/Users/cievon/Documents/debug/hplayer/bin/mac/hplayer.app/Contents/Frameworks'
ld: library not found for -lavutil
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [../hplayer/bin/mac/hplayer.app/Contents/MacOS/hplayer] Error 1
11:38:06: 进程"/usr/bin/make"退出,退出代码 2 。
Error while building/deploying project hplayer (kit: Desktop Qt 5.14.1 clang 64bit)
When executing step "Make"
11:38:06: Elapsed time: 00:12.
windows下,QTcreator编译,msvc2015 X64,
报错:
I just build the project to qt creator and mingw64, it just paly video and have no voice?
非常感谢这个工作!
1、HVideoCapture 无法正常工作,也就是采用opencv解码的,显示出来的一直是黑色窗口。。会是什么问题?
2、HFrame如何向Mat转化呢
I noticed that if somehow internet get disconnected for a minute or two the rtsp video doesn't auto-play when the internet gets connected again. The rtsp video stops playing.
How to make hplayer to auto reconnect/play rtsp video after re-connecting the internet?
我枯了。。。。
经过测试,发现无法播放rtsp.
测试地址: rtsp://184.72.239.149/vod/mp4://BigBuckBunny_175k.mov
用VLC播放正常。
用hplayer播放,提示:"不能打开媒体rtsp://184.72.239.149/vod/mp4://BigBuckBunny_175k.mov"
编译异常:
1>src\qt\qtheaders.h(5): fatal error C1083: 无法打开包括文件: “hgl.h”: No such file or directory (编译源文件 tmp\moc\moc_mainwindow.cpp)
查找文件夹发现,不仅仅hgl.h没有,下面的.h文件也是没有的:
"h.h",
"hframe.h",
"hgui.h"
Playing a same video using both ffplayer and hplayer, I noticed that the hplayer video quality is different than the official ffplayer.c video quality.
I noticed that the network / streaming and local video quality played by hplayer is poor.
hplayer is an amazing project, it deserves high-quality video playback capabilities.
如题, 我的Windows下没有USB摄像头. CaptureTab的initUI未处理这种情况, 结果主界面崩溃退出
临时解决方法是手动注释掉
hplayer/src/ui/hopenmediadlg.cpp
Line 81 in 17fbe03
有一个问题,不知道该如何拿到视频流的数据。
我看到了一个push_frame和pop_frame,该怎么操作呢?
谢谢。
Let suppose you play a video and now if you right click and hold it on the Titlebar of the Application then you would notice that the video would stop playing until you release the mouse button! Similarly if you left click and hold it on the Titlebar of the Application then the video stops for about a second!
The solution:
Solution for this problem is very easy. You need to create the renderer in the Thread and then use that renderer for rendering the video. That's it! Now the video would NEVER STOP PLAYING when you click on the titlebar of the application!
I noticed that the latest hplayer plays local videos but fails and crashes when I try to play rtsp stream.
In QtCreator Application Output shows following message:
C:\hplayer\bin\msvc14_x86\hplayer.exe ...
[dshow @ 000001eb628d09c0] DirectShow video devices (some may be both video and audio devices)
[dshow @ 000001eb628d09c0] "HP Truevision HD"
[dshow @ 000001eb628d09c0] Alternative name "@device_pnp_\\?\usb#vid_0bda&pid_5776&mi_00#6&33f079c4&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global"
[dshow @ 000001eb628d09c0] DirectShow audio devices
[dshow @ 000001eb628d09c0] "Microphone (Realtek High Definition Audio)"
[dshow @ 000001eb628d09c0] Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{E96AB72D-4A92-494C-AF9C-604A911E046C}"
[udp @ 000001eb628d5a80] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
[udp @ 000001eb628eac40] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
[udp @ 000001eb628fb500] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
[udp @ 000001eb6290b800] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
[rtsp @ 000001eb628d3240] UDP timeout, retrying with TCP
[rtsp @ 000001eb628d3240] Could not find codec parameters for stream 1 (Video: h264, none, 1280x720): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[h264_cuvid @ 000001eb6294e4c0] Cannot load cuvidGetDecodeStatus
[h264_cuvid @ 000001eb6294e4c0] Failed loading nvcuvid.
Assertion desc failed at src/libswscale/swscale_internal.h:670
14:15:48: C:\hplayer\bin\msvc14_x86\hplayer.exe exited with code 3
The hplayer log shows this:
[2020-04-03 14:15:26.140][INFO ] C:\hplayer\bin\msvc14_x86\hplayer.exe version: 1.20.4.3 [..\hplayer\src\main.cpp:119:main]
[2020-04-03 14:15:32.114][INFO ] ifile:rtsp://freja.hiof.no:1935/rtplive/definst/hessdalen03.stream [..\hplayer\src\video\hffplayer.cpp:112:HFFPlayer::open]
[2020-04-03 14:15:43.743][INFO ] interrupt quit=0 media.src=rtsp://freja.hiof.no:1935/rtplive/definst/hessdalen03.stream [..\hplayer\src\video\hffplayer.cpp:39:interrupt_callback]
[2020-04-03 14:15:43.743][INFO ] interrupt quit=0 media.src=rtsp://freja.hiof.no:1935/rtplive/definst/hessdalen03.stream [..\hplayer\src\video\hffplayer.cpp:39:interrupt_callback]
[2020-04-03 14:15:43.744][INFO ] stream_num=2 [..\hplayer\src\video\hffplayer.cpp:150:HFFPlayer::open]
[2020-04-03 14:15:43.744][INFO ] video_stream_index=1 [..\hplayer\src\video\hffplayer.cpp:155:HFFPlayer::open]
[2020-04-03 14:15:43.744][INFO ] audio_stream_index=0 [..\hplayer\src\video\hffplayer.cpp:156:HFFPlayer::open]
[2020-04-03 14:15:43.744][INFO ] subtitle_stream_index=-1381258232 [..\hplayer\src\video\hffplayer.cpp:157:HFFPlayer::open]
[2020-04-03 14:15:43.744][INFO ] video_stream time_base=1/90000 [..\hplayer\src\video\hffplayer.cpp:168:HFFPlayer::open]
[2020-04-03 14:15:43.744][INFO ] codec_id=27:h264 [..\hplayer\src\video\hffplayer.cpp:171:HFFPlayer::open]
[2020-04-03 14:15:43.744][INFO ] decoder=h264_cuvid [..\hplayer\src\video\hffplayer.cpp:190:HFFPlayer::open]
[2020-04-03 14:15:43.744][INFO ] codec_name: h264_cuvid=>Nvidia CUVID H264 decoder [..\hplayer\src\video\hffplayer.cpp:204:HFFPlayer::open]
[2020-04-03 14:15:43.747][INFO ] Can not open hardwrae codec error: -1, try software codec. [..\hplayer\src\video\hffplayer.cpp:223:HFFPlayer::open]
[2020-04-03 14:15:43.747][INFO ] codec_name: h264=>H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 [..\hplayer\src\video\hffplayer.cpp:204:HFFPlayer::open]
As far as I think hplayer assumes that every user must have h264_cuvid (Nvidia CUVID H264 decoder ) but this can't be true for some users. Also there should be some algorithm to stop hplayer from crashing and play video successfully if it get hardware codec error..
On my laptop I have 2 GPUs, one Intel(R) HD Graphics 5500 and one NVIDIA GeForce 820M.
I noticed that local videos play smoothly and they use Intel(R) HD Graphics 5500 but when I try to play rtsp stream, I think, hplayer trys to play rtsp video through NVIDIA GeForce 820M which I think don't have Nvidia CUVID H264 decoder so hplayer fails and crash!
Can the rtsp stream be played through Intel(R) HD Graphics 5500 just like the local videos?
您好,请问您的程序可以编译成64位吗?
Can you please mention which version of Qt and FFMPEG is used to build this project?
I am on Windows having Qt5.13.2-msvc2017-64bit.
首先非常感谢分享。给我了很多思路参考,另外好像没有gpu解码呈现效果,虽然配置文件有cuda,qsv设置,好像没有显示画面,虽然看起来gpu有使用率。看代码是缺少了ffmpeg解码后从gpu拿取帧的功能。
您好!十分感谢您的工作,我遇到一个问题想请教一下。
如下,当我在 hplayer\src\video\HVideoPlayerFactory.h 使用 HVideoCapture时
#ifndef H_VIDEO_PLAYER_FACTORY_H
#define H_VIDEO_PLAYER_FACTORY_H
#include "hmedia.h"
#include "HVideoPlayer.h"
#include "HVideoCapture.h" // 这个库一添加就报错
#include "hffplayer.h"
class HVideoPlayerFactory
{
public:
static HVideoPlayer* create(media_type_e type) {
switch (type) {
case MEDIA_TYPE_FILE:
case MEDIA_TYPE_NETWORK:
case MEDIA_TYPE_CAPTURE:
return new HVideoCapture;
// return new HFFPlayer;
default:
return NULL;
}
}
};
#endif // H_VIDEO_PLAYER_FACTORY_H
使用 VS2022 编译就会出现如下错误,
1>C:\OpenCV-4.6.0\install\include\opencv2\core\base.hpp(561,16): warning C4002: 类函数宏的调用“LU”参数过多 (编译源文件 src\video\HVideoCapture.cpp)
1>C:\OpenCV-4.6.0\install\include\opencv2\core\base.hpp(561,16): error C2062: 意外的类型“unsigned long” (编译源文件 src\video\HVideoCapture.cpp)
1>C:\OpenCV-4.6.0\install\include\opencv2\core\base.hpp(563,16): warning C4002: 类函数宏的调用“LU”参数过多 (编译源文件 src\video\HVideoCapture.cpp)
1>C:\OpenCV-4.6.0\install\include\opencv2\core\base.hpp(563,16): error C2062: 意外的类型“unsigned long” (编译源文件 src\video\HVideoCapture.cpp)
1>C:\OpenCV-4.6.0\install\include\opencv2\core\matx.hpp(501,20): warning C4002: 类函数宏的调用“LU”参数过多 (编译源文件 src\video\HVideoCapture.cpp)
1>C:\OpenCV-4.6.0\install\include\opencv2\core\base.hpp(561,16): error C2062: 意外的类型“unsigned long” (编译源文件 src\ui\HMultiView.cpp)
1>C:\OpenCV-4.6.0\install\include\opencv2\core\base.hpp(563,16): warning C4002: 类函数宏的调用“LU”参数过多 (编译源文件 src\ui\HMultiView.cpp)
1>C:\OpenCV-4.6.0\install\include\opencv2\core\base.hpp(563,16): error C2062: 意外的类型“unsigned long” (编译源文件 src\ui\HMultiView.cpp)
1>C:\OpenCV-4.6.0\install\include\opencv2\core\matx.hpp(501,20): warning C4002: 类函数宏的调用“LU”参数过多 (编译源文件 src\ui\HMultiView.cpp)
1>C:\OpenCV-4.6.0\install\include\opencv2\core\base.hpp(561,16): error C2062: 意外的类型“unsigned long” (编译源文件 src\ui\MainWindow.cpp)
1>C:\OpenCV-4.6.0\install\include\opencv2\core\base.hpp(563,16): warning C4002: 类函数宏的调用“LU”参数过多 (编译源文件 src\ui\MainWindow.cpp)
1>C:\OpenCV-4.6.0\install\include\opencv2\core\base.hpp(563,16): error C2062: 意外的类型“unsigned long” (编译源文件 src\ui\MainWindow.cpp)
1>C:\OpenCV-4.6.0\install\include\opencv2\core\base.hpp(561,16): warning C4002: 类函数宏的调用“LU”参数过多 (编译源文件 src\ui\HVideoWidget.cpp)
1>C:\OpenCV-4.6.0\install\include\opencv2\core\base.hpp(561,16): error C2062: 意外的类型“unsigned long” (编译源文件 src\ui\HVideoWidget.cpp)
1>C:\OpenCV-4.6.0\install\include\opencv2\core\base.hpp(563,16): warning C4002: 类函数宏的调用“LU”参数过多 (编译源文件 src\ui\HVideoWidget.cpp)
1>C:\OpenCV-4.6.0\install\include\opencv2\core\base.hpp(563,16): error C2062: 意外的类型“unsigned long” (编译源文件 src\ui\HVideoWidget.cpp)
1>C:\OpenCV-4.6.0\install\include\opencv2\core\base.hpp(561,16): error C2062: 意外的类型“unsigned long” (编译源文件 src\ui\CentralWidget.cpp)
1>C:\OpenCV-4.6.0\install\include\opencv2\core\base.hpp(563,16): warning C4002: 类函数宏的调用“LU”参数过多 (编译源文件 src\ui\CentralWidget.cpp)
1>C:\OpenCV-4.6.0\install\include\opencv2\core\base.hpp(563,16): error C2062: 意外的类型“unsigned long” (编译源文件 src\ui\CentralWidget.cpp)
1>已完成生成项目“hplayer.vcxproj”的操作 - 失败。
========== 生成: 0 成功,1 失败,0 最新,0 已跳过 ==========
这个应该怎么解决呢?
I want to apply it on the .ui file. How to implement function of dividing the frame into 9 16 25?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.