diff --git a/vid_convert.py b/vid_convert.py old mode 100644 new mode 100755 index 7c118fc..60c5406 --- a/vid_convert.py +++ b/vid_convert.py @@ -110,9 +110,13 @@ def cropping(file, infos): ''' logging.info("Détection de la taille de l'image...") duration_tier = int(infos['duration'] / 3) - command = f"ffmpeg -loglevel info -i {file} -ss {duration_tier} -t {duration_tier} -an -f null -vf cropdetect -y /dev/null" + command = f"ffmpeg -loglevel info -i {file} -ss {duration_tier} -t {int(duration_tier / 10)} -an -f null -vf cropdetect -y /dev/null" logging.debug(command) - cropsize = subprocess.getoutput(command).splitlines()[-3].split()[-1] + line = -3 + cropsize = "times" + while cropsize == "times" or ":" not in cropsize: + cropsize = subprocess.getoutput(command).splitlines()[line].split()[-1] + line -= 1 logging.debug(f"Paramètre de découpe : {cropsize}") return cropsize @@ -301,7 +305,8 @@ if __name__ == '__main__': else: logging.basicConfig(format='[%(asctime)s]\n%(message)s', level=logging.INFO, datefmt='%d/%m/%Y %H:%M:%S') file = args.f_input - infos = get_infos(file) + # infos = get_infos(file) + interlaced = False interlaced = is_interlaced(file, infos) cropsize = cropping(file, infos) volumes = volume_audio(file, infos) @@ -321,7 +326,7 @@ if __name__ == '__main__': else: vid_part_time = 0 while vid_part_time < infos['duration']: - crf = 19 + crf = 20 convert_video(file, infos, vid_part_time, cropsize, crf, animation, interlaced, args.vhs) vid_part_time += 300 create_mkv(file)