fix: ajout color_primaries/trc/matrix dans commande FFmpeg pour HDR10
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -188,17 +188,18 @@ def convert_video(file, infos, crf, crop, enc_options, interlaced, vhs):
|
|||||||
track = infos['video']['index']
|
track = infos['video']['index']
|
||||||
codec = 'libsvtav1'
|
codec = 'libsvtav1'
|
||||||
svtav1_params = enc_options
|
svtav1_params = enc_options
|
||||||
hdr = ''
|
|
||||||
if interlaced:
|
if interlaced:
|
||||||
crop = f"{crop},yadif"
|
crop = f"{crop},yadif"
|
||||||
if vhs:
|
if vhs:
|
||||||
crop = f"{crop},hqdn3d,unsharp=5:5:0.8:3:3:0.4"
|
crop = f"{crop},hqdn3d,unsharp=5:5:0.8:3:3:0.4"
|
||||||
|
color_args = ''
|
||||||
if 'side_data_list' in infos['video'].keys():
|
if 'side_data_list' in infos['video'].keys():
|
||||||
try:
|
try:
|
||||||
light_level = f"{infos['video']['side_data_list'][1]['max_content']},{infos['video']['side_data_list'][1]['max_average']}"
|
light_level = f"{infos['video']['side_data_list'][1]['max_content']},{infos['video']['side_data_list'][1]['max_average']}"
|
||||||
color_primaries = infos['video']['color_primaries']
|
color_primaries = infos['video']['color_primaries']
|
||||||
color_transfer = infos['video']['color_transfer']
|
color_transfer = infos['video']['color_transfer']
|
||||||
color_space = infos['video']['color_space']
|
color_space = infos['video']['color_space']
|
||||||
|
color_args = f'-color_primaries {color_primaries} -color_trc {color_transfer} -colorspace {color_space}'
|
||||||
green_x = infos['video']['side_data_list'][0]['green_x'].split('/')
|
green_x = infos['video']['side_data_list'][0]['green_x'].split('/')
|
||||||
green_x = int(int(green_x[0])*(int(green_x[1])/50000))
|
green_x = int(int(green_x[0])*(int(green_x[1])/50000))
|
||||||
green_y = infos['video']['side_data_list'][0]['green_y'].split('/')
|
green_y = infos['video']['side_data_list'][0]['green_y'].split('/')
|
||||||
@@ -239,7 +240,7 @@ def convert_video(file, infos, crf, crop, enc_options, interlaced, vhs):
|
|||||||
else:
|
else:
|
||||||
svtav1_params = hdr10plus_param
|
svtav1_params = hdr10plus_param
|
||||||
svtav1_args = f'-svtav1-params {svtav1_params}' if svtav1_params else ''
|
svtav1_args = f'-svtav1-params {svtav1_params}' if svtav1_params else ''
|
||||||
command = f'ffmpeg -loglevel error -i {file} -map 0:{track} -an -sn -c:v {codec} {svtav1_args} -crf {crf} -pix_fmt {fmt} -filter:v {crop} -y {output}'
|
command = f'ffmpeg -loglevel error -i {file} -map 0:{track} -an -sn -c:v {codec} {svtav1_args} -crf {crf} -pix_fmt {fmt} {color_args} -filter:v {crop} -y {output}'
|
||||||
logging.info("Encodage vidéo en cours (AV1-SVT)...")
|
logging.info("Encodage vidéo en cours (AV1-SVT)...")
|
||||||
logging.debug(command)
|
logging.debug(command)
|
||||||
result = subprocess.getoutput(command)
|
result = subprocess.getoutput(command)
|
||||||
|
|||||||
Reference in New Issue
Block a user