Skip to content

Instantly share code, notes, and snippets.

@Hashbrown777
Created July 28, 2023 08:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hashbrown777/e939696cd8570a99b0e623712aa25363 to your computer and use it in GitHub Desktop.
Save Hashbrown777/e939696cd8570a99b0e623712aa25363 to your computer and use it in GitHub Desktop.
1..56 `
| %{ "_$($_.ToString().PadLeft(2, '0')).mp4" } `
| &{
Begin {
$filter = ''
$files = @()
}
Process {
$filter += "[$($files.Count / 2):0] [$($files.Count / 2):1] "
$files += '-i',$_
}
End {
& 'C:\Program Files\ffmpeg\bin\ffmpeg.exe' `
$files `
-fps_mode vfr `
-filter_complex "${filter}concat=n=$($files.Count / 2):v=1:a=1 [v] [a]" `
-map '[v]' `
-map '[a]' `
-vcodec libx264 `
-crf 10 `
___720_10.mp4
}
}
. ~/async.ps1
gci -File `
| %{
if ($_.Name -match '^(\d+)\.mp4$') {
$Matches[1]
}
} `
| Async `
-Func { Process {
&'C:\Program Files\ffmpeg\bin\ffmpeg.exe' `
-i "$_.mp4" `
-filter_complex '[0:a:0][0:a:1]amix=2:weights=0.75 2[aout]' `
-map '0:V:0' `
-map '[aout]' `
-c:v copy `
"_$_.mp4"
} }
1..56 `
| %{ "_$($_.ToString().PadLeft(2, '0')).mp4" } `
| &{
Begin {
$files = @()
$lines = ''
$v = ''
$a = ''
}
Process {
$files += '-i',$_
$lines += "movie=$_, scale=1920:1080 [v$($files.Count / 2)] ; amovie=$_ [a$($files.Count / 2)] ; "
$v += " [v$($files.Count / 2)]"
$a += " [a$($files.Count / 2)]"
}
End {
& 'C:\Program Files\ffmpeg\bin\ffmpeg.exe' `
$files `
-fps_mode vfr `
-filter_complex "$lines$v concat=n=$($files.Count / 2):v=1:a=0 [outv] ;$a concat=n=$($files.Count / 2):v=0:a=1 [outa]" `
-map '[outv]' `
-map '[outa]' `
-vcodec libx264 `
-crf 10 `
_.mp4
}
}
@Hashbrown777
Copy link
Author

rotate &'C:\Program Files\ffmpeg\bin\ffmpeg.exe' -i .\_.mp4 -vf transpose=1 __.mp4

@Hashbrown777
Copy link
Author

first 10s of youtube vid yt_dlp --downloader ffmpeg --downloader-args "ffmpeg:-t 10" "https://www.youtube.com/watch?v=abcdef"

@Hashbrown777
Copy link
Author

cut 15 to 55s out of video ffmpeg' -i _.mp4 -vf "select='not(between(t,15,55))', setpts=N/FRAME_RATE/TB" -af "aselect='not(between(t,15,55))', asetpts=N/SR/TB" .\__.mp4

@Hashbrown777
Copy link
Author

audio *= 10 ffmpeg -i _.MOV -filter:a 'volume=10' .\__.mp4

@Hashbrown777
Copy link
Author

transpose=0 90° counter-clockwise and vertical flip (default)
transpose=1 90° clockwise
transpose=2 90° counter-clockwise
transpose=3 90° clockwise and vertical flip

@Hashbrown777
Copy link
Author

centre and pad to size
-vf "scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2,setsar=1"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment