Page 1 of 1

Beginner to Scripting Has Question

Posted: Fri Nov 06, 2009 1:57 am
by Hazuki
Okay, I know very little about Bash scripting. I've knocked together a script that is supposed to do the following:

1) store the date as a variable
2) look at all the saved jpg frames in /usr/share/zoneminder/events
3) write these to a list
4) tell mencoder to create a video from the list of files
5) remove the jpgs
6) remove the list

The thing is, I'm running into the "commandline is too long" problem when the mencoder step starts. Is there a way around this? The script is below; I know it's probably somewhere between horribly naive and just plain horrible, but as mentioned I am a beginner...

#!/bin/bash
DATE="`date`"
ls /usr/share/zoneminder/events/*/* | grep -i jpg > /usr/share/zoneminder/events/piclist-$DATE.txt
mencoder "mf://$(cat /usr/share/zoneminder/events/piclist-"$DATE".txt)" -mf fps=15 -o /usr/share/zoneminder/videos/"$DATE".mpg -ovc lavc -lavcopts vcodec=mpeg4
rm $(cat /usr/share/zoneminder/events/piclist-"$DATE".txt)
rm /usr/share/zoneminder/events/piclist-"$DATE".txt