How do i make rails wait until an ffmpeg call is complete?

I'd be interested in seeing your code. Is it available?

Upload progress: use one of the many “ajax upload solutions” out there. I really like SWFUpload, because it’s the Flash file that streams the upload to the server that keeps track of the upload progress. Other solutions mostly rely on serverside tracking.

For the progress report on the conversion, your method makes it impossible, because Rails can only return information at the end of the request and your method only completes after the conversion. The only way to accomplish what you’re looking for, is passing the rails request on to backgroundrb, and use a PeriodicalUpdater (or some push technology, but that’s even more complex) to query the backgroundrb worker.

Best regards

Peter De Berdt

If you just want to capture the output of the command once it’s finished and not while it’s working on a file (haven’t used ffmpeg yet so you’ll have to look into the output yourself), you can just use something like

result = ´ls -l /usr/bin/´

If you want progress (each percentage prints out a new line in the terminal), you’re best off using backgroundrb to handle the process.

A rails request has the following lifecycle:

• User enters a url

• Url is routed to the controller method

• Controller method executes step by step, so if you use a ´command´ it’s one of those steps that needs to execute before going to the next line of code

• View is rendered

There’s a good introductory blog post at

Best regards

Peter De Berdt