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 to FLV?

Discussion in 'PHP' started by papa_face, Apr 22, 2007.

Thread Status:
Not open for further replies.
  1. #1
    Hello,
    Is it possible to allow a person to upload a video and have the server or php convert the video file to a FLV file?
     
    papa_face, Apr 22, 2007 IP
  2. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #2
    yes, you need ffmpeg and or mencoder.

    If you have root access to the server theres an installer for everything you need on my site.

    The most basic command for converting a video with ffmpeg would be :

    ffmpeg -i movie.ext out.flv

    ^you can use that with exec in php or whatever language you choose
     
    krakjoe, Apr 22, 2007 IP
  3. papa_face

    papa_face Notable Member

    Messages:
    2,237
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    285
    #3
    So if I have FFMPEG installed and I want to convert a video.avi files in the /videos directory to out.flv in the /flv directory what PHP code would I use?

    regards
     
    papa_face, Apr 22, 2007 IP
  4. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #4
    
    <?
    function ffmpeg_c( $input, $output )
    {
     exec( "ffmpeg -i $input $output", $data );
     return $data;
    }
    ffmpeg_c( dirname(__FILE__) . "/videos/video.avi", dirname(__FILE__) . "/flv/out.flv");
    ?>
    
    PHP:
    something like that
     
    krakjoe, Apr 22, 2007 IP
  5. ilxeon

    ilxeon Peon

    Messages:
    336
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #5
    hello
    i would like to see the installer you have made but site is not loading for me :confused:
     
    ilxeon, Apr 22, 2007 IP
  6. papa_face

    papa_face Notable Member

    Messages:
    2,237
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    285
    #6
    Is this possible to do without FFMPEG?
     
    papa_face, Apr 22, 2007 IP
  7. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #7
    There are other encoders out there, only I dunno how to use them, ffmpeg is easy to use and supports most any codec ...

    krakjoe.com is working for me :S
     
    krakjoe, Apr 22, 2007 IP
  8. papa_face

    papa_face Notable Member

    Messages:
    2,237
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    285
    #8
    Only problem, is that my host doesn't have it installed, and they want me to upgrade in order to get it.
     
    papa_face, Apr 22, 2007 IP
  9. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #9
    Well, if they dont have ffmpeg installed they aren't likely to have any other encoding / transcoding software installed on the server, and if they do, they will probably still require you to upgrade your account to use it.

    I would just bite the bullet and upgrade your account ............
     
    krakjoe, Apr 22, 2007 IP
  10. papa_face

    papa_face Notable Member

    Messages:
    2,237
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    285
    #10
    The upgrade is almost 3x more expensive. I think i will just encode them manually for now.
     
    papa_face, Apr 22, 2007 IP
  11. Aragorn

    Aragorn Peon

    Messages:
    1,491
    Likes Received:
    72
    Best Answers:
    1
    Trophy Points:
    0
    #11
    If nothing works, change your webhost. Go to Devshed forums and ask for your requirements.
     
    Aragorn, Apr 22, 2007 IP
  12. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #12
    Do you have shell access on your account ??

    I can put together a script that will build ffmpeg without being the root user, but it won't be able to build the ffmpeg-php library and you require an unjailed shell also .....

    Like Aragorn said, I really would change webhost, lots and lots of people have it, and far more would be willing to install it at no cost to you.
     
    krakjoe, Apr 22, 2007 IP
  13. papa_face

    papa_face Notable Member

    Messages:
    2,237
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    285
    #13
    They have agreed to install ffmpeg, without the other video sharing components what ever that means.
     
    papa_face, Apr 22, 2007 IP
  14. papa_face

    papa_face Notable Member

    Messages:
    2,237
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    285
    #14
    They installed FFMPEG. I ran the following code:
    <?
    function ffmpeg_c( $input, $output )
    {
     exec( "ffmpeg -i $input $output", $data );
     return $data;
    }
    ffmpeg_c("videos/thepiano.wmv","flv/out.flv");
    ?>
    Code (markup):
    But it outputted a flv file that was 0kb...
     
    papa_face, Apr 22, 2007 IP
  15. papa_face

    papa_face Notable Member

    Messages:
    2,237
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    285
    #15
    Can someone recommend a reasonably priced host that has FFMPEG installed as standard?
     
    papa_face, Apr 22, 2007 IP
  16. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #16
    I do :)

    http://hozter.info

    The chances are they just installed ffmpeg without checking any of it's prerequisites ......
     
    krakjoe, Apr 22, 2007 IP
  17. papa_face

    papa_face Notable Member

    Messages:
    2,237
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    285
    #17
    I have just tried:
    <?
    function ffmpeg_c( $input, $output )
    {
     exec( "ffmpeg -i $input $output", $data );
     return $data;
    }
    ffmpeg_c("videos/thepiano.wmv","flv/out.flv");
    ?>
    Code (markup):
    On my new host and it didnt output any file at all. Any advice?
     
    papa_face, Apr 22, 2007 IP
  18. papa_face

    papa_face Notable Member

    Messages:
    2,237
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    285
    #18
    Ah its okay. It works now. I just didnt have the correct permissions.
     
    papa_face, Apr 22, 2007 IP
  19. papa_face

    papa_face Notable Member

    Messages:
    2,237
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    285
    #19
    I have just tried to convert a 95mb WMV file with FFMPEG but the output file is 0k. Does it take time to process or is there something that I should know in terms of file size limits?
     
    papa_face, Apr 23, 2007 IP
  20. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #20
    WMV codecs are not included in the default install I don't think, you'd have to search about for the correct codecs for the video you wanna process......

    Before I write code to interact with something online, I'll download whatever software Im working with and test it locally, you can get prebuilt ffmpeg binaries and ffplay ones from the ffmpeg site somewhere, I suggest you get them and try whatever code your trying to use locally first, this eliminates quite a few problems before you started..........
     
    krakjoe, Apr 26, 2007 IP
Thread Status:
Not open for further replies.