1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

convert video format to .flv(flash format) using php script

Discussion in 'PHP' started by moove, Dec 22, 2006.

  1. #1
    Hi,

    i am a php programmer,I want to paly the video in my php site.I used the html object to play the video.But the user can upload any formated video(like .avi,mpeg,wmv).so for compatability i want to convert this formated video into .flv format(flash format) when they uploading.Does anyone know how to conert the vdieo using php script.my server is windeos server and php 5 version.

    thank u.
     
    moove, Dec 22, 2006 IP
  2. nocookies

    nocookies Peon

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    nocookies, Dec 23, 2006 IP
  3. moove

    moove Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks for your reply.

    i am unaware to configure ffmpeg into my php script and i think ffmpeg is compatibility with linuz server but my server si windows.

    can u explain how to configure the ffmpef into my php site.expecting your reply.thank u.
     
    moove, Dec 23, 2006 IP
  4. nocookies

    nocookies Peon

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Sorry. I missed the part about Windows. There are tutorials on how to build ffmpeg under Windows:
    http://arrozcru.no-ip.org/ffmpeg_wiki/tiki-index.php. But it sounds rather complicated.

    I'm much more acquainted with Linux that Windows, so I probably can't help you to find Windows specific software.
     
    nocookies, Dec 23, 2006 IP
  5. butterfingers

    butterfingers Well-Known Member

    Messages:
    1,142
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    128
    #5
    hi,

    i want to create a site that someone can download and convert directly.

    http://vixy.net/flv_converter
    i would like to ask on how you call the function of the engine...

    how do i put thing exactly like http://vixy.net/flv_converter,
    and when i click start, it convert by itself...

    i know to compile using gcc.
    what i want to know is to call the function using php.

    thanks in advance.
     
    butterfingers, Jan 18, 2007 IP
  6. sridivya

    sridivya Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    hello,
    i am working on an unix server where i am able to convert my video file into an flv format but the audio is nt available in the converted file can u tell me what would be the problem

    php file
    --------
    <?php
    class media_handler
    {
    function convert_media($filename, $rootpath, $inputpath, $outputpath, $width, $height, $bitrate, $samplingrate)
    {
    $outfile = "";
    // root directory path, where FFMPEG folder exist in your application.
    $rPath = $rootpath."\ffmpeg";
    // which shows FFMPEG folder exist on the root.
    // Set Media Size that is width and hieght
    $size = $width."x".$height;
    // remove origination extension from file adn add .flv extension, becuase we must give output file name to ffmpeg command.
    $outfile =$filename;
    $out=explode(".",$outfile);


    // Media Size
    //$size = Width & "x" & Height;

    // remove origination extenstion from file and add .flv extension , becuase we must give output filename to ffmpeg command.

    $outfile = $out[0].".flv";
    // Use exec command to access command prompt to execute the following FFMPEG Command and convert video to flv format.

    $ffmpegcmd1 = "/usr/local/bin/ffmpeg -i ".$inputpath."/".$filename. " -ar " .$samplingrate." -ab ".$bitrate." -f flv -s ".$size." ".$outputpath."/".$outfile;

    //$ffmpegcmd1 = "/usr/local/bin/ffmpeg -i ".$inputpath."/".$filename. " -b 500 -r 25 -s 320×240 -hq -deinterlace -ab 56 -ar 22050 -ac 1 ".$outputpath."/".$outfile." 2>&1";


    $ret = shell_exec($ffmpegcmd1);

    // return output file name for other operations
    return $ffmpegcmd1;
    }
    function grab_image($filename, $rootpath, $inputpath,$outputpath, $no_of_thumbs, $frame_number, $image_format, $width, $height)
    {
    // root directory path
    $_rootpath = $rootpath."\ffmpeg";
    // Media Size
    $size = $width."x".$height;

    // I am using static image, you can dynamic it with your own choice.
    $out=explode(".",$filename);

    $outfile = $out[0].".jpg";

    $ffmpegcmd1 = "/usr/local/bin/ffmpeg -i ".$inputpath."/".$filename." -vframes ".$no_of_thumbs." -ss 00:00:03 -an -vcodec ". $image_format." -f rawvideo -s ".$size. " ". $outputpath."/".$outfile;

    $ret = shell_exec($ffmpegcmd1);

    // Execute this command using exec command or any other tool to grab image from converted flv file.
    return $ffmpegcmd1;
    }
    }
    ?>

    i am using this for converison ...................
    can u help me out.......
    thanku
     
    sridivya, Feb 1, 2008 IP
  7. satyakishore

    satyakishore Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    thanks
    kishore
     
    satyakishore, Mar 12, 2008 IP
  8. burek

    burek Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    sridivya, if you would only look into the help for ffmpeg :)

    it says:

    Audio options:
    -aframes number set the number of audio frames to record
    -ab bitrate set audio bitrate (in kbit/s)
    -ar rate set audio sampling rate (in Hz)
    -ac channels set number of audio channels
    -an disable audio
    -acodec codec force audio codec ('copy' to copy stream)
    -vol volume change audio volume (256=normal)


    so, remove -an from your params list, and it will work :)
     
    burek, Jul 7, 2008 IP
  9. bucabay

    bucabay Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Theres also the FFmpeg extension for PHP.

    http://ffmpeg-php.sourceforge.net/
     
    bucabay, Jul 7, 2008 IP
  10. mudassar anwar

    mudassar anwar Well-Known Member

    Messages:
    757
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    110
    #10
    mudassar anwar, May 3, 2009 IP
  11. szalinski

    szalinski Peon

    Messages:
    341
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #11
    hmm but this only allows getting info about files, not actually converting them... :(
     
    szalinski, May 4, 2009 IP
  12. yantomulia

    yantomulia Peon

    Messages:
    57
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #12
    any information to converting them?
     
    yantomulia, May 28, 2009 IP
  13. heykooldude

    heykooldude Peon

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13
    Ya if someone could provide that..it would be useful..
     
    heykooldude, Jun 10, 2009 IP
  14. dasli

    dasli Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #14
    Are you tryed Video to Flash Converter Pro ( geovid )? When I needed in converting video to flash this program helped me...
     
    dasli, Aug 5, 2009 IP
  15. abu123

    abu123 Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #15
    Convert video to flv using PHP FFMPEG
    Here is my code it will convert to flv but size can be 0KB. ANy one HELp????

    <?php
    function makeMultipleTwo ($value){
    $sType = gettype($value/2);
    if($sType == "integer"){
    return $value;
    } else {
    return ($value-1);
    }
    }

    $srcFile = "kabhi-alvida.avi";
    $destFile = ".flvs/kabhi-alvida.flv";
    $ffmpegPath = "/usr/local/bin/ffmpeg";
    $flvtool2Path = "/usr/local/bin/flvtool2";


    $ffmpegObj = new ffmpeg_movie($srcFile);


    $srcWidth = makeMultipleTwo($ffmpegObj->getFrameWidth());
    $srcHeight = makeMultipleTwo($ffmpegObj->getFrameHeight());
    $srcFPS = $ffmpegObj->getFrameRate();
    $srcAB = intval($ffmpegObj->getAudioBitRate()/1000);
    $srcAR = $ffmpegObj->getAudioSampleRate();


    $command = $ffmpegPath . " -i " . $srcFile . " -ar " . $srcAR . " -ab " . $srcAB . " -f flv -s " . $srcWidth . "x" . $srcHeight . " " . $destFile . " | " . $flvtool2Path . " -U stdin " . $destFile;
    $convert = exec($command);



    if(!$convert){
    echo "FAILED!!!";
    }

    ?>
     
    abu123, Dec 1, 2009 IP
  16. jumpjump

    jumpjump Peon

    Messages:
    287
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #16
    I did try ffmpegx. After a lengthy conversion, the movie & audio only played in slow motion. Or you may try this Video Encoder Engine for Adobe Flash, my friends recommend it to me. It can help you convert video format to .flv(flash format) using php script, C++, Visual Basic, Delphi, ASP, .NET, ColdFusion, it's safe and works pretty well for me, I think it deserves for a try.
    http://www.flash-video-soft.com/flash-video-sdk/
    Hope it helps. :)
     
    jumpjump, Dec 21, 2009 IP
  17. manju9950

    manju9950 Guest

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #17
    Hi..
    I have a problem converting video using ffmpeg.
    I am trying something like this

    $ffmpegcmd = escapeshellcmd("ffmpeg -i mysrc.mov target.flv");

    echo $ret = shell_exec($ffmpegcmd);

    This works perfectly fine in local wamp server. But if i try same thing in server its not working. No error nothing..

    I have tried all file permission and everything nothing worked.

    Please help..
     
    manju9950, Jan 7, 2010 IP
  18. Valentina_Sk

    Valentina_Sk Guest

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #18
    Hi!
    Are you still here?)):p
    You can try to use another program to convert video files to flash!
    I prefer to use VisiFly program, it is very easy in use, step by step program. You can convert all video (avi, wmv, mpeg, mp4, mov) to flv or swf. Also these program allows to create HTML to use it on your website.:)
     
    Valentina_Sk, Mar 18, 2010 IP
  19. yaerma

    yaerma Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #19
    It's looks useful!
    ilunarpages
     
    yaerma, Mar 18, 2010 IP
  20. Valentina_Sk

    Valentina_Sk Guest

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #20
    I hope)
    You can find all the information about this program here: http://visifly.com/
    Good luck)
    :)
     
    Valentina_Sk, Mar 19, 2010 IP