Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.

Cheers,
Kirupa

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