Video Compression

VideoNerd

Turing codec is open-source codec to encode hevc.

Download and Build

git clone https://github.com/bbc/turingcodec.git
cd turingcodec
mkdir build
cd build
cmake ../ -G "Visual Studio 16 2019" -A x64

Open turing.sln in the build-folder (‘cmake’ creates turing.sln), choose Release/x64 and build the solution, the binary turing.exe is created at ‘turingcodec\build\turing\Release\’

 

Run

Case A:  Low latency IBBB, 10Mbps, GOP size 50 frames

 

turing.exe encode --frame-rate 60 --input-res 1920x1080 --frames 200 --speed fast --bitrate 20000 --min-cu 8  --max-gop-n 999999 --max-gop-m 1 --segment 60  --repeat-headers  -o battlefield.h266  battlefield1.yuv

notes:

--bitrate 20000         bitrate is always in kbits

--segment 60            emit IDR each 60 frames

--max-gop-n 999999 --max-gop-m 1   disable GOPs, only the parameter ‘segment’ determines GOP

If you need printing encoded frame type, average QP, size in bits, PSNR scores, use --verbosity 2

..

POC 0 ( I-SLICE, QP 20 ) 2309568 bits [ Y 46.1910 dB U 49.1987 dB V 51.2513 dB ] [ ET 0.6 ]
POC 1 ( B-SLICE, QP 25 ) 464952 bits [ Y 36.9402 dB U 46.4874 dB V 49.4216 dB ] [ ET 0.4 ]
POC 2 ( B-SLICE, QP 29 ) 234920 bits [ Y 37.1444 dB U 46.6636 dB V 49.7002 dB ] [ ET 0.4 ]
POC 3 ( B-SLICE, QP 29 ) 220888 bits [ Y 37.5529 dB U 46.8249 dB V 49.6880 dB ] [ ET 0.3 ]
POC 4 ( B-SLICE, QP 29 ) 193848 bits [ Y 38.9513 dB U 47.4926 dB V 50.0161 dB ] [ ET 0.4 ]
POC 5 ( B-SLICE, QP 28 ) 148192 bits [ Y 41.8981 dB U 48.3969 dB V 50.4946 dB ] [ ET 0.3 ]
POC 6 ( B-SLICE, QP 30 ) 71080 bits [ Y 44.9678 dB U 49.8206 dB V 51.4332 dB ] [ ET 0.1 ]
POC 7 ( B-SLICE, QP 30 ) 63488 bits [ Y 48.0542 dB U 51.0008 dB V 52.2244 dB ] [ ET 0.4 ]
POC 8 ( B-SLICE, QP 30 ) 37960 bits [ Y 49.5726 dB U 51.2596 dB V 52.7061 dB ] [ ET 0.2 ]
POC 9 ( B-SLICE, QP 28 ) 46168 bits [ Y 50.4920 dB U 52.0814 dB V 53.6258 dB ] [ ET 0.2 ]
POC 10 ( B-SLICE, QP 28 ) 15472 bits [ Y 49.9254 dB U 52.0820 dB V 53.6251 dB ] [ ET 0.0 ]
POC 11 ( B-SLICE, QP 28 ) 39552 bits [ Y 49.3817 dB U 52.0683 dB V 53.6021 dB ] [ ET 0.1 ]
POC 12 ( B-SLICE, QP 28 ) 69280 bits [ Y 48.8852 dB U 52.0350 dB V 53.6032 dB ] [ ET 0.1 ]

 

 

To get info on all encoding parameters, type the following command:

turing.exe help encode

 

Usage: turing.exe encode [options] input-file

Input options:
--input-res              video frame resolution <width>x<height>
--seek                     number of initial frames to be omitted before encoding starts
--frames                 number of frames to encode
--frame-rate          frame rate
--bit-depth            video bit depth (of both input YUV and output stream), default 8.

Selected Output options:
-o                            output file name
--dump-frames      dump reconstructed YUV file name
--hash                   decoded picture hash: 0 = MD, 1 = CRC, 2 = Check sum,  hash suffix SEI is signaled

 

Selected Rate control options:
--qp                          quantization parameter (default 26)
--aq                         TM5-like adaptive quantisation based onpsycho-visual model
--aq-depth               maximum depth at which adaptive quantisation can be performed (default 3)
--aq-range               maximum range at which the qp can vary during  adaptive quantisation (default 6)
--dqp-depth            cu depth where QP can be varied (default = -1, i.e. automatically chosen)
--bitrate                   if configured than CBR rate control based on lambda-rate model is applied

Selected Structure options:
--shot-change                   enable shot change detection
--max-gop-n                      maximum intra picture interval, default 250
--max-gop-m                    maximum anchor picture interval (1 or 8)
--segment                         enable IDR segmentation (-1 for disabled)
--wpp                                enable wave-front parallel processing (default enabled)
--ctu                                CTU size in luma pixels  (default 64x64)
--min-cu                          minimum CU size in luma pixels (default 8x8)
--repeat-headers              emit VPS/SPS/PPS on every keyframe (default - first keyframe only)

Selected Coding tool options:
--deblock                                    enable deblocking filter, to diable use --no-deblock
--sao                                           enable sample adaptive offset filter, to disable use --no-sao
--strong-intra-smoothing          enable strong intra smoothing, to disable use --no-strong-intra-smoothing
--amp                                          enable asymmetric motion partitions , to disable use --no-amp (default)
--rdoq                                          enable rate distortion optimised quantisation, by default disabled, if set then the encoding process is slowed
--max-num-merge-cand              maximum number of merge candidates tested (by default all 5)
--sdh                                             enable sign data hiding, relevant only with --rdoq
--tskip                                           enable transform skip (beneficial for screen content), disabled by default

Selected Performance options:
--speed               speed / efficiency tradeoff : slow, medium, fast
--fdm                   fast decision for merge mode
--fdam                 fast decision for all modes (enabled by default), to disable use --no-fdam
--ecu                    enable early cu termination (enabled by default)
--esd                   enable early skip detection  (enabled by default)

Selected Optimisation options:
--threads                                          size of thread pool (default - 0=auto detect)
--concurrent-frames                       maximum number of pictures that may encode inparallel (default 4)
--no-parallel-processing                 disable parallelisation (wpp, multithreadingand encoding of concurrent frames)

Selected Reporting:
--psnr                            measure PSNR and report
--profiler                       profile CPU usage and report
--verbosity                   output during encoding (0, 1 or 2), default 1

2 Responses

Leave a Reply

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