经过调查以找到解决问题的方法后,我最终两手空空。我想要 Windows 10 中的上下文菜单选项,以便每当我右键单击 mp3 文件时,我都可以使用此选项从 mp3 文件的开头和结尾修剪静音。我不想从音频文件的中间部分删除静音。任何人都可以为我提供适当的 FFmpeg 命令行以仅从 mp3 文件的开头和结尾删除静音吗?
小智 16
像这样的东西:
ffmpeg -i input.mp3 -af "silenceremove=start_periods=1:start_duration=1:start_threshold=-60dB:detection=peak,aformat=dblp,areverse,silenceremove=start_periods=1:start_duration=1:start_threshold=-60dB:detection=peak,aformat=dblp,areverse" output.flac
Run Code Online (Sandbox Code Playgroud)
您需要根据具体情况调整阈值 ( start_threshold) 和持续时间 ( start_duration)。
小智 7
对我来说,使用 mp4 文件执行此操作的最佳选择是此过滤器:
ffmpeg -i INPUT.mp4 -af "areverse,atrim=start=0.2,silenceremove=start_periods=1:start_silence=0.1:start_threshold=0.02,areverse,atrim=start=0.2,silenceremove=start_periods=1:start_silence=0.1:start_threshold=0.02"
-acodec aac OUTPUT.mp4,
Run Code Online (Sandbox Code Playgroud)
要了解所有过滤器部件:
areverse:反转整个音频。atrim=start=0.2:剪掉前 0.2 秒以避免音频结尾处可能出现的高停止录音噪音(请记住音频是反向的)。silenceremove=start_periods=1:start_silence=0.1:start_threshold=0.02:这部分去掉了最后的沉默。areverse:这部分将音频恢复到原来的方式。atrim=start=0.2剪掉前 0.2 秒以避免音频开头可能出现的高噪音silenceremove=start_periods=1:start_silence=0.1:start_threshold=0.02":这部分消除了开始的沉默