fix: détection conteneur source pour extraction HDR10+ (MKV vs MP4)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -64,13 +64,15 @@ 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)
|
||||||
duration = subprocess.getoutput(f"ffprobe -v quiet -print_format json -show_format {file}")
|
format_data = json.loads(subprocess.getoutput(f"ffprobe -v quiet -print_format json -show_format {file}"))
|
||||||
duration = json.loads(duration)
|
duration = float(format_data['format']['duration'])
|
||||||
duration = float(duration['format']['duration'])
|
format_name = format_data.get('format', {}).get('format_name', '')
|
||||||
hdr10_v_cmd = f'ffmpeg -loglevel panic -i {file} -c:v copy -vbsf hevc_mp4toannexb -f hevc - | hdr10plus_parser -o metadata.json --verify -'
|
is_mp4_container = 'mp4' in format_name or 'mov' in format_name
|
||||||
|
bsf = '-vbsf 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_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:
|
||||||
hdr10_cmd = f'ffmpeg -loglevel panic -i {file} -c:v copy -vbsf hevc_mp4toannexb -f hevc - | hdr10plus_parser -o /tmp/{file}_hdr10_metadata.json -'
|
hdr10_cmd = f'ffmpeg -loglevel panic -i {file} -c:v copy {bsf} -f hevc - | hdr10plus_parser -o /tmp/{file}_hdr10_metadata.json -'
|
||||||
hdr10_cmd_res = subprocess.getoutput(hdr10_cmd)
|
hdr10_cmd_res = subprocess.getoutput(hdr10_cmd)
|
||||||
logging.debug(hdr10_cmd_res)
|
logging.debug(hdr10_cmd_res)
|
||||||
v_infos.update({'hdr10plus': True, 'hdr10plus_metadata': f'/tmp/{file}_hdr10_metadata.json'})
|
v_infos.update({'hdr10plus': True, 'hdr10plus_metadata': f'/tmp/{file}_hdr10_metadata.json'})
|
||||||
|
|||||||
Reference in New Issue
Block a user