Abstract: The MKV package format is a new multimedia package format developed by the open source organization. It has the advantages of being scalable and supporting multiple video and audio encoding formats. It is one of the main package formats used in HD movies. This paper designs and implements an MKV player based on SMP8654 platform, which can support the playback of high-definition MKV files, and further optimizes the characteristics of embedded systems and HD media, which has certain engineering significance and market value.
Keywords: MKV; multimedia encapsulation; SMP8654; player; embedded system
This article refers to the address: http://
0 Introduction With the advancement of electronic technology and multimedia technology, the resolution of digital video has gradually increased, and it has begun to evolve from SD (standard definition) to HD (high definition). With the development of large-screen liquid crystal display technology, high-definition movies have gradually entered the field of vision of consumers. The HD player supports a wide range of video and audio encoding formats, and can smoothly play 1080i/p resolution HD movies, and supports analog, digital, HDMI and other methods in output. In addition, in terms of price and film source, it has great advantages over Blu-ray players, and will gradually replace traditional players such as VCD and DVD, becoming the mainstream products of next-generation home entertainment.
MKV is a new multimedia package format that supports multiple video and audio encoding formats. It can pack up to 16 different formats of audio and subtitle streams in different languages â€‹â€‹into one file. It is widely used in high definition movies. More and more videos and movies use MKV as their package format. The ability to support the MKV package format is an important indicator of HD player performance. This paper proposes a design and implementation scheme of MKV player based on SMP8654 platform, and further optimizes the characteristics of embedded system and HD media, which can provide smooth playback of MKV files.
1 MKV package format MKV is called Matroska Video and is a new multimedia package format. The multimedia encapsulation format, also known as Multimedia Container, is different from the encoding formats such as H264, MPEG-2, and MPEG-4. It only provides a "shell" for multimedia encoding, and does not involve encoding itself. MKV is a standard developed by the open source organization Matroska Development Team. It consists of three parts: MKV (Matroska Video), MKA (Matroska Audio) and MKS (Matroska Subtitles). The latter two formats are used for audio and subtitles respectively. The purpose of MKV is to replace traditional packaging formats such as AVI. AVI is a package format that Microsoft introduced in 1992. The meaning is Audio Video Interactive, which is a combination of video and audio encoding. Microsoft introduced an improved version of AVI, AVl2.0, in 1996. There are more restrictions on the AVI format, only one video track and one audio track, and some additional tracks, such as text. The AVI format does not provide any control functions. In general, the traditional AVI-based package format is obsolete and can only contain a few audio and video formats, and is not open enough and has poor scalability. Because of this, it was the birth of a new multimedia packaging format such as Matroska.
Compared with the traditional package format, MKV has the following advantages: support variable bit rate (VBR), support for error detection and repair of soft subtitles, support for streaming, strong openness and cross-platform compatibility, support for more than 16 channels of audio. Stream and subtitle stream, etc. The biggest feature of Matroska is that it can accommodate almost all types of video, audio and subtitle streams, except H. In addition to 264, other video and audio formats such as MPEG4, MPEG2, Ac3, AAC, etc. can be included. Even the very closed RealMedia and QuicklTime are included, and their audio and video are reorganized to achieve better. effect.
Since the MKV package format itself has many advantages, with the popularity of the Internet and high-definition movies, the MKV format has been widely used, and more and more high-definition movies on the Internet use the MKV format. However, MKV is a standard developed and promoted by open source organizations, lacking the support of large commercial companies, resulting in the lack of a complete and effective design implementation of MKV file playback. This problem is particularly acute on embedded platforms with limited performance and resources. Although many high-definition players currently provide support for the MKV format, most of the implementation solutions have problems of imperfect support and low playback efficiency. When playing high-rate video, there will be fluency, video, etc. The problem affects the viewing effect. This paper proposes a design and implementation scheme of MKV player based on SMP8654 platform, and optimizes the characteristics of embedded system, which better meets the requirements of smooth playback of MKV files.
2 hardware platform and software overall design Hardware platform with SMP8654 chip as the core, through the bus and RAM, SATA hard disk, flash memory, input and output devices and other peripherals. The SMP8654 is a multimedia playback SoC solution from Sigma Design that integrates a powerful multimedia processor, robust content assurance system, new DDR2 memory controller, multiple on-chip CPUs, and a complete system peripheral interface. From the perspective of media playback, the smp8654 provides an advanced decoding engine that fully supports high-definition video decoding and supports MPEG1, MPEG-2, MPEG-4, and H. Hardware decoding in formats such as 264, WMV9, VCl, and AVS, supports high-performance graphics acceleration, multi-standard audio decoding and advanced display processing capabilities. Siena Design provides chip-related development kits and development frameworks for developing applications for third-party vendors. The work of this paper is also based on this framework for secondary development. In terms of the software platform, since a complete playback system is already quite complicated, it is not suitable for directly manipulating the underlying hardware to perform functions, and requires the support of the operating system. The operating system in this project uses uclinux, and the file system uses Romfs. Uclinux is a Linux customized for embedded systems. It has the main advantages of standard Linux operating system stability and powerful network functions, but it is not as complicated as standard Li-nux, mainly for no MMU (memory management unit). Microcontroller. Romfs is a file system designed for embedded systems. It is small, reliable, and fast to read. It is a common file system for embedded systems.
The playback process of the media file generally includes the following steps: system initialization, determining file type, file parsing, setting hardware decoder and audio and video decoding, wherein file parsing and audio and video decoding are key parts. Since the SMP8654 integrates a complete audio and video hardware decoder, the decoding work is mainly done by hardware. We only need to send the audio and video data to the corresponding decoding buffer as required. The overall software architecture is shown in Figure 2.
3 system key technology design and implementation
3.1 MKV file parsing MKV file parsing is mainly to parse the various components of the MKV format to obtain the necessary audio and video parameters and media data. MKV is a package format. The actual video and audio data are encapsulated into a sub-module. To obtain the actual data, the file must be parsed first, and the file parsing runs through the whole process. Whether it can be effectively and correctly parsed is related to the accuracy of reading data, which in turn affects the effect of playback. The MKV format uses variable-length encoding to reduce storage space, and on the other hand, it brings new problems to parsing.
The MKV file format is based on EBML (Extensible Binary MetaLanguagel, an extensible binary meta-language similar to XML format, which uses variable-length integer storage to save space. The basic structure of EBML is a typical TLV structure. There are three parts:
The ID flag attribute type, size is the size of the data part, the data part is the actual data of the attribute identified by the ID, and the ID and size are integers of variable length coding. The length of the integer is length=1+[number of leading zero bits]. The number of zeros in front is up to seven, that is, an integer that can represent up to 56 bits. A number greater than 56 bits is not allowed in the file.
The distinguishing feature of the MKV file format is modular, structured storage. Each higher level element consists of several levels of elements up to the most basic constituent elements, each of which is a TLV structure. A standard MKV file consists of two parts: EBML Header and Segment. The EBML Header is composed of sub-elements such as EBMLVersion and DocType, and contains information such as the version of the file and the type of the document. The Segment part saves the actual data of the video and audio of the media file, and its data part can be divided into several sub-elements such as SeekHead, Tracks, and Cluster (Table 1). All elements can be processed in a single process. We can follow the idea of â€‹â€‹layering TCP/IP protocol, using a function for each function of each layer, using lower-level functions to complete this function, and can be called by higher-level functions. When parsing a file, starting from the top of the file, whenever the element of the previous level is parsed to have a child element, the function is called to perform the next level of parsing, and then until the end of the file, the parsing of the file can be completed. The parsing call process of the entire MKV is shown in Figure 3. Hea-der Parse and Segment Parse are the uppermost element analytic functions of the file, and Cluster Parse and Tracks_Parse are the analytic functions of the next-level constituent elements. Ebml_read_ele-ment_idebml read element length is the analytic function of the bottommost basic constituent elements.
3.2 Setting the Hardware Decoder Audio and Video Core Parameters Tracks is used to describe the information of each multimedia stream contained in the file. A multimedia stream is described by a TrackEntry, and all tracks are described in a single Tracks. A TrackEntry mainly contains: TrackNumber (determining which ID of the stream belongs), TrackType (video, audio or subtitle), TimeScale (timestamp unit), CodecID (encoding format); CodecPrivate (private data required for different encoding formats) Etc.; for video, it also contains the following information: PixelWidth, PixelHeight, and so on. For audio, the track also contains the following information: channels, Sampling Frequency, and more. These are the key parameters about whether audio and video can be correctly decoded and played. They need to be obtained during parsing and then set by hardware manipulation function.
The Cluster contains the actual data, a Cluster block, usually a media data spanned by a few seconds, and a file with thousands of Clusters. Each Cluster has several BlockGroups. Based on the starting pts and duration of the Cluster and BlockGroup, the actual pts of the current block can be calculated. PTS is important data used to determine the playback time, and is also the key information for audio and video synchronization. This part of the information is to set the hardware decoder while feeding video or audio data.
3.3 Performance Optimization MKV packaged movies are usually HD movies with a resolution of 1920Ã—1080, even with H. Advanced coding formats such as 264, the code rate is still very high. At the same time, MKV supports variable bit rate, variable code rate can reduce the file size, but the violent fluctuation of the code rate will make the playback not smooth. In high-definition files, the code rate is generally between 10 and 30 M/ps, and the highest is 60 Mp/s. With such a high bit rate, if no special processing is performed, it is easy to appear during playback, and the playback is not smooth. To solve this problem, we consider it from two aspects.
In terms of parsing, the efficiency of parsing is related to whether the data can be read into the buffer as soon as possible. If the processing time is too long, the buffer will be empty for a period of time, and then there will be a jam. The MKV file usually contains one channel of video, multiple channels of audio and multiple subtitles. Only one channel of audio and one subtitle are selected during playback. The data of other channels can be regarded as invalid data. When parsing, it can be judged according to the flag of the block header whether the data is valid data or invalid data required for current playback. If it is valid data, continue to parse and send audio and video data to the buffer. If it is invalid data, without parsing, move the file pointer directly to the next block, which can greatly speed up file parsing and data reading.
In terms of playback, usually the processing flow during playback is to read one frame of data, and then send it to the hardware decoder, and wait until the hardware decoder is empty, and then read the data of the next frame. If it is to deal with the playback of low-rate files, this will not be a problem, but when the file resolution is higher and the code rate is higher, the parsing read time and decoding time will increase, which will cause the card to be stuck. To solve this problem, we have designed a buffer FIFO in memory, which is equivalent to a sliding window (Figure 4). The buffer can store several frames (one frame is a block, and the number of buffers stored according to the size of the frame is not Wait). When the buffer is not full, it reads a block in the file and parses it, then passes the actual data to the end of the buffer. When the hardware buffer is found to be idle, the data of the FIFO leader is sent directly from the memory into the hardware buffer, and there is no need to read the file. Since there are multiple frames in the buffer, it can provide a certain buffer, so that the data can be provided in time when the code rate fluctuates, avoiding the problem that the hardware buffer is empty and the playback is not smooth.
4 Conclusion This article details the features of the MKV package format. Based on SMP8654, a design and implementation scheme of MKV player is proposed. After verification, it can achieve smooth playback of high-definition MKV files and has been applied to products. Next, we will do further research. Based on the MKV player, we will design a universal media player framework for multiple package formats, and integrate other formats such as FLV and FLAC, and provide better scalability. It is convenient to expand other package formats later.
24V AC Adapter also can be called 24V AC DC Adapter. It is with input 100v~240v can be used for worldwide. For 24v Power Adapter yidashun can manufacture from 24V 1A~24V 10A Max power. Usually most popular sell model is 24V 3A 5A with dc size 5.5*2.1mm or 5.5*2.5mm for led lights.
our 24v psu all is with full power and can be used for led lights or other devices run constantly each day.
Yidashun can also customized the 24v power supply as your demands. if the Adapter output you need is not 24V, pls do not hesitate to contact us, we can customized the output voltage, current, dc size, Cable length according to your specifications.
Yidashun can also customized the 24v adapter as your demands. if the adapter output you need is not 24V, pls do not hesitate to contact us, we can customized the output voltage, current, dc size, cable length according to your specifications.
24V AC Adapter,24V AC Power Adapter,24V AC DC Adapter,24V AC Switching Adapter
Shenzhen Yidashun Technology Co., Ltd. , http://www.ydsadapter.com