fix: réutilisation full_v_infos pour format/durée, -vbsf → -bsf:v

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-22 23:44:44 +01:00
parent cff086892b
commit 463e0ea38d

View File

@@ -64,11 +64,10 @@ def get_infos(file):
'index': s_stream['index'], 'index': s_stream['index'],
'language': s_stream['tags']['language']} 'language': s_stream['tags']['language']}
s_infos.append(s_stream_infos) s_infos.append(s_stream_infos)
format_data = json.loads(subprocess.getoutput(f"ffprobe -v quiet -print_format json -show_format {file}")) format_name = full_v_infos.get('format', {}).get('format_name', '')
duration = float(format_data['format']['duration']) duration = float(full_v_infos['format']['duration'])
format_name = format_data.get('format', {}).get('format_name', '')
is_mp4_container = 'mp4' in format_name or 'mov' in format_name is_mp4_container = 'mp4' in format_name or 'mov' in format_name
bsf = '-vbsf hevc_mp4toannexb' if is_mp4_container else '' bsf = '-bsf:v hevc_mp4toannexb' if is_mp4_container else ''
hdr10_v_cmd = f'ffmpeg -loglevel panic -i {file} -c:v copy {bsf} -f hevc - | hdr10plus_parser --verify -' hdr10_v_cmd = f'ffmpeg -loglevel panic -i {file} -c:v copy {bsf} -f hevc - | hdr10plus_parser --verify -'
hdr10_v_raw = subprocess.getoutput(hdr10_v_cmd) hdr10_v_raw = subprocess.getoutput(hdr10_v_cmd)
if 'metadata detected' in hdr10_v_raw: if 'metadata detected' in hdr10_v_raw: