- #With dest.webm existing
- if [ ! -f "$dest.webm" ]; then
- #Create passlog lock file
- touch "$passlog.lock"
-
- #With 1080p sourcerate
- if [ $sourcerate -ge 5120000 ]; then
- #Set bitrate
- bitrate=5120k
-
- #First pass
- ffmpeg -i $i -v error -passlogfile $passlog.1080p -c:v libvpx-vp9 -b:v $bitrate -pass 1 -an -f null /dev/null < /dev/null;
-
- #With first pass
- if [ $? = 0 ]; then
- #Second pass
- ffmpeg -y -i $i -v error -passlogfile $passlog.1080p -c:v libvpx-vp9 -b:v $bitrate -pass 2 -pix_fmt yuv420p -c:a libopus -movflags +faststart -metadata creation_time="$date"$location -fflags +bitexact $dest.1080p.webm < /dev/null;
- fi
-
- #With passlog file
- if [ -f "$passlog.1080p-0.log" ]; then
- #Remove passlog file
- unlink "$passlog.1080p-0.log";
- fi
+ #Set source fps
+ sourcefps=$(ffprobe -hide_banner -v quiet -select_streams v:0 -show_entries stream=r_frame_rate -of default=noprint_wrappers=1:nokey=1 -i "$i" | perl -pne 'use POSIX qw(ceil); if (/^([0-9]+)\/([0-9]+)$/) { print ceil($1/$2); } elsif (/^([0-9]+)$/) { print ceil($1); }; undef $_;');
+
+ #Set filters
+ filters=()
+
+ #Set fps
+ fps=24
+
+ #With sourcefps > 59
+ if [ $sourcefps -gt 59 ]; then
+ #Set fps
+ fps=30
+ #With sourcefps > 49
+ elif [ $sourcefps -gt 49 ]; then
+ #Set fps
+ fps=25
+ #With sourcefps > 47
+ elif [ $sourcefps -gt 47 ]; then
+ #Set fps
+ fps=24
+ #With sourcefps > 29
+ elif [ $sourcefps -gt 29 ]; then
+ #Set fps
+ fps=30
+ #With sourcefps > 24
+ elif [ $sourcefps -gt 24 ]; then
+ #Set fps
+ fps=25
+ fi