www.webdeveloper.com
Results 1 to 2 of 2

Thread: having trouble converting video for html5 video player

  1. #1
    Join Date
    Feb 2007
    Posts
    66

    having trouble converting video for html5 video player

    Hi,
    I am making my own personal video upload website, and have got a jQuery upload for copying the file to my server, but I need to convert it to mp4 so that it will play in html5's video player, I have already written some code to do this but I must have changed something that broke it as when I get to the conversion process it last 2-3 seconds and doesn't actually do anything, here is the code
    convert.php
    PHP Code:
    <?php
        
    include("../include/session.php");

        
    $file $_COOKIE['TV_NTWK_IN_UPLOAD_FILE'];
        
    $code $_COOKIE['TV_NTWK_IN_UPLOAD_CODE'];

        
    $ext end(explode("."$file));

        
    mkdir("php/thumbnails/$code/");
        
    exec("ffmpeg -i php/files/$file -vframes 1 php/thumbnails/$code/poster.jpg");
        
    exec("ffmpeg -i php/files/$file -vframes 50 php/thumbnails/$code/1.jpg");
        
    exec("ffmpeg -i php/files/$file -vframes 250 php/thumbnails/$code/2.jpg");
        
    exec("ffmpeg -i php/files/$file -vframes 450 php/thumbnails/$code/3.jpg");
        
    exec("ffmpeg -i php/files/$file -vframes 650 php/thumbnails/$code/4.jpg");
        
    exec("ffmpeg -i php/files/$file -vframes 850 php/thumbnails/$code/5.jpg");

        
    if( !
    exec("ffmpeg -i php/files/$file -vcodec libx264 php/files/$code.mp4 1>php/stats/$code.txt 2>&1 &") ) {
        
    mysql_query("INSERT INTO ntwk_tv_videos (id, user, title, video_image, video_type, description, timestmp) VALUES ('" $code "', '" $session->accessid "', 'Your New Video (" date('F d, Y - H:i:s') . ")', 'poster', '$ext', 'Uploaded: " date('F d, Y - H:i:s') . "', '" date('Y-m-d') . "T" date('H:i:s') . "Z')");
        
    header("Location: modify-info.php?code=$code");
    }else{
        
    unlink("php/files/$file");
        
    unlink("php/files/$code.mp4");
        
    unlink("php/thumbnails/$code/");
        
    header("Location: index.php?error=" base64_encode("Video Failed to Convert!"));
    }
    ?>
    Can someone please help me with this, as am not that advanced with ff-mpeg

    also if there is a cleaner and faster way of doing this, that would be great, thanks

  2. #2
    Join Date
    Feb 2007
    Posts
    66
    I may even consider flash (.flv) but I don't want a video player that is watermarked with someone elses logo, I would want my own

Thread Information

Users Browsing this Thread

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

Tags for this Thread

Posting Permissions

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



Recent Articles