2013-02-14 48 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