给大家分享一篇关于互联网和手机的文章。相信很多朋友对互联网和手机还是不太了解,所以边肖也在网上搜集了一些关于手机和互联网的相关知识与大家分享。希望大家看完之后会喜欢。
如果你习惯从网上商场下载FLAC(免费无损音频压缩编码)格式的音频文件,请不要使用Windows 10系统的Explorer编辑元数据。Windows 10版本2004及更高版本中有一个错误,如果使用资源管理器修改元数据,可能会损坏FLAC音频文件。
此BUG影响Windows10专业版、家庭版、企业版、工作站版和其他SKU版本。根据本月早些时候发布的支持文件,Windows 10的文件资源管理器中的错误会破坏一些FLAC文件,这些文件在FLAC头之前包含一个ID3帧。ID3是一个框架,负责存储音乐标题、艺人、专辑、曲目号等信息。
在Windows 10系统上,FLAC处理程序忽略ID3框架,因为它认为FLAC文件一开始使用4字节fLaC。当用户编辑音乐文件时,覆盖了ID3框架,没有启动代码。因此,音乐播放器无法识别修改后的文件。如果在文件资源管理器中更改了音乐文件的标题、艺术家或其他元数据,则不会播放或加载音乐文件。
幸运的是,微软已经找到了根本原因,现在可以通过Windows Update修复了。在KB5003214更新的更新日志中,微软确认此错误已修复,如果您更改其标题、艺术家或其他元数据,FLAC音乐文件将不再不可播放。
对于那些损坏的音乐文件,微软发布了一个新的PowerShell脚本,您可以运行它来使文件再次播放。但是,它无法恢复存储在ID3框架中丢失的元数据。为了避免日后FLAC音乐文件出现问题,微软建议应用本月可选的累积更新。
解决办法
1.打开记事本
2.将以下脚本代码复制到记事本中
#版权所有2021微软
#此脚本将修复媒体基金会参考KB5003430损坏的FLAC文件。
#更多信息,请参考KB5003430
参数(
[参数(强制=$ true,
帮助消息=“被媒体基金会损坏的FLAC文件的路径”,
valuefrom remaininguments=$ true)]
[验证脚本({-不是[字符串]: isnullorempty($ _)-和(测试路径$_) })]
[字符串] $文件
)
#如果有任何错误,我们需要备份当前文件
$文件目录=拆分-路径-解析$文件
$文件名=拆分-路径-分叶-解析$文件
$完整路径=连接路径-解析$文件目录$文件名
$ Filename=[字符串]: format(' Backup _ { 03360 yyyyymmdd _ hhmmss } _ { 1 } ',[DateTime]:Now,$ Filename)
$ BackupLocation=连接路径$文件目录$文件名
“写输出”微软FLAC修复工具。该工具将修复编辑其详细信息时损坏的FLAC音频文件。
写输出“受影响的文件:美元完整路径”
写输出“将备份文件:美元备份位置”
写输出“要继续吗?”
$ choice=$ host . ui . promptforchoice('修复FLAC脚本','是否要继续',('是','否'),1)
>function ParseStreamInfoMetADATABlock([System.IO.FileStream] $ stream)
{
$ blockType = $ stream.ReadByte()
$ lastBlock = ($ blockType -shr 7) -ne 0
$ blockType = $ blockType -band 0x7F
if ($ blockType -ne 0)
{
return $ false
}
$ blockSize = (($ stream.ReadByte() -shl 16) -bor ($ stream.ReadByte() -shl 8) -bor $ stream.ReadByte())
if ($ blockSize -lt 34)
{
return $ false
}
$ minAudioBlockSize = ($ stream.ReadByte() -shl 8) -bor $ stream.ReadByte()
$ maxAudioBlockSize = ($ stream.ReadByte() -shl 8) -bor $ stream.ReadByte()
if ($ minAudioBlockSize -lt 16 -or $ maxAudioBlockSize -lt 16)
{
return $ false
}
$ minFrameSize = (($ stream.ReadByte() -shl 16) -bor ($ stream.ReadByte() -shl 8) -bor $ stream.ReadByte())
$ maxFrameSize = (($ stream.ReadByte() -shl 16) -bor ($ stream.ReadByte() -shl 8) -bor $ stream.ReadByte())
$ sampleInfo = (($ stream.ReadByte() -shl 24) -bor ($ stream.ReadByte() -shl 16) -bor ($ stream.ReadByte() -shl 8) -bor $ stream.ReadByte())
$ sampleRate = $ sampleInfo -shr 12
$ channelCount = (($ sampleInfo -shr 9) -band 0x7) + 1
$ bitsPerSample = (($ sampleInfo -shr 4) -band 0x1F) + 1
[UInt64] $ sampleCount = (($ stream.ReadByte() -shl 24) -bor ($ stream.ReadByte() -shl 16) -bor ($ stream.ReadByte() -shl 8) -bor $ stream.ReadByte())
$ sampleCount = (([UInt64] $ sampleInfo -band 0xF) -shl 32) -bor $ sampleCount
$ MD5HashBytes = New-Object byte[] 16
$ stream.Read( $ MD5HashBytes, 0, $ MD5HashBytes.Length)
$ MD5Hash = [Guid]( $ MD5HashBytes)
if ($ sampleRate -eq 0)
{
return $ false
}
# Passing these checks means that we likely have a stream info header and can rebuild the file
Write-Output "File Stream Information"
Write-Output "Sample Rate: $ sampleRate"
Write-Output "Audio Channels: $ channelCount"
Write-Output "Sample Depth: $ bitsPerSample"
Write-Output "MD5 Audio Sample Hash: $ MD5Hash"
return $ true
}
if ($ choice -eq 0)
{
Copy-Item $ FullPath -Destination $ BackupLocation -Force
$ stream = [System.IO.File]::Open( $ FullPath, [System.IO.FileMode]::Open)
$ stream.Seek(4, [System.IO.SeekOrigin]::Begin)
while ($ stream.ReadByte() -eq 0) {}
# We now need to figure out where a valid FLAC metadata frame begins
# We are likely pointing to the last byte of the size member so we'll seek back 4 bytes and retry
$ flacDataStartPosition = $ stream.Position - 4
$ stream.Seek( $ flacDataStartPosition, [System.IO.SeekOrigin]::Begin)
while (-not(ParseStreamInfoMetadataBlock( $ stream)))
{
$ flacDataStartPosition = $ flacDataStartPosition + 1
$ stream.Seek( $ flacDataStartPosition, [System.IO.SeekOrigin]::Begin)
}
# Insert the start code
$ stream.Seek( $ flacDataStartPosition, [System.IO.SeekOrigin]::Begin)
if (Test-Path "$ FullPath.tmp")
{
Remove-Item "$ FullPath.tmp"
}
$ fixedStream = [System.IO.File]::Open(" $ FullPath.tmp", [System.IO.FileMode]::CreateNew)
[byte[]] $ startCode = [char[]]('f', 'L', 'a', 'C');
$ fixedStream.Write( $ startCode, 0, $ startCode.Length)
$ stream.CopyTo( $ fixedStream)
$ stream.Close()
$ fixedStream.Close()
Move-Item -Force "$ FullPath.tmp" $ FullPath
}
3. 文件菜单上,点击保存。
4. 在 "另存为 "对话框中,找到你要保存PowerShell脚本的文件夹。
5. 在文件名框中,输入FixFlacFiles.ps1,将保存类型框改为文本文档(*.txt),然后点击保存。
6. 在Windows Explorer中,找到你保存的PowerShell脚本。
7. 右键单击该脚本,然后单击用PowerShell运行。
8. 当有提示时,输入无法播放的FLAC文件的文件名,然后按回车键。
本文就为大家讲解到这里了。标签: