How to Embed Text or an Image to a Video on the Fly?

Discussion in 'PHP' started by misohoni, Aug 29, 2011.

  1. #1
    I run a video site, I'd like to be able to add our watermark, either as a graphic or text to each video (wmv format) on the fly...is it possible to do?
     
    Solved! View solution.
    misohoni, Aug 29, 2011 IP
  2. ssmm987

    ssmm987 Member

    Messages:
    180
    Likes Received:
    4
    Best Answers:
    3
    Trophy Points:
    43
    #2
    I think it's difficult to add it to the video itself (Would be a lot easier if you used flash)

    You could make a overlay div, displaying the adds.
     
    ssmm987, Aug 30, 2011 IP
  3. misohoni

    misohoni Notable Member

    Messages:
    1,717
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    200
    #3
    misohoni, Aug 30, 2011 IP
  4. #4
    yea, just use ffmpeg...
    it's what i do for my porn site...
    HOWEVER! if your hosting the video like i am... you'll probably notice how putting a simple watermark totally screws up with the video compression.
    it can some times double the size of your video :S

    an ugly watermark with no alpha, and that is with a solid background would probably lower the file size slightly though.

    yea, i thought about doing it for my site, but decided not to.
    ---
    but yeah... it's not difficult to do...

    in php you would do something like,
    
    //make sure you keep threads @ 1 or it'll lag your entire server
    //-vf is ffmpeg's NEW way of adding watermarks; and obviously the logo.png is the logo
    //vcodec is the codec, duh! libx264 is mp4 format
    exec(ffmpegPath. ' -i '.$file.' -vf "movie=logo.png [logo];[in][logo] overlay=10:main_h-overlay_h-10 [out]" -threads 1 -vcodec libx264  -sameq '.$dest, $out, $ret);
    
    PHP:
     
    hotnoob, Aug 31, 2011 IP
    misohoni likes this.
  5. The Webby

    The Webby Peon

    Messages:
    1,852
    Likes Received:
    30
    Best Answers:
    1
    Trophy Points:
    0
    #5
    Using ffmpeg is a horrible idea.. as hotnoob (lol) said, it will screw up the vid compression pretty badly.
    The best bet is to use an external program, that you can execute through php (and even pass the set parameters).

    But it depends on the platform that you are using, and the server privilege that you have.
     
    The Webby, Sep 1, 2011 IP
  6. runbrun11

    runbrun11 Member

    Messages:
    43
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    38
    #6
    why not use jwplayer and use the watermark feature?
     
    runbrun11, Sep 1, 2011 IP
  7. hotnoob

    hotnoob Member

    Messages:
    96
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    28
    #7
    you just can't beat ffmpeg lol...

    it is fairly difficult to learn, but once you know it, you don't really forget it lol...
     
    hotnoob, Sep 3, 2011 IP
  8. HalvinCarris

    HalvinCarris Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Best idea is to go with ffmpeg, just play around with the parameters till you get the best result.
     
    HalvinCarris, Sep 3, 2011 IP
  9. misohoni

    misohoni Notable Member

    Messages:
    1,717
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    200
    #9
    Ok thanks the next question would be - can anyone take this on as a paid project for us?
     
    misohoni, Sep 3, 2011 IP
  10. hotnoob

    hotnoob Member

    Messages:
    96
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    28
    #10
    i can do it for you.

    add me on skype, my username is HotNoob.
     
    hotnoob, Sep 3, 2011 IP