


Proceedings of Engineering and Technology Innovation , vol. 3, 2016, pp. 19 - 21 

19 

Flexible Macroblock Ordering Scramble Encryption  

Techniques for H.264/AVC Videos 

Yih-Chuan Lin
1,*

, Wei-Siang Wang
1
, Yao-Tang Chang

2
 

1
Department of Computer Science and Information Engineering, National Formosa University,  

Yunlin, Taiwan. 

2
Department of Information Technology , Kao Yuan University, Kaohsiung, Taiwan. 

Received 01 February 2016; received in revised form 12 March 2016; accept ed 02 April 2016 

 

Abstract 

In this paper, a ne w v ideo encryption method 

through scramb ling the co mpressed videos is 

presented, which is targeted for H.264/A VC 

video encryption in order to provide the greatest 

content protection in the compressed domain.  

The proposed algorithm uses a macroblock 

switching mechanism to scra mble the video  

content for the compressed video sequences . 

Only the  instantaneous decoded reference (IDR) 

pictures are scrambled to take  the advantage of 

drift e rror propagation fro m a ll the in-

ter-prediction fra mes. The proposed encryption 

technique is designed to perform after the en-

coding process on the compressed bitstream 

such that bitstream is modified by the parser 

directly. Fina lly, the scra mbled video is still 

format-co mpliant to a general H.264/A VC d e-

coder and can only be recovered by the author-

ized user that owns private key. Based  on ex-

perimental results, the scene in the scrambled  

video can be effective ly protected by the pro-

posed scheme with low co mputational co m-

plexity and negligible bitrate overhead. 

Ke ywor ds : vio lation of privacy, H.264/A VC, 

video encryption, protection effect 

1. Introduction 

With the rapid advance of mu ltimed ia  

communicat ion and network technology, digita l 

video applications are easy to be found every-

where. The comp ressed bitstream is transmitted 

over the internet, decoded on a c lient and  

showed. Digital v ideo surveillance and applica-

tions can be found ubiquitously in our daily lives. 

For manage ment purposes, the captured videos 

are usually encoded and transmitted over the 

Internet to a third-party video service provider. 

Vio lation of personal privacy and possible 

leakage o f v ideo scene are addressed in the study. 

In the case of video surveillance system, in order 

to archive a huge surveillance data that gener-

ated fro m each  IP ca me ra, the captured video 

usually trans mitted to third-party servers . These 

servers are so-called delegates that provide high 

capacity for storage; reliable bandwidth re-

sources for end users to access; and simp le  

manage ment interface fo r video owners. Ho w-

ever, there may have some  untrustworthy system 

administrators that take a pee k at  the uploaded 

video content in third-party service provider. 

Selective encryption is a particu lar tech-
nique to encrypt the video content; only sens i-

tive part of the bitstream is encrypted. For ex-

amp le, the stream c ipher is just applied to ce rtain  

parts that are sensitive for the  video scene; s e-

lected bits are used XOR bit wise operation with  

cipherte xt that generated by stream c ipher. 

Shahid et al. [1] proposed a format-co mp liant  

selective encryption method. For CA VLC, signs 

of trailing ones and magnitude’s level suffix in  

the specified range are encrypted. For CABAC, 

the magnitude’s EG0 sub-suffix in  the specified  

range and signs of non-zero quantized transform 

residual are encrypted. It is no change in final 

bitrate. Wang et al. [2] proposed a tunable en-

cryption scheme; besides the above-mentioned, 

signs of motion vector and intra prediction mode 

are also encrypted. Obviously, the correspond-

ing computational cost is relatively lowe r than 

full encryption. 

2. Method 

In this study, we imple ment two video en-

cryption algorith ms that prevent the sensitive 

* Corresponding author. Email: lyc@nfu.edu.t w 



Proceedings of Engineering and Technology Innovation , vol. 3, 2016, pp. 19 - 21 

20 Copyright ©  TAETI 

content fro m un-authorized access in the un-

trustworthy cloud. The encrypted video only 

recovered from the trusted person who owns a 

privacy key. The  proposed s ystem arch itecture is  

shown in Fig. 1. There e xist two video scram-

bling mechanisms that can be used to satisfy 

diffe rent situations  in the video encryption pro-

cess . 

 
Fig. 1 Proposed system scenario 

The proposed video scrambling methods are 

separately described as follows : 

2.1. Scrambling with other Videos 

In a video surveillance environ ment, the 

surveillance ca me ra is wide ly d istributed over 

the building. The first scheme is to scramb le  

mu lti-way v ideo contents simu ltaneously ; every 

sequence contains part of pictures  that belong to 

the others . The coded IDR pictures in each s e-

quence are denoted by V = {v1, v2, ..., vi}, where  i  

is the number of input sequences. The ith coded 

IDR p icture can be represented by vi = {vi1, 

vi2, ..., vij}, where j is the number of slice groups. 

After the encryption process, the scrambled IDR 

