CN100496129C - H.264 based multichannel video transcoding multiplexing method - Google Patents

H.264 based multichannel video transcoding multiplexing method Download PDF

Info

Publication number
CN100496129C
CN100496129C CN 200710023476 CN200710023476A CN100496129C CN 100496129 C CN100496129 C CN 100496129C CN 200710023476 CN200710023476 CN 200710023476 CN 200710023476 A CN200710023476 A CN 200710023476A CN 100496129 C CN100496129 C CN 100496129C
Authority
CN
China
Prior art keywords
stream
video
mpeg
program
transcoding
Prior art date
Application number
CN 200710023476
Other languages
Chinese (zh)
Other versions
CN101068366A (en
Inventor
肃 严
方怀东
翀 柳
陈启美
鹿宝生
Original Assignee
南京大学
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 南京大学 filed Critical 南京大学
Priority to CN 200710023476 priority Critical patent/CN100496129C/en
Publication of CN101068366A publication Critical patent/CN101068366A/en
Application granted granted Critical
Publication of CN100496129C publication Critical patent/CN100496129C/en

Links

Abstract

基于H.264多路视频转码复用的方法,输入是多路MPEG-2单节目流,输出是一路H.264多节目流,实现MPEG-2到H.264的视频转码、音视频的解复用与复用、多路H.264节目的复用,其视频转码包括码率、分辨率及格式转换;MPEG-2到H.264的视频转码算法采用MPEG-2到H.264码的快速转换方法,利用H.264的宏块模式选择与MPEG-2运动补偿残差间的相关性,利用MPEG-2解码得到的运动补偿残差、MB模式、直接映射成H.264的宏块模式;并且合成TS流,在多路MPEG-2节目流以ASI接口通过PCI总线输入转码复用服务器,转码复用后的单路H.264视频流通过PCI总线以ASI接口方式输出。 The method of multiple video transcoding H.264 multiplexing based on a multi-channel input single program MPEG-2 stream, the output multi-program stream is H.264 way to achieve transcode MPEG-2 to H.264 video, the audio and video demultiplexing and multiplexing, multiple H.264 multiplex program which comprises transcoding the video bit rate, resolution and format conversion; video transcoding MPEG-2 to H.264 algorithm uses MPEG-2 to H fast H.264 code conversion method using the H.264 macroblock mode selection and correlation between the MPEG-2 motion compensation residual, residual motion compensation, MB mode MPEG-2 decoding obtained directly mapped into H. 264 macroblock mode; synthesis and TS stream in multiplexed MPEG-2 program stream through the PCI bus to the input ASI interface multiplexing transcoding server transcoded single multiplexed H.264 streams to PCI bus ASI output interfaces.

Description

基于H. 264多路视频转码复用的方法. The method of H. 264 multiplexed multiplexed video transcoding based.

技术领域 FIELD

本发明属于数字电视中的视频压縮编码与复用领域。 The present invention belongs to the video compression-encoded digital television and Multiplexing art. 尤其是涉及基于H.264多路视频转码复用的方法和复用器。 More particularly, to a method and a multiplexer-based multi-channel video transcoding H.264 multiplexing. 背景技术 Background technique

近年来移动数字电视在国内迅速发展,但图像带宽束缚了数字视频业务的拓展。 In recent years, the rapid development of mobile digital television in the country, but the image-bandwidth constrained the expansion of digital video services. 为了兼顾码流传输效率和视频图像质量,系统通常的传输速率在6〜10Mbps。 In order to take into account the transmission efficiency and stream video image quality, system transfer rate typically 6~10Mbps. 而数字电视视频录像节目多采用MPEG-2视频压縮标准,图像尺寸较大。 The digital video recording television programs using multiple MPEG-2 video compression standard, the image size is large. 比如,标清的MPEG-2 码率约为4Mbps,高清的MPEG-2码率约为10Mbps。 For example, the MPEG-2 standard definition about 4Mbps bit rate, MPEG-2 HD bitrate of about 10Mbps. 移动数字电视用户的带宽一般难以满足多路高码率的视频流的实时传输,为了使用户能在较低带宽的情况下能顺利收看更多的移动数字电视节目,需要降低视频^1的码率。 Mobile digital TV user's bandwidth is generally difficult to meet the real-time transmission of high bit-rate multiplexed video stream, to enable the user to move more smoothly watch digital TV programs with lower bandwidth necessary to reduce the video code ^ 1 rate. 再加上储存容量的限制和各种不同数字电视终端的出现,使数字电视用户对高效的视频编码技术需求越来越迫切。 Together with the storage capacity limit and varying the various DTV terminal, the user of the digital television efficient video encoding technology needs more urgent.

在数字电视信源未采用低码率、高清晰度的压縮编码标准之前,上述问题目前的解决办法有两个,其一是将高码率的MPEG-2等数字视频进行高压缩,转为低码率的MPEG-2数字视频;其二是将高码率的MPEG-2等数字视频进行转码,转为H. 264数字视频。 In the digital television signal source is not a low bit rate, high resolution prior to compression coding standard, the above problems have now two solutions, one of which is the high rate of the MPEG-2 digital video and other high-compression, transfer MPEG-2 digital video of low bit rate; the other is the high rate of the MPEG-2 digital video transcoding and the like, into H. 264 digital video. 第一种方法将会导致图象质量大幅度下降,显然不可取,第二种方法则会在几乎不降低图象质量的情况下,获得更高压縮效率和更低传输码率。 The first method will lead to a significant decline in image quality, clearly undesirable, in the case of the second method will be hardly reduced image quality, and higher compression efficiency lower transmission rate.

与MPEG-2相比,H.264在同等图像质量下,能够提高4倍以上的压縮效率。 Compared with MPEG-2, H.264 in the same image quality can be improved more than 4 times the compression efficiency. 可见上述第二种方法比较可取。 Visible above second method is preferable. 但化264作为单纯的视频压縮标准,没有关于音视频合成及多路复用传输等方面的内容。 However, of the 264 video compression standard as a simple, no details about aspect of the multiplex transmission of audio and video synthesis and the like. 目前也没有专用的设备实现MPEG-2到H. 264的视频转码以及复用。 There is also no special equipment to achieve transcoding MPEG-2 video and the H. 264 multiplexing. 考虑到电视台原有的MPEG-2前端设备数量多且非常昂贵,摒弃己有大量的MPEG-2前端设备,包括数码摄像机、非线性图像节目编辑器,这是不现实的。 Considering the number of the original MPEG-2 TV distal and very expensive equipment and more, a large number of already discarded MPEG-2 distal devices, including digital cameras, linear image editor program, this is not realistic. 如何保障图像质量,同时大幅度降低图像的带宽,即构建转码复用专用设备已成当务之急。 How to ensure the image quality while significantly reducing bandwidth of the image, that is to build transcoding multiplexing equipment is urgent.

现有技术中未涉及基于H.264多路视频转码复用的方法和复用器。 No prior art relates to a method based on H.264 transcoding multiple video multiplexer and multiplexed. 如CN1745573图像拾取设备及其运动图片拍摄方法,在运动图片拍摄模式下工作的图像拾取装置,其中运动图片拍摄开始之前,通过在键输入部分(12)上的快门按钮来指示, 将控制部分(IO)的时钟频率设置为普通频率,从而减小监控状态下的电力消耗以延长电池寿命,而且其中,当指示运动图片拍摄开始时,由时钟转换控制部分(101)将该时钟频率大幅增加,从而使得在对运动图片数据进行解码处理期间,MPEG转换器(7) 能够高速访问存储YUV数据,例如参考数据,搜索数据等的SDRAM(8),并能够对运动图片进行实时压縮。 The image pickup apparatus and CN1745573 moving picture photographing method, operating at an image moving picture photographing mode pickup apparatus, wherein before the start of moving picture photographing, a shutter button indicated by the key input portion (12), the control section ( IO) clock frequency is set to normal frequency, so that the power consumption (101) increased significantly to prolong battery life, and wherein, when a moving picture photographing start indication, the clock switching control section decreases the clock frequency in the monitor state, so that the motion picture data during the decoding process, MPEG converter (7) capable of storing the YUV data high-speed access, such as SDRAM reference data, search data, etc. (8), and is capable of real-time compression of the moving picture.

CN1567271具备高速网络接口的MPEG码流变换采集方法及装置,在设备内实现传输流的数据过滤、PID修改、服务信息插入和码率变换,设备具有高速以太网接口用于将变换后的目标传输流传送到计算机中。 MPEG stream data collection method and apparatus CN1567271 conversion with high-speed network interface, data filtering device in the transport stream, the PID modification, insertion, and service information rate conversion device having the target transmission speed Ethernet interface is used to transform stream to the computer. 实现码流的直接采集,也能够对码流进行处理。 Direct acquisition stream, it is possible to process the stream.

CN1633180基于变换和数据融合的多描述视频编码方法,包括对要编码的信号实施变换l〜n;分别对变换l〜n后的信号进行量化和熵编码;分别按照各自的路径1〜n对量化和熵编码后的信号1〜n进行解码;分别对解码后的信号1〜n进行逆变换;逆变换后分别得到边描述l〜n,将l〜n个逆变换后的数据融合成为中心描述等步骤。 CN1633180 Multiple Description Transform and Data Fusion video encoding method, comprising converting l~n embodiment to be coded signal; respectively l~n transformed signal is quantized and entropy encoding, respectively; according to a respective quantization path 1~n and the encoded signals 1~n entropy decoding, respectively; 1~n decoded signals and inverse transforming; were obtained after the inverse transform side l~n described, the data inverse conversion l~n integrated into a central described and other steps. 它能将基于变换和数据融合的多描述编码和视频编码结合起来,对一组视频序歹ij,这种编码方法能产生多个MPEG码流,从每一个码流中都可以还原出一个失真较大的视频序列;当多个码流被收到时, 一个失真较小的视频序列将被还原出来。 It will be based on a combination of video coding and multiple description coding and data conversion of fusion up to bad sequence ij of a set of video, this encoding method capable of producing a plurality of MPEG streams, each stream from the distortion can restore a larger video sequence; when a plurality of streams are received, a small distortion of the video sequence will be to restore them. 发明内容 SUMMARY

本发明提出了在原有的MPEG-2移动数字电视的基础上,增加专用的H.264视频转码复用服务器,并采用变换域的视频转码算法,降低转码复杂度。 The present invention is proposed on the basis of the mobile digital TV on original MPEG-2, adding a dedicated multiplexed H.264 video transcoding server, and the video transform domain transcoding algorithm, reducing the complexity of the transcoding. 用软件方式实现了多路MPEG-2到H.264的转码、H.264视频与音频的复用与解复用及多路H.264节目的复用与解复用。 Multiplexing the transcoding MPEG-2 to H.264 by software manner, H.264 video and audio multiplexing and demultiplexing the multiplexed H.264 multiplexing program and demultiplexing.

本转码复用器的实现所采用的技术方案如下:基于H.264多路视频转码复用的方法和复用器,输入是多路MPEG-2单节目流,输出是一路H.264多节目流,实现MPEG-2到R264的视频转码、音视频的解复用与复用、多路H.264节目的复用,其视频转码包括码率、分辨率及格式转换。 Implement the transcoding multiplexer adopted the following technical solution: a method based on H.264 transcoding multiple video multiplexer and multiplexed, the multiplexer inputs are single program MPEG-2 stream, the output all the way H.264 multi-program stream for video transcoding MPEG-2 to R264, the solution multiplexing video and audio multiplexing, multiple H.264 multiplex program which comprises transcoding the video bit rate, resolution and format conversion. MPEG-2到H,264的视频转码算法采用基于机器学习的转码算法,实现码率、分辨率可调,帧内、帧间采用不同的算法。 MPEG-2 to H, transcoding video transcoding algorithm 264 uses machine learning algorithm to achieve bit rate, resolution adjustable, intra, inter different algorithms. MPEG-2 到R264码的快速转换方法如下述。 The method of rapid conversion to MPEG-2 code R264 as follows. 在合成TS流时按一定规律重新改写PID值,以避免PID冲突引起的解码器不能正确解码。 In synthesizing the TS stream according to certain rules rewrite PID value to avoid PID conflicts caused by the decoder can not decode correctly. 在合成TS流时对PMT表的流类型字段作相应的修改。 In synthesizing the TS stream of a stream type field of the PMT amended accordingly. 多路MPEG-2节目流以ASI接口通过PCI总线输入转码复用服务器, 转码复用后的单路H.264视频流通过PCI总线以ASI接口方式输出,并使用FIFO提供的半满信号来读取FIFO数据或写FIFO,以避免CPU频繁访问PCI接口。 Multiplex MPEG-2 program stream multiplexed transcoded ASI interface input server via a PCI bus, multiplexed transcoded H.264 streams in a single ASI interface output by way of the PCI bus, and a half-full signal provided by the FIFO to read or write data FIFO FIFO, in order to avoid frequent access CPU PCI interface. MPEG-2 到H.264的转码以及多路转码后的H.264视频流与音频流复用在同一服务器中完成。 Transcoding MPEG-2 to H.264 and multiplexed transcoded H.264 video stream and an audio stream multiplexed in the same server is completed.

TS流由编码后的基本数据流(ES)根据一定的格式打包形成PES包,再加入一些系统信息而构成,在发送端,基本流的PES打包由音/视频编码器完成,复用器接收编码端的音、视频数据流以及辅助数据流,按照一定的复用方法将其交织成为单一的TS流。 TS stream from the packed elementary streams (ES) encoded according to a certain format for the PES packets, then add some system configuration information, the transmitting side, the elementary stream PES done by packing audio / video encoder, multiplexer receives audio encoding end, the video data stream and auxiliary data stream, according to a certain method which interleave multiplexing into a single stream TS. 为了实现音、视频同步,在码流中还必须加入各种时间的标志和系统的控制信息。 In order to achieve audio and video synchronization code stream information must also be added to the control systems of various signs and time. 对于接收端,则正好和发送端过程相反。 For the receiving end, the transmitting end and the process is just the opposite.

MPEG-2到H.264的视频转码:从MPEG-2视频到H.264视频的转码,目前主要有两种架构:基于像素域的级联体系转码(CPDT)和基于DCT域的转码(DDT)。 MPEG-2 to H.264 transcoding video: MPEG-2 video from the transcoding H.264 video, there are mainly two architectures: a cascade system based on pixel-domain transcoder (CPDT) and based DCT domain transcoding (DDT). 基于像素域的级联体系转码就是先完全解码,在像素域做处理,再重新编码。 Based cascaded pixel-domain transcoding system is the first fully decoded, the processing done in the pixel domain, and then re-encoded. 由于二次编码时编码部分和解码部分在结构上完全独立,因此转码具有很大的灵活性,但是对宏块数据的运动矢量和编码模式都重新作了计算,转码效率低,如全靠软件来实现, 难以达到实时的要求。 Since the coding section and the decoding section when the two-pass encoding is completely independent in structure, and therefore has great flexibility transcoding, but the motion vector and the encoding mode of the macro block data have been calculated again, transcoding low efficiency, such as full rely on software to implement, difficult to achieve real-time requirements. 基于DCT域的转码(DDT)直接在DCT域对DCT系数、运动失量等重估计,计算复杂度低,但灵活性受到限制,当要求改变运动矢量、码率、分辨率等,就很难采用这种体系结构。 Based transcoding DCT domain (of DDT) directly in the DCT domain DCT coefficients, motion estimation and other heavy loss, low computational complexity, but the flexibility is limited, when it is desired to change the motion vector, bit rate, resolution and the like, it is difficult to adopt this architecture.

本发明MPEG-2到H.264码的快速转换方法,利用H.264的宏块模式选择与MPEG-2运动补偿残差间的相关性,将H.264宏块模式选择问题转化为数据分类问题, 利用MPEG-2解码得到的运动补偿残差、MB模式、编码块模式(CBPC)直接映射成H.264的宏块模式;在MPEG-2码解码时,保存相关的MB信息,包括MB编码模式、编码块类型(CBPC)、 MB残差的均值和方差(以4x4的sub-MB分别计算,共16个均值和方差),其解码后采用标准的H.264编码器对YUV图像编码,并保存H.264 MB编码模式,采用机器学习算法得到决策树,用于H.264编码模式的分类;在MPEG-2 码流解码时,获取MPEG-2的MC残差、宏块模式、编码块模式(CBPC),并计算出4x4子块MC残差的均值和方差;通过决策树获取H.264中宏块编码模式;在H.264 编码时,对MB的编码模式直接赋值;H.264编码器的输入为MPEG-2解码后的YUV 数据以及MB编码模式,并 The method of rapid conversion to the H.264 MPEG-2 code according to the present invention, the use of the H.264 macroblock mode selection and the correlation between the MPEG-2 motion-compensated residuals, the H.264 macroblock mode selection data classified into problem, motion compensation residual obtained by decoding MPEG-2, MB mode, a coded block pattern (CBPC) is mapped directly to the H.264 macroblock mode; when the MPEG-2 decoding, MB saved relevant information, including MB coding mode, coding block type (CBPC), MB mean and variance of the residuals (in the 4x4 sub-MB are calculated, the mean and variance of 16), after which the decoded using standard H.264 encoder for encoding the YUV image , MB and stores H.264 coding mode, machine learning algorithm decision tree for classifying H.264 coding mode; when decoding MPEG-2 stream, obtaining a residual MC in MPEG-2, macroblock modes, coded block pattern (CBPC), and calculate the 4x4 subblock MC residual mean and variance; obtaining the H.264 macroblock coding mode decision tree; in the H.264 coding, the MB coding mode direct assignment; H H.264 encoder input after the YUV data of MPEG-2 decoding and encoding mode MB, and 有使用MPEG-2的运动矢量,在运动估计时,使用由决策树得到的MB编码模式。 There MPEG-2 using the motion vector in motion estimation, the MB coding mode obtained by the decision tree. 其转码算法框图如图1所示。 Transcoding algorithm which block diagram shown in Fig.

得到决策树的方法是:决策树分类应遵循一下原则: Get the decision tree method is: what should follow the principle of decision tree classification:

1) 将输入序列分成Intra、 Skip、 Inter 16><16和Inter 8x8的分类器; 1) the input sequence into Intra, Skip, Inter 16> <16 and Inter 8x8 classifier;

