pix_fmt + HDR10+

This commit is contained in:
Antoine Van Elstraete 2021-06-20 01:18:59 +02:00
parent e4efafa608
commit 85e830e7af

View File

@ -19,7 +19,8 @@ def get_infos(file):
'color_primaries': None,
'color_space': None,
'color_transfer': None,
'display_aspect_ratio': None
'display_aspect_ratio': None,
'pix_fmt': None
}
a_infos = {}
v_infos_cmd = f"ffprobe -v quiet -print_format json -show_format -show_streams -select_streams v {file}"
@ -43,6 +44,14 @@ def get_infos(file):
duration = subprocess.getoutput(f"ffprobe -v quiet -print_format json -show_format {file}")
duration = json.loads(duration)
duration = float(duration['format']['duration'])
hdr10_v_cmd = f'ffmpeg -loglevel panic -i {file} -c:v copy -vbsf hevc_mp4toannexb -f hevc - | ./hdr10plus_parser -o metadata.json --verify -'
hdr10_v_raw = subprocess.getoutput(hdr10_v_cmd)
logging.debug(hdr10_v_raw)
import pdb; pdb.set_trace()
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_raw = subprocess.getoutput(hdr10_cmd)
v_infos.update({'hdr10': True, 'hdr10_metdata': f'/tmp/{file}_hdr10_metadata.json'})
infos = {'duration': duration, 'video': v_infos, 'audio': a_infos}
logging.debug("Informations du film : \n" + json.dumps(infos, indent=True))
return infos