当前位置:网站首页>QT compiling security video monitoring system 44 video uploading
QT compiling security video monitoring system 44 video uploading
2022-06-12 04:22:00 【qq60b6d1b681847】
One 、 Preface
Video upload is used to upload locally stored video files to the cloud server , Indirectly realize the function of storing local video to the cloud , In fact, it is stored locally first , After the file is generated, upload it to the cloud , The final effect is the same , To expand compatibility , A separate video upload module is directly made , You can select the video file to upload on the interface and check , You can query by date and time , Channel query, etc , You can customize the address and port of the cloud server , Click one click upload to see the upload progress of each video file . They all use multi-threaded uploading , You can upload multiple files at the same time , Each file has a file size and upload progress display . At present, they are all uploaded manually , Automatic uploading mechanism can be added in the later stage , Listen for folder changes ( Once a change occurs, find the corresponding newly added video file ) Or file storage completion signal , Trigger upload immediately .
Video upload features
- Multithreading to send and receive files , Support encrypted transmission .
- The receiver supports two ways: listening port receiving files and active connection server receiving files .
- according to File start + file size + The contents of the document + End of file Receive one by one by subcontracting .
- It can decrypt and output the received encrypted file package .
- If the file is received by connecting to the server, the request file can be specified .
- The form of the request file of the receiver can be used as a general program upgrade scheme .
- The progress bar updates the progress of sending and receiving files in real time .
- The sender can set the maximum size of each packet, that is, the number of slices and packets .
- The sender can encrypt each packet of the file .
- The sender supports merging and sending packets .
- You can specify a directory to search the request file sent by the client .
- Each function is an independent class , The interface is clear and friendly , Easy to use .
- Support any Qt edition 、 Any system 、 Any compiler .
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 frmVideoUpload::addItem(const QString &name, const QString &data)
{
int row = fileNames.count();
QString fileName = data + "/" + name;
fileNames << fileName;
// Check box , If all is checked, the current equipment will be automatically selected
QCheckBox *itemCk = new QCheckBox(this);
itemCk->setChecked(ckAll->isChecked());
// Add file name
QTableWidgetItem *itemFile = new QTableWidgetItem;
itemFile->setText(name);
itemFile->setData(Qt::UserRole, QString(data));
itemFile->setTextAlignment(Qt::AlignCenter);
// Add file size
QTableWidgetItem *itemSize = new QTableWidgetItem;
quint64 size = QFile(fileName).size();
itemSize->setText(TcpFileHelper::getFileSizeMB(size));
itemSize->setTextAlignment(Qt::AlignCenter);
// Adding unit
QTableWidgetItem *itemUnit = new QTableWidgetItem;
itemUnit->setText("MB");
itemUnit->setTextAlignment(Qt::AlignCenter);
// Add progress bar
QProgressBar *itemBar = new QProgressBar(this);
itemBar->setRange(0, size);
itemBar->setValue(0);
ui->tableWidget->setCellWidget(row, 0, itemCk);
ui->tableWidget->setItem(row, 1, itemFile);
ui->tableWidget->setItem(row, 2, itemSize);
ui->tableWidget->setItem(row, 3, itemUnit);
ui->tableWidget->setCellWidget(row, 4, itemBar);
}
void frmVideoUpload::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;
}
fileNames.clear();
ui->tableWidget->clearContents();
QString filePath;
if (ui->cboxType->currentText() == " Store video ") {
filePath = AppData::VideoNormalPath;
} else {
filePath = AppData::VideoAlarmPath;
}
// Get all folder names , Query the corresponding channel type video according to the time
// If the start time is less than or equal to the end time , Then add the video files under the folder corresponding to the start time to the list
// 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 savePath = QString("%1/%2").arg(filePath).arg(dateStart.toString("yyyy-MM-dd"));
QDir saveDir(savePath);
// Determine whether the folder exists
if (saveDir.exists()) {
// Specify file extension filtering , Sort in ascending chronological order
QStringList filter;
filter << "*.mp4" << "*.h264";
QStringList names = saveDir.entryList(filter, QDir::NoFilter, QDir::Time | QDir::Reversed);
foreach (QString name, names) {
// If it's all the channels of choice , Do not filter video files
if (ui->cboxCh->currentText() == " All channels ") {
addItem(name, savePath);
} else {
// Add the video file of the corresponding channel
QString videoCh = name.split("_").first();
QString chName = QString("Ch%1").arg(ui->cboxCh->currentIndex());
if (videoCh == chName) {
addItem(name, savePath);
}
}
}
}
dateStart = dateStart.addDays(1);
}
}
void frmVideoUpload::on_btnUpload_clicked()
{
// Filter selected files
int fileCount = fileNames.count();
QList<QString> files;
QList<QProgressBar *> bars;
for (int row = 0; row < fileCount; row++) {
QString fileName = fileNames.at(row);
QCheckBox *itemCk = (QCheckBox *)ui->tableWidget->cellWidget(row, 0);
QProgressBar *bar = (QProgressBar *)ui->tableWidget->cellWidget(row, 4);
bar->setValue(0);
if (itemCk && itemCk->isChecked()) {
files << fileName;
bars << bar;
}
}
int count = files.count();
if (count == 0) {
QUIHelper::showMessageBoxError(" No device selected !", 3);
return;
}
// Each upload has a thread
for (int i = 0; i < count; i++) {
TcpSendFileThread *sendFileThread = new TcpSendFileThread(this);
sendFileThread->setFileName(fileNames.at(i));
// If the network is not good, you can adjust the size of the packets sent each time
sendFileThread->setMaxPackageSize(0xFFFF);
sendFileThread->setReceiveIP(AppConfig::UploadHost);
sendFileThread->setReceivePort(AppConfig::UploadPort);
sendFileThread->setProgressBar(bars.at(i));
sendFileThread->start();
}
}
- 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.
边栏推荐
- Detailed explanation of software testing process
- 疫情数据分析平台工作报告【6.5】疫情地图
- R语言plotly可视化:plotly可视化基础二维直方图、自定义设置二维直方图的颜色、二维直方图是二元分布的直方图可视化(Basic 2D Histogram)
- How to have peace of mind? Get a new heart
- 怎样拥有心灵的平和?获得一颗全新的心灵
- Implementation of fitness club management system based on SSH
- 基于SSH实现健身俱乐部管理系统
- 疫情数据分析平台工作报告【4】跨域相关
- 动规(14)-三角形最佳路径问题
- [MySQL] MySQL installation
猜你喜欢

