我有一个 bat 文件,它读取“µudios LUFS”文件夹中的几个音频文件,并通过将这些文件复制到“Normalized µudios Lufs”文件夹来执行 LUFS 标准化。
我正在尝试在另一个名为 Logs 的文件夹中生成每个文件及其相应名称的日志。
在将文件标准化的命令行上,我使用-report:
-report file="%Userprofile%\Desktop\Logs\!filename!.mp3.log":level=24
代码:
md "C:\Users\%username%\Desktop\Temp_normalizing_lufs" ------> temp folder audio files being normalized
pushd "%Userprofile%\Desktop\µudios LUFS" ------> folder with the original audio files
__
FOR /F "delims=" %%a in ('where .:*.mp3 ^|findstr /vi "_LOUDNORM _EBU"') DO ( |
SET "filename=%%~na" |
ffmpeg -hide_banner -i "%%a" -af "[0:a]loudnorm=print_format=summary" -f null NUL 2> "%%~na.log" |
@FOR /F "tokens=3" %%b IN ('FINDSTR /C:"Input Integrated" "%%~na.log"') DO (SET II=%%b) |
@FOR /F "tokens=4" %%b IN ('FINDSTR /C:"Input True Peak" "%%~na.log"') DO (SET ITP=%%b) | set original audio files values
@FOR /F "tokens=3" %%b IN ('FINDSTR /C:"Input LRA" "%%~na.log"') DO (SET ILRA=%%b) | to use as parameters in loudnorm
@FOR /F "tokens=3" %%b IN ('FINDSTR /C:"Input Threshold" "%%~na.log"') DO (SET IT=%%b) |
@FOR /F "tokens=3" %%b IN ('FINDSTR /C:"Target Offset" "%%~na.log"') DO (SET TO=%%b) |
DEL "%%~na.log" __|
SETLOCAL ENABLEDELAYEDEXPANSION
FOR /F "tokens=1,2 delims=," %%b IN ('ffprobe -v 0 -select_streams a -show_entries "stream=bit_rate,sample_rate" -of "csv=p=0" "!filename!.mp3"') ----> getting the sample rate and bitrate of the original audio file to use as parameters in loudnorm
DO (
SET FFREPORT=file="C:\Users\%username%\Desktop\Logs\!filename!.log":level=24 ffmpeg -hide_banner -i "!filename!.mp3" -af "loudnorm=linear=true:I=!-10.0!:LRA=11:tp=!-0.1!:measured_I=!II!:measured_LRA=!ILRA!:measured_tp=!ITP!:measured_thresh=!IT!:offset=!TO!:print_format=summary" -c:v copy -id3v2_version 3 -metadata:s:v title="Album cover" -metadata:s:v comment="Cover (front)" -acodec mp3 -b:a %%c -ar:a %%b "C:\Users\%username%\Desktop\Temp_normalizing_lufs\!filename!.mp3"
)
ENDLOCAL
)
xcopy "C:\Users\%username%\Desktop\Temp_normalizing_lufs\*.mp3" "C:\Users\%username%\Desktop\Normalized µudios Lufs\LOUDNORM\MP3\LUFS %-10.0%" /y /s /i ----> copying the audio files from the temporary folder to the final folder
__
del /q "C:\Users\%username%\Desktop\Temp_normalizing_lufs\*.*" |
rmdir "C:\Users\%username%\Desktop\Temp_normalizing_lufs" /s /q | Removing the temporary folder from the desktop
__|
错误日志消息:
Successfully opened the file.
Parsing a group of options: output url file=ACDC - Jailbreak.mp3.log:level=24.
Successfully parsed a group of options.
Opening an output file: file=ACDC - Jailbreak.mp3.log:level=24.
[NULL @ 0000021f879b8680] Unable to find a suitable output format for 'file=ACDC - Jailbreak.mp3.log:level=24'
file=ACDC - Jailbreak.mp3.log:level=24: Invalid argument
[AVIOContext @ 0000021f87967840] Statistics: 131072 bytes read, 0 seeks
Ps:日志文件在原音频文件夹内生成,名称为ffmpeg-20240427-105701.log(没有音频名),并且bat不会转换音频。
如何在另一个文件夹中创建带有每个音频名称的日志文件?
巴雅尔·格洛芙
我将您的建议插入到我的蝙蝠中,但是不起作用,请查看我的问题中的变化。
附言:在我的 bat 中,只有在 FFREPORT 环境变量前面加上 SET 后它才有效。
我使用命令将日志文件路径更改为另一个文件夹,如该链接所示,但它不起作用:
为我的 ffmpeg 输出创建日志文件
命令:
SET FFREPORT=file="C:\Users\%username%\Desktop\Logs\!filename!.log":level=24
Ps2:该命令位于DO循环内,因为bat将转换文件夹中的多个音频。
结论:
该路径不起作用,日志文件生成在与音频文件同一文件夹下,然后被自动删除并且bat不会转换音频文件。