• <s id="aiiqm"></s>
  • 
    
    • <sup id="aiiqm"></sup>
    • <sup id="aiiqm"></sup>
       

      微軟承認Win10中存在新Bug:其會導致用戶音頻文件損壞

      發布時間:2021-06-03 10:22:45  |  來源:太平洋電腦網  

      如果你是一名音樂發燒友,那么應該知道Flac這種常見的無損音樂格式。Flac音樂文件支持metadata,用戶可以編輯metadata,讓音樂文件帶有藝術家、所屬專輯、音軌等等信息。

      通常來說,metadata和音頻數據并不相關,修改metadata并不會影響音頻本身。

      但是,近日微軟官方公布了Win10中存在一個Bug,在Win10中用資源管理器修改Flac文件的metadata,竟會導致音頻的損壞!

      根據Windows Latest的報道,微軟最新發布的一份支持文件披露,如果在Win10的2004或者更高版本中,使用文件資源管理器修改Flac音樂文件的metadata,就會損耗Flac音頻文件。

      這個Bug在Win10專業版、家庭版、企業版、工作站版乃至其他版本的Win10中均有出現。

      根據微軟本月早些時候發布的支持文件,Win10的文件資源管理器導致了這個錯誤,它破壞了Flac文件頭包含的ID3框架也就是metadata,而這個ID3框架負責存儲音頻的注釋,例如音樂標題、藝術家、專輯、曲目編號等。

      在Win10上,Flac的處理程序忽視了ID3框架,該程序認為Flac文件在使用4字節的文件頭,當Flac文件被Win10編輯的時候,ID3框架被覆蓋了,導致沒有了開始代碼,導致了音樂播放器無法識別被修改后的文件。

      因此,在Win10中,如果你直接用文件資源管理器修改Flac音樂文件的標題、藝術家等metadata,會導致該文件無法播放。

      幸運的是,微軟已經確定了Bug的根本原因,用戶可以通過Windows Update升級KB5003214補丁進行修復。

      在KB5003214補丁中,微軟確認了上文提到的錯誤已經被修復,修改了Flac的標題、藝術家等metadata后,Flac不會再變得無法播放。

      而對于已經損壞了的Flac文件,微軟則發布了一個PowerShell腳本來進行修復,運行該腳本后Flac文件即可重新播放,不過已經從ID3框架中丟失了的metadata信息并不能恢復。

      下面是利用PowerShell腳本修復Flac文件的具體方法。

      1、開啟記事本;

      2、復制以下字符,粘貼到記事本中:

      # Copyright 2021 Microsoft

      # This script will repair a FLAC file that has been corrupted by Media Foundation in reference to KB5003430.

      # Refer to KB5003430 for further information

      param(

      [parameter(Mandatory=$true,

      HelpMessage="The path to the FLAC file that has been corrupted by Media Foundation",

      ValueFromRemainingArguments=$true)]

      [ValidateScript({ -not [String]::IsNullOrEmpty($_) -and (Test-Path $_) })]

      [String]$File

      )

      # We need to back up the current file incase we have any errors

      $FileDirectory = Split-Path -Resolve $File

      $Filename = Split-Path -Leaf -Resolve $File

      $FullPath = Join-Path -Resolve $FileDirectory $Filename

      $Filename = [String]::Format("Backup_{0:yyyyMMdd_hhmmss}_{1}", [DateTime]::Now, $Filename)

      $BackupLocation = Join-Path $FileDirectory $Filename

      Write-Output "Microsoft FLAC Repair Tool. This tool will repair a FLAC audio file that was corrupted when editing its details."

      Write-Output "Affected File: $FullPath"

      Write-Output "A backup of the file will be made: $BackupLocation"

      Write-Output "Do you wish to continue?"

      $choice=$host.ui.PromptForChoice("Fixing FLAC Script", "Do you wish to continue", ('&Yes', '&No'), 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、保存文件,在“另存為”對話框中,將目錄定位到你想要保存PowerShell腳本的位置;

      4、在文件名輸入框中,輸入“FixFlacFiles.ps1”,將另存為文件的類型更改為Text Documents (*.txt);

      5、進入到你保存該PowerShell腳本的目錄;

      6、右鍵點擊剛剛保存的腳本,然后選擇“使用PowerShell運行”;

      7、出現提示時,輸入無法播放的Flac文件的文件名,然后按下回車鍵。

      微軟建議大家安裝本月推送的可選累積更新,以避免修改Flac文件metadata出現的問題。

      關鍵詞: 微軟 Win10

       

      關于我們 - 聯系我們 - 版權聲明 - 招聘信息 - 友鏈交換

      2014-2020  電腦商網 版權所有. All Rights Reserved.

      備案號:京ICP備2022022245號-1 未經過本站允許,請勿將本站內容傳播或復制.

      聯系我們:435 226 40@qq.com

      国内精品一区视频在线播放,嫩草影视在线观看,天天久久狠狠伊人第一麻豆,波多野结衣视频免费看
    • <s id="aiiqm"></s>
    • 
      
      • <sup id="aiiqm"></sup>
      • <sup id="aiiqm"></sup>
        主站蜘蛛池模板: 国产精品免费精品自在线观看 | 欧美一区二区三区久久综合| 女人把私人部位扒开视频在线看| 国产igao视频网在线观看hd| 久久久久久成人毛片免费看| 高清永久免费观看| 日韩精品中文字幕在线| 国产成人久久777777| 久久精品国产亚洲AV天海翼| 国产极品粉嫩交性大片| 日韩字幕一中文在线综合| 国产在线一区视频| 久久久久国产免费| 老师在办公室疯狂的肉我| 成人无码精品1区2区3区免费看| 厨房切底征服岳完整版| 一个人看的毛片| 特级xxxxx欧美| 国产精品无码久久综合网| 亚洲伊人色一综合网| 中文字幕永久免费| 精品精品国产高清a毛片| 女人与大拘交在线播放| 亚洲精品午夜国产va久久| 12345国产精品高清在线| 最近中文字幕高清免费大全8| 国产在线观看色| 亚洲女初尝黑人巨高清| 天天综合网色中文字幕| 日本乱码一卡二卡三卡永久| 午夜看一级特黄a大片| mikko四只小动物的名字 | 日本三浦理惠子中文字幕| 午夜电影在线看| 一区二区三区午夜| 欧美日韩国产综合视频在线看| 国产极品视觉盛宴| 中文精品久久久久人妻不卡| 福利视频第一区| 国内一级一级毛片a免费| 亚洲av专区无码观看精品天堂|