2) 将Inter 16x16分成16x16、 16x8、 8><16的分类器; 2) into the Inter 16x16 16x16, 16x8, 8> <classifier 16;

3) 将inter 8x8分成8x8、 8x4、 4x8、 4><4的分类器。 3) into the inter 8x8 8x8, 8x4, 4x8, 4> <4 classifiers.

决策树生成应遵循一下原则: Decision Trees should follow what principles:

1) 如果MPEG-2 MB的MC没有编码,即没有非零MV, 4个8x8块没有编码系数,H.264MB将被编码成16x16,需通过决策树二级判别,选择最优模式; 1) If the MPEG-2 MB is not coded MC, i.e. no non-zero MV, 4 th 8x8 block is not coded coefficients, H.264MB to be encoded into a 16x16, two discrimination required by the decision tree, select the optimal mode;

2) 如果MPEG-2MB为intra模式,则在H.264中,该MB编码成intra或inter 8x8, 若编码成intra,算法终止;若为inter8x8,需通过二级判决,选择最优模式; 2) If the MPEG-2MB as intra mode, in H.264, the MB encoded as intra or inter 8x8, if coded into intra, the algorithm terminates; if inter8x8, by two judgments required, selects the optimal mode;

3) 如果MPEG-2 MB为skip模式,在H.264中,该MB也为skip模式。 3) If the MPEG-2 MB is a skip mode in H.264, also the MB skip mode.

