225 字
1 分钟
自动化处理 Amazon Music 文件 MD5 不一致问题
当你从某些特殊渠道拿到Amazon Music的音频文件的时候,你会发现其Hi-Res FLAC文件md5与其他平台售卖版本不同,这是因为其前面有空采样。因此只需去除空采样即可达到“Bit Perfect”。故写这一脚本自动化处理具有错误md5的文件。
# This code is distributed under the Apache 2.0 License.# author: nptr$files = Get-ChildItem -Recurse -Filter *.flac | Select-Object FullName, BaseName$files | ForEach-Object { $fullName = $_.FullName $fileName = $_.BaseName Write-Host Processing $fileName $flag = metaflac --show-tag=BP $fullName $res = metaflac --show-sample-rate $fullName $skip = 0 switch ($res) { 44100 { $skip = 286 } 48000 { $skip = 312 } 96000 { $skip = 624 } 192000 { $skip = 1248 } Default { $skip = 0 } } if ($flag -ne "BP=1") { Write-Host SampleRate: $($res / 1000)kHz, skip $skip if ($skip -ne 0) { flac -8 --skip=$skip -f $fullName metaflac --set-tag=BP=1 $fullName } } else { Write-Host Skipping $fileName }}
用到了PowerShell7以及metaflac,相信聪明的你能够解决这两个问题。
自动化处理 Amazon Music 文件 MD5 不一致问题
https://nptr.cc/posts/2024-05/amazon-music-postprocess/