I have this bash script for a batch conversion of some mp4 files:
#!/bin/bash
ls dr*.mp4 | grep -v -E "\.[^\.]+\." | sed "s/.mp4//g" | while read f
do
TARGET="$f.ffmpeg.mp4"
if ! [ -f $TARGET ]
then
echo $TARGET
ffmpeg -nostdin -i $f.mp4 -s 320x180 -vc h264 -acodec copy -f mp4 -y $TARGET
fi
TARGET="$f.ffmpeg.flv"
if ! [ -f $TARGET ]
then
echo $TARGET
ffmpeg -nostdin -i $f.mp4 -s 320x180 -acodec copy -y $TARGET
fi
TARGET="$f.jpg"
if ! [ -f $TARGET ]
then
echo $TARGET
ffmpeg -nostdin -i $f.ffmpeg.mp4 -ss 0 -vframes 1 -f image2 $TARGET
fi
TARGET="$f.ffmpeg.ogv"
if ! [ -f $TARGET ]
then
echo $TARGET
ffmpeg -nostdin -i $f.mp4 -s 320x176 -ar 11025 -acodec libvorbis -y $TARGET
fi
done
It runs once but does and converts the input file name to 4 different formats, but does not loop to the next input file name. I tried to shuffle the order of the various conversions, but still the script runs exactly once for one file name. I tried to run ffmpeg with the -nostdin flag, but it says
"Unrecognized option 'nostdin'"
The ffmpeg version is ffmpeg version 0.10.6-6:0.10.6-0ubuntu0jon1~lucid2 - I just update the ffmpeg package from http://ppa.launchpad.net/jon-severinsson/ffmpeg/ubuntu and cannot find an newer version. The base system is
Distributor ID: Ubuntu
Description: Ubuntu 10.04.1 LTS
Release: 10.04
Codename: lucid