4) 决策树通过WEKA数据挖掘工具生成。 4) tool generates decision data mining by WEKA. WEKA的数据挖掘程序的文件格式为ARFF (Attribute-Relation File Format)。 WEKA file format for data mining program ARFF (Attribute-Relation File Format). 一个ARFF文件采用ASCII代码书写,反映 A ARFF file in ASCII code is written, reflect

一组属性间的相互关系。 The relationship between the properties of a group. 一般包括两个不同的段:1)文件头,包括关系的名称、属性和类型;2)数据。 Typically includes two distinct sections: 1) the file header, including the name, the attribute and type of relationship; 2) data.

5) 训练集由高码率的MPEG-2序列组成,不包括B帧。 5) the training sequence set by the MPEG 2-high rate of composition does not include B-frames. 决策集由MPEG-2码流解码后,H.264重新编码得到。 After the decision set by the MPEG-2 stream decoding code, H.264 been re-encoded. 在H.264编码过程中,量化参数为25,使用RD优化得到宏块编码模式。 In the H.264 encoding process, the quantization parameter 25, obtained using the RD optimized macroblock coding modes.

转码决策树包括三个等级,采用3个不同的WEKA树,如图2所示: Transcoding tree includes three levels, with three different WEKA tree, shown in Figure 2:

1) 将输入序列分成Intm、 Skip、 Inter 16x16和Inter 8x8的分类器; 1) the input sequence into Intm, Skip, Inter 16x16 and Inter 8x8 classifier;

2) 将Inter 16x16分成16x16、 16><8、 8x16的分类器; 2) into the Inter 16x16 16x16, 16> <classifier 8, 8x16 of;

3) 将inter 8x8分成8x8、 84、 4x8、 4x4的分类器。 3) into the inter 8x8 8x8, 84, 4x8, 4x4 classifier.

第一个WEKA决策树,训练数据集使用了MPEG-2 —个宏块内16个4><4子块残差的均值和方差、宏块模式(skip、 intra和3种non-intm,分别以0、 1、 2、 4、 8标识)、编码块模式(CBPC)和H.264MB的编码模式。 WEKA first decision tree using the training data set of MPEG-2 - 16 th macroblock 4> <4 subblock mean and variance of the residuals macroblock mode (skip, intra and three non-intm, respectively, 0, 1, 2, 4, 8 identification), a coded block pattern (CBPC) and an encoding mode of H.264MB.

ARFF数据段的实例行样本用于训练决策树模型, 一行代表一个宏块样本。 Examples of sample row data segment ARFF for training decision tree model macroblock row for a sample.

第二个决策树,训练样本集使用了MPEG-2 —个宏块内16个4x4子块残差的均值和方差、宏块模式(3种non-intra)、编码块模式(CBPC)禾卩H.264 MB的16><16 的子编码模式(16x16, 16x8, 8x16)。 The second decision tree using the training sample set of MPEG-2 - 16 th macroblock 4x4 subblock mean and variance of the residuals macroblock mode (three kinds of non-intra), a coded block pattern (CBPC) Wo Jie H.264 MB 16> <16 sub coding modes (16x16, 16x8, 8x16). 该决策树决定了inter 16x16的最终编码模式。 The final decision tree determines the inter 16x16 coding mode of.

第三个决策树,训练样本集使用了MPEG-2—个宏块内4个4x4子块残差的均值和方差、宏块模式(3种non-intra)、编码块模式(CBPC)禾tl H.264 MB的8x8的子编码模式(8x8, 8x4, 4x8, 4x4)。 The third decision tree using the training sample set of four 4x4 sub-blocks of the mean and variance of the residuals MPEG-2- macroblocks, macroblock mode (three kinds of non-intra), a coded block pattern (CBPC) tl Wo H.264 MB of 8x8 sub-coding mode (8x8, 8x4, 4x8, 4x4).

基于这些训练文件,通过WEKA数据挖掘工具使用J48算法生成决策树。 Based on these training documents, by using data mining tools WEKA J48 decision tree algorithm to generate. J48算法由RossQuinlan提出,在数据挖掘领域有着广泛的应用。 J48 algorithm proposed by RossQuinlan, has been widely used in the field of data mining.

TS流复用 TS stream multiplexing

对于转码后多路节目的H.264视频,和原来节目的音频按照MPEG-2系统层来实现音、视频数据的复用和同步,并把多路节目合成一路TS流(传输流)进行传输。 For audio multiplexed H.264 video program, the original program according to transcode MPEG-2 system layer to achieve sound, video synchronization and multiplexing of data, and the multiple programs combined into one stream TS (Transport Stream) of transmission. TS流由编码后的基本数据流(ES)根据一定的格式打包形成PES包,再加入一些系统信息而构成,在发送端,基本流的PES打包由音/视频编码器完成,复用器接收编码端的音、视频数据流以及辅助数据流,按照一定的复用方法将其交织成为单一的TS 流。 TS stream from the packed elementary streams (ES) encoded according to a certain format for the PES packets, then add some system configuration information, the transmitting side, the elementary stream PES done by packing audio / video encoder, multiplexer receives audio encoding end, the video data stream and auxiliary data stream, according to a certain method which interleave multiplexing into a single stream TS. 为了实现音、视频同步,在码流中还必须加入各种时间的标志和系统的控制信息。 In order to achieve audio and video synchronization code stream information must also be added to the control systems of various signs and time. 对于接收端,则正好和发送端过程相反。 For the receiving end, the transmitting end and the process is just the opposite.

传输流可由多个节目构成,而每一个节目可由多个流复合在一起,包括视频流、 音频流、节目特殊信息流(PSI)等。 A plurality of program transport streams may be configured, and each program may be composited together a plurality of streams, including a video stream, an audio stream, program specific information stream (PSI) and the like. 其中PSI有四种类型:节目关联表(PAT)、节目映射表(PMT)、网络信息表(NU)和条件访问表(CAT)。 There are four types of which PSI: Program Association Table (PAT), program map table (PMT), a network information table (NU) and the Conditional Access Table (CAT). 复用器将转码后的H.264 视频和原音频按传输流的格式打包。 H.264 video multiplexer transcoded and packed in the format of the original audio transport stream. TS包的长度为188字节,分成包头和包负荷两部分。 TS packet length is 188 bytes, divided into two parts, a header and a load. 包头4字节前缀是链接字头,包括同步字节0x47和数据包标识PID,从PID 可以判断其后面负载的数据类型,是视频流、音频流、PSI还是其它数据包。 4 is a prefix byte header link header, and includes a sync byte 0x47 the PID packet identification, data type can be determined from the load behind the PID, is a video stream, an audio stream, the PSI or other data packets. 包负荷是包的实际内容,根据具体情况,可以放置PES包或PSI包。 It is the actual load package content package, as the case may be placed or PSI packets PES packets.

PSI用来描述传送流的组成结构,在系统中担任极其重要的角色,在多路复用中尤为重要的是PAT表和PMT表。 PSI is used to describe the composition of the structure of the transport stream, as an extremely important role in the system, particularly important in the multiplex is the PAT and PMT table. PAT表中给出了一路TS流中有多少套节目,以及它与PMT表PID之间的对应关系;PMT表给出了一套节目的具体组成及与视频、音频等PID的对应关系。 PAT flow given in the table how many sets of programs, and the correspondence between it and the PMT PID way the TS; PMT table gives the specific composition of a correspondence between the program and the video, audio, etc. PID control.

在转码复用器中,采用软件方式将多路单一节目的MPEG-2传送流(SPTS)转码后复用成多节目一路H.264传送流(MPTS),它的系统组成框图如图3所示。 Transcoding multiplexer, software manner using MPEG-2 transport stream multiplex after a single program (the SPTS) into a plurality of multiplexed transcoded H.264 transport stream along the program (of MPTS), it is a system block diagram in FIG. 3 shown in FIG.

