Convert a video to flv using php

Discussion in 'Programming' started by sundhararajhan, Jun 26, 2008.

  1. #1
    Hi,

    I want to convert some sort of video files into .flv format. I hope i can do this using php programming. I think i need some to codec and converter for this. Can any send me sample programs or links for this ?..

    Thanks in advance.
     
    sundhararajhan, Jun 26, 2008 IP
  2. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #2
    You must have ffmpeg installed on server.
    If you have that installed on server, then you convert any video to FLV on server using following syntax:

    $ffmpegpath = "/usr/bin/ffmpeg"; //usually this
    
    $input = "/video_to_convert.wmv";
    $output = "/video_FLV.flv";
    
    $command = "$ffmpegpath -i $input -acodec mp3 -ar 22050 -ab 32 -f flv $output"; //-ar 22050 -ab 32 -f flv -s 320x240 
    
    @exec( $command, $ret );
    if(!file_exists($output) or @filesize($output)==0) 
        echo "Did not convert the file";
    PHP:

    Second option is convert files locally to FLV and then upload them.

    I hope it helps.
     
    Vooler, Jun 26, 2008 IP
  3. blognol

    blognol Peon

    Messages:
    87
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi Vooler,

    Can we convert any video into 3gp format using ffmpeg.
     
    blognol, Jun 26, 2008 IP
  4. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #4
    Ya for sure, if you are asking me using php.

    There are many ways to do this, either on local PC and/or server.

    I hope it helps.
    regards
     
    Vooler, Jun 26, 2008 IP