48 lines
2.3 KiB
Bash
48 lines
2.3 KiB
Bash
#! /bin/bash
|
|
|
|
set -euo pipefail
|
|
f="${1:-"/Users/breel/Movies/bel_1_1.mp4"}"
|
|
g="$f.2.${f##*.}"
|
|
|
|
echo ffmpeg -i "$f" -vf mpdecimate -loglevel debug -f null -
|
|
echo ffmpeg -y -i "$f" -vf mpdecimate=hi=16:lo=16:frac=1:max=1000 -vsync vfr $g
|
|
|
|
# https://stackoverflow.com/questions/62648760/use-debug-log-from-ffmpeg-mpdecimate-to-remove-frames-of-another-input-file
|
|
|
|
echo ffmpeg -i "$f" -vf "split=2[full][crop];[crop]mpdecimate=hi=16:lo=16:frac=1:max=1000[crop];[crop][full]overlay" "$g"
|
|
|
|
if [ ! -f ./mpdecimate_trim.py ]; then
|
|
wget -O ./mpdecimate_trim.py https://github.com/KenjiTakahashi/mpdecimate_trim/raw/master/mpdecimate_trim.py
|
|
fi
|
|
echo cp "$f" "$g"
|
|
echo python3 "./mpdecimate_trim.py" "$g"
|
|
|
|
# https://superuser.com/questions/984841/ffmpeg-remove-parts-without-motion
|
|
|
|
echo ffmpeg -y -i "$f" -vf "select=gt(scene\,0.003),setpts=N/(25*TB)" "$g"
|
|
|
|
# https://stackoverflow.com/questions/35675529/using-ffmpeg-how-to-do-a-scene-change-detection-with-timecode
|
|
|
|
echo 'ffmpeg -y -i "$f" -filter:v "select='gt(scene,0.50)',showinfo" -f null - 2>&1 | grep showinfo | grep pts_time:[0-9.]* -o | grep [0-9.]* -o'
|
|
|
|
# https://stackoverflow.com/questions/40966394/how-to-simply-remove-duplicate-frames-from-a-video-using-ffmpeg
|
|
|
|
#ffmpeg -y -i "$f" -vsync cfr "$g".tmp.${f##*.}
|
|
#ffmpeg -y -i "$g".tmp.${f##*.} -vf "select='if(gt(scene,0.003),st(1,t),lte(t-ld(1),1))',setpts=N/FRAME_RATE/TB" "$g"
|
|
#rm "$g".tmp.${f##*.}
|
|
|
|
# https://stackoverflow.com/questions/37088517/remove-sequentially-duplicate-frames-when-using-ffmpeg
|
|
|
|
# ffmpeg -i $f -vf mpdecimate -loglevel debug -f null - 2>&1 | grep Parsed_mpdecimate_0 | grep ' keep '
|
|
# ffmpeg -i input.mp4 -vf mpdecimate,setpts=N/FRAME_RATE/TB out.mp4
|
|
# ffmpeg -i "$f" -vf "split=2[full][crop];[crop]mpdecimate=hi=16:lo=16:frac=1:max=1000[crop];[crop][full]overlay" "$g"
|
|
ffmpeg -y -i "$f" -vf "split=2[full][crop];[crop]mpdecimate,setpts=N/FRAME_RATE/TB[crop];[crop][full]overlay" "$g"
|
|
|
|
# https://stackoverflow.com/questions/25697596/using-ffmpeg-with-silencedetect-to-remove-audio-silence
|
|
# [silencedetect @ 0000000004970f80] silence_start: -0.00154195
|
|
# [silencedetect @ 0000000004970f80] silence_end: 3.20435 | silence_duration: 3.2059
|
|
# ...
|
|
# [silencedetect @ 0000000004970f80] silence_start: 343.84
|
|
|
|
ffmpeg -i "$f" -af silencedetect=n=-50dB:d=1 -f null - 2>&1 | grep silencedetect
|