我有一个用于在 linux 上进行截屏的文件,我想根据用户输入修改其中的部分内容。目前,我什至无法将参数粘贴到变量的命令中。
#!/bin/bash -x
fps="30"
capturesize="hd1080"
outputsize="720"
filter=-vf 'scale=${outputsize}'
avconv \
-f x11grab -r $fps -s $capturesize -i :0.0 \
-f alsa -ac 2 -i pulse \
-f alsa -ac 2 -i pulse \
-f alsa -ac 1 -i pulse \
-map 0:0 -map 1:0 -map 2:0 -map 3:0 \
-vcodec libx264 \
$filter \
-pre:v lossless_ultrafast \
-acodec libmp3lame \
-threads 4 \
-y $@
$fps
并被$capturesize
正确评估,但$filter
分配给出了一个很好的:
+ filter=-vf
+ 'scale=${outputsize}'
~/bin/screencap: line 9: scale=${outputsize}: command not found
将行更改为:
filter="-vf 'scale=$outputsize'"
给人一种更不愉快的感觉:
+ filter='-vf '\''scale=720'\'''
+ avconv -f x11grab [...] -vf ''\''scale=720'\''' [...]
[...]
No such filter: 'scale=720'
Error opening filters!