[fix] add quiet option to video script
This commit is contained in:
parent
ce402fa9b2
commit
c4d2e33cc1
24
makevideo.sh
24
makevideo.sh
@ -2,16 +2,17 @@
|
||||
usage(){
|
||||
cat << EOF
|
||||
|
||||
$(basename $0) -d <directory> -s <accelerate> -p <prefix> -v <video_dir> -s <size>
|
||||
$(basename $0) -a <accelerate> -b bitrate -d <directory> -p <prefix> -q -v <video_dir> -s <size>
|
||||
|
||||
——————————————————————————————————————————————————————————————————————————————————
|
||||
Opt | Variable | Type | Definition | Default value
|
||||
——————————————————————————————————————————————————————————————————————————————————
|
||||
-d directory path Directory path of images to convert ./pics
|
||||
-a accelerate int Convert only 1/N images 1
|
||||
-b bitrate str Video bitrate 1500k
|
||||
-d directory path Directory path of images to convert ./pics
|
||||
-p prefix str Images filename prefix. ''
|
||||
-q quiet int Minimal output 0
|
||||
-v video_dir path Directory path to store video file. ./videos
|
||||
-b bitrate str Video bitrate 1500k
|
||||
-s size str Images geometry. '1024x768'
|
||||
——————————————————————————————————————————————————————————————————————————————————
|
||||
|
||||
@ -26,12 +27,16 @@ accelerate="1"
|
||||
size='1024x768'
|
||||
video_dir="./videos"
|
||||
bitrate="1500k"
|
||||
quiet=0
|
||||
|
||||
while getopts "a:b:d:hs:p:r:v:" o; do
|
||||
while getopts "a:b:d:hs:p:qr:v:" o; do
|
||||
case "${o}" in
|
||||
a)
|
||||
accelerate=${OPTARG}
|
||||
;;
|
||||
b)
|
||||
bitrate=${OPTARG}
|
||||
;;
|
||||
d)
|
||||
directory=${OPTARG}
|
||||
;;
|
||||
@ -41,8 +46,8 @@ while getopts "a:b:d:hs:p:r:v:" o; do
|
||||
p)
|
||||
prefix=${OPTARG}
|
||||
;;
|
||||
b)
|
||||
bitrate=${OPTARG}
|
||||
q)
|
||||
quiet=1
|
||||
;;
|
||||
s)
|
||||
size=${OPTARG}
|
||||
@ -69,7 +74,7 @@ directory="$( realpath ${directory} 2>/dev/null )/"
|
||||
# Safe test prefix
|
||||
let c=0
|
||||
tmpfile=$( mktemp )
|
||||
for file in ${directory}/${prefix}* ; do
|
||||
for file in ${directory}${prefix}* ; do
|
||||
|
||||
let $(( c++ ))
|
||||
[[ $(( $c % ${accelerate} )) -eq 0 ]] || [[ $rate -eq 1 ]] && echo "file '$file'" >> $tmpfile
|
||||
@ -94,5 +99,6 @@ date=$(date +%s)
|
||||
video_file="${video_dir}$date.mp4"
|
||||
echo -e "\nSaving to video file $video_file\n"
|
||||
|
||||
ffmpeg -hide_banner -loglevel quiet -stats -f concat -safe 0 -i "${tmpfile}" -pix_fmt yuv420p -s "${size}" -vcodec libx264 -b ${bitrate} "${video_file}"
|
||||
rm -f $tmpfile
|
||||
[ 0 -eq $quiet ] || quiet_options=" -hide_banner -loglevel quiet -stats "
|
||||
ffmpeg $quiet_options -f concat -safe 0 -i "${tmpfile}" -pix_fmt yuv420p -s "${size}" -vcodec libx264 -b ${bitrate} "${video_file}"
|
||||
#rm -f $tmpfile
|
||||
|
Loading…
Reference in New Issue
Block a user