尝试编写简单的脚本来编码文件,但不断收到此错误信息:
/ usr / bin / cm:第28行:意外令牌附近的语法错误else'
/usr/bin/cm: line 28:
其他'
这是一个名为cm的脚本:
#!/bin/bash
echo Filename?
read Filename
echo Enter Target Filesize In Megabytes..
read TargetSize
echo ffmpeg preset?
read PRESET
Duration='ffprobe -i $Filename -show_entries format=duration -v quiet -of csv="p=0"'
Bitrate='($TargetSize*8192)/$Duration'
exiftool -b $Filename -ImageSize
echo WIDTH=?
read WIDTH
echo HEIGHT=?
read HEIGHT
echo Padding Required? Enter 'y' or 'n'
read PADANSWR
if [PADANSWR = 'y'] then
echo X=?
read X
echo Y=?
read Y
ffprobe -show_entries stream=index,codec_type:stream_tags=language -of compact $Filename -v 0 | grep eng
echo ENG AUDIO INDEX?
read ENGAUDIOINDEX
echo ENG SUBS INDEX?
read ENGSUBSINDEX
ffmpeg -i $Filename -strict -2 -c:v libx264 -preset $PRESET -b:v $Bitrate -vf "padding=width=$WIDTH:height=$HEIGHT:x=$X:y=$Y:color=black" pass 1 -f matroska /dev/null -c:a ac3 -b:a 192k && ffmpeg -i $Filename -strict -2 -c:v libx264 -preset $PRESET -b:v $Bitrate -vf "padding=width=$WIDTH:height=$HEIGHT:x=$X:y=$Y:color=black" -pass 1 -f matroska ENCODE1.mkv -c:a ac3 -b:a 192k
else
ffmpeg -i $Filename -strict -2 -c:v libx264 -preset $PRESET -b:v $Bitrate -threads 12 -pass 1 -f matroska /dev/null -c:a ac3 -b:a 192k && ffmpeg -i $Filename -strict -2 -c:v libx264 -preset $PRESET -b:v $Bitrate -threads 12 -pass 1 -f matroska ENCODE1.mkv -c:a ac3 -b:a 192k
fi
刚刚开始用bash编码 - 脚本中的行可以使用多长时间,或者我需要使用'\'字符 - 如果我使用'\'字符,它之后需要一个空格吗? TIA