多路单节目MPEG-2的TS流以ASI接口方式接入,通过PCI总线将节目数据传给转码复用服务器。 Multiple single program TS to MPEG-2 stream ASI interface mode access, the PCI bus by the program code multiplexed data to the switch server. 服务器主要功能是接收4路MPEG-2单路节目传输流,将其视频转成H.264视频,然后复用成一个多路节目的传输流,并且除去空包,重新改写PID值和流类型字段;抽取和处理任何一个接收到的PSI和业务信息(Sl),将其和本地产生的这类数据集成起来;另外,还需要用系统时钟STC来进行节目时钟参考PCR的再标识处理。 The main function is to receive the server 4 single program MPEG-2 transport stream, into which video to H.264 video, and then multiplexed into a multi-program transport streams, and removing null packets, the PID values ​​and to rewrite the stream type field; extracting and processing any received PSI and a service information (Sl is), this type of data and its locally generated integrate; in addition, the need to use the system clock STC to the program clock reference PCR re-identification process. 为完成以上功能,并且尽可能提高系统工作速度,在具体实现考虑了以下几点- To accomplish the above functions and maximize system operating speed, taking into account the specific implementation of the following -

1) 为了避免主机CPU频繁访问PCI接口,利用FIFO提供的半满信号,CPU读取FIFO数据或写FIFO。 1) In order to avoid the host CPU frequently accessed PCI interface, using the FIFO half-full signal is provided, CPU FIFO read or write data FIFO. 对于输入FIFO,半满时产生中断,CPU响应中断,将FIFO 中的数据一次性读入内存缓冲;对于输出FIFO,情况类似, 一次性将FIFO写至半满。 For the input FIFO, an interrupt is generated when half full, the CPU interrupt response time into the data in the FIFO buffer memory; the output FIFO, a similar situation, a one-time write FIFO half full.

2) 节目同步字的识别。 2) identifying the program synchronization word. 要获取一个节目的数据,必须先找到TS流数据包的同步字,由于同步头并非满足唯一透明原则,即负荷中有可能恰为其值,因此需搜索检测。 To obtain data of a program must first locate the synchronization word of the TS packet, the synchronization header is not satisfied because the only principle of transparency, i.e. there may be just a load whose value therefore needs to search detector.

3) PID冲突的解决。 3) PID resolve the conflict. PID是TS流中负载类型的唯一标识。 PID is the unique identification TS stream load types. 不同支路MPEG-2 码流的PID值可能相同,如果不加修改往往会导致不能正确译码,解决的办法是在合成TS流时按一定的规律重新改写PID值。 Different branches PID of MPEG-2 stream may be the same value, without modification often leads not correctly decoded, the solution is in the synthesis of TS stream according to certain rules rewrite PID value. 例如,若节目1的PID为100,以后每检测一道节目,新的PID加1,依次类推。 For example, if the program PID 1 to 100, after each program detected a new PID plus 1, and so on.

4) 流类型的修改。 4) modify the flow type. 由于输入的MPEG-2 TS流的视频格式为MPEG-2,而重新合成的TS流的视频格式为H.264,因此需要对PMT表的流类型字段作相应的修改, 修改前MPEG-2的流类型字段为0x02,修改后的流类型字段为0xlb。 Since the MPEG-2 TS format of the input video stream is MPEG-2, and re-synthesized TS format video stream is H.264, so the need for a stream type field of the PMT amended accordingly, MPEG-2 Pre-modified flow type field is 0x02, the type field is modified flow 0xlb.

TS流解复用 TS stream demultiplexing

TS流的解复用与复用的流程刚好相反,其流程如图4所示。 Solutions TS stream multiplexed with the multiplexing process contrary, the process shown in FIG. 接收端通过检测PID 为0包来建立PAT表,由PAT表得到该路TS流所包含各套节目的PMT表的PID, 从而建立PMT表。 0 packet receiving end to establish the PAT PID is detected by, PID of PMT of each program sets the path table included in the TS obtained by the PAT, the PMT table to establish. 最后由PMT表得到每套节目所对应的音视频包的PID。 PID corresponding to each program audio and video obtained from the last packet PMT table. 接收端通过这些PID将对应的音频、视频数据放入缓冲区,以便音视频解码器的解码。 The receiving end corresponding to the PID of audio and video data into the buffer, in order to decode audio and video decoder.

附图说明 BRIEF DESCRIPTION

图1是MPEG-2到H.264的视频转码算法框图。 FIG. 1 is a block diagram of a video transcoding algorithm of the MPEG-2 to H.264. 图2 MPEG-2到H.264视频转码器决策树框图。 FIG 2 MPEG-2 to H.264 decision tree block diagram illustrating a video transcoder. 图3是多路单节目传送流的转码复用框图。 FIG 3 is a block diagram of transcoding multiplexed single program transport multiplex streams. 图4是TS流解复用流程图。 FIG 4 is a flowchart stream TS demultiplexing. 图5是视频转码在移动数字电视中的应用框图。 FIG 5 is a block diagram of a video transcoding application in the mobile digital television. 图6是TS流各表PID的对应关系图。 FIG 6 is a table PID of each TS stream correspondence between FIG. 具体实施方式 detailed description

在基于MPEG-2的移动数字电视系统中,视频内容主要来自于MPEG-2节目库、 卫星电视,以及视频直播节目,通过复用器将多个MPEG-2节目流复用后,进行信道编码调制,然后进行数字电视无线发射。 In the mobile digital television systems based on MPEG-2, video content mainly from the MPEG-2 program library, satellite TV, and video broadcast program, the plurality of multiplexers by MPEG-2 program stream multiplexing, channel coding modulated, and then wireless transmit digital television.

引入基于H. 264的视频转码复用器后,系统构架如图5所示。 After the introduction of video transcoding based on H. 264 multiplexer, the system architecture shown in FIG. 它实际上是将MPEG-2 节目库与MPEG-2节目流前移, 一方面,通过静态转码建立H.264视频节目库,供播放系统选用;另一方面,对卫星电视和视频直播的MPEG-2节目流进行动态实时转码, 降低视频流的码率,改变视频流的空间分辨率、帧率,适应后端的传输需求。 It is actually the MPEG-2 program library program stream with MPEG 2-forward, on the one hand, the establishment of H.264 video transcoding program through a static library for playback system selection; on the other hand, satellite TV and live video MPEG-2 program stream dynamic real-time transcoding, bit rate reduction of the video stream, the video stream changes spatial resolution, frame rate, transmission needs to adapt to the rear end. 转码后通过软件复用将多套H.264节目合成一路TS流进行传输。 After transcoded H.264 multiplexing multiple sets of software programs synthesized by way TS stream for transmission.

多路单节目MPEG-2的TS流以ASi接口方式接入视频转码复用器,通过PCI 总线将节目数据传给转码复用服务器。 Multiple single program TS to MPEG-2 stream ASi interface mode video transcoding access multiplexer, the program via a PCI bus multiplexed data to transcoding server. 服务器接收多路MPEG-2单路节目传输流, 将其视频转成H.264视频,然后复用成一个多路节目的传输流,并通过ASI接口输出。 The server receiving the multiple single program MPEG-2 transport stream, into which video to H.264 video, and then multiplexed into a transport stream of a multi-channel program, and output through the ASI interface.

在输入的MPEG-2单路节目流中,检测到的第一套节目的PID为100,以后每检测到一套节目,在合成TS流时,新的PID加1 。 In the single program MPEG-2 input stream, PID of the detected first program 100 is, for every subsequent set of the program is detected in the synthesis of TS stream, plus a new PID. 由于输入的MPEG-2 TS流的视频格式为MPEG-2,而重新合成的TS流的视频格式为H.264,需要对PMT表的流类型字段作相应的修改,修改前MPEG-2的流类型字段为0x02,修改后的流类型字段为Oxlb。 Since the video format of the input MPEG-2 TS stream is MPEG-2, and re-synthesized TS format video stream is H.264, the need for a stream type field of the PMT amended accordingly, MPEG-2 stream before the modification of type field is 0x02, the type field is modified flow Oxlb.

MPEG-2到H.264码的快速转换方法中采用的基于决策树的分类: 使用开源的数据挖掘工具WEKA分析MPEG-2宏块残差的均值与方差、编码模式、编码块类型(CBPC),获取H.264宏块编码模式。 MPEG-2 to H.264 fast code conversion method used in a classification tree based on: the use of open source data mining tools WEKA analyzed MPEG-2 macroblock residuals mean and variance, coding mode, coding block type (CBPC) obtaining H.264 macroblock coding modes. 该转码器的决策树包括3个WEKA决策树,在图2中以灰色标识。 The decision tree comprises a transcoder 3 WEKA decision tree in Figure 2 to identify gray. 第一个WEKA决策树用于判别skip、 Intra、 8x8、 16x16模式,如果是8x8模式或16x16模式,则使用第二个或第三个决策树判决该MB的最终模式。 A first decision tree for determining WEKA skip, Intra, 8x8, 16x16 mode, if the mode is 8x8 or 16x16 mode, use the second or third mode of the decision tree MB of the final decision. 通过WEKA工具计算出决策树中均值和方差的判决电平。 Calculated decision level decision trees mean and variance by WEKA tool. 决策树的工作如下: Tree work are as follows:

