/arib_std-b72

ARIB STD-B72 Colour Bar Test Pattern for Hybrid Log-Gamma (HLG)

Primary LanguagePythonMIT LicenseMIT

Generating HLG colorbar still image complying to ARIB STD-B72

Introduction

This is a HLG (Hybird Log-Gamma) colorbar generator complying to ARIB STD-B72. Unlike exported from NLE or general video processing software, raw data generated by this code have YUV444 precision and are very faithful to the defined standards by ARIB (Association of Radio Industries and Businesses).
*This code is made for ARIB colorbar used in Japan, not SMPTE colorbar.

Only 4K 10bit supported. Other resolution and bit depth will be supported in the future update.

Sample

[4K60p/HDR] ARIB STD-B72 Colour Bar Test Pattern for Hybrid Log-Gamma (HLG) 1min - YouTUbe
https://www.youtube.com/watch?v=YiFP1xrRE4c
[4K60p/HDR] ARIB STD-B72 Colour Bar Test Pattern for Hybrid Log-Gamma (HLG) 1min

Prerequisites

  • python and numpy module installed
  • ffmpeg installed (if you generate video)

How to use

Colorbar still image can generated by following :

python std-b72.py

then still image named "std-b72_3840x2160_yuv444p10le.yuv" appears.

This still image can preview by ffplay, like following :

ffplay -video_size 3840x2160 -pixel_format yuv444p10le "std-b72_3840x2160_yuv444p10le.yuv"

Generating video

By using ffmpeg, the still image can be converted to HEVC/H.265 video with HDR metadata, like following :

ffmpeg -s 3840x2160 -pix_fmt yuv444p10le -framerate 60000/1001 -stream_loop -1 -i "std-b72_3840x2160_yuv444p10le.yuv" -t 60 -pix_fmt yuv420p10le -r 60000/1001 -color_primaries bt2020 -color_trc arib-std-b67 -colorspace bt2020nc -c:v libx265 "out.mp4"

If you need uncompressed video, for example YUV420 10bit (v210),

ffmpeg -s 3840x2160 -pix_fmt yuv444p10le -framerate 60000/1001 -stream_loop -1 -i "std-b72_3840x2160_yuv444p10le.yuv" -t 60 -pix_fmt yuv422p10le -c:v v210 -r 60000/1001 "out.avi"

Futhermore, if you need video with 1kHz sine audio, add options following :

-f lavfi -i "sine=frequency=1000:sample_rate=48000:duration=60,volume=-2dB" -ac 2 -c:a pcm_s24le

References

Disclaimer

Please use this code at your own risk. I do not take any responsibility or liability for you using this code.