I have been using the following to create iPod Touch / iPhone / etc compatible video files for a while:
Code:
ffmpeg -y -i "filename.avi" -acodec aac -ac 2 -ar 44100 -ab 64 -s 480x320 -vcodec h264 -b 300k -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -me umh -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -g 300 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt 300k -maxrate 300k -bufsize 300k -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 15 -qmax 51 -qdiff 4 -level 30 -threads 2 -title "Video"  Video.mp4
It works quite well, and lives happily in a bash script for batch jobs, too. And lo, there was peace in the land.

Except for one problem: if I need to do some video processing outside of ffmpeg, or the equivalent (and otherwise working) command for mencoder, by way of a pipe, it all breaks! So, if I do:
Code:
mkfifo stream.yuv
mplayer -vf scale=480:320 filename.avi -vo yuv4mpeg &
ffmpeg -y -f yuv4mpegpipe -i filename.avi yadda yadda same as above

I wind up with a file that looks fine, plays fine, but iTunes will NOT open it, the iPod will NOT play it, etc. This is due to the fact that the encoder (either ffmpeg or mencoder) can't seek the input stream since it is a fifo, not a file, and thus encodes the end result DIFFERENTLY than if you just had a straight up input file. At least I think so, since that is the only difference I can think of!

My question is: how do I do processing to some video without using a fifo, AND without creating some ginormous temporary file!! I don't need 70GB of uncompressed video and a time-wasting intermediate step to boot. Is there some form of a ... I dunno, a pipe that will talk back to the other process to seek back and forth to whatever it is that it needs? I really don't know what I am asking for here, except that I know on Windows (boo! hiss!) had an Avisynth program that basically did just that.

So how do I accomplish this in UNIX/OS X/linux/etc?

(And yes, this is so that I can hardcode softsubs into the video stream, but I have had other needs for this as well. For instance, things that mplayer can display, but mencoder has no symmetric option for.)