ffmpeg獲取視訊大小再壓縮視訊指令碼

2020-08-14 21:08:14
#!/bin/bash
for file in `find . | grep ".mp4$"`;
do
newname=`basename -s .mp4 $file`
newdirname=`dirname $file`
output=$newdirname"/"$newname"_o.mp4"

tt=`ffprobe -v error -show_entries stream=width,height -of default=noprint_wrappers=1 $file`

echo $tt | awk -F'[ =]+' 
#'{print $2,$4}'
HandBrakeCLI -i $file -o $output -O -e x264 -q 22 -w $2 -l $4 -B 48
#HandBrakeCLI -i $file -o $output -O -e x264 -q 22 -w 1280 -l 720 -B 48
#mv $output $file
done