Compare commits

..

No commits in common. "89b618a502f6201a9ca70c90e09f66ac7f520bb4" and "c50b87fb7c49eeff0ba3fdf2b1f8fca8c03a0a53" have entirely different histories.

View File

@ -61,7 +61,7 @@ def loudnorm(inputfile: str, outputfile: str):
# normalize audio # normalize audio
file_normalized = pyloudnorm.normalize.loudness( file_normalized = pyloudnorm.normalize.loudness(
data=data, input_loudness=loudness, target_loudness=-18.0 data=data, input_loudness=loudness, target_loudness=-30.0
) )
# write normalized audio to file # write normalized audio to file
@ -128,15 +128,7 @@ def ffmpeg_copy_metadata(inputfile: str, outputfile: str):
with tempfile.NamedTemporaryFile() as temp_audio: with tempfile.NamedTemporaryFile() as temp_audio:
shutil.copyfile(outputfile, temp_audio.name) shutil.copyfile(outputfile, temp_audio.name)
# get input file extension
extension = os.path.splitext(os.path.basename(inputfile))[1]
inputcmd = {inputfile: None, temp_audio.name: None} inputcmd = {inputfile: None, temp_audio.name: None}
# NOTE opus maps metadata to the first audio stream. Other formats like flac, mp3 and m4a/aac by contrast map it to the input directly
if extension == ".opus":
outputcmd = {outputfile: "-map 1 -c copy -map_metadata 0:s"}
else:
outputcmd = {outputfile: "-map 1 -c copy -map_metadata 0"} outputcmd = {outputfile: "-map 1 -c copy -map_metadata 0"}
ff = ffmpy.FFmpeg(inputs=inputcmd, outputs=outputcmd, global_options=("-y")) ff = ffmpy.FFmpeg(inputs=inputcmd, outputs=outputcmd, global_options=("-y"))