In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "Qt ffmpeg decoding processing method is what," interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let Xiaobian take you to learn "Qt ffmpeg decoding processing method is what"!
I. Foreword
Using ffmpeg decoding is an essential skill for all video surveillance developers. It is a thing that cannot be bypassed. It can even be said that it is an essential skill for all audio and video developers. FFmpeg is an open-source computer program that can record, convert, and stream digital audio and video. It includes the leading audio/video coding library libavcodec. FFmpeg was developed under Linux, but it compiles on most operating systems, including Windows. This project was started by Fabrice Bellard and is now hosted by Michael Niedermayer. Can easily achieve a variety of video formats between the mutual conversion, such as video avi can be recorded under the current video site used to convert flv format.
About ffmpeg decoding, online search to the code is definitely a lot of a lot, and many are very detailed, decoding function flow chart is very clear, about ffmpeg this piece of learning I recommend Thor blog, analysis is quite detailed, I just used Qt+ffmpeg decoding a long time ago, reference is Thor example, of course, these demos in fact ffmpeg development package dev examples are also very detailed, but there is no analysis process, Refer to Thor's blog to see a lot of the analysis process.
I summarize the decoding process:
Register decoding library related (av_register_all, avformat_network_init, etc.)
Initialize various parameters such as cache size (av_dict_set)
Open a video stream or file (avformat_alloc_context, avformat_open_input)
Get stream information (avformat_find_stream_info)
Get video stream and initialize video decoder (av_find_best_stream, avcodec_find_decoder)
Get audio stream and initialize audio decoder (av_find_best_stream, avcodec_find_decoder, avcodec_open2)
Pre-allocated frame memory (av_frame_alloc)
Read audio and video frames cyclically (av_read_frame, av_packet_unref)
Decoded video (avcodec_decode_video2 or avcodec_send_packet, avcodec_receive_frame)
Decoding audio (avcodec_decode_audio4)
End of processing to release resources (sws_freeContext, av_frame_free, av_free)
II. Functional characteristics
Multi-threaded real-time playback of video streams and native videos.
Windows+linux+mac support, ffmpeg3 and ffmpeg4 support, 32-bit and 64-bit support.
Multi-thread display image, not card main interface.
Automatically reconnect the webcam.
You can set the border size i.e. offset and border color.
Can set whether to draw OSD label, i.e. label text or picture and label position.
Two OSD positions and styles can be set.
You can set whether to save to a file and file name.
Drag files directly to the ffmpegwidget control for playback.
Support h365 video stream +rtmp and other common video streams.
You can pause and resume playback.
Support callback mode and handle mode.
Support thread reading progress and other information and event callback two processing modes.
Automatically signals whether the current playback position and volume are muted.
Provide interface to set playback position and volume and mute settings.
Support single video file storage and timed video file storage.
Customize the top float bar, send a signal notification by clicking, and set whether to enable it.
Support qsv, dxva2, d3d11va hard decoding.
Support opengl rendering video data, very low CPU usage.
Support embedded Linux.
III. Effect Drawing
4. Core code bool FFmpegThread::init(){ //determine whether the camera can be connected if (checkConn && isRtsp) { if (! checkUrl(url, checkTime)) { return false; } } //initialization parameters this->initOption(); //Initialize input if (! initInput()) { return false; } //Initialize video if (! initVideo()) { return false; } //Initialize audio if (! initAudio()) { return false; } //initialization frame this->initFrame(); //Output video information //av_dump_format(formatCtx, 0, url.toStdString().data(), 0); //qDebug()
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.