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