Last active
February 18, 2023 06:05
-
-
Save nanoDBA/a6a946f02fe1118e4533fa257baf0ff4 to your computer and use it in GitHub Desktop.
FFmpeg Remove video frames without motion and remove audio track
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$sourceFrameRate = 10.74 | |
$filename = "C:\Users\kilroy\2023-02-17_17-37-36_boxstarter_2_of_2.mp4" | |
$newFilename = "$(dir $filename | foreach { Join-Path -Path $_.Directory -ChildPath $_.BaseName })_remove_nonmotion_mute_audio.mp4" | |
ffmpeg.exe -i "$($filename)" -vf "select=gt(scene\,0.0002),setpts=N/($($sourceFrameRate)*TB)" -an "$($newFilename)" | |
<# -an remove audio #> | |
<# -vf "select=gt(scene\,0.001),setpts=N/(<framerategoeshere>*TB)" #> | |
<# https://superuser.com/questions/984841/ffmpeg-remove-parts-without-motion/1029175#1029175 | |
"The higher the number, the more change between frames is ignored, | |
in quick testing you might need to go as low as 0.00001-0.00005 | |
depending on the kind of footage you're dealing with." #> | |
# https://video.stackexchange.com/questions/20229/ffmpeg-trim-filter-renders-the-same-length-output-as-input-with-trimmed-out-fram/20230#20230 | |
# https://www.videoproc.com/resource/ffmpeg-commands.htm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment