convert mpg to flv using php – PHP

  php

Q(Question):

hi

i m having a page in which users may upload their own videos .

And i need to convert it into flv file to run the uploaded file in player..

is there any sources available ..

i tried ffmpeg., it works in localhost fine but when i upload it into my server no conversion occurs…

thanks

regards
vijay.

A(Answer):

ffmpeg works for me fine.

what is the problem you got with it

Regards

A(Answer):

i followed the steps provided in this link
http://worldtv.com/blog/guides_tutor…_converter.php

and downloaded the files and copied it into my local apache server and checked for the file conversion..

it works fine.,

but when i tried the same steps by uploading the files into the webserver no new flv files where generated…

this is the code present in the file..


<?php
exec("ffmpeg -i football.mpg football.flv");
?>

is there anyother thing that i would need to do ?

A(Answer):

Hey.

What are the differences between the servers?
(Operating systems, version differences, configuration, etc…)

Note that that tutorial seems to deal with Windows executables. If you are using Windows on your test server, but your real server uses Linux (which is very common) then your Windows executable ffmpeg.exe file won’t work. You will need to Linux equivalent.

Also, it’s not uncommon that shared hosts disable exec, and other such functions, as they can pose a security threat. Are you using such a host? – If you are, you might want to inquire as to whether they allow this.

A(Answer):

yes the file i downloaded deals with windows..

i searched through the net and downloaded the files for linux .,

but i have no idea of about how to deal with those linux files.,

can you suggest me a good way to complete this conversion..

thanks

A(Answer):

I’ve never worked with ffmpeg myself, so I don’t really know how to set it up manually.

If you are working on a common Linux distribution, you can try to see if it exists in the distro’s package manager.
For example, on Ubuntu (and most likely all Debian-based distros), you can issue this command to install ffmpeg:

$ sudo apt-get install ffmpeg

And I’m guessing RedHat/Fedora distributions can do something like this:

$ yum install ffmpeg

Try those and see if that works. If not you will probably have to compile it from source. Unless you can find a precompiled binary package compatible with your system.

A(Answer):

thank you for your reply..

As i told i dont know linux so i m not quite right where to execute the code and bring out the output..

if you find anyother links that could help me please do send me..

thanks again..

LEAVE A COMMENT