PHP Video Editing and Streaming - php

I am developing online video streaming website on PHP.
I need two functionalities:
Need to add title/text at bottom of the video dynamically.
Need to add background music to video dynamically.
Is it possible with PHP or any available open source library?
Can anyone guide me or provide links to this type of library ?
Thanks.

Editing video with PHP is an extremely bad idea. This idea very closely approximates impossible. At best you would need to decode the video which would be brutally slow in php.
If I had to tackle this problem, I would try to add the title and background music in the player, not to the video file itself. If you're streaming the video it is likely that you're using Flash or some other client-side player. You would need to write the player (or perhaps modify an existing one, there are several available) to add another layer over top of the movie for the title, and an audio track.
Slightly more hare-brained, but still easier than rewriting video in php, would be to layer a transparent image generated in php over top of the player using css and javascript, and embedding the audio in the page. This paragraph contains a terrible idea.

php doesn't provide any video oriented stuff to perform, but there is one CMS namely Kaltura, is designed and implemented in doing these kindaa stuff. Search it , download it and play it.

You can make your own player in Flash and add a default watermark. You don't need PHP for that.

Related

PHP-How to check webpage(url) contain video or not?

I create website for RSS reader.
I want to add new feature in it.
For this I want to test that webpage(url)
contain video or not??
Can any one tell me that how to do this??
I just want to test that the url or webpage contain video or not??
I believe the only way to do this is to scan the source code of the page through PHP and look for likely embedded video codes. Those can vary though, so you may need to look for several patterns. Some video sharing sites embed them via iframes though, and that will be harder to deal with.
There are plenty of examples on the web on how to parse a site's generated source code, but be careful of violating their terms of use.

Force Quality for YouTube (or other) Video

Being new to streaming videos:
I don't know how to properly ask the question
I don't know of the proper place to ask the question
I'll use YouTube as the base example
Let's say I render a video in high quality and I want to play it on my website with the embedded YouTube player (or jw). The video is hosted from my server, not YouTube.
Is there a way to force one set of users to see low quality vid and one set of users to have the option of seeing it in high quality (b/c of connection speeds they may not want hq)? I'm hoping to run a forum and the quality of the video would be a benefit to contributors or registered members.
I'd like to know how to do this server-side. I know the YouTube player has a quality param, but I'd like to be able to force the quality. If a scripting language is needed, I'm using Perl, but I'm open to a PHP alternative.
One other question that ties into this: if you have a video in hq, is it possible to play that in low quality, or would I have to render different versions of the same vid?
Thank you in advance.
Well, if you are hosting it yourself, the youtube player seems to be out of question, doesn't it?
To achieve what you are planning, the player plugin you are using has to support multiple qualities. Now, when generating the player embedding code in php, check if the current visitor is a user, if yes, supply the player with all video qualities, if not, just with the lowest one.
To display different qualities, you'd have to seperately render the videos.

How to extract image from google video?

Images for every youtube videos are hosted their server. You can image of any frame and can display on your site.
I want to do same with other video sites without using getting ffmmpeg installed. Because my share hosting service will not le me do this.
Please suggest me on the same. I want to do it in PHP
It won't work, at least given two conditions:
The video sites don't provide an API for you to extract arbitrary frames from the video. If they do, your solution will be video provider specific.
You don't want to write your own video decoder for the codec (for example H.264) in PHP. Note that this would be a extremely difficult task and the decoder would be really slow if implemented completely in PHP.
Point 1 is rather improbable, at least I don't know of any video site that does this. Point 2 is really really a lot of work, I'd say it's impossible without deep and profund knowledge of the video codec.
So I guess, your best starting point is to either drop this feature or use a hoster that offers you ffmpeg.

Facebook like status url detection

I am wondering if there is a script similar to the facebook status update thing,
What I mean, is when for ex. I paste a youtube/other video site/image/link it automatically detects the contents of the page and associates an embed code with it (if its a video)..
So I'm wondering if there is a ready script that has a large database of websites and can associate video site url's with embed codes.
I could actually do something like that by myself but the problem is that I want to support a lot of websites, like facebook does.
Please help me find a solution.
Thanks.
Take a look at the Embedly API: http://api.embed.ly/
It gets the embed code for a lot of the popular video sites out there and also for some images sites. I highly recomend it,
you can try it out here.
You really wouldn't have to scan that large of a database. With videos, you could keep track of maybe the top three or so uploading sources (youtube, vimeo, metcafe...) and their embed codes.
As for images and links, those are pretty easy to detect and don't require any special embed code. By pretty easy, I mean very simple. Just use a simple regular expression to search for a link in their post.
If it's a picture, you can easily tell by looking at the file extension of the link (jpg, png, gif, etc.). If so, do whatever is proper to embed any old image. If it's just an ordinary old link (doesn't match any of your video sites, or doesn't end in a file extension for an image), just use the link itself.
The only marginally tricky part would be getting the unique embed codes for the video sites. But perhaps there is some external library/api that could do that small part for you (another answerer has provided has a proper API/pre-built library for this). However, images and links are mostly pretty simple.
EDIT It seems I misread your problem, and that you are only looking for pre-built libraries with video embed codes. In that case, the other answer is exactly what you want.

Online video streaming

I want to make a video site in which we can upload the video in any format and display it like youtube. How can I do this? My whole site is in PHP I'm a newbie in the video streaming sp plz be descriptive with your answer
Thanks
First you need a VideoPlayer written in Flash / Actionscript, there are also a lot of free ones arround in the internet, e.g.: FlowPlayer, You also could write you own. You acctually do not net to buy Flash for this. The Flash/Flex compiler mxmlc is available for free. You could also write you Flashvideoplayer in Haxe (also free).
You you do not want the users to switch within the video you could deliver the videos via HTTP, other wise you need an streaming server like: FlashMediaServer (not free). There are also open source alternatives like Red5 or haxeVideo.
You you do not have the video available in the right format you need to encode them: the best tool for this task could be ffmpeg
I suggest looking at the html5 <video> tag, this is probably the simplest way. For an example look at the the one from surfin' safari.
Be aware that some browsers support ogg and others h264, but not both.
Encoding of the video can be made using ffmpeg on the server.
One of my websites does this, and it's a MASSIVE pain.
However, there are websites out there that'll take a video and convert it to an FLV for you (for a price), for example we use a service called Hey!Watch which is reasonably reliable.
If you really want to encode it to flash yourself, you're going to need a full copy of Flash and a LOT of time =]
There is this highly underrated post with 3 great links for open source solutions that are like youtube and fits perfectly your question (and at least another one):
http://www.vidiscript.co.uk/
http://www.phpmotion.com/
http://osshare.sourceforge.net/
I'm posting this here just to point out the links. I think 2 of those 3 questions should be marked as duped anyway.

Categories