我正在使用由Aruba.it管理的共享服务器它用
ffmpeg版本4.1用gcc 4.8.5构建(海湾合作委员会)20150623(红帽4.8.5-36)我需要使用ffmpeg将任何上传的MP3的响度修复为-12 …
如果您手动运行它,在终端中没有脚本,您将收到错误:
Unable to find a suitable output format for '04:measured_thresh=-40.21:offset=-0.47' 04:measured_thresh=-40.21:offset=-0.47: Invalid argument
你的命令中有一个错误的空间,所以改变 measured_tp=-11 04 至 measured_tp=-11.04 。
measured_tp=-11 04
measured_tp=-11.04
同 shell_exe 要么 exec 使用:
shell_exe
exec
$output = shell_exec('/usr/bin/ffmpeg -i Temp.mp3 -af loudnorm=I=-12:LRA=7:tp=-2:measured_I=-30:measured_LRA=1.1:measured_tp=-11 04:measured_thresh=-40.21:offset=-0.47 -y output.mp 2>&1');
2 refers to the second file descriptor of the process, i.e. stderr.
> means redirection.
&1 means the target of the redirection should be the same location as the first file descriptor, i.e. stdout.
在 $output 你会有回应。如果是apache用户 www-data 没有足够的权限执行命令 sudo
$output
www-data
sudo
根据@llogan的建议,我找到了解决方案。 它应该是3个步骤,而不是只有一个步骤。 在我的情况下,MP3到MP3不起作用。 所以我将输入MP3转换为wave,将其标准化,然后转换回MP3
exec("/usr/bin/ffmpeg -i Temp.mp3 Temp.wav"); exec("/usr/bin/ffmpeg -i Temp.wav -af loudnorm=I=-12:LRA=7:tp=-2:measured_I=-30:measured_LRA=1.1:measured_tp=-11.04:measured_thresh=-40.21:offset=-0.47 output.wav"); exec("/usr/bin/ffmpeg -i output.wav -ab 320k output.mp3");
这个解决方案很完美