Zabbix6.0 new feature GEOMAP map marker can you use it?

疫情数据分析平台工作报告【6】可视化绘图

1. Mx6ull learning notes (II) - uboot migration

疫情数据分析平台工作报告【1】数据采集

图解 Apache SkyWalking UI 的使用

Zabbix6.0新功能Geomap 地图标记 你会用吗?

智能面板WiFi联动技术,ESP32无线芯片模组,物联网WiFi通信应用

如何制作数据集并基于yolov5训练成模型并部署

19. Optimized database query of tornado project

D1 Nezha development board power on record
随机推荐
[fpga+gps receiver] detailed design introduction of dual frequency GPS receiver based on FPGA
手动封装一个forEacht和Map
Kotlin 启动协程、launch 与async的区别、按照顺序启动协程
D1 哪吒开发板 上电记录
DS18B20 digital thermometer (I) electrical characteristics, power supply and wiring mode
leetcode797. 所有可能的路径(中等)
Brief introduction to 44 official cases of vrtk3.3 (combined with steamvr)
[automation] generate xlsx report based on openstack automated patrol deployed by kolla
Oracle:decode function
Exception handling and unit testing
Some points needing attention about thread pool
命令执行漏洞详解
Solution to missing in unity script
双目标定学习资料整理
PyTorch中的Sequential、ModuleList和ModuleDict用法总结
后续版本是否会支持代码块搜索高亮显示
Introduction to distributed locks
数据库新建表,以前没问题的,今天
魏武帝 太祖知不可匡正,遂不复献言
C# Task. Waitall method