PPT

advertisement
Transcoding of H.264
bitstream to MPEG-2
bitstream.
Sreejana Sharma
1
What is transcoding?



The process of converting video from one format to
another .
Transcoding is basically undertaken to meet the
constrained transmission bandwidths and terminal
capabilities.
Need: To facilitate interoperability between different
networks, devices and content representation formats.
2
Applications of transcoding.




Adapt the bit rate of a precompressed video stream to
the channel bandwidth.
To dynamically adapt the multimedia content to the
usage environment.
To insert new information into a compressed video
stream.
Also help support VCR trick modes for on-demand
video applications.
3
Criteria to be fulfilled for efficient
transcoding.



The quality of the transcoded bitstream should be
comparable to the one obtained by direct encoding and
decoding of the output stream.
The information contained in the input stream should
be used as much as possible to avoid multigenerational
deterioration.
The process should be cost efficient, low in complexity
and achieve the highest quality possible.
4
Need for H.264 to MPEG-2 transcoding




H.264 is fast becoming the codec of the future as it can
produce MPEG-2 comparable quality at almost half the
bandwidth.
Widespread adaptation to H.264 is anticipated.
However many existing systems such as home receivers and
digital TVs use MPEG-2.
This motivates the need for an architecture that efficiently
leverages the lower cost of H.264 without significant
investment in additional video coding hardware.
5
H.264/AVC to MPEG 2 Transcoding.



Intuitive method is to re-encode the H.264 video with
MPEG-2 encoder and then decode with MPEG-2
decoder.
However this process is computationally intensive and
high in complexity.
Solution is to extract various parameters from the
encoded H.264 bitstream and decode them using
MPEG-2 standards.
6
H.264 Decoder.
7
MPEG-2 Encoder.
8
H.264 and MPEG-2.




Baseline Profile at
Level 3
4:2:0 Chroma format
Picture coding type I,P
One reference frame
enabled for inter
prediction.




Simple Profile Main
Level
4:2:0 Chroma format
Picture coding type I,P
One reference frame
enabled for inter
prediction.
9
Transcoding
Algorithm
10
Intra frame coding.
H.264
MPEG-2
Macroblock modes supported
16x16 with 4 directional modes,
4x4 with 9 directional modes
8x8
Type of intra prediction
Adaptive directional prediction
of 4x4 or 16x16 pixel blocks
None
Transform
4x4 Integer transform
8x8 DCT
11
Intra Frame Transcoding.
12
Procedure


The input sequence is passed through an H.264
encoder and decoder.
The output of H.264 is then passed through an
MPEG-2 encoder and decoder to get the final output.
13
Results
Average PSNR of
MPEG-2 encoded
decoded sequence
(dB)
Clip Number
Sequence Type
Bit rate (Mbps)
Average PSNR of
transcoded
sequence (dB)
1
Foreman
2
34.385
34.634
2
Akiyo
1.4
35.525
35.889
3
Coastguard
3.4
33.928
34.869
4
Hall Monitor
1.8
33.349
33.598
5
Container
2.6
33.705
33.783
14
PSNR Comparison
PSNR comparison of transcoded streams vs Mpeg-2
encoded and decoded stream
50
PSNR (db)
45
Average PSNR of
transcoded sequence (dB)
40
Average PSNR of MPEG-2
encoded decoded
sequence (dB)
35
30
25
1
2
3
4
5
Clip number
15
Quality Comparison
H.264 input stream
30 fps
352x288
MPEG-2 clip obtained by
encoding decoding.
MPEG-2 stream obtained by
Transcoding.
16
Inter Frame Transcoding
H.264
MPEG-2
MC prediction with ¼ pel
accuracy
yes
No, only ½ pel accuracy
MC modes
16x16,16x8,8x16,
8x8,8x4,4x8, 4x4
16x16
Multiple reference prediction
yes
no
Transform
4x4 Integer DCT transform.
8x8 2D DCT transform.
Use of B frames as reference
frames
Allowed, can be selected by the
user
no
17
Inter frame transcoding
REF
BLOCKS
INPUT
VLD
+
IQ
+
DCT
IDCT
H.264
DECODER
+
Q
VLC
OUTPUT
MPEG-2
ENCODER
IQ
LIST
0
IDCT
+
MV REUSE
REFINEMENT
+
RECONS
FRAMES
18
Procedure




