Tutorial for how to convert video to flv using php. Most of video upload sites are using the ffmpeg and php for uploading and converting the video files. For converting you need to install the ffmpeg on your server. you can download and install ffmpeg from following location.
how to convert video to flv using php
how to convert video to flv using php
http://www.ffmpeg.org/download.html
For installting the ffmpeg on linux box I found following article very helpful
http://mysql-apache-php.com/ffmpeg-install.htm
After installing the ffmpeg on your system you can use following commands for converting the video files to flv format.
Above code with convert the video file to flv format but my suggestion is convertion of video files will take so much bandwidth on server so use cronjob for converting the video files in night time.
We given php code for Checking directory and deleting one day old files from folder using php, from folder in windows or linux through php language. For deleting the files from folder in any system (windows or linux). I created the PHP script for deleting the old files from system.
Earlier I created the script for deleting files from folder but that was for only linux. Then I created script which will work independently. Following script will work in mac or windows or linux.
When we want to connect to amazon server instance through linux terminal then you need to install ec2-api-tools for fedora. We given full detailed information.
How to install ec2-api-tools for fedora
For installing the ec2-api-tools in linux box follow the steps.
Permissions 0755 for ‘ec2-project.pem’ are too open.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: ec2-project.pem
For solving the issue you need to change the key file permission to 700. For that use following command
[root@localhost EC2key]$ chmod 700 -R ec2-project.pem
[root@localhost EC2key]$ ssh -i ec2-project.pem root@ec2-59-16-79-85.compute-1.amazonaws.com
Last login: Mon Jan 10 01:08:27 2011 from 158.162.131.50
[root@domU-18-33-35-0B-D5-02 ~]#
Video upload functionality is needed in every networking site. I will give best option the create the thumbnail from video file and convert video file to flv format.
convert avi to flv using ffmpeg with Thumbnail
For conversion of video files and creating the thumbnail we need the ffmpeg software need to be installed on server. Here I used the linux server. For installing the FFmpeg I used following article.
http://mysql-apache-php.com/ffmpeg-install.htm
After installing the ffmpeg software in linux you can use the command prompt for converting the video file.
Use the following command for covert the avi or video file to flv format.
converting the video files to flv format that takes some time. So I recommend not to convert the video file to flv while uploading.
Just create the thumbnail and show to use.
For converting the video file to flv format use the cronjob. Create two or One cronjob setting and daily two or more time through script convert the video files to flv.
Normally running the shell script we will use the following command. If shell script not running then you need to do shell script executable. using following command
execute shell script daily through cron
#./shell_script.sh
If shell script not running then you need to do shell script executable. using following command
#chmod +x shell_script.sh
for running the shell scirpt daily through use the following command
#su
#PASSWORD
#crontab -e
Put following lines in cron file.
* * 1 * * /bin/sh /home/myuser/shellscript/shell_script.sh
I always need to use this method for copy files one remote machine to another machine. there are many tool to do that. filezilla, winscp and many more. But I like command prompt.
rsync copy files from remote server to other server
scp is command is very useful for file transfer on remote machine.
To copy local file on remote machine use following command
#scp FILENAME USERNAME@55.86.59.95:/home/USER/
To copy file from remote machine use following command
#scp USERNAME@55.86.59.95:/home/USER/FILENAME .
or use
#scp USERNAME@55.86.59.95:/home/USER/FILENAME *
To copy file from remote machin using scp command with port
#scp -P54 USERNAME@55.86.59.95:/home/USER/FILENAME .
or use
#scp -P54 USERNAME@55.86.59.95:/home/USER/FILENAME *
Above commands will execute faster than other tools.
rsync copy files from remote server to other server
There are many articles we can found for to connect to amazon ec2 machine though ssh. But all I found for windows. Using putty and putty key gen tool you can connect to amazon ec2 linux machine.
How to connect amazon instance through linux command prompt
How to connect amazon instance through linux command prompt
If you are having the linux box and you want to connect to amazon ec2 machine then that is very easy. You just need to install the following package to connect to amazon ec2 machine.
Install the ec2-api-tools on linux or mac machine. use the following command.
# yum install ec2-api-tools
When you first try to create the amazon instance that time you need to create the key pair file. You got the .pem file as key pair file. That file is very important for connecting to amazon instance machines.
Keep your key pair file(.pem ) in safe location and dont give this file anyone. Go to directory where you kept the key pair file.
We given steps for install memcached on centos. Memcached server is used for increase server performance and response time. Here we given the commands for installing memcached on centos.
how to install memcached on centos
I always need to install the memcached on my linux servers like fedora or centos. On fedora box installing the memcached is very easy through yum install. But Centos installing and using memcached is not so easy.
how to install memcached on centos
For my Ruby on Rails and PHP applications I always need to install the memcached on server. Here I am going to give you the steps for installing the memcached.
Very important note: you need to install the gcc compiler for memcached binary installation. Using the memcached with php installation you need the phpize and php-pecl-memcached installed. follow my steps and memcached binary installation.
For many application we need to install the imagemagick on Centos linux server. Many Ruby on rails and PHP applications need the support of imagemagick for image resizing.
How to install imagemagick binary on CentOS
How to install imagemagick binary on CentOS
We all the very traditional way of installing the application on linux machine which is as follows:
# yum install imagemagick
This command will not install the imagemagick on Centos properly. So use following commands for installing the imagemagick on centos
When you are running any script on server or running any application you want to know how much memory or disk uses is happened by application.
how to find out cpu and disk usage in linux
how to find out cpu and disk usage in linux
When you are doing load testing this time this kind of applications are very useful to check the server status. Create file name CPU-Disk.sh and put following content in that.