As far as itunes closing the connection, it does that when it doesn’t understand the header that it received, or it isn’t a streamable format (either because the qt component won’t work with a streaming file, or because the m4v/mov/mp4 metadata isn’t optimized for fast-start).
I’m trying to figure out how to do this now. Seems I can’t use ffmpeg because that will require me to use qt-faststart to – leading to a to long delay – ~38 minutes to convert it to a MOV then an additional ~38 minutes to fix the header with qt-faststart.
Which I think is probably par for the course on any converter. Until it’s done transcoding, it doesn’t know for sure exactly how many frames there will be, or what the ultimate file size is going to be in bytes.
This can (should?) be done in the scanner. If it’s a movie (AVI, MOV, M4V, MP4 etc), then get all necessary information from the file, write it into a ‘headers’ table (in ‘header format’) in the database (in binary format, base64 or whatever is best/simplest).
So when FireFly is to send the movie to the client, then first send the header then the file (skipping the header since it’s already sent).