Skip to content

Commit 021e9a4

Browse files
committed
Add date preserving PowerShell bulk command
1 parent 9e95a81 commit 021e9a4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/ffmpeg-notes.md

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

135135
### Batch encode
136136

137-
Bulk file conversion.
137+
Single line bulk file encoding commands.
138138

139139
#### PowerShell
140140

141141
```powershell
142142
Get-ChildItem -Recurse -Filter *.mp3 | ForEach-Object { ffmpeg -i $_.FullName -b:a 48k (Join-Path $_.DirectoryName "$($_.BaseName).opus") }
143143
```
144144

145+
Or to preserve the original last modified date:
146+
147+
```powershell
148+
Get-ChildItem -Recurse -Filter *.mp3 | ForEach-Object { $out = "$($_.Directory)\$($_.BaseName).opus"; ffmpeg -i $_.FullName -b:a 48k $out; (Get-Item $out).LastWriteTime = $_.LastWriteTime }
149+
```
150+
145151
#### Batch script
146152

147-
Bulk conversion using Windows batch scripting. Should probably use something better like PowerShell.
153+
Bulk Opus encoding using Windows batch scripting. Should probably use something better like PowerShell.
148154

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

0 commit comments

Comments
 (0)