Upload and play video files.

Discussion in 'PHP' started by X.Homer.X, Jun 27, 2008.

  1. #1
    I have a media page on my site, where users can upload pictures, and they display on the site. Im wondering if i could do this with videos as well. Also, I would like to know if i could make so admins have to approve the image before it gets posted on the site (logic not code). I think it would be fairly simple.

    Thanks in advance =]
     
    X.Homer.X, Jun 27, 2008 IP
  2. graham23s

    graham23s Well-Known Member

    Messages:
    188
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    105
    #2
    Hi Mate,

    you could do this on your server, who do you host with? there is a few bits of software needed to convert the uploaded file to .flv (flash) example code on one of my sites would be:

    
         function make_flv($uploadedmoviesdir,$outputflvdirectory,$var_loggedinuser) {
         
           $timestamp = time();
         
           ## convert string
           $encode = "/usr/bin/ffmpeg -i $uploadedmoviesdir -sameq -acodec mp3 -ar 22050 -ab 32 -f flv -s 320x240 $outputflvdirectory";       
           $scrcap = "/usr/bin/ffmpeg -i $outputflvdirectory -s 320x240 -ss 00:00:05 -t 00:00:01 -f image2 flvmovies/screencaps/$var_loggedinuser-$timestamp-screencap.jpg";
           //$filein = "/usr/bin/ffmpeg -i $outputflvdirectory 2> flvmovies/filestats/$var_loggedinuser-$timestamp-info.txt";
           
              
           ## execute
           exec($encode);
           exec($scrcap);
           //exec($filein);
           
           return("$var_loggedinuser-$timestamp-screencap.jpg");
         
         }
    
    PHP:
    this also makes a screencap of the video! and im using dreamhost

    hope it helps

    Graham
     
    graham23s, Jun 27, 2008 IP
  3. X.Homer.X

    X.Homer.X Peon

    Messages:
    290
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    what software woudl i need? Im using godaddy for my hosting.

    also, how would i impliment this script?
     
    X.Homer.X, Jun 27, 2008 IP
  4. graham23s

    graham23s Well-Known Member

    Messages:
    188
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    105
    #4
    Hi Mate,

    could you check with them they have ffmpeg support! thats really it the rest is fairly easy i can write a function for you :)

    Graham
     
    graham23s, Jun 27, 2008 IP