Skip to content

Commit

Permalink
Update HDR check and readd header information with each keyframe. (#4)
Browse files Browse the repository at this point in the history
* Changed HDR handling to use new syntax for svtav1-params as found in https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/Docs/Parameters.md

* Change color space mapping to use a dictionary instead of a single hardcoded mapping.

* Update scripts/ffmpeg_automator.py

Co-authored-by: Carlos Martinez <[email protected]>

* Update scripts/ffmpeg_automator.py

Co-authored-by: Carlos Martinez <[email protected]>

* Update HDR check and re-added repetition headers with svtav1-params.

* Update scripts/ffmpeg_automator.py

Co-authored-by: Carlos Martinez <[email protected]>

---------

Co-authored-by: Carlos Martinez <[email protected]>
  • Loading branch information
Cryator and Dashboy1998 authored Dec 11, 2024
1 parent f5b3ab6 commit 3c2f62d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/ffmpeg_automator.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def check_hdr(file_path):
for stream in media_info['streams']:
if stream['codec_type'] == 'video':
if 'color_space' in stream:
hdr = stream.get('color_space') == 'bt2020nc'
hdr = 'bt2020' in stream.get('color_space')
break

return hdr
Expand Down Expand Up @@ -217,7 +217,7 @@ def run_ffmpeg(input_path, output_path):

if check_hdr(input_path):
hdr_settings = get_hdr_setings(input_path)
encode_settings['svtav1-params'] = 'enable-hdr=1:color-primaries={color_primaries}:transfer-characteristics={color_transfer}:matrix-coefficients={color_space}:mastering-display=R({red_x},{red_y})G({green_x},{green_y})B({blue_x},{blue_y})WP({white_point_x},{white_point_y})L({max_luminance},{min_luminance}):content-light={max_content},{max_average} -pix_fmt {pix_fmt}'.format(**hdr_settings) # noqa: E501
encode_settings['svtav1-params'] = 'enable-hdr=1:repetition_headers=1:color-primaries={color_primaries}:transfer-characteristics={color_transfer}:matrix-coefficients={color_space}:mastering-display=R({red_x},{red_y})G({green_x},{green_y})B({blue_x},{blue_y})WP({white_point_x},{white_point_y})L({max_luminance},{min_luminance}):content-light={max_content},{max_average} -pix_fmt {pix_fmt}'.format(**hdr_settings) # noqa: E501

ffmpeg = (
FFmpeg().input(input_path).output(
Expand Down

0 comments on commit 3c2f62d

Please sign in to comment.