0

I have a pretty simple shell script and after doing the first two jobs, it just stops and sits there, doesnt do anything, it doesnt seem to matter what the third job is, if I switch the order etc, it will not finish it.

Any ideas would be great...

Here is my shell script

for f in "$@"
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
Chris James Champeau
  • 984
  • 2
  • 16
  • 37
  • whitespace or strange characters in `$@`? Post list of filenames... – Fredrik Pihl Feb 14 '13 at 19:57
  • ...or, ffmpeg spawns an awful lot of processes; perhaps you need to use `ffmpeg ... && ffmpeg ... && ffmpeg ...`. And finally, as always when debugging shell-scripts, shange the shebang to `#!/bin/bash -x` to enable debugging and look at the output. just my 0.1€... – Fredrik Pihl Feb 14 '13 at 20:15
  • 2
    Exact duplicate of [shell script ffmpeg stops after 2 jobs](http://superuser.com/q/552230/110524). Please do not crosspost between stack networks. – llogan Feb 14 '13 at 20:17
  • @LordNeckbeard - word! – Fredrik Pihl Feb 14 '13 at 20:26

1 Answers1

1

Your final ffmpeg line needs -nostdin.

Running FFMPEG from Shell Script /bin/sh

Community
  • 1
  • 1
Zombo
  • 1
  • 62
  • 391
  • 407
  • I also started logging it to see what the issue was, but it seems that it worked, I also had to put `-nostdin` before my -i otherwise it was giving me an error on the final command – Chris James Champeau Feb 14 '13 at 23:51