2013-02-14 95 views
0

我有一个非常简单的shell脚本,在完成前两个任务之后,它只是停下来坐在那里,没有做任何事情,如果我切换它似乎并不重要订单等,它不会完成它。shell脚本ffmpeg在2个工作后停止

任何想法将是巨大的......

这里是我的shell脚本

for f in "[email protected]" 
do 
name=$(basename "$f") 
dir=$(dirname "$f") 
/opt/local/bin/ffmpeg -i "$f" -y -b 250k -deinterlace -vcodec vp8 -acodec libvorbis -nostdin "$dir/webm/${name%.*}.webm" 
/opt/local/bin/ffmpeg -i "$f" -y -b 250k -strict experimental -deinterlace -vcodec h264 -acodec aac -nostdin "$dir/mp4/${name%.*}.mp4" 
/opt/local/bin/ffmpeg -i "$f" -y -ss 00:00:15.000 -deinterlace -vcodec mjpeg -vframes 1 -an -f rawvideo -s 720x480 "$dir/img/${name%.*}.jpg" 
done 
+0

'$ @'中的空白或奇怪的字符?发布文件名列表... – 2013-02-14 19:57:29

+0

...或者,ffmpeg衍生出很多进程;也许你需要使用'ffmpeg ... && ffmpeg ... && ffmpeg ...'。最后,像往常一样,在调试shell脚本时,将shebang变成'#!/ bin/bash -x'来启用调试并查看输出。只是我的0.1€... – 2013-02-14 20:15:44

+2

[shell脚本ffmpeg在2个作业之后停止](http://superuser.com/q/552230/110524)的完全重复。请勿在堆叠网络之间进行路口交叉。 – LordNeckbeard 2013-02-14 20:17:24

回答

1

你最终ffmpeg线需要-nostdin

Running FFMPEG from Shell Script /bin/sh

+0

我也开始记录它以查看问题是什么,但它似乎起作用,我还必须在-i之前放置'-nostdin',否则它会在最后的命令中给我一个错误 – 2013-02-14 23:51:51