Motion vector extraction
Motion vector resampling.
Motion vector refinement.
Motion vector reuse.
19
Motion vector extraction

Motion vectors are extracted from the H.264 after the
variable length decoding stage.
20
Motion compensation modes in H.264
21
Need for motion vector resampling.
H.264 can have up to 16 motion vectors for a
single 16x16 macroblock.
 MPEG-2 supports only one motion vector per
16x16 macroblock.
 Need to generate MPEG-2 compliant motion
vector with good coding efficiency.

22
Motion vector resampling



Only one reference frame used in H.264 encoding
stage.
Every motion vector from H.264 is scaled according to
the area of the block.
If more than one motion vector is present for a 16x16
macroblock, the scaled motion vectors are summed to
get the final MPEG-2 compliant motion vector.
23
Algorithm



For example:
If the macroblock is divided into two blocks of 16x8
then a single macroblock is arrived as follows:
MPEG-2mv_x= (H.264mv_ax +H.264mv_ bx )/2
MPEG-2mv_y= (H.264mv_ay +H.264mv_by)
24
Algorithm


If the MB is divided into 8x8 blocks.
Each block can have sub partitions and up to 16
motion vectors.
25
Algorithm







Derive MV for each 8x8 sub-block.
If the first 8x8 block is partitioned into four 4x4 blocks:
mv_x0 = ¼(mv_x00+mv_x01+mv_x02+mv_x03)
mv_y0 = ¼ (mv_y00+mv_y01+mv_y02+mv_y03)
The final MPEG-2 compatible motion vectors is calculated as
follows:
MPEG-2mv_x=¼(mv_x0+mv_x1+mv_x2+mv_x3)
MPEG-2mv_y=¼(mv_y0+mv_y1+mv_y2+mv_y3)
26
Need for motion vector refinement



The quantization parameters of the incoming bit stream and
those selected may differ. When these differences are large it
results in quality degradation.
H.264 uses variable block size motion compensation modes
whereas MPEG-2 uses a full search algorithm for the entire
16x16 block.
Achieve compatibility between 1/4 pel MV accuracy in H.264
and 1/2 pel MV accuracy in MPEG-2.
27
Motion vector refinement scheme.



Search window of -2 pixels to +2 pixels
Horizontal and vertical search method.
Instead of checking all points in the search window,
only points in the horizontal and vertical direction are
checked for the minimum SAD .
28
Algorithm
Incoming base motion vector
Compute SAD for base motion vector
Compare SADs of all the points in the
Horizontal plane within -2 pels to
+2 pels with SAD of base motion vector.
Set motion vector with minimum
SAD as motion vector in
the horizontal plane
Compare SADs of all the points in the
vertical plane within -2 pels to
+2 pels with SAD of last motion vector.
Set motion vector with minimum
SAD as final motion vector
29
Motion vector refinement scheme.
30
Results
31
Results
Average Time (ms)
P frame motion estimation time comparison
9025
8025
7025
6025
5025
4025
3025
2025
1025
25
Average time (ms) for MPEG-2
encoding
Average time (ms) for MPEG-2
encoding with MV reuse
1
2
3
4
5
Clip Number
32
Results
PSNR (dB)
P frame PSNR comparison
43
41
39
37
35
33
31
29
27
25
PSNR (dB) obtained by brute
force transcoding from H.264 to
MPEG-2
PSNR (dB) obtained H.264 to
MPEG-2 transcoding with MV
reuse
1
2
3
4
5
Clip Number
33
Motion vectors in P frame
H.264 input stream
30fps
352x288
MPEG-2 bitstream obtained by
proposed method.
1 Mbps
MPEG-2 bitstream obtained by
Encoding and decoding in
MPEG-2 at 1 Mbps.
34
Quality comparison

MPEG-2 encoding.

Proposed method.
35
Conclusions




Information of the incoming stream is used as much as
possible.
Low in complexity.
Fairly acceptable loss in PSNR.
All the expectations for a good transcoder are met.
36
Future Research



