BAKER (Schzio pedophile) ID: 6dbd1b Aug. 6, 2022, 11:37 a.m. No.17085941   🗄️.is 🔗kun   >>6754

>>17085163

TY1stB!

 

(from pb Notables, #21698)

>>17085163

 

This was a few seconds too long for Twitter.

Anon figured out ffmpeg command to shorten a video; want to share it in case it can help others.

Wrote a simple script to help even more.

Run it like:

videorate.sh INPUT OUTPUT SPEED

INPUT is the input file.

If the OUTPUT file exists, ffmpeg will asks "yes or no" to overwrite, interactively. If you want to use this as part of another script, you could add "-y" to the ffmpeg arguments.

Anon intentionally chose NOT to add that argument, so as not to overwrite any of anon's files.

SPEED is the speed in percentage to change the video by; for instance, to speed the video up by 5%, specify "5" (without the quotes); to slow it down by 5 percent, specify "-5". Can also specify decimals, e.g. "5.5" or "-5.5".

Some tools it uses may not be preinstalled, like "calc".

This is a Bash script, runs on Unix/Linux.

Unix is/are not a gender.

Script is below, also at Catbox:

https://files.catbox.moe/bmbll1.sh

 

Updated video attached, using "2.9" percent speedup from the original; results in a video that will fit on Twitter, running length 2:19 and no discernible difference from the original!

 

#!/bin/shINPUT=$1OUTPUT=$2SPEED=$3if [ "$INPUT" "" -o "$OUTPUT" "" -o "$SPEED" == "" ];then echo "Usage: $0 input.mp4 output.mp4 percent, will speed up video by that percentage, e.g. '5.5' for 5.5% faster, or '-5.5' to slow it by 5.5%." exit 1fi# from https:'//'www.baeldung.com/linux/bash-variable-is-numericre='^[+-]?[0-9]+([.][0-9]+)?$'if [[ $SPEED =~ $re ]]then # Need to calculate 1+change% and 1-change% (video is "slow down by this much" and audio is "speed up by this much"); # see https:'//'trac.ffmpeg.org/wiki/How%20to%20speed%20up%20/%20slow%20down%20a%20video VIDSPEED=calc "(100-$SPEED)/100" AUDSPEED=calc "(100+$SPEED)/100" ffmpeg -i "$INPUT" -filter_complex "[0:v]setpts=$VIDSPEED*PTS[v];[0:a]atempo=$AUDSPEED[a]" -map "[v]" -map "[a]" "$OUTPUT" ERR=$? if [ $ERR -ne 0 ] then echo "" echo "SOMETHING WENT WRONG! ffmpeg exited with errorlevel [$ERR]. CHECK ABOVE, PERHAPS THE PERCENTAGE PROVIDED WAS OUT OF BOUNDS?" exit $ERR fi echo "" echo "Copy/paste the following line to verify the video:" echo "" echo " vlc \"$OUTPUT\"" echo ""else echo "Speed [$SPEED] not recognized as numeric. Use a numeric value to speed the video up by that percentage. This can be decimal, and could also be negative to slow the video down."fi