[dundee] ffmpeg and PHP FTP functions

chris wyllie cgwyllie at googlemail.com
Fri Jun 8 14:15:15 BST 2007


Thanks very much for the prompt replies.

Is there not a problem handling file uploads of such large files through
normal methods? I thought there was a max file size restriction on uploads
and it would time out/reach this limit before it was done uploading a few
hundred megs... Or is this not the case? Is it possible to upload such a
large file in the regular way?

I don't think we can get SSH access, their tech support people will install
things for us if they meet some sort of requirements they have. As I said,
at the moment they won't put ffmpeg on for anyone because of the strain it
causes on the server.

"A standalone ffmpeg will do the job. You can either bundle it into one
big static binary (about 7MB depending on what you include) or you can
keep some of it in shared libraries, allowing you to link other things
like PHP plugins against it. I can show you how to do that."

How would that be done? I'm not sure we could get past notice of their
admins using it. We have the ability to schedule jobs, I was thinking that a
PHP file could be used to run a batch shell script for converting the video
or even call the shell file directly maybe once a day or so.

Or if encoding was done after the upload, how can you trigger it and as you
say close the connection before it starts? if you redirect before calling
the encoding, won' it not be run at all?

Thanks for the offer of your ruby extenstion however I haven't worked with
ruby so I doubt I could get it working just now.

Thanks again for replying,

Chris

On 08/06/07, James Le Cuirot <chewi at aura-online.co.uk> wrote:
>
> On Fri, 8 Jun 2007 01:51:30 +0000
> "chris wyllie" <cgwyllie at googlemail.com> wrote:
> >
> > It's kinda like a youtube clone in that I need to upload large videos,
> > create previews of them by converting, watermark them to keep
> > copyright and create a thumbnail.
> >
> > ffmpeg was suggested and evidently it's a widely used option for this
> > kind of task. The problem is that the hosting plan which has been
> > bought already(out of my control) have pulled the plug on ffmpeg
> > support as it's a shared environment and was causing resource issues.
>
> A standalone ffmpeg will do the job. You can either bundle it into one
> big static binary (about 7MB depending on what you include) or you can
> keep some of it in shared libraries, allowing you to link other things
> like PHP plugins against it. I can show you how to do that.
>
> But whatever you use will consume a lot of juice and it's extremely
> likely that your host will notice and will take action against it. It's
> easy enough to execute ffmpeg remotely through SSH in a batch fashion
> but is that really what you want to do? The input file would need to be
> sent to that other server. The output file would be created on that
> other server. You might as well just send the whole request to the
> other server in the first place. What you do with the output file then
> is up to you. Maybe you could host it from the other server or you could
> have it sent to the main server afterwards.
>
> One of the other problems is what you send back to the browser during
> the request. If you just let the encoding run first, the browser will
> probably time out by the time it's finished. You need to send back a
> response first and close the connection before you start the encoding.
> Alternatively, you can try and set up some kind of daemon process to
> handle the encoding separately. That's what we're doing on our
> Rails-based project.
>
> I needed to get some information from the input file before starting
> the encoding so I wrote a Ruby extension called FFruby. It gives you
> easy access to some of a file's properties through FFrubyFile,
> FFrubyAudioStream and FFrubyVideoStream objects. It works through
> ffmpeg's libraries, libavformat and libavcodec, so it could potentially
> handle encoding as well but that would require quite a bit more work.
> If you're interested... http://rubyforge.org/projects/ffruby
>
> James
>
> _______________________________________________
> dundee GNU/Linux Users Group mailing list
> dundee at lists.lug.org.uk  http://dundee.lug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/dundee
> Chat on IRC, #tlug on dundee.lug.org.uk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.lug.org.uk/pipermail/dundee/attachments/20070608/1e86d9d9/attachment.html


More information about the dundee mailing list