Ajustement du volume
This commit is contained in:
parent
e0e747ab04
commit
94cf69a21c
@ -85,6 +85,25 @@ def cropping(file, infos):
|
||||
return cropsize
|
||||
|
||||
|
||||
def volume_audio(file, infos):
|
||||
'''
|
||||
Cette fonction ajuste le volume vers 0dB
|
||||
'''
|
||||
volumes = {}
|
||||
for piste_audio in infos['audio']:
|
||||
piste = piste_audio['index']
|
||||
command = f"ffmpeg -loglevel info -i {file} -map 0:{piste} -af volumedetect -f null -y /dev/null"
|
||||
volumedetect = subprocess.getoutput(command)
|
||||
for line in volumedetect.splitlines():
|
||||
if "max_volume" in line:
|
||||
volume = line.split()[-2]
|
||||
volume = f"{str(-float(volume))}dB"
|
||||
logging.debug(f"Ajustement du volume de la piste {piste} : {volume}")
|
||||
volumes.update({piste: volume})
|
||||
return volumes
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import argparse
|
||||
parser = argparse.ArgumentParser()
|
||||
@ -98,3 +117,4 @@ if __name__ == '__main__':
|
||||
infos = get_infos(args.f_input)
|
||||
interlaced = is_interlaced(args.f_input, infos)
|
||||
cropsize = cropping(args.f_input, infos)
|
||||
volumes = volume_audio(args.f_input, infos)
|
||||
|
Loading…
Reference in New Issue
Block a user