1. Background
Video analysis is widely used in the field of sports. Coaches and athletes can carefully study the details of the game by controlling the segmentation, playback, and pause of the game video, and analyze and summarize the technical and tactical characteristics of the athletes, which can be used as first-hand information to guide the athletes' daily training and competition. With the continuous development of multimedia technology and video encoding and decoding technology, high-definition video, as an important tool that can provide strong support for the study of athletes' technical and tactical levels, is increasingly valued by coaching teams in various countries.
MTS video format is an emerging high-definition video format. Its video encoding usually adopts H264 format, audio encoding adopts AC-3 format, and the resolution is full HD standard 1920*1080. Due to the complexity of H264 encoding adopted by MTS video format, the decoding of MTS has high requirements for hardware compatibility. HD video sources will pause and lose frames when played on many existing players, so it is necessary to convert them into MPEG format with stronger compatibility. When using the original national fencing team video management system developed based on DrectShow technology for MTS format video encoding, the problem of not being able to recognize the video format will occur, and due to the low efficiency of DrectShow for video encoding, it takes too long to process HD video, affecting the system work efficiency.
To solve this problem, this paper, based on the original video management system, uses the binary library generated by compiling FFmpeg in the Windows environment to improve the original video editing module, realizes the cutting of MTS format high-definition video sources and the compression conversion to MPEG format, and uses the XML Parser component to save the timeline information of the edited video to an XML document, thus realizing the editing, storage and management of high-definition sports videos.
2 FFmpeg encoding
2.1 Introduction to FFmpeg
FFmpeg is a powerful open source free cross-platform audio and video encoder and decoder collection. It is free software and uses GPL or LGPL licenses. It supports more than 40 encodings such as MPEG, MTS, MPEG4, and more than 90 decodings such as MPEG, Matroska, OGG, etc. It is a complete open source solution that integrates recording, conversion, audio/video encoding and decoding functions. FFmpeg is developed based on the Linux operating system and can also be compiled and used in most operating systems. It has high encoding efficiency. Therefore, based on the above advantages, this system chooses FFmpeg as the basis for implementing the video editing module.
2.2 Compiling FFmpeg in Windows
FFmpeg is a cross-platform open source project based on Linux system. It uses gcc compiler. To compile FFmpeg in Windows environment, you cannot use special compilers such as BCB or VC++. You need to download the compilation tool chain mingw installation package first and configure the corresponding environment variables. In addition, you need to install Msys to simulate the Linux environment and install yasm.
exe's 32-bit version (corresponding to your own operating system) to compile the assembly code in FFmpeg.
After the installation is complete, edit the C:\MinGW\msys\1.0\msys.bat file and add the relative path of VS2010 to the last line. After adding this line, when compiling FFmpeg, there will be an additional lib corresponding to the dll called under Windows. There are four commonly used library files: libavcodec, libavformat, libavutil and libswscale. The libavcodec library stores the decode/encode modules for audio and video decoding and encoding, the libavformat library stores the muxer/demuxer modules for merging/separating audio and video streams, and the libavutil library stores auxiliary modules such as memory operations.
2.3 FFmpeg encoding implementation
This video editing module mainly calls the corresponding functions in the audio/video codec library libavcodec to realize format conversion and cutting functions. Before using FFmpeg encoding, you first need to initialize the libavcodec library, register all codecs and file formats, import encoder bit rate, frame rate, encoding pixel format and other parameters, and then find the encoder and open it for encoding. By assigning values to each member parameter in the structure AVCodecContext with preset video parameters, the setting of encoding parameters is realized. The core function of encoding is avcodec_encode_video(). Every time the system collects a frame of data, it is sent to the avcodec_encode_video() function to be encoded into an H.264 video stream. The detailed functions and encoding process during the encoding process are shown in Figure 1.
3 Implementation of video editing module based on FFmpeg
The structure of the improved HD video editing module is shown in Figure 2.
4 High Definition Video Analysis System
The video analysis system of the national fencing team after adding the high-definition video editing module is shown in Figure 4.
This paper uses a 4-minute and 5-second clip from the standard HD test video of the fencing team to test the video editing module. The image resolution of the source is 1920*1080, the bit rate is 12414kbps, the frame rate is 25 frames/second, and the source file size is 363MB. This system is used to intercept a 2-minute video for format conversion. The encoding system correctly identifies the source file and outputs a 138MB MPEG file. The actual playback effect on the player shows that the video editing module can correctly cut and compress the HD MTS format source file according to user requirements into a smoothly playable MPEG format, which basically meets the design requirements.
5 End
This paper elaborates on the design and implementation of a high-definition video editing module based on FFmpeg. After analyzing the shortcomings of the original editing module developed based on DrectShow technology, it analyzes and proposes an improvement plan based on FFMpeg, and introduces the specific implementation of the plan. This solution maintains FFmpeg's efficient encoding rate and good encoding quality while being compatible with other modules of the original system. The edited video meets the various requirements for training use by the national fencing team.
Previous article:Development of circuit breaker partial discharge test system
Next article:Electronic wallet system for electronic games using smart cards
- Popular Resources
- Popular amplifiers
- MathWorks and NXP Collaborate to Launch Model-Based Design Toolbox for Battery Management Systems
- STMicroelectronics' advanced galvanically isolated gate driver STGAP3S provides flexible protection for IGBTs and SiC MOSFETs
- New diaphragm-free solid-state lithium battery technology is launched: the distance between the positive and negative electrodes is less than 0.000001 meters
- [“Source” Observe the Autumn Series] Application and testing of the next generation of semiconductor gallium oxide device photodetectors
- 采用自主设计封装,绝缘电阻显著提高!ROHM开发出更高电压xEV系统的SiC肖特基势垒二极管
- Will GaN replace SiC? PI's disruptive 1700V InnoMux2 is here to demonstrate
- From Isolation to the Third and a Half Generation: Understanding Naxinwei's Gate Driver IC in One Article
- The appeal of 48 V technology: importance, benefits and key factors in system-level applications
- Important breakthrough in recycling of used lithium-ion batteries
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- [NXP Rapid IoT Review] Rapid IoT Studio Simple Programming Step 3 Bluetooth Connection Control Test
- If anyone has an electronic version of this book, please share it with me, thank you!
- Inline instructions in TI DSP TMS320C66x study notes
- Part-time job - Embedded Linux + Android related product development
- Knowledge about the pressure taking method of throttling device
- Please recommend a development board
- Dr. MC is available for viewing. Can be discussed openly
- The new forum homepage is online! Do you think it is necessary to keep the old homepage entrance?
- How to quickly write the output logic expression of CMOS logic gate circuit
- Recommendations for components encountered in peak sampling circuit design