KB5003430: Windows Explorer 메타데이터를 편집하면 FLAC로 인코딩된 음악 파일이 손상됩니다.

적용 대상
Windows 10 Enterprise, version 2004 Windows 10 Home and Pro, version 2004 Windows 10 Pro, version 2004 Windows 10 Enterprise and Education, version 2004 Windows 10 Pro Education, version 2004 Windows 10 Pro for Workstations, version 2004 Windows 10 Pro, version 20H2 Windows 10 Enterprise, version 20H2 Windows 10 Enterprise and Education, version 20H2 Windows 10 Home and Pro, version 20H2 Windows 10 Pro Education, version 20H2 Windows 10 Pro for Workstations, version 20H2

요약

이 업데이트는 타이틀, 아티스트 또는 기타 메타데이터가 변경된 경우 FLAC(무료 무손실 오디오 코덱) 음악 파일을 재생할 수 없게 하는 메타데이터 인코딩 문제를 해결합니다.

원인

이 문제는 FLAC 파일에 FLAC 헤더 앞에 ID3 프레임이 포함되어 있을 때 발생할 수 있습니다. ID3 프레임에는 제목 및 아티스트와 같은 메타데이터가 포함되어 있습니다. FLAC 속성 처리기는 모든 FLAC 파일이 4 바이트 시작 코드 fLaC로 시작되고 파일의 시작 부분에 있는 ID3 프레임을 고려하지 않았다고 가정했습니다. 따라서 시작 코드 fLaC가 파일을 재생할 수 없게 렌더링하지 않으면 ID3 프레임을 덮어씁니다.

해결 방법

향후 FLAC 음악 파일에 대한 이 문제를 방지하려면 2021년 5월 25일— KB5003214(OS 빌드 19041.1013, 19042.1013 및 19043.1013) 미리 보기를 설치합니다.

영향을 받는 FLAC 음악 파일을 복구하려면 다음 PowerShell 스크립트를 실행합니다.

중요

이 스크립트는 ID3 프레임에 저장된 손실된 메타데이터를 복원하지 않습니다. 그러나 파일을 다시 재생할 수 있습니다.

  1. 메모장을 엽니다.

  2. 다음 스크립트를 복사하여 메모장에 붙여넣습니다.

    # Copyright 2021 Microsoft
    # 이 스크립트는 KB5003430 참조하여 Media Foundation에서 손상된 FLAC 파일을 복구합니다.
    # 자세한 내용은 KB5003430 참조하세요.
    param(
    [parameter(Mandatory=$true,
    HelpMessage="Media Foundation에서 손상된 FLAC 파일의 경로",
    ValueFromRemainingArguments=$true)]
    [ValidateScript({ -not [String]::IsNullOrEmpty($_) -and (Test-Path $_) })]
    [String]$File
    )
    # 오류가 있는 현재 파일 incase를 백업해야 합니다.
    $FileDirectory = Split-Path -해결 $File
    $Filename = Split-Path -리프 -해결 $File
    $FullPath = Join-Path -해결 $FileDirectory $Filename
    $Filename = [String]::Format("Backup_{0:yyyyMMdd_hhmmss}_{1}", [DateTime]::Now, $Filename)
    $BackupLocation = Join-Path $FileDirectory $Filename
    Write-Output "Microsoft FLAC 복구 도구. 이 도구는 세부 정보를 편집할 때 손상된 FLAC 오디오 파일을 복구합니다."
    Write-Output "영향을 받는 파일: $FullPath"
    Write-Output "파일 백업이 수행됩니다: $BackupLocation"
    Write-Output "계속하시겠습니까?"
    $choice=$host.ui.PromptForChoice("FLAC 스크립트 수정", "계속하시겠습니까", ('&예', '&아니요'), 1)
    function ParseStreamInfoMetadataBlock([System.IO.FileStream]$stream)
    {
    $blockType = $stream. ReadByte()
    $lastBlock = ($blockType -shr 7) -ne 0
    $blockType = $blockType 밴드 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 -또는 $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
    $MD 5HashBytes = New-Object 바이트[] 16
    $stream. Read($MD 5HashBytes, 0, $MD 5HashBytes.Length)
    $MD 5Hash = [Guid]($MD 5HashBytes)
    if($sampleRate -eq 0)
    {
    return $false
    }
    # 이러한 검사를 전달한다는 것은 스트림 정보 헤더가 있을 가능성이 높고 파일을 다시 작성할 수 있음을 의미합니다.
    Write-Output "파일 Stream 정보"
    Write-Output "샘플 속도: $sampleRate"
    Write-Output "오디오 채널: $channelCount"
    Write-Output "샘플 깊이: $bitsPerSample"
    Write-Output "MD5 오디오 샘플 해시: $MD 5Hash"
    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)
    동안($stream. ReadByte() -eq 0) {}
    # 이제 유효한 FLAC 메타데이터 프레임이 시작되는 위치를 파악해야 합니다.
    # 크기 멤버의 마지막 바이트를 가리킬 수 있으므로 4바이트 뒤로 검색하고 다시 시도합니다.
    $flacDataStartPosition = $stream. 위치 - 4
    $stream. Seek($flacDataStartPosition, [System.IO.SeekOrigin]::Begin)
    while (-not(ParseStreamInfoMetadataBlock($stream))
    {
    $flacDataStartPosition = $flacDataStartPosition + 1
    $stream. Seek($flacDataStartPosition, [System.IO.SeekOrigin]::Begin)
    }
    # 시작 코드 삽입
    $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 파일의 파일 이름을 입력한 다음 Enter 키를 누릅니 .