This transcoder can be applied on PVR or multimedia
server to play the delivered H.264 content in the existing
MPEG-2 equipment.
This thesis is based on transcoding of H.264 from baseline
profile to MPEG-2 simple profile with no B frames.
The same process could be extended to transcoding from
the main profile of H.264 to main profile of MPEG-2 with
the presence of B frames.
37
References
[1] Jun Xin, Chia-Wen Lin, Ming-Ting Sun , “Digital Video Transcoding” , Proceedings of the IEEE, Vol. 93,
Issue 1,pp 84-97, January 2005.
[2] Jing Wang et. al.,“An AVS to MPEG-2 Transcoding System”, Proceeding of 2004 International Symposium on
Intelligent Multimedia, Video and Speech Processing, October 20-22, 2004 Hong Kong.
[3] A. Vetros, C. Christopoulos and H. Sun, “Video transcoding architectures and techniques: an overview”, IEEE
Signal Processing magazine, Vol. 20, Issue 2, pp 18-29,March 2003.
[4] Soon-kak Kwon, A. Tamhankar and K.R. Rao, “Overview of H.264 / MPEG-4 Part 10 (pp.186-216)”, Special
issue on “ Emerging H.264/AVC video coding standard”, J. Visual Communication and Image
Representation, vol. 17, pp.183-552, April 2006.
[5] J. Youn and Ming-Ting Sun , “Motion Vector Refinement for high-performance transcoding”, in IEEE Int.
Conf. Consumer Electronics, Los Angeles, C.A., Vol. 1, Issue 1, pp 30-40,March 1999.
[6] Hari Kalva, “Issues in H.264/MPEG-2 Video Transcoding”, Computer Science and Engineering, Florida
Atlantic University, Boca Raton, FL.
[7] B. Haskell, A. Puri and A. Netravali, “Digital Video: an introduction to MPEG-2”, Chapman and Hall, 1997.
[8] MPEG-2 software (version 12) from MPEG software simulation group
http://www.mpeg.org/MPEG/MSSG/#source.
[9] H.264 software JM (10.2) from: http://iphome.hhi.de/suehring/tml/download/
[10] T. Wiegand et. al., “Overview of the H.264/AVC Video Coding Standard”, IEEE Transactions on Circuits
and Systems for Video Technology, Vol. 13, Issue 7, July 2003.
[11] P.N.Tudor, “ Tutorial on MPEG-2 Video Compression”, IEE J Langham Thomson Prize, Electronics and
Communication Engineering Journal, December
1995.
38
References
[12] Iain E.G.Richardson, “H.264 and MPEG-4 Video Coding for Next Generation Multimedia”, Wiley 2003
[13] P Kunzelman and H.Kalva, “Reduced complexity H.264 to MPEG-2 transcoder”, ICEE paper 10/02/2006.
[14] J Chu, W Lu, Y Liu, Y Song, X Song, S Yu, “H.264/MPEG-2 Transcoding based on Personal Video Recorder
Platform”, IEEE.
[15] Test streams obtained from: http://www.cipr.rpi.edu/resource/sequences/sif.html
[16] Commercially available transcoders, PSP Video 9, http://www.pspvideo9.com
[17] J McVeigh et. al., “A software based real time MPRG-2 video encoder”, IEEE Trans. CSVT, Vol 10, pp 11781184, Oct.2000.
[18] Information Technology – Generic coding of moving pictures and associated audio information: Video, ITU-T
Rec H.262 (2000 E).
[19] T Shanableh and M Ghanbari, “Transcoding architectures for DCT domain heterogenous video transcoding”,
Proc.IEEE ICIP, Vol.1 pp 433-436, Thessaloniki, Greece, Sept 2001.
[20] R Periera, “Efficient transcoding of MPEG-2 to H.264”, Master’s thesis DEC 2005, EE Department, U.T.A.
[21] ITU-T, “Advanced video coding for generic audio visual services”, H.264, March 2005
[22] K.R.Rao and J.J.Hwang, “Techniques and standards for Image, Video and Audio Coding”, Prentice Hall
[23] I.E.G Richardson, “Video Codec Design: developing image and video compression systems”, Chichester: Wiley,
2002.
39
THANK YOU
40
QUESTIONS
41
Download