I would like to be able to convert videos to flv through the use of php and FFMPEG.
I was just wondering if anyone knew any good guides to setting up FFMPEG in a linux environment. I have found scripts showing how to use ffmpeg through exec() with php but I would like to know how to set everything up.
Also, I believe other software also needs to be installed in order for FFMPEG to work (ex. mp3 codecs?). If anyone could point me in the right direction, I would really appreciate it. I have been trying to search for ways to do this, but a lot of guides are outdated and some of the wget commands do not even work. Thanks in advance.
If you are looking for specific guides, would be useful to know which linux distribution you are using. As far as what else you need apart from ffmpeg, depends on what exactly you wish to be encoding. For example, if you wish to be able to encode xvid videos into flv, you'll need the Xvid codec.
I would recommend getting at least:
FAAD2
FAAC
LAME
yasm
x264
xvid
If you intend to encode mp4 videos with h264, you'd need qt-faststart as well, to move the meta data to allow immediate streaming.
(and personally prefer mencoder over ffmpeg)
Try this: http://wiki.collectiveaccess.org/index.php?title=Compiling_ffmpeg
I am a CollectiveAccess user, which uses ffmpeg for video processing. Those instructions were pretty much spot on when installed a new CA system on a fresh CentOS.
ffmepeg, and its dependencies, work best when compiled from latest source since the yum repositories lag a bit.
sudo apt-get install php5-ffmpeg
sudo apt-get install ffmpeg
That's should do the job (on ubuntu/debian at least)
Related
every time I try to install php on windows I get a file called php-5.4.8.tar.bz2 I dont know how to install this kind of file can someone help me?
If you are new to PHP, then I would suggest you to use WAMP Server. Link below:
http://www.wampserver.com/en/
Install it, execute it, start working. Real fast and easy. It comes pre-configured with Apache, MySQL and PHP.
You're using the wrong file, you're on Windows not Unix!
This should help:
http://www.php.net/manual/en/install.php
yet, use a wamp server, it's simple and easy to use. enjoy your PHP trip ! :)
In case you're looking for a place to start learning PHP, I highly suggest this simple tutorial:
http://www.w3schools.com/php/
It's a very straight forward tutorial that'll get you started with PHP in no time!
You have downloaded the installation package for Unix based systems. You want to download the Windows Version. Note that you will also need to download an install Apache with this.
You may find it easier to install a full development package. I recommend WAMP or XAMPP. These contain all the tools you need to get started, including Apache, PHP, and MySQL.
Compressed archive created by bzip2, a file compression program often found on Unix-based systems; incorporates the Burrows-Wheeler compression algorithm as well as Run-Length Encoding (RLE) for high levels of compression; often used for Linux software package distributions.
Info about .bz2
You can unrar it using winrar
I have a PHP site that requires PDF to image conversion, and we're obviously using imagemagick for it.
However, right now we're trying to move to different hosting, and it seems like I will not be able to install imagemagick package on the new hosting to do the same thing as we do now.
So the question is - is there any way to convert PDF to image with either pure PHP means, or with anything else that can be just popped into DOCUMENT_ROOT and do not need to be properly installed into the system.
This is a Linux system, but I have no idea what distribution, and I can't check as my rights in this system are really limited.
thanks
Alex.
"[...] requires PDF to image conversion, and we're obviously using imagemagick for it."
This is not obvious at all.
Because ImageMagick cannot convert PDF to images all by itself. It requires to use Ghostscript as its 'delegate'. So you may have installed ImageMagick, but not installed Ghostscript and it will not work.
Vice versa, you could have Ghostscript installed but not ImageMagick -- and you could still easily convert PDF to images. For instance, convert to JPEG with resolution 144 DPI (without specifying one, you'd get 72 DPI):
gs \
-o out.jpg \
-sDEVICE=jpeg \
-r144 \
in.pdf
Also, you are free to install Ghostscript wherever you want.
(BTW: I'd keep my hands off a hosting provider who does not offer a ImageMagick nor Ghostscript installation, let alone not allow to install it yourself...)
On linux systems statically linked things can work without external library dependencies. So if you could get/create a statically linked imagemagick executable, you could use it directly under docroot. Probably it isnt so trivial.
Or you could use remote sites for doing the conversion for you. Like:
http://pdf2jpg.net/
(For posting to upload forms like this curl will be usefull.)
I have installed FFMPEG on WAMP 2. However I believe I also need qt-faststart in order to quickly load the meta data in MP4 files. How do I go about this?
You need qt-faststart to make MP4 files streamable. Here is a Windows build of qt-faststart.exe: http://notboring.org/downloads/video/qt-faststart.zip
Will that work for you?
An alternative to qt-faststart is MP4Creator.
http://mp4creator.sourceforge.net/
Commandline: mp4creator -optimize videofile.mp4
I found it to be much faster than qt-faststart on slow disks (like an SD card)
Sorry, Mike ;)
I've searched the internet for days to find out how to install ffmpeg (and lame) on XAMPP for Mac (PHP). But I didn't find the key to my quetsion.
I need to covert mp3's on my webserver (php) using lame, but I like to test it on my XAMPP for Mac first.
I think I need the "php_ffmpeg.dll" which can be downloaded at Sourceforge.
I found a step-by-step description here but this question only refers to XAMPP for Windows. But I need it for Mac.
Can anyone help to supply a step-by-step description?
The DLL file is not what you need, they're only for Windows.
Follow these instructions to install ffmpeg on your Mac, then use one of PHP's program execution functions to call the ffmpeg executable from your PHP code.
I'm a newbie and after I've successfully learnt enough to build my simple but useful web services, I managed to put myself in a position where I need to configure my own PHP build.
The problem is I don't really know what build means --never built anything either.
My broad question is:
Any good step by step tutorial that doesn't just say "must have dependencies"?
My specific question is:
For instance, one that shows how to build PHP with odbc, then rebuild (configure.nice and make nice?) with imap in addition.
If someone finds a PHP bundle that comes with odbc, great; with odbc & imap, better. But I'm really looking for someone to show me how to fish. Please.
Thnx.
A.
Gazler is correct, for a simple setup, you can just configure Ubuntu through the repositories via apt-get. For RHEL-based systems - yum would be the equivalent. However, if you are wanting to know more of how to compile from scratch (which would give you more control over installation), then you can do so.
Basics of compiling an application:
Download source from website (such as PHP, www.php.net)
untar the source (tar -xzvf source.tar.gz)
cd source
Configure the source (./configure [install-option-flags])
Compile source (make)
Test Install (doesn't actually install) - make test
Install the software (make install)
Step 4 is a very broad step. You will need to figure out what options you want to configure - see PHP Core Configuration Options.
Requirements for installing PHP will differ between environments, so that's too broad to cover in one answer, however, you will at least need a c-compiler to compile the source. Usually gcc is my choice, and is usually installed already. On Ubuntu (Debian-based) use apt-get install build-essential or search and install via yum on RHEL-based systems, I believe it would be something like yum install gcc.
You will probably run into dependencies issues as you compile, as I said its a very broad step, however, once you figure out the requirements that you need, you should be good to go, so long as you document your steps for your environment.
Again, the easiest way to go is to install via your software repository (apt-get, yum, emerge, pacman, etc), but these don't give you as much leverage on controlling your environment installation, whereas building from source gives you all the configuration control that you'd need.
You haven't mentioned what distro you are on, On ubuntu you can do:
sudo apt-get install lamp-server^ php5-imap php5-odbc
That should be enough to get you started and configured.