节点1:输入该节点的是MPEG-2编码MB。 Node 1: is the input node of the MPEG-2 encoding MB. 通过检测MPEG-2 MB的残差大小, 将MB的编码方式分成4类:skip、 Intm、 8><8或16x16。 By detecting MPEG-2 MB residuals size, encoding the MB into four categories: skip, Intm, 8> <8 or 16x16. Intra决策过程不在专利中讨论,其他情况需根据前面的分类情况进行第二次决策分类。 Intra decision-making process is not discussed in the patent, other cases require a second decision classified according to the previous classification. 在生成决策树时,将使 When generating a decision tree, will

用以下规则: With the following rules:

1) 如果MPEG-2 MB的MC没有编码,即没有非零MV, 4个8x8块没有编码系数。 1) If the MPEG-2 MB is not coded MC, i.e. no non-zero MV, 4 th 8x8 block is not coded coefficients. H.264MB将被编码成16x16。 H.264MB to be encoded into 16x16. 需通过决策树二级判别,选择最优模式。 Determining two required decision tree, select the optimal mode.

2) 如果MPEG-2MB为intra模式,则在H.264中,该MB编码成intra或inter 8x8。 2) If the MPEG-2MB as intra mode, in H.264, the MB encoded as intra or inter 8x8. 若编码成intra,算法终止;若为inter8x8,需通过二级判决,选择最优模式。 If encoded as Intra, the algorithm terminates; if inter8x8, by two judgments required to select the optimum mode.

3) 如果MPEG-2 MB为skip模式,在H.264中,该MB也为skip模式。 3) If the MPEG-2 MB is a skip mode in H.264, also the MB skip mode.

节点2:输入该节点是由节点1分出的16xl6MB,该节点用第二个WEKA决策树,对H.264 MB的模式(16x16, 16x8或8xl6)分类。 Node 2: The input node is separated by the node 1 16xl6MB, with the second node tree WEKA of H.264 MB modes (16x16, 16x8 or 8xl6) classification. 检测16x8或8x16子块是否生成更好的预测,若判别为16x8或8x16,则为最终的编码模式,否则,将由节点4 继续判别。 Detecting whether 16x8 or 8x16 subblocks generated better prediction, if it is determined as 16x8 or 8x16, was the final coding mode, otherwise, is determined by the node 4 continues.

节点3:输入该节点的由节点1分出的8x8MB。 3 nodes: a node of the input node 1 is separated 8x8MB. 该节点用第三个WEKA决策树, 对H.264 8x8子宏块选择最优模式:8x8, 8><4, 4x8, 4x4。 The node tree with a third WEKA, H.264 8x8 sub-macroblock to select the optimum mode: 8x8, 8> <4, 4x8, 4x4. 该决策树执行4次,分别对一个宏块内的4个8x8子块进行判别一次,该部分只使用8x8子块内的4个4x4 块的均值和方差。 The tree performs 4 times, respectively, the four 8x8 sub-blocks within a macro block is determined once, this portion only four 4x4 blocks within 8x8 mean and variance of sub-blocks.

节点4:输入该节点的是由节点1分出的skip模式块或由节点2分出的16x16模式块。 Node 4: the input node is separated from the node 1 skip mode blocks or nodes separated by a 2 16x16 mode block. 该节点估计H.264 16x16模式(不包括16x8和8x16模式),选择最优模式是skip或interl6x16。 The node estimates H.264 16x16 mode (not including the 16x8 and 8x16 mode), selects an optimum mode is the skip or interl6x16.

MB模式的判决和门限值的选择由H.264的量化参数(QP)决定,随着QP的不同,均值和方差的门限值也不同。 Judgment and threshold selection of MB mode is determined by the quantization parameter (QP) H.264, with different QP, the threshold mean and variance are also different. 解决这种情况可以有两种方法:1)对每个QP生成一个决策树,在H,264编码时,根据所用的QP值,选择相应的决策树;2)只生成一个决策树,根据QP值调整均值和方差的门限。 This situation can be resolved in two ways: 1) generating a decision tree for each QP in H, 264 encode according to the QP value used to select the appropriate decision tree; 2) only generates a decision tree, according to the QP value adjustments mean and variance threshold. 对于第一种方法,在一个转码器中需生成52个不同的决策树,而每一个又需3个WEKA决策树,因此共需156个WEKA决策树。 For the first method, a transcoder 52 must generate a different tree, and each tree and it takes three WEKA, thus totaling 156 WEKA tree. 在H.264中,QP值与量化步长有一定的关系,QP每增加6,量化步长增加一倍,因此可以通过这种关系调整均值和方差的门限值。 In H.264, QP value and the quantization step have a certain relationship, QP for each additional 6, the quantization step size to double, so you can adjust the threshold mean and variance of this relationship. 在该转码器中,采用了第二种方法。 In this transcoder, using a second method. 生成了QP为25的决策树,其他QP值可以通过调整门限电平来实现。 Generating a decision tree QP 25, QP value other threshold levels may be achieved by adjusting the gate. 当QP增加6时,门限值提高2.5%,反之降低2.5%。 6 When the QP increases, the threshold increase of 2.5%, whereas the reduction of 2.5%.

在接收端的TS流解复用,通过检测PID为0的包建立PAT表,由PAT表得到该路TS流所包含各套节目的PMT表的PID,从而建立PMT表。 Stream is demultiplexed at the receiving end of the TS, the PAT is established by detecting packet 0 PID, PID of PMT of each program sets the path table from the TS stream containing the PAT obtained, thereby establishing the PMT table. 最后由PMT表得到每套节目所对应的音视频包的PID,如图6所示。 Finally, each program corresponding to the obtained PID of audio and video packets from the PMT table, shown in FIG. 6. 接收端通过这些PID将对应的音频、视频数据放入缓冲区,由音视频解码器解码。 The receiving end corresponding to the PID of audio and video data into the buffer, decoded by the AV decoder.

合成TS流时按一定规律重新改写PID值,例如,若节目1的PID为100,以后每检测一道节目,新的PID加1 ,依次类推;在合成TS流时对PMT表的流类型字段作相应的修改,修改前MPEG-2的流类型字段为0x02,修改后的流类型字段为Oxlb。 According to certain rules synthesizing TS stream rewrite PID value, e.g., PID when the program 1 is 100, after every detected one program, a new PID plus 1, and so on; synthetic TS in the stream type field of the PMT for the time stream appropriate changes, modifications before the stream type field of 0x02 MPEG-2, the modified stream type field Oxlb.

基本数据流(ES)根据一定的格式打包形成PES包,再加入一些系统信息(如业务信息(Sl)、系统时钟信息等)而构成。 Elementary stream (ES) according to a certain format packaged form PES packets, then add some system information (e.g., service information (Sl is), the system clock information, etc.) is configured.

PSI用来描述传送流的组成结构,在多路复用中PAT表中给出了一路TS流中有多少套节目,以及它与PMT表PID之间的对应关系;PMT表给出了一套节目的具体组成及与视频、音频等PID的对应关系;并采用流类型的修改:由于输入的MPEG-2 TS流的视频格式为MPEG-2,而重新合成的TS流的视频格式为H.264,对PMT表的流类型字段作相应的修改,修改前MPEG-2的流类型字段为0x02,修改后的流类型字段为0xlb。 PSI composition is used to describe the structure of the transport stream, the stream is given in the way how many sets of programs are multiplexed in the TS table PAT, and the correspondence between the PID of the PMT table it; PMT table gives a specific composition of the program and the correspondence between the video and audio PID's; and using a stream type changes: the input video format is MPEG-2 TS stream is MPEG-2, and the video format of the re-synthesized TS stream is H. 264, a stream type field of the PMT accordingly modified before modifying the flow type field of 0x02 MPEG-2, the modified stream type field 0xlb.

