The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.


Results 1 to 3 of 3

Thread: upload and convert file using ffmpeg problem

  1. #1

    upload and convert file using ffmpeg problem

    Hello. i have a problem with php script who convert .mpeg uploaded file in .flv . i think the
    code is good but somehow he dont work on my machine. pls help

    upload.php

    <html><body>
    <?php
    #require("config/db_config.php");
    #$connection = mysql_connect($db_host, $db_user, $db_password) or die ('wtf ?! mysqconn failed');
    #mysql_select_db($db_name, $connection);

    function converttoflv( $in, $out )
    {
    # unlink( $out );
    $cmd = "ffmpeg -v 0 -i $in -ar 11025 $out 2>&1";
    $fh = popen( $cmd, "r" );
    while( fgets( $fh ) ) { }
    pclose( $fh );
    }

    function getthumbnail( $in, $out )
    {
    # unlink( $out );
    $cmd = "ffmpeg -i $in -pix_fmt rgb24 -vframes 1 -s 150x100 $out 2>&1";
    $fh = popen( $cmd, "r" );
    while( fgets( $fh ) ) { }
    pclose( $fh );
    }

    function flv_import( $upfile, $fname, $title )
    {
    $fname = preg_replace( '/\..*$/', '', basename( $fname ) );
    $flvpath = "$fname.flv";
    $thumbpath = "$fname.gif";
    converttoflv( $upfile, "movies/$flvpath" );
    getthumbnail( $upfile, "movies/$thumbpath" );

    #$query = "INSERT INTO movies (title,source,thumb,width,height) VALUES('$title','$flvpath','$thumbpath','150','100 ')";
    #mysql_query($query) or die(mysql_error());

    }
    echo $_FILES['movie']['tmp_name'];
    echo "<br />";
    echo $_FILES['movie']['name'];
    flv_import( $_FILES['movie']['tmp_name'], $_FILES['movie']['name'], $_POST['title'] );
    ?>
    File sucessfully uploaded
    </body></html>

    i commented mysql lines cuz they work and didnt wanted to fill my db with records while i was testing convertion.

  2. #2
    do you have ffmpeg available on your server ?

  3. #3
    sry for bothering u guys. i fix the problem. apache couldnt write output files to the directory coz of permission problems. . strange thing is that it didnt output error or something ..

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012