当前位置:网站首页>QT compiling security video monitoring system 43- picture playback
QT compiling security video monitoring system 43- picture playback
2022-06-12 04:19:00 【qq60b6d1b681847】
One 、 Preface
Local playback has been available before 、 Remote playback 、 Device playback 3 A module , Local playback is used to playback the video files stored on the local computer of the software ; Remote playback needs to call the manufacturer sdk perhaps GB28181( Not realized , Consider adding later ) from NVR Play back the video ; The device plays through the universal rtsp Call in the form of regular video stream nvr Storage video or real-time video playback ; Recently, a picture playback module has been added , It is used to play back the picture files in the picture folder , Line up to draw a sequence of pictures , It looks like a video .
There's a scenario where , User's own artificial intelligence algorithm , Can get a bunch of picture sequences , Custom rule store , After triggering the alarm, I also get a bunch of picture sequences , In this way, the picture sequence can be played directly through this module , It also supports import and Export , The playback speed can be controlled , Pull the playback progress bar to directly locate the corresponding picture sequence for playback .
Picture storage rules
- Default storage home directory image_normal.
- Store in the main directory according to the date directory such as 2021-04-07 2021-04-08.
- The date directory contains a single picture file such as Ch1_2021-04-07-14-08-11-222.jpg.
- The extended function can store corresponding data files, such as a directory of alarm text and picture files The name is the same The extension name can be txt.
Two 、 Functional characteristics
( One ) Software modules
- Video monitoring module , All kinds of small window body sub modules , Including a list of devices 、 Picture and text police information 、 Window information 、 Pan tilt control 、 Preset position 、 Cruise settings 、 Equipment control 、 Floating map 、 Web browsing, etc .
- Video playback module , Including local playback 、 Remote playback 、 Device playback 、 Picture playback 、 Video upload, etc .
- Electronic map module , Including pictures, maps 、 Online map 、 offline map 、 Path planning, etc .
- Log query module , Including local logs 、 Device logs, etc .
- System setup module , Including system settings ( Basic settings 、 Video parameters 、 Database settings 、 Map configuration 、 Serial port configuration, etc )、 VCR Management 、 Camera Management 、 Polling configuration 、 User management, etc .
( Two ) Basic function
- Supports various video streams (rtsp、rtmp、http etc. )、 Video file (mp4、rmvb、avi etc. )、 Local USB The camera plays .
- Support multi screen switching , Include 1、4、6、8、9、13、16、25、36、64 Screen switching .
- Support full screen switching , A variety of switching methods, including the right mouse button menu 、 toolbar button 、 Shortcut key (alt+enter Full screen ,esc Exit full screen ).
- Support video polling , Include 1、4、9、16 Screen polling , Polling groups can be set ( Polling plan )、 Polling interval 、 Stream type, etc .
- Support onvif agreement , Including device search 、 Pan tilt control 、 Equipment control ( Picture parameters 、 Proofreading time 、 System restart , Capture pictures, etc ).
- Support rights management , Different users can have different module permissions , Like deleting logs 、 Shut down the system, etc .
- The database supports a variety of , Include sqlite、mysql、sqlserver、postgresql、oracle、 People's Congress, Jincang, etc .
- Local USB The camera supports setting resolution 、 Frame rate and other parameters .
- All docking modules automatically generate corresponding menus to control display and hide , Right click in the title bar to pop up .
- Support to display all modules 、 Hide all modules 、 Reset normal layout 、 Reset full screen layout .
- Double click the device to pop up the real-time preview video , Support image map 、 Online map 、 Offline maps, etc .
- Drag the camera node to the corresponding window to play video , At the same time, it supports dragging local files to play directly .
- Delete video support right mouse button delete 、 Floating bar close delete 、 Drag it outside the video monitoring panel to delete it .
- The device button on the picture map can be dragged freely , Automatically save location information . Baidu map can click the mouse to obtain longitude and latitude information , Used to update device location .
- Any channel in the form of video monitoring panel supports drag and drop switching , Instant response .
- It encapsulates Baidu map , views switching , path of particle , Equipment points , Click the mouse to get the latitude and longitude .
- Double click the node 、 Drag nodes 、 Drag the form, swap the position, etc , Automatically update and save the last playback address , Next time the software opens the automatic application .
- Lower right volume bar control , Lose focus auto hide , Volume bar mute icon .
- Support video capture , You can specify a single or all channel screenshot , There's also a screenshot button on the bottom toolbar .
- Support timeout auto hide mouse pointer 、 Automatic full screen mechanism .
- Support onvif Pan tilt control , The camera can be moved up and down , Including reset and focus adjustment .
- Support any onvif The camera , Including but not limited to Haikang 、 Dahua 、 Depending Yu 、 The great cause of heaven and earth 、 HUAWEI, etc. .
- Can save video , It can be stored in a fixed time or in a single file , Optional storage interval time .
- Video stream communication mode can be set tcp+udp, Video decoding can be set to speed first 、 Quality first 、 Equilibrium, etc .
- Chinese name of software can be set 、 English name 、LOGO Icon, etc .
- The stored video files can be exported to the specified directory , Support batch upload to the server .
( 3、 ... and ) Special function
- The main interface adopts the docking form mode , Various components are added in the form of small modules , You can customize any module to add .
- Docking module can drag any position to embed and suspend , Support maximum full screen , Support multi screen .
- Dual layout file storage mechanism , Normal mode 、 Full screen mode corresponds to different layout schemes , Auto switch and save , For example, in full screen mode, several modules can be highlighted and displayed transparently in designated positions , More sci-fi, modern .
- original onvif Protocol mechanism , Using the underlying protocol analysis (udp Radio search +http Request to execute command ) It's lighter, easier to understand, easier to learn and expand , It doesn't rely on any third-party components, such as gsoap.
- Original data import and export mechanism , Cross platform does not rely on any components , Export data instantaneously .
- Built in multiple original components , The universe is worth a lot , Including data import and export components ( Export to xls、pdf、 Print )、 Database components ( Database management thread 、 Automatically clean up data threads 、 Universal paging 、 Data request, etc )、 Map components 、 Video surveillance components 、 File multithreading transceiver component 、onvif Communication components 、 General browser kernel components, etc .
- Custom message box + Error box + Inquiry frame + Prompt box in the lower right corner ( Contains multiple formats ) etc. .
- Beautiful skin change , the height is 17 Change the skin style at will , All styles are unified , Including menu, etc .
- Video control suspension bar can add multiple buttons by itself , Buttons can also be added to the small toolbar at the bottom of the monitoring interface .
- Double click the camera node to automatically play the video , Double click the node to automatically add videos one by one , Will automatically jump to the next , Double click the parent node to automatically add all videos under the node . Optional main stream 、 Sub-stream .
- VCR Management 、 Camera Management , You can add, delete, modify, import, export and print information , Apply the new device information to generate the tree list immediately , No need to restart .
- Multiple kernels can be selected to switch freely ,ffmpeg、vlc、mpv etc. , Can be found in pro Set in . Recommend to use ffmpeg, Cross platform is the most , By default linux and mac Compiled libraries on the platform .
- Support hard decoding , Hard decoding type can be set (qsv、dxva2、d3d11va etc. ).
- By default opengl Drawing video , Ultra low CPU Resource occupation , Support yuyv and nv12 Two formats to draw , It's awesome .
- Highly customizable , Users can easily derive their own functions on this basis , For example, add a custom module , Add operation mode 、 Robot monitoring 、 Drone monitoring 、 Excavator monitoring, etc .
- Support xp、win7、win10、linux、mac、 All kinds of domestic systems (UOS、 Winning Qilin 、 Galaxy unicorn, etc )、 The embedded linux Such as system .
- Note complete , The project structure is clear , Super detailed complete use of the development manual , Accurate to the function description of each code file , Keep iterating over versions .
3、 ... and 、 Experience address
- Experience address : https://pan.baidu.com/s/1d7TH_GEYl5nOecuNlWJJ7g Extraction code :01jf file name :bin_video_system.zip.
- Domestic site : https://gitee.com/feiyangqingyun
- International sites : https://github.com/feiyangqingyun
- Zhihu Homepage : https://www.zhihu.com/people/feiyangqingyun/
- Online document : https://feiyangqingyun.gitee.io/qwidgetdemo/video_system/
Four 、 design sketch