多路单节目MPEG-2的TS流以ASI接口方式接入,通过PCI总线将节目数据传给转码复用服务器;服务器接收4路MPEG-2单路节目传输流,将其视频转成H.264 视频,然后复用成一个多路节目的传输流,并且除去空包,重新改写PID值和流类型字段;抽取和处理任何一个接收到的PSI和业务信息(Sl),将其和本地产生的这类数据集成起来。 Multiple single program TS to MPEG-2 stream ASI interface mode access, the PCI bus by the program data to the multiplexing transcoding server; receiving four single program MPEG-2 transport stream, into which video to H .264 video, and then multiplexed into a multiplexed stream of a program, and removing null packets, the PID values ​​and to rewrite the stream type fields; extraction and processing of any received PSI and a service information (Sl is), and its local such data generated integrated. 另外,还需要用系统时钟STC来进行节目时钟参考PCR的再标识处理。 Further, the need to use the system clock STC to re-identify the processing program clock reference PCR. TS流解复用时,接收端通过检测PID为0包来建立PAT表,由PAT表得到该路TS流所包含各套节目的PMT表的PID,从而建立PMT表;最后由PMT表得到每套节目所对应的音视频包的PID。 When the TS stream is demultiplexed, the receiving end to establish the PAT table 0 packet by detecting the PID, obtained from the PAT of the channel TS stream the PID PMT table for each set of programs comprises, to establish the PMT table; finally obtained each by the PMT table PID corresponding sets of programs of audio and video packets. 接收端通过这些PID将对应的音频、视频数据放入缓冲区,由音视频解码器解码。 The receiving end corresponding to the PID of audio and video data into the buffer, decoded by the AV decoder. 本发明实施流程还包括:基于H.264多路视频转码复用的方法,输入是多路MPEG-2单节目流,输出是一路H.264多节目流,实现MPEG-2到H.264的视频转码、 音视频的解复用与复用、多路H.264节目的复用,其视频转码包括码率、分辨率及格式转换;MPEG-2到H.264的视频转码算法采用MPEG-2到H.264码的快速转换方法, 利用H.264的宏块模式选择与MPEG-2运动补偿残差间的相关性,将H.264宏块模式选择问题转化为数据分类问题,利用MPEG-2解码得到的运动补偿残差、MB模式、 编码块模式(CBPC)直接映射成H.264的宏块模式;在MPEG-2码流解码时,保存相关的MB信息,包括MB编码模式、编码块类型、MB残差的均值和方差,其解码后采用标准的H.264编码器对YUV图像编码,并保存H.264 MB编码模式,采用机器学习算法得到决策树,用于H.264编码模式的分类;在MPEG-2码流解码时,获取MPEG-2的MC残差、宏 Process further embodiment of the present invention comprises: a method H.264 transcoding multiple video multiplexing based on a multi-channel input single program MPEG-2 stream, the output multi-program stream all the way H.264, MPEG-2 to H.264 achieve video transcoding, and demultiplexing the multiplexed audio and video, multiplexed H.264 multiplex program which comprises transcoding the video bit rate, resolution and format conversion; MPEG-2 to H.264 video transcoding the method of rapid conversion algorithm uses MPEG-2 to H.264 code, using the H.264 macroblock mode selection and the correlation between the MPEG-2 motion-compensated residuals, the H.264 macroblock mode selection data classified into problem, the use of MPEG-2 decoding motion compensated residuals obtained, MB mode, a coded block pattern (CBPC) is mapped directly to the H.264 macroblock mode; when the MPEG-2 stream decoding, MB storage related information, including MB coding mode, coding the block type, the mean and variance of the residual MB, which is decoded using the standard H.264 encoder for encoding YUV image, and stores MB H.264 coding mode decision tree machine learning algorithm, with the classification H.264 coding mode; when decoding MPEG-2 stream, obtaining a residual MC in MPEG-2 macro 块模式、编码块模式(CBPC),并计算出4x4子块MC残差的均值和方差;通过决策树获取H.264中宏块编码模式;在H.264编码时,对MB的编码模式直接赋值;H.264编码器的输入为MPEG-2解码后的YUV数据以及MB编码模式:在运动估计时,使用由决策树得到的MB编码模式;实现码率、分辨率可调, 帧内、帧间采用不同的算法;并且合成TS流,在多路MPEG-2节目流以ASI接口通过PCI总线输入转码复用服务器,转码复用后的单路H.264视频流通过PCI总线以ASI接口方式输出;TS流由编码后的基本数据流(ES)根据一定的格式打包形成PES 包,再加入系统信息而构成,在发送端,基本流的PES打包由音/视频编码器完成, 复用器接收编码端的音、视频数据流以及辅助数据流,按照一定的复用方法将其交织成为单一的TS流;在码流中加入各种时间的标志和系统的控制信息;对于接收端, 则正好 Block mode, a coded block pattern (CBPC), and calculate the 4x4 subblock MC residual mean and variance; obtaining the H.264 macroblock coding mode decision tree; the H.264 coding, the MB coding mode directly assignment; H.264 encoder input after the YUV data of MPEG-2 decoding and encoding MB mode: motion estimation, the MB coding mode obtained by the decision tree; to achieve bit rate, resolution adjustable frame, frames using different algorithms; synthesis and TS stream in multiplexed MPEG-2 program stream through the PCI bus to the input ASI interface multiplexing transcoding server transcoded single multiplexed H.264 streams to PCI bus ASI interface mode output; the TS stream packed by the elementary data streams (ES) encoded according to a certain format for the PES packets, then added to the system information is configured in the transmitting side, PES elementary stream packing is done by audio / video encoder, multiplexer receives encoding end audio and video data streams and auxiliary data streams, according to a certain method which interleave multiplexing into a single stream of TS; flag information added to the control system and the various times in the stream; for receiving end , then just 发送端过程相反。 Instead sending process ends. 合成TS流时重新改写PID值。 Synthesis rewritten TS stream PID value.

在MPEG-2码流解码时利用FIFO提供的半满信号,CPU读取FIFO数据或写FIFO;对于输入FIFO,半满时产生中断,CPU响应中断,将FIFO中的数据一次性读入内存缓冲;对于输出FIFO, 一次性将FIFO写至半满。 When using the MPEG-2 stream decode FIFO half-full signal is supplied, the CPU read FIFO or write FIFO data; for the input FIFO, an interrupt is generated when half full, the CPU in response to the interrupt, the disposable read data into the FIFO buffer memory ; the output FIFO, a one-time write to the FIFO half full.

传输流可由多个节目构成,而每一个节目可由多个流复合在一起,包括视频流、 音频流、节目特殊信息流PSI;其中节目特殊信息流PSI有四种类型:节目关联表PAT、 节目映射表PMT、网络信息表(NIT)和条件访问表(CAT);复用器将转码后的H.264 视频和原音频按传输流的格式打包。 A plurality of program transport streams may be configured, and each program may be a composite with a plurality of streams including a video stream, an audio stream, PSI program specific information stream; wherein Stream PSI Program Specific Information There are four types: the PAT program association table, the program map table PMT, a network information table (NIT) and the Conditional access table (CAT); H.264 video multiplexer transcoded and packed in the format of the original audio transport stream. TS包的长度为188字节,分成包头和包负荷两部分;包头4字节前缀是链接字头,包括同步字节0x47和数据包标识PID,从PID 判断其后面负载的数据类型,是视频流、音频流、PSI还是其它数据包;包负荷是包的实际内容,放置PES包或PSI包。 TS packet length is 188 bytes, divided into two parts, a header and a load; 4-byte header link header is a prefix, and includes a sync byte 0x47 the PID packet identification, data type is determined from the load behind the PID, video stream, an audio stream, PSI, or other data packet; packet load is the actual contents of the package, the package is placed PES packets or PSI.

PSI用来描述传送流的组成结构,在多路复用中PAT表中给出了一路TS流中有多少套节目,以及它与PMT表PID之间的对应关系;PMT表给出了一套节目的具体组成及与视频、音频等PID的对应关系;并采用流类型的修改:由于输入的MPEG-2 TS流的视频格式为MPEG-2,而重新合成的TS流的视频格式为H.264,对PMT表的流类型字段作相应的修改,修改前MPEG-2的流类型字段为0x02,修改后的流类型字段为0xlb。 PSI composition is used to describe the structure of the transport stream, the stream is given in the way how many sets of programs are multiplexed in the TS table PAT, and the correspondence between the PID of the PMT table it; PMT table gives a specific composition of the program and the correspondence between the video and audio PID's; and using a stream type changes: the input video format is MPEG-2 TS stream is MPEG-2, and the video format of the re-synthesized TS stream is H. 264, a stream type field of the PMT accordingly modified before modifying the flow type field of 0x02 MPEG-2, the modified stream type field 0xlb.

多路单节目MPEG-2的TS流以ASI接口方式接入,通过PCI总线将节目数据传给转码复用服务器;服务器接收4路MPEG-2单路节目传输流,将其视频转成H.264 视频,然后复用成一个多路节目的传输流,并且除去空包,重新改写PID值和流类型字段;抽取和处理任何一个接收到的PSI和业务信息(Sl),将其和本地产生的这类数据集成起来。 Multiple single program TS to MPEG-2 stream ASI interface mode access, the PCI bus by the program data to the multiplexing transcoding server; receiving four single program MPEG-2 transport stream, into which video to H .264 video, and then multiplexed into a multiplexed stream of a program, and removing null packets, the PID values ​​and to rewrite the stream type fields; extraction and processing of any received PSI and a service information (Sl is), and its local such data generated integrated.

还需要用系统时钟STC来进行节目时钟参考PCR的再标识处理。 Need to use the system clock STC to re-identify the processing program clock reference PCR. TS流解复用时,接收端通过检测PID为O包来建立PAT表,由PAT表得到该路TS流所包含各套节目的PMT表的PID,从而建立PMT表;最后由PMT表得到每套节目所对应的音视频包的PID;接收端通过这些PID将对应的音频、视频数据放入缓冲区,由音视频解码器解码。 TS stream is demultiplexed, the receiving end is established by detecting a PID O packet of the PAT, PID respective sets of programs the PMT table of the channel TS stream contains a PAT table obtained, thereby establishing the PMT table; finally obtained each by the PMT table PID of audio and video packets corresponding sets of programs; the receiving terminal corresponding audio PID, video data into the buffer, a decoder for decoding audio and video.

Claims (9)

