Skip to content

Commit e0e8676

Browse files
committed
Add PowerShell version of bulk conversion
1 parent e80411f commit e0e8676

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

src/ffmpeg-notes.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,23 @@ ffmpeg -i input.mp4 -map 0 -vf "scale=1920:1080:force_original_aspect_ratio=decr
134134

135135
### Batch encode
136136

137-
Bulk conversion using Windows batch scripting. Should probably use something better like PowerShell
137+
Single line bulk file encoding commands.
138+
139+
#### PowerShell
140+
141+
```powershell
142+
Get-ChildItem -Recurse -Filter *.mp3 | ForEach-Object { ffmpeg -i $_.FullName -b:a 48k (Join-Path $_.DirectoryName "$($_.BaseName).opus") }
143+
```
144+
145+
Or to preserve the original last modified date:
146+
147+
```powershell
148+
Get-ChildItem -Recurse -Filter *.mp3 | ForEach-Object { $out = (Join-Path $_.DirectoryName "$($_.BaseName).opus"); ffmpeg -i $_.FullName -b:a 48k $out; (Get-Item $out).LastWriteTime = $_.LastWriteTime }
149+
```
150+
151+
#### Batch script
152+
153+
Bulk Opus encoding using Windows batch scripting. Should probably use something better like PowerShell.
138154

139155
```batch
140156
FOR /F "tokens=*" %G IN ('dir /b *.mp3') DO ffmpeg -i "%G" -b:a 48k "%~nG.opus"

0 commit comments

Comments
 (0)