Reference H264 scalable codec – JSVM

Appendix: Use Case Bitrate Adaptive Video Delivery in Scalable Mode

 

 

Short presentation on Scalable Video Coding of AVC/H.264:

In a scalable (layered) video coding the video signal is encoded as a stack of layers that makes progressive reconstruction at increasingly higher quality possible. The output from the encoder is arranged in a hierarchical structure of cumulative layers, so that the more layers that are used in the decoding process, the higher is the quality of the reconstructed video.

SNR or Quality scalability is less time consuming on both sides encoder and decoder than the spatial, since image scaling is not applied: 

 

 

 

 

Reference H264 scalable codec – JSVM

The repository https://vcgit.hhi.fraunhofer.de/jvet/jsvm.git   contains JSVM (scalable h264) codec plus several tools. One of the tools is DownConvertStatic.exe   for scaling of yuv files in case of spatial scalability is used.

To build JSVM reference codec

1) clone JSVM

git clone https://vcgit.hhi.fraunhofer.de/jvet/jsvm.git

2) go to the folder jsvm\JSVM\H264Extension\build\windows  and open H264AVCVideoEncDec_vc10.sln (if you have more advanced version of Visual Studio make re-target)

3) Choose Release/x64 and built the solution (some projects apparently would fail to be built).

4) exe-files are created at the folder jsvm\bin64

 

Use Case: Spatial Scalability, two layers QCIF and CIF

i have the CIF file: crowd_cif.yuv.  i am requested to create spatial two-layered h264 stream: the base layer is QCIF (176×144) and the enhancement layer CIF.

First of all i have to downscale crowd_cif.yuv to qcif, i use the tool DownConvertStatic.exe from JSVM library (ffmpeg can used alternatively)

Usage of DownConvertStatic:

DownConvertStatic   input-width  input-height  input-yuv   output-width  output-height  output-yuv   method

where method –  0 standard scaling method, 1 for dyadic scaling

Downscaling 352×288 (cif) to 176×144 (qcif):

DownConvertStatic   352 288   C:\Tool\yuv\crowd_cif.yuv   176 144 C:\Tool\yuv\crowd_qcif.yuv    0

 

Create main.cfg file, this configuration file contains all relevant info applicable to both layers: 

# JSVM Main Configuration File for two spatial layers

#OutputFile output file will be specified in the command line
FrameRate 50.0                 # Maximum frame rate [Hz]
FramesToBeEncoded 500 # Number of frames (at input frame rate)
GOPSize 16                       # GOP Size (at maximum frame rate)
BaseLayerMode 2              # Base layer mode (0,1: AVC compatible, # 2: AVC w subseq SEI)
SearchMode 4                    # Search mode (0:BlockSearch, 4:FastSearch)
SearchRange 32                 # Search range (Full Pel)
NumLayers 2                      # Number of layers
LayerCfg ..\spatial-configs\layer0.cfg # qcif layer configuration file
LayerCfg ..\spatial-configs\layer1.cfg # cif layer configuration file

Create basic layer configuration file (layer0.cfg):

# JSVM Layer Configuration File

#InputFile Input file will be specified in the command line
SourceWidth 176     # Input frame width
SourceHeight 144    # Input frame height
FrameRateIn 50      # Input frame rate [Hz]
FrameRateOut 50     # Output frame rate [Hz]

 

Create enhancement layer configuration file (layer1.cfg):

# JSVM Layer Configuration File

#InputFile Input file will be specified in the command line
SourceWidth 352 # Input frame width
SourceHeight 288 # Input frame height
FrameRateIn 50 # Input frame rate [Hz]
FrameRateOut 50 # Output frame rate [Hz]
InterLayerPred 2  # Inter-layer Pred. (0: no, 1: yes, 2:adap.)

 

Run h264 spatial two-layered encoding:

H264AVCEncoderLibTestStatic -pf ..\spatial-configs\main.cfg -lqp 0 20 -lqp 1 22 -frms 100 -rec 0 none -rec 1 none -org 0 C:\Tool\yuv\crowd_qcif.yuv -org 1 C:\Tool\yuv\crowd_cif.yuv -bf layer2.h264

-bf  specifies the output h264 file

‘-rec 0 none’ and ‘-rec 1 none’  – not create reconstruction yuv files for layer 0 and layer 1 

-org 0  specifies input yuv file for the basic layer

-org 1  specifies input yuv file for the enhancement layer

 

Note: ffplay plays the output scalable h264 file, but only the basic layer.

 

To decode enhancement layer use H264AVCDecoderLibTestStatic.exe:

H264AVCDecoderLibTestStatic.exe   layer2.h264    layer2_cif.yuv

 

To decode the basic layer you need peel the scalable stream to remove enhancement data, use the tool BitStreamExtractorStatic

BitStreamExtractorStatic    layer2.h264   basic.h264 -l 0

‘-l 0’  layer 0 (the basic)

 

 

Appendix: Use Case Bitrate Adaptive Video Delivery in Scalable Mode


Server sends scalable video stream, for simplicity let’s assume the server sends three layers: 


base layer:                    720p, bitrate 2Mbps
intermediate layer:      1080p, bitrate 8Mbps
high layer:                   4K, bitrate 15Mbps

 

If network conditions get worsened (e.g. Client reports on massive packet losses) then Server at the next key-frame switches to lower bitrate-resolution, i.e. starts transmitting base layer or base+intermediate layers. Once network conditions improved, Server switches to three-layered video.

19 Responses

  1. Hi, i think that i saw you visited my blog thus i came to “return the favor”.I’m trying to find things to improve my website!I suppose its ok to use a few of your ideas!!

  2. Good web site! I really love how it is easy on my eyes and the data are well written. I am wondering how I could be notified whenever a new post has been made. I have subscribed to your RSS feed which must do the trick! Have a nice day!

  3. Excellent site you have here but I was curious about if you knew of any discussion boards that cover the same topics talked about here? I’d really like to be a part of online community where I can get opinions from other experienced individuals that share the same interest. If you have any recommendations, please let me know. Many thanks!

  4. I have to express some thanks to this writer just for rescuing me from such a circumstance. Because of surfing around through the the web and finding advice that were not powerful, I was thinking my entire life was done. Being alive without the presence of answers to the issues you have resolved through your good blog post is a crucial case, and ones which may have negatively damaged my entire career if I had not discovered your website. Your ability and kindness in handling the whole thing was invaluable. I don’t know what I would have done if I hadn’t come upon such a stuff like this. I can now relish my future. Thanks a lot very much for your reliable and effective help. I will not think twice to recommend your web sites to anybody who ought to have guidance about this matter.

  5. This blog is definitely rather handy since I’m at the moment creating an internet floral website – although I am only starting out therefore it’s really fairly small, nothing like this site. Can link to a few of the posts here as they are quite. Thanks much. Zoey Olsen

Leave a Reply

Your email address will not be published. Required fields are marked *