1、基于H. 264多路视频转码复用的方法,其特征是输入是多路MPEG-2单节目流,输出是一路H.264多节目流,实现MPEG-2到H.264的视频转码、音视频的解复用与复用、多路H.264节目的复用,其视频转码包括码率、分辨率及格式转换;MPEG-2到H.264的视频转码算法采用MPEG-2到H.264码的快速转换方法,利用H.264的宏块模式选择与MPEG-2运动补偿残差间的相关性,将H.264宏块模式选择问题转化为数据分类问题,利用MPEG-2解码得到的运动补偿残差、MB模式、编码块模式(CBPC)直接映射成H.264的宏块模式;在MPEG-2码流解码时,保存相关的MB信息,包括MB编码模式、编码块类型、MB残差的均值和方差,其解码后采用标准的H.264编码器对YUV图像编码,并保存H.264MB编码模式,采用机器学习算法得到决策树,用于H.264编码模式的分类;在MPEG-2码流解码时,获取MPEG-2的MC残差、宏块模式、编码 1, H. 264 multiplexing method for transcoding video based multiplexing, wherein the input multiplexer is a single MPEG-2 program stream, output a multi-program stream all the way H.264 for video is MPEG-2 to H.264 transcoding, and demultiplexing the multiplexed audio and video, multiplexed H.264 multiplex program which comprises transcoding the video bit rate, resolution and format conversion; video transcoding MPEG-2 to H.264 algorithm employed rapid conversion method code MPEG-2 to H.264, the use of H.264 macroblock mode selection and the correlation between the MPEG-2 motion-compensated residuals, the H.264 macroblock mode selection data classification problem into a problem, motion compensation residual obtained by decoding MPEG-2, MB mode, a coded block pattern (CBPC) is mapped directly to the H.264 macroblock mode; when the MPEG-2 stream decoding information stored related MB, MB coding comprising mode coding block type, MB mean and variance of the residuals after decoding using the standard H.264 encoder for encoding YUV image, and stores H.264MB coding mode decision tree machine learning algorithm, for H. 264 classification coding mode; when decoding MPEG-2 stream, obtaining a residual MC in MPEG-2, a macroblock mode, the encoder 模式(CBPC),并计算出4×4子块MC残差的均值和方差;通过决策树获取H.264中宏块编码模式;在H.264编码时,对MB的编码模式直接赋值;H.264编码器的输入为MPEG-2解码后的YUV数据以及MB编码模式:在运动估计时,使用由决策树得到的MB编码模式;实现码率、分辨率可调,帧内、帧间采用不同的算法;并且合成TS流,在多路MPEG-2节目流以ASI接口通过PCI总线输入转码复用服务器,转码复用后的单路H.264视频流通过PCI总线以ASI接口方式输出;TS流由编码后的基本数据流(ES)根据一定的格式打包形成PES包,再加入系统信息而构成,在发送端,基本流的PES打包由音/视频编码器完成,复用器接收编码端的音、视频数据流以及辅助数据流,按照一定的复用方法将其交织成为单一的TS流;在码流中加入各种时间的标志和系统的控制信息;对于接收端,则正好和发送端过程相反 Mode (CBPC), and calculate the 4 × 4 sub-block of the MC residual mean and variance; obtaining the H.264 macroblock coding mode decision tree; in the H.264 coding, the MB coding mode direct assignment; H input H.264 encoder is MPEG-2 YUV data decoded and encoded MB mode: motion estimation, the MB coding mode obtained by the decision tree; to achieve bit rate, resolution adjustable frame, using inter different algorithms; synthesis and TS stream in multiplexed MPEG-2 program stream through the PCI bus to the input ASI interface multiplexing transcoding server transcoded single multiplexed H.264 streams in a PCI bus interface mode ASI output; the TS stream from the packed elementary streams (ES) encoded according to a certain format for the PES packets, then added to the system configuration information, the transmitting side, the elementary stream PES done by packing audio / video encoder, the multiplexer tone receiver encoding side, the video data stream and auxiliary data stream, according to certain multiplexing method which interleaved into a single TS stream; adding control information signs and systems of various times in the stream; for the receiving end, is just and the transmission process ends opposite
2、 根据权利要求1所述的基于H.264多路视频转码复用的方法,其特征是为在MPEG-2码流解码时利用FIFO提供的半满信号,CPU读取FIFO数据或写FIFO; 对于输入FIFO,半满时产生中断,CPU响应中断,将FIFO中的数据一次性读入内存缓冲;对于输出FIFO, 一次性将FIFO写至半满。 2. A method according to claim multiple H.264 video transcoding based multiplexing, wherein half full signal when the FIFO using the MPEG-2 stream is decoded to provide the 1, CPU to read or write data FIFO FIFO; for the input FIFO, an interrupt is generated when half full, the CPU interrupt response time into the data in the FIFO buffer memory; the output FIFO, the write FIFO disposable half full.
3、 根据权利要求1所述的基于H.264多路视频转码复用的方法,其特征是合成TS流时重新改写PID值。 3. The method of H.264 multiple video transcoding multiplexed according to claim 1 is based, wherein the rewrite synthesized TS stream PID value.
4、 根据权利要求1所述的基于H.264多路视频转码复用的方法,其特征是传输流可由多个节目构成,而每一个节目可由多个流复合在一起,包括视频流、音频流、 节目特殊信息流PSI;其中节目特殊信息流PSI有四种类型:节目关联表PAT、节目映射表PMT、网络信息表(NIT)和条件访问表(CAT);复用器将转码后的H.264视频和原音频按传输流的格式打包。 4. The method of H.264 multiple video transcoding multiplexed according to claim 1 is based, wherein the transport stream may be composed of a plurality of programs, and each program may be a complex with a plurality of streams, including video streaming, audio stream, PSI program specific information stream; wherein stream PSI program specific information there are four types: a program association table the PAT, the PMT program map table, network information table (NIT) and the Conditional access table (CAT); multiplexer transcoding after the original H.264 video and audio packed in the format of the transport stream.
5、 根据权利要求4所述的基于H.264多路视频转码复用的方法,其特征是TS 包的长度为188字节,分成包头和包负荷两部分;包头4字节前缀是链接字头,包括同步字节0x47和数据包标识PID,从PID判断其后面负载的数据类型,是视频流、 音频流、PSI还是其它数据包;包负荷是包的实际内容,放置PES包或PSI包。 5. The method of claim multiple H.264 video transcoding based multiplexing, characterized in that the length of the 4-byte TS packet 188, packet header and loads into two parts; 4-byte header is a prefix link header, and includes a sync byte 0x47 the PID packet identification, data type is determined from the load behind the PID, is a video stream, an audio stream, PSI, or other data packet; packet load is the actual contents of the package, the PES packet is placed or PSI package.
6、 根据权利要求1所述的基于H.264多路视频转码复用的方法,其特征是PSI 用来描述传送流的组成结构,在多路复用中PAT表中给出了一路TS流中有多少套节目,以及它与PMT表PID之间的对应关系;PMT表给出了一套节目的具体组成及与视频、音频等PID的对应关系;并采用流类型的修改:由于输入的MPEG-2TS流的视频格式为MPEG-2,而重新合成的TS流的视频格式为H.264,对PMT表的流类型字段作相应的修改,修改前MPEG-2的流类型字段为0x02,修改后的流类型字段为Oxlb。 6. The method of H.264 multiple video transcoding multiplexed according to claim 1 is based, wherein the PSI composition used to describe the structure of the transport stream is given in the way TS multiplex table PAT stream number of sets of programs, and the correspondence between it and the PMT PID; PMT table giving the correspondence relationship between a program and the specific composition of the video, audio, etc. the PID; and using a stream type changes: the input MPEG-2TS format of the video stream is MPEG-2, and the video format of the re-synthesized TS stream is H.264, the flow type field of the PMT accordingly modified before modifying the flow type field is MPEG-2 0x02 , the modified stream type field Oxlb.
7、 根据权利要求1所述的基于H.264多路视频转码复用的方法,其特征是多路单节目MPEG-2的TS流以ASI接口方式接入,通过PCI总线将节目数据传给转码复用服务器;服务器接收4路MPEG-2单路节目传输流,将其视频转成H.264视频, 然后复用成一个多路节目的传输流,并且除去空包,重新改写PID值和流类型字段; 抽取和处理任何一个接收到的PSI和业务信息(Sl),将其和本地产生的这类数据集成起来。 7. The method of H.264 multiple video transcoding based multiplexing, wherein a single multiplexed TS to MPEG-2 program stream ASI interface mode access, the PCI bus by the data transmission program according to claim 1 multiplexing a transcoding server; receiving four single program MPEG-2 transport stream, into which video to H.264 video, and then multiplexed into a multi-program transport streams, and removing null packets, PID rewrite and a stream type field value; extracting and processing any received PSI and a service information (Sl), to which such data and locally generated integrated.
8、 根据权利要求7所述的基于H.264多路视频转码复用的方法,其特征是还需要用系统时钟STC来进行节目时钟参考PCR的再标识处理。 8. The method of claim H.264-based multiple video transcoding multiplexed claim 7, characterized in that the need to use the system clock STC to re-identify the processing program clock reference PCR.
9、 根据权利要求1所述的基于H.264多路视频转码复用的方法,其特征是TS 流解复用时,接收端通过检测PID为0包来建立PAT表,由PAT表得到该路TS流所包含各套节目的PMT表的PID,从而建立PMT表;最后由PMT表得到每套节目所对应的音视频包的PID;接收端通过这些PID将对应的音频、视频数据放入缓冲区, 由音视频解码器解码。 9. A method according to claim multiple H.264 video transcoding based multiplexing, characterized in that when the TS stream is demultiplexed, to establish the receiving end PAT table of the PID 0 packets detected by 1, obtained from the PAT table the channel TS stream the PMT PID of the program comprises various sets, to establish the PMT table; last PID program corresponding to each audio and video packet obtained by the PMT table; the receiving terminal corresponding to the audio PID, video data is put into the buffer, decoded by the audio and video decoder.
CN 200710023476 2007-06-05 2007-06-05 H.264 based multichannel video transcoding multiplexing method CN100496129C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 200710023476 CN100496129C (en) 2007-06-05 2007-06-05 H.264 based multichannel video transcoding multiplexing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 200710023476 CN100496129C (en) 2007-06-05 2007-06-05 H.264 based multichannel video transcoding multiplexing method

