I am writing a basic editing system that utilizes .flv (flash video) files. I am converting my media with ffmpeg under linux (Centos 4.4)

I first convert the file then add the keyframe meta data to it using YAMDI.
When putting clips together i scan the .flv file with a php script to pull out the data from the start keyframe of a clip i want to play to the end keyframe. Then combine this together.

This works brilliantly from within a single media clip with no problems what so ever. However as soon as i try and incorporate more than one clip it is MUCH less likely to work. However i have had many occasions of it working with particular pairs of media.

What other switches am i able to use with ffmpeg to allow this sort of forced join to work?

Code:
ffmpeg -i $1 -ar 22050 -ab 32000 -qscale 18 -f flv -r 25 -s 320x240 -acodec libmp3lame $1.flv.tmp
is the current command i am using from within a shell script to convert my media.
Will it be better to force a bit rate? Or use 2 pass encoding?

I realise this is a much less practical way of combining media, but for this application its simply not practical to use a command line splitter/joiner to create a new file as this would rapidly overload the servers ram and storage.

Any input is very welcome!


Many thanks,
Ben