picture is turned into }ˆ,...,ˆ,ˆ{ˆ kjk2k1i   vvvv  , where 1 

≤ k ≤ i. 

(a) Generate the H.264/AVC bitstream: Each  

came ra contains an H.264/A VC encoder, the 

FMO configurations are listed below: 

 The FMO map type is dispersed mode. 

 4 slice groups in a coded picture. 

(b) Detect the IDR  picture: The detector parses 
the input bitstream and looks for the NALU 

type to indicate whether the IDR p icture has 

happened or not. If the IDR picture is de-

tected, the sentinel value will be signaled. 

(c) Redirect the NALU path: The dispatcher is 
controlled by a bitstream detector. If the  

sentinel value  is true, the selector signal will 

be set to the specified value  and the input 

NALU will be redirected to the correspond-

ing output position. The above-mentioned 

selector signal is determined by a chaotic  

sequence that proposed in our previous study 

[3]. 

(d) Data embedding: Be fore transmitting the 
bitstream to the cloud storage, it is necessary 

to embed the privacy key informat ion in the 

bitstream. The re lated data hiding process 

can be found in our previous work [4]. 

2.2. Scrambling by Itself 

In some situations, there is only one monitor 

in the building. The second method is to scra m-

ble single video content by itself; the video 

content can be recovered independently. The 

ma in idea is that all the mac roblocks in the 

identical picture will be  switched to a new posi-

tion while  the final bitstrea m is still for-

mat-co mp liant  to a genera l H.264/A VC decoder. 

The subset of macroblocks in a picture can be 

listed below: 

 MBrow = {mb1, mb2, ..., mbr-1}, where r is the 
number of macroblocks in a row. 

 MBcolumn = {mbr, mb2r, ..., mb( c-1)×r}, where  
c is the number of macroblocks in a column. 

 MBrest = {mbk | r+1 ≤ k  ≤ r× c  - 1, and k  ≠ nr, 

n ∈N
+
}. 

Let set X is the original macroblock position 

and set Y is the scramb le mac roblock position. 

Given a one-to-one and onto function f that 

assigns the set X to the set Y. Every ele ment of 

Y is the image of unique element of X. 

Due to the dependence on each adjacent 

mac roblock, a  huge drift error may be caused by 

switching macroblock position. However, there  

is a problem in switching macrobloc k position 

directly. Because coeff_token is encoded by the 

look-up table, switching macroblock position 

directly may cause a violation of the standard 

format. We need to re-encode the coeff_tok en to 

ensure that it can be found in the look-up table. 

3. Results and Discussion 

The proposed video encryption scheme has 

been imp le mented in a video stream platform 

that is based on the Joint Model. 



Proceedings of Engineering and Technology Innovation , vol. 3, 2016, pp. 19 - 21 

21 Copyright ©  TAETI 

3.1. Multi-way Videos Scrambling  

 
(a) encrypted Hall monitor 

 
(b) encrypted Container 

Fig. 2 The encrypted video, frame #149, P picture 

Fig. 2 illustrates a visual co mparison of 

original videos  and scramb led videos  in the  

8-way ca me ra environment. As can be seen, the 

proposed scheme p rovides a high scra mb ling  

effect that protects the video content from un-

authorized access. 

3.2. Single Video Scrambling 

 
(a) encrypted Hall monitor 

 
(b) encrypted Container 

Fig. 3 The encrypted video, frame #149, P picture 

Fig. 3 de monstrates the scramb ling e ffect  

which is quite d ifferent fro m the first method 

and no video content is  leak out. This method 

provides a better scrambling effect. 

4. Conclusions 

In this paper, we propose two encryption 

schemes  that provide quite high scra mb le e ffect  

for the video content in different scenario. It  is a  

real-t ime  application since only simp ly parsing  

and re-encoding in  the co mpressed domain a re  

needed. Although our approaches are applied  

after the co mpression, we can  s till p reserve 

format-co mpliance. Future works a im to seam-

lessly combine two methods to achieve more  

scrambling effects. 

References 

[1] Z. Shahid, M. Chau mont, and W. Puech, 
“Fast protection of H.264/A VC by selective 

encryption of CAVLC and CABA C for I 

and P fra mes,” IEEE T rans. Circuits Syst. 

Video Technol., vol. 21, no. 5, pp. 565-576, 

March 2011. 

[2] Y. Wang, M. O'Neill, and F. Kurugollu, “A  
tunable encryption scheme and analysis of 

fast selective encryption for CA VLC and  

CABA C in H.264/A VC,” IEEE T rans. 

Circuits Syst. Video Technol., vol. 23, no. 9, 

pp. 1476-1490, February 2013. 

[3] Y. T. Chang and Y. C. Lin, “The scra mb ling  
cryptography imp le mented with chaotic 

sequence trigger optical switch algorith m in  

WDM passive optical network,” Proc. IEEE  

Int. Ca rnahan Conference on Security  
Technology, September 2015. 

[4] W. S. Wang and Y. C. Lin, “A tunable data 
hiding scheme for CA BAC in H.264/A VC 

video streams,” Proc. IEEE Int. Sy mposium 
on Ne xt-Generat ion Electronics, May 2015.