Publications (2)

Publication Number Publication Date
CN101068366A CN101068366A (en) 2007-11-07
CN100496129C true CN100496129C (en) 2009-06-03

Family

ID=38880773

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 200710023476 CN100496129C (en) 2007-06-05 2007-06-05 H.264 based multichannel video transcoding multiplexing method

Country Status (1)

Country Link
CN (1) CN100496129C (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101909211B (en) 2010-01-04 2012-05-23 西安电子科技大学 H.264/AVC high-efficiency transcoder based on fast mode judgment

Families Citing this family (26)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101588252B (en) 2008-05-23 2011-07-20 华为技术有限公司 Control method and control device of multipoint conference
CN101715124B (en) 2008-10-07 2013-05-08 镇江唐桥微电子有限公司 Single-input and multi-output video encoding system and video encoding method
CN101635854B (en) 2009-08-26 2012-07-04 腾讯科技(深圳)有限公司 Method and device for realizing transcoding merging
CN102098502B (en) * 2009-12-14 2015-06-03 无锡中星微电子有限公司 Method and device for converting coding formats
EP2579595A2 (en) * 2011-09-30 2013-04-10 Broadcom Corporation Streaming transcoder with adaptive upstream and downstream transcode coordination
TWI633759B (en) 2010-04-13 2018-08-21 Ge影像壓縮有限公司 Inheritance in sample array multitree subdivision
CN106231333A (en) 2010-04-13 2016-12-14 Ge视频压缩有限责任公司 Decoder, coding/decoding method, encoder and coded method
TWI466548B (en) 2010-04-13 2014-12-21 Fraunhofer Ges Forschung Sample region merging
CN101945265B (en) * 2010-08-19 2013-05-08 北京市博汇科技有限公司 Bandwidth occupancy rate based multi-program constant code rate TS flow multiplexing algorithm
CN101924943B (en) * 2010-08-27 2011-11-16 郭敏 Real-time low-bit rate video transcoding method based on H.264
CN102025999B (en) * 2010-12-31 2012-05-16 北京工业大学 Video transcoding fast intra-frame predicating method based on support vector machine
CN102055983B (en) * 2011-01-26 2013-01-23 北京世纪鼎点软件有限公司 Decoding method for MVC-3D (Manual Volume Control Three-Dimensional) video based on standard H.264 decoder
WO2012106898A1 (en) * 2011-07-18 2012-08-16 华为技术有限公司 Method, device and system for transmitting and processing multi-channel audio-video
CN102256162B (en) * 2011-07-22 2013-11-06 网宿科技股份有限公司 Method and system for optimizing media-on-demand based on real-time file format conversion
CN102523418B (en) * 2011-12-28 2014-05-28 深圳市九洲电器有限公司 Interface converting device, video signal converting method and audio/video equipment
CN102611935A (en) * 2012-02-29 2012-07-25 山东泰信电子有限公司 Playing method of multi-code-stream single channel
CN102802024A (en) * 2012-08-28 2012-11-28 曙光信息产业(北京)有限公司 Transcoding method and transcoding system realized in server
CN103065635A (en) * 2013-01-15 2013-04-24 哈尔滨工程大学 Stable, high-quality and real-time voice frequency transmission method based on the third generation telecommunication (3G) network
CN104038816B (en) * 2014-06-20 2017-06-23 深圳市九洲电器有限公司 A kind of video synchronization method and system
CN104363509B (en) * 2014-10-24 2018-11-16 深圳国微技术有限公司 A kind of video conversion method, device, play system and terminal
CN104768030B (en) * 2015-03-30 2018-01-26 深圳市九洲电器有限公司 Program audio synchronous broadcast method and system
CN106341622A (en) * 2015-07-06 2017-01-18 阿里巴巴集团控股有限公司 Multi-channel video stream coding method and device
WO2017036370A1 (en) * 2015-09-03 2017-03-09 Mediatek Inc. Method and apparatus of neural network based processing in video coding
CN105306947B (en) * 2015-10-27 2018-08-07 中国科学院深圳先进技术研究院 video transcoding method based on machine learning
CN106850644A (en) * 2017-02-17 2017-06-13 山东浪潮商用系统有限公司 A kind of method that TS bags PID modifications are realized based on Java language
CN107404648B (en) * 2017-08-24 2019-12-03 中南大学 A kind of multi-channel video code-transferring method based on HEVC

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1567271A (en) 2003-06-19 2005-01-19 欧阳捷 Conversion and acquisition method and apparatus of MPEG code with highspeed network interface
CN1633180A (en) 2004-12-24 2005-06-29 海信集团有限公司 Multi-description video coding method based on transformation and data fusion
CN1745573A (en) 2003-09-17 2006-03-08 卡西欧计算机株式会社 Image pickup apparatus and moving picture photographing method thereof

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1567271A (en) 2003-06-19 2005-01-19 欧阳捷 Conversion and acquisition method and apparatus of MPEG code with highspeed network interface
CN1745573A (en) 2003-09-17 2006-03-08 卡西欧计算机株式会社 Image pickup apparatus and moving picture photographing method thereof
CN1633180A (en) 2004-12-24 2005-06-29 海信集团有限公司 Multi-description video coding method based on transformation and data fusion

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
《RD-OPTIMIZATIONFORMPEG-2TOH.264TRANSCODING》. Gerardo Fernandez-Escribano,Hari Kalva等.Muntimedia and Expo,2006 IEEE International Conference,No.第309-312页. 2006
Converting DCT Coefficients to H.264/AVC. Jun Xin,Anthony Vetro,Huifang Sun.MITSUBISHI ELECTRIC RESEARCH LABORATORIES http://www.merl.com. 2004
SPEEDING-UP THEMACROBLOCK PATITION MODEDESESION IN MPEG-2/H.264 TRANSCODING. Gerardo Fernandez-Escribano,Hari Kalva等.Image Processing,2006IEEE International Conference. 2006

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101909211B (en) 2010-01-04 2012-05-23 西安电子科技大学 H.264/AVC high-efficiency transcoder based on fast mode judgment

Also Published As

Publication number Publication date
CN101068366A (en) 2007-11-07

Similar Documents

Publication Publication Date Title
KR100574186B1 (en) Encoded stream splicing device and method, and an encoded stream generating device and method
AU2007319699B2 (en) Techniques for variable resolution encoding and decoding of digital video
KR100620270B1 (en) Method and apparatus for transcoding compressed video bitstreams
US8731046B2 (en) Software video transcoder with GPU acceleration
CN1316433C (en) Video-information encoding method and video-information decoding method
DK1486065T3 (en) Procedure for coding movement in a video sequence
CN1242620C (en) Transcoder-based adaptive quantization for digital video recording
KR100252108B1 (en) Apparatus and method for digital recording and reproducing using mpeg compression codec
CN101218831B (en) Image decoding method and device
US6493386B1 (en) Object based bitstream transcoder
JP4786114B2 (en) Method and apparatus for encoding video
KR100213048B1 (en) Receiver having analog and digital video mode and receiving method thereof
JP4576783B2 (en) Data processing method and data processing apparatus
JP4930810B2 (en) Image processing apparatus, image processing method, and recording medium
ES2563295T3 (en) Motion picture decoding procedure that uses additional quantization matrices
ES2630454T3 (en) Image coding device, image decoding device, image coding procedure and image decoding procedure
US6542546B1 (en) Adaptable compressed bitstream transcoder
US20050094729A1 (en) Software and hardware partitioning for multi-standard video compression and decompression
TWI603609B (en) Constraints and unit types to simplify video random access
KR100574705B1 (en) Process and apparatus for converting an mpeg-2 bitstream into an smpte-259 compatible bitstream
JP5346112B2 (en) System for combining multiple video streams and method of use associated therewith
KR100557103B1 (en) Data processing method and data processing apparatus
KR100849965B1 (en) Method and apparatus for providing prediction mode fine granularity scalability
CN1227909C (en) System for editing compressed image sequences
TWI285854B (en) System for encoding video data and system for decoding video data

Legal Events

Date Code Title Description
C06 Publication
C10 Request of examination as to substance
C14 Granted
C53 Change or modification
COR Bibliographic change or correction in the description

Free format text: CORRECT: INVENTOR; FROM: FANG HUAIDONG LIU LIU LU BAOSHENG YAN SU CHEN QIMEI TO: LI BO FANG HUAIDONG LIU LIU LU BAOSHENG YAN SU CHEN QIMEI

LICC Enforcement, change and cancellation of record of contracts on the license for exploitation of a patent
C17 Cessation of patent right