In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to realize mpv video storage by Qt". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "Qt how to achieve mpv video storage"!
I. Preface
Using mpv to store videos and save video files has never been so convenient. Just set the file path corresponding to the attribute stream-record directly. My dear, one line of code is so concise and beautiful that I can't believe my eyes. Mpv supports not only the mainstream win, linux and mac operating systems, but also mobile Android IOS, especially all kinds of embedded linux. I remember that if vlc wants to cross-compile successfully on the embedded linux, it is difficult to cross-compile on the embedded linux. There are too many dependencies on various plug-ins. Until you give up, the linux system on X86 is more convenient, but in this block, mpv is simply a complete vlc. The direct command line can be installed on the embedded linux. The built-in ffmpeg super decoder allows you to directly call mpv on the command line to play audio and video. This is very useful in some scenarios where Qt cannot play audio and video on embedded linux. I use mpv to play audio and video on Quan Zhi H3 board. The default GPU decoding makes CPU occupy the polar regions.
Previous articles have written that both vlc video storage and ffmpeg video storage support both saving as a video file and timing storage as different video files. This function uses the same strategy, so turn on a timer to deal with it. For example, if you turn on timing storage, stop recording at the time, then start recording again and reset the name of the video file. The same is true for mpv. Setting the property stream-record to an empty string means to stop recording, and then reset the property stream-record to the new file name.
II. Functional features
Multi-thread real-time playback video stream + local video and so on.
Windows+linux+mac is supported.
Multi-thread display image, do not card the main interface.
Automatically reconnect the webcam.
You can set whether to save to a file and the file name.
You can drag the file directly to the mpvwidget control to play.
Supports h365 video streams + rtmp and other common video streams.
Playback can be paused and resumed.
Support for storing individual video files and storing video files at regular intervals.
Customize the top suspension bar and send click signal notification, which can be set whether it is enabled or not.
Can set screen stretch fill or proportional fill.
You can take screenshots (original pictures) and screenshots of the video.
Video files store MP4 files.
Qsv, dxva2, d3d11va and other hard decoding are supported.
Third, effect picture
4. The core code void MpvThread::initSave () {if (! saveFile) {return;} if (saveInterval = = 0) {saveVideo (fileName);}} void MpvThread::saveVideo () {if (! saveFile) {return;} / / reset the file name QString dirName = QString ("% 1ram% 2") .arg (savePath) .arg (QDATE); newDir (dirName) FileName = QString ("% 1/%2_%3.mp4") .arg (dirName) .arg (fileFlag) .arg (STRDATETIME); saveVideo (fileName);} void MpvThread::saveVideo (const QString & fileName) {if (mpvPlayer) {/ / the path to the platform, otherwise the Chinese directory may not recognize QString file = QDir::toNativeSeparators (fileName); QByteArray data = file.toUtf8 () SetValue ("stream-record", "); setValue (" stream-record ", data.constData ());}} so far, I believe you have a deeper understanding of" how Qt implements mpv video storage ". You might as well do it in practice! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.