5、 ... and 、 Core code
void frmVideoPlayImage::loadImage()
{
int count = listFile.count();
if (count == 0) {
return;
}
// Play to end
if (listIndex >= count) {
// Automatically switch to the next
if (ui->listWidget->currentRow() < ui->listWidget->count() - 1) {
ui->listWidget->setCurrentRow(ui->listWidget->currentRow() + 1);
on_listWidget_doubleClicked();
} else {
isPlay = false;
timerPlay->stop();
ui->sliderPosition->setValue(0);
ui->labTimePlay->setText(QString(" The first %1 Zhang ").arg(0));
ui->labTimeAll->setText(QString(" common %1 Zhang ").arg(0));
return;
}
}
// Constantly send pictures in the form of signals , The corresponding slot function will be drawn automatically
QImage image(listFile.at(listIndex));
emit receiveImage(image);
listIndex++;
ui->labTimePlay->setText(QString(" The first %1 Zhang ").arg(listIndex));
ui->sliderPosition->setValue(listIndex);
}
void frmVideoPlayImage::addItem(const QString &text, const QString &data)
{
QListWidgetItem *item = new QListWidgetItem;
item->setText(text);
item->setData(Qt::UserRole, QString(data));
item->setCheckState(Qt::Unchecked);
ui->listWidget->addItem(item);
}
void frmVideoPlayImage::on_btnSelect_clicked()
{
QDate dateStart = ui->dateStart->date();
QDate dateEnd = ui->dateEnd->date();
if (dateStart > dateEnd) {
QUIHelper::showMessageBoxError(" The start time cannot be greater than the end time !", 3);
return;
}
// Convert date to date time to calculate the number of days difference , If the maximum number of days is exceeded, you will be prompted not to continue
if (dateStart.daysTo(dateEnd) >= 60) {
QUIHelper::showMessageBoxError(" You can only query at most at a time 60 Days. !", 3);
return;
}
ui->listWidget->clear();
QString filePath;
if (ui->cboxType->currentText() == " Store image ") {
filePath = AppData::ImageNormalPath;
} else {
filePath = AppData::ImageAlarmPath;
}
// Filter the specified channel
QString channel = ui->cboxCh->currentText();
QString ch = QString("Ch%1").arg(channel.mid(2, channel.length()));
// Load the date directory with files into the list
// And save the image set name of the channel corresponding to the directory into the custom attribute
// Then add one day to the start time , Until greater than the end time
while (dateStart <= dateEnd) {
// Generate a folder corresponding to the date
QString dateName = dateStart.toString("yyyy-MM-dd");
QString savePath = QString("%1/%2").arg(filePath).arg(dateName);
QDir saveDir(savePath);
// Determine whether the folder exists
if (saveDir.exists()) {
// Specify file extension filtering , Sort in ascending chronological order
QStringList filter;
filter << "*.jpg" << "*.png";
QStringList fileNames = saveDir.entryList(filter, QDir::NoFilter, QDir::Time | QDir::Reversed);
QStringList fullNames;
foreach (QString fileName, fileNames) {
QString name = savePath + "/" + fileName;
if (channel == " All channels ") {
fullNames << name;
} else {
if (fileName.startsWith(ch)) {
fullNames << name;
}
}
}
int count = fullNames.count();
if (count > 0) {
QString text = QString("%1 %2 total : %3").arg(dateName).arg(channel).arg(count);
addItem(text, fullNames.join("|"));
}
}
dateStart = dateStart.addDays(1);
}
ui->labTip->setText(QString(" Total found %1 individual ").arg(ui->listWidget->count()));
}
void frmVideoPlayImage::on_btnDown_clicked()
{
// Get all checked file sets
QStringList fileNames;
int count = ui->listWidget->count();
for (int row = 0; row < count; row++) {
QListWidgetItem *item = ui->listWidget->item(row);
if (item->checkState() == Qt::Checked) {
fileNames << item->data(Qt::UserRole).toString().split("|");
}
}
if (fileNames.count() == 0) {
QUIHelper::showMessageBoxError(" No file selected !", 3);
return;
}
// The Save As dialog box pops up
QString path = QUIHelper::getFolderName();
if (!path.isEmpty()) {
// Copy files one by one
foreach (QString fileName, fileNames) {
QString name = fileName.split("/").last();
QString targetFile = path + "/" + name;
QFile::copy(fileName, targetFile);
}
DbQuery::addUserLog(" Copy picture files ");
QUIHelper::showMessageBoxInfo(" Copy the picture file !", 3);
}
}
QString frmVideoPlayImage::getHtml()
{
// The following image is a sample image stored in the resource file
// The absolute path from the real application to the picture
QStringList images;
#if 1
images << ":/image/liuyifei0.jpg" << ":/image/liuyifei2.jpg" << ":/image/liuyifei1.jpg";
images << ":/image/liuyifei0.jpg" << ":/image/liuyifei1.jpg" << ":/image/liuyifei2.jpg";
images << ":/image/liuyifei2.jpg" << ":/image/liuyifei1.jpg" << ":/image/liuyifei0.jpg";
#else
// The following represents from the executable directory snap Folder take pictures 1.jpg
images << QUIHelper::appPath() + "/snap/1.jpg";
#endif
// There are many parameters that can be set , You can view the corresponding structure
UavsReportData reportData;
reportData.images = images;
reportData.title = " Main title ";
reportData.subTitle = " Subtitle ";
reportData.name = " Unmanned aerial vehicle (uav) -2021";
// Get the size of the print area to calculate the width of the picture
// A little more is needed for redundancy
int imageWidth = (DataPrint::dataPrint->getPrinter()->pageRect(QPrinter::DevicePixel).width() - 80) / 2;
QStringList list;
DataCreat::creatUavsReportHead(list, reportData);
DataCreat::creatUavsReportBody(list, reportData, imageWidth);
return list.join("");
}
void frmVideoPlayImage::dataout(int type)
{
DataContent dataContent;
dataContent.fileName = QUIHelper::appPath() + "/db/html.pdf";
dataContent.pageMargin = QMargins(15, 20, 15, 20);
// Initialize once to ensure the successful instantiation of the object
DataHelper::Init();
DataPrint::dataPrint->init();
DataPrint::dataPrint->setDataContent(dataContent);
// Reset here html When the printing area is used, it needs to be set once setDataContent Then reset
// for the first time setDataContent Only after that can the accurate printing area be obtained
dataContent.html = getHtml();
DataPrint::dataPrint->setDataContent(dataContent);
if (type == 0) {
DataPrint::dataPrint->print();
} else if (type == 1) {
DataPrint::dataPrint->open();
DataPrint::dataPrint->close();
QUIHelper::openFile(dataContent.fileName, " Export alarm report ");
}
}
void frmVideoPlayImage::on_btnPdf_clicked()
{
dataout(1);
}
void frmVideoPlayImage::on_btnPrint_clicked()
{
dataout(0);
}
void frmVideoPlayImage::on_btnPlayVideo_clicked()
{
if (ui->listWidget->currentRow() < 0) {
return;
}
isPlay = !isPlay;
if (isPlay) {
IconHelper::setIcon(ui->btnPlayVideo, 0xf28d, btnRadius);
timerPlay->start();
} else {
IconHelper::setIcon(ui->btnPlayVideo, 0xf144, btnRadius);
timerPlay->stop();
}
}
void frmVideoPlayImage::on_listWidget_doubleClicked()
{
// Get all the queried image name collections corresponding to the folder from the attribute
listFile = ui->listWidget->currentItem()->data(Qt::UserRole).toString().split("|");
int count = listFile.count();
if (count > 0) {
listIndex = 0;
ui->labTimeAll->setText(QString(" common %1 Zhang ").arg(count));
ui->sliderPosition->setRange(0, count - 1);
ui->sliderPosition->setValue(0);
isPlay = true;
IconHelper::setIcon(ui->btnPlayVideo, 0xf28d, btnRadius);
timerPlay->start();
}
}
void frmVideoPlayImage::on_sliderFps_clicked()
{
timerPlay->setInterval(ui->sliderPosition->value() * 100);
}
void frmVideoPlayImage::on_sliderFps_sliderMoved(int value)
{
timerPlay->setInterval(value * 100);
}
void frmVideoPlayImage::on_sliderPosition_clicked()
{
listIndex = ui->sliderPosition->value();
}
void frmVideoPlayImage::on_sliderPosition_sliderMoved(int value)
{
listIndex = value;
}
void frmVideoPlayImage::on_listWidget_itemPressed(QListWidgetItem *item)
{
bool checked = (item->checkState() == Qt::Checked);
item->setCheckState(checked ? Qt::Unchecked : Qt::Checked);
}
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
- 41.
- 42.
- 43.
- 44.
- 45.
- 46.
- 47.
- 48.
- 49.
- 50.
- 51.
- 52.
- 53.
- 54.
- 55.
- 56.
- 57.
- 58.
- 59.
- 60.
- 61.
- 62.
- 63.
- 64.
- 65.
- 66.
- 67.
- 68.
- 69.
- 70.
- 71.
- 72.
- 73.
- 74.
- 75.
- 76.
- 77.
- 78.
- 79.
- 80.
- 81.
- 82.
- 83.
- 84.
- 85.
- 86.
- 87.
- 88.
- 89.
- 90.
- 91.
- 92.
- 93.
- 94.
- 95.
- 96.
- 97.
- 98.
- 99.
- 100.
- 101.
- 102.
- 103.
- 104.
- 105.
- 106.
- 107.
- 108.
- 109.
- 110.
- 111.
- 112.
- 113.
- 114.
- 115.
- 116.
- 117.
- 118.
- 119.
- 120.
- 121.
- 122.
- 123.
- 124.
- 125.
- 126.
- 127.
- 128.
- 129.
- 130.
- 131.
- 132.
- 133.
- 134.
- 135.
- 136.
- 137.
- 138.
- 139.
- 140.
- 141.
- 142.
- 143.
- 144.
- 145.
- 146.
- 147.
- 148.
- 149.
- 150.
- 151.
- 152.
- 153.
- 154.
- 155.
- 156.
- 157.
- 158.
- 159.
- 160.
- 161.
- 162.
- 163.
- 164.
- 165.
- 166.
- 167.
- 168.
- 169.
- 170.
- 171.
- 172.
- 173.
- 174.
- 175.
- 176.
- 177.
- 178.
- 179.
- 180.
- 181.
- 182.
- 183.
- 184.
- 185.
- 186.
- 187.
- 188.
- 189.
- 190.
- 191.
- 192.
- 193.
- 194.
- 195.
- 196.
- 197.
- 198.
- 199.
- 200.
- 201.
- 202.
- 203.
- 204.
- 205.
- 206.
- 207.
- 208.
- 209.
- 210.
- 211.
- 212.
- 213.
- 214.
- 215.
- 216.
- 217.
- 218.
- 219.
- 220.
- 221.
- 222.
- 223.
- 224.
- 225.
- 226.
- 227.
- 228.
- 229.
- 230.
- 231.
- 232.
- 233.
- 234.
- 235.
- 236.
- 237.
- 238.
- 239.
- 240.
- 241.
- 242.
- 243.
- 244.
- 245.
- 246.
- 247.
- 248.
- 249.
- 250.
- 251.
- 252.
- 253.
- 254.
- 255.
- 256.
- 257.
- 258.
- 259.
- 260.
- 261.
- 262.
- 263.
- 264.
边栏推荐
- [fpga+fft] design and implementation of FFT frequency meter based on FPGA
- 手动封装一个forEacht和Map
- Drop down menu dropdown yyds dry inventory of semantic UI
- E-commerce middle office system architecture
- 图解 Apache SkyWalking UI 的使用
- Object detection model rfbnet -- a very useful model
- 疫情数据分析平台工作报告【6.5】疫情地图
- 【FPGA+GPS接收器】基于FPGA的双频GPS接收器详细设计介绍
- 1. Mx6ull learning notes (II) - uboot migration
- hash function
猜你喜欢

