CoolFace
Modelpublic

ReltivlyObjectv/video-dataset-processing-scripts

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes
Transcribe-VideoSpeechViaWhisper.ps127 linesDownload Raw Back to root
1$whisperPath = "S:\Application Installers\whisper_cpp"
2$whisperExe  = Join-Path $whisperPath "whisper-cli.exe"
3$model       = Join-Path $whisperPath "ggml-base.en.bin"
4#$model       = Join-Path $whisperPath "ggml-base.bin"
5
6$mp4Files = Get-ChildItem -Path (Get-Location) -Filter *.mp4 -File
7
8foreach ($file in $mp4Files)
9{
10    $baseName = [System.IO.Path]::GetFileNameWithoutExtension($file.Name)
11    $wavFile = Join-Path $file.DirectoryName ($baseName + ".wav")
12
13    Write-Host "Processing $($file.Name)..."
14
15    Start-Process ffmpeg `
16        -ArgumentList "-y -i `"$($file.FullName)`" -ar 16000 -ac 1 -c:a pcm_s16le `"$wavFile`"" `
17        -NoNewWindow -Wait
18
19    $outputBase = Join-Path $file.DirectoryName ($baseName + ".transcription")
20
21    # & "$whisperExe" -m "$model" -f "$wavFile" -l ja -otxt -of "$outputBase"
22    & "$whisperExe" -m "$model" -f "$wavFile" -otxt -of "$outputBase"
23
24    Start-Sleep 1
25
26    Get-ChildItem $file.DirectoryName -Filter "$baseName*.wav" -ErrorAction SilentlyContinue | Remove-Item -Force
27}