JSP implementation of bank counter business performance evaluation system
![[data recovery in North Asia] data recovery in which the logical volume of the server is changed and the file system is damaged due to system reinstallation](/img/7f/ad628a45bec0ac9a5586d743ca0310.jpg)
[data recovery in North Asia] data recovery in which the logical volume of the server is changed and the file system is damaged due to system reinstallation

【FPGA混沌】基于FPGA的混沌系统verilog实现

无线物联网WiFi模块方案,ESP32-S3芯片技术,助力设备智能化

命令执行漏洞详解

智能面板WiFi聯動技術,ESP32無線芯片模組,物聯網WiFi通信應用
![Epidemic data analysis platform work report [3] website deployment](/img/94/04af8ab245a0162219cd90b2ab96b8.png)
Epidemic data analysis platform work report [3] website deployment

分布式锁介绍
![[Clickhouse column] user initialization of new library role](/img/00/a11fb1a8e38ed4e0634839160c8ead.png)
[Clickhouse column] user initialization of new library role

【高效】最强开发工具Ctool编译踩坑
随机推荐
成功解决:TypeError: the JSON object must be str, bytes or bytearray, not dict
[软件工具][原创]voc数据集类别名批量修改工具使用教程
疫情数据分析平台工作报告【1】数据采集
Will subsequent versions support code block search highlighting
Goodbye to excel and PPT, I found a better visual fool software
Yyds dry inventory MySQL learning - how transactions are isolated
SqEL简单上手
如何制作数据集并基于yolov5训练成模型并部署
19.tornado项目之优化数据库查询
【clickhouse专栏】新建库角色用户初始化
Ebpf series learning (4) learn about libbpf, co-re (compile once – run everywhere) | use go to develop ebpf programs (cloud native tool cilium ebpf)
Smart panel WiFi linkage technology, esp32 wireless chip module, Internet of things WiFi communication application
请用递归的方法计算下列函数的值:px(x,n)=x-x^2 +x^3- x^4+… ((-1)n-1)(xn) n>0 **输入格式要求:“%lf%d“ 提示信息:“Enter X and N:”
Legendary biological car-t has been approved by FDA, becoming the first domestic cell therapy product to successfully go to sea
疫情数据分析平台工作报告【2】接口API
EN in Spacey_ core_ web_ SM installation problems
关于线程池需要注意的几点
[data recovery in North Asia] data recovery in which the logical volume of the server is changed and the file system is damaged due to system reinstallation
Function realization and application of trait
双目标定学习资料整理