How to upload a video through PHP, and transcode it via FFmpeg - php

Currently I am building a video streaming platform and I need a way to upload my videos, through multiple resolutions to my Wowza server. I am currently running Ubuntu with Nginx, PHP and Wowza so I want to be able to, when the user uploads the video, encode it to 1080p, 720p, 480p, and 360p. How would I do this?

You could take a look at the free, open source Video Share VOD solution that can manage video uploads, conversions to multiple formats.
You could customise that to add more formats as necessary.
It installs easily with WP framework, requires PHP and FFMPEG on server.

Related

Record video on browser and upload to LAMP server

I have tried a lot of things out there: red5, jquery webcam, html5 ... but none of these solution record a video and leave it ready to upload to a server.
Is there anyway (html5, flash, whatever ... the better cross-broswer solution, the best) to upload video (+ audio!) and upload the result to a server (I guess through AJAX) ?
Summarize:
jQueryWebcam (https://github.com/infusion/jQuery-webcam): it has flash video, uploads to a server image, not a video
Eric Bidelman's solution (http://ericbidelman.tumblr.com/post/31486670538/creating-webm-video-from-getusermedia):records video in html5 and allows you to download (so you can upload
to a server), but no audio !
Red5 (http://www.red5-recorder.com/services.php): paid services, not
uploading in free version :(
DMV (https://github.com/rwldrn/dmv): it just captures a photo ... besides not cross-browser
I have developed video recording solutions for the better part of the last 5 years and contributed a lot to fixing video recording bugs in Red5.
There are currently 2 production ready technical solutions for recording audio and video on the web. One for desktop and one for mobile.
On desktop you will need a Flash application that sits embedded in a web page, captures the visitors webcam and mic, encodes the raw video and audio data and streams it as it is recorded (through rtmp) to a media server.
You have at least 3 options for the media server:
Red5 is free and open source (btw. recording works out of the box in Red5)
Wowza ($65/month)
Adobe Media Server Pro ($4500)
The media server receives (again through streaming/rtmp not through http) the data and, depending on the codec used on the client, saves it to mp4, flv or f4v files.
This Flash client + media server recording process - which has worked pretty well since Flash Player 6 in 2002 - will most likely replaced by the HTML5 alternative named MediaStream Recorder (not yet implemented fully by any browser).
On mobile you can use HTML Media Capture (explained here with screenshots) to record video using the device's native video recording app and codecs. HTML Media Capture records locally (on the device) and then you upload (normal HTTP upload process) the file to the web server.
A commercial solution that implements both (Flash client + media server on desktop and HTML Media Capture on mobile) is HDFVR.
You could use something like binary download via javascript.
Here is one example
As you have not much info about video protocols i cant give you better answer
you can try this library, RecordRTC. It generates a blob file to put in video source and you can upload this file later to your server.
RecordRTC Library
This library is a container for other libraries, like Whammy for video, Recorderjs for audio and jsGif for gifs.
You can use Whammy library for record videos too:
Whammy

how to create a thumbnail of uploaded video file in php without ffmpeg?

Is there any possiblity to create a thumbnail of uploaded video file in php without using ffmpeg.
Most server side scripts rely on ffmpeg, so if you can't use that you can either upload the video to an external service but that would mean sending the whole file OR you could try creating them client-side in the browser -- Generate thumbnails from video files using HTML5's video tag and canvas
If however you can't use ffmpeg for installtion reasons you could look at a wrapper -- It currently provides FFmpeg-PHP emulation in pure PHP so you wouldn't need to compile and install the module.
In the past I have used this website to do video conversion and create thumbnails. It works very well and have both free and paid plans.
The system consists of several "robots" that do different jobs. These robots can read your videos if you put them in a public folder with an URI or Amazon S3 for example. The actions that the robot must do are defined in "templates" in JSON and have a PHP SDK. Have a look at the docs.
P.S: I'm not related with transloadit, seems like I am a commercial guy...

Record video from webcam with jquery/flash directly in browser?

I want to let users record video via webcam and then upload the recorded video to the site all through the browser.
Here is an example that works exactly how I want my site to work except it does not seem to capture video, just images.
http://www.xarg.org/project/jquery-webcam-plugin/
Please let me know if there is a way I can customize this or if there is something else out there that I can use.
I want something standalone and don't want to rely on another service to accomplish this.
Thanks!
We've been looking for the same thing, but from my research, it appears there's no way to do it strictly through jquery and Flash without some back end help.
What I've found is three options:
Adobe Flash Media Server
Wowza Media Server
Red5 Media Server
There's advantages and disadvantages to all three. Flash and Wowza are not free, but have great documentation and support. Red5 is free, but the documentation can be lacking depending on what you're doing.
We just signed up for a free 180-day Developer license for Wowza and are currently evaluating that.
HaxeVideo is an multithread FLV streaming server entirely written using the Haxe programming language.
And this link for information Haxe programming language.
But I found an easy way out for me. I have 2 options for you.
youtube api (Free) https://developers.google.com/youtube/youtube_upload_widget
http://nimbb.com/ (Not Free)
But if you want to try.
Check out http://hdfvr.com . It is a commercial video recording solution developed in Flash. It can record to both .flv and .mp4 files and when used with Wowza and the Wowza Transcoder it can record MP4 files with AAC audio and H.264 video.
It works with all 3 media servers in the top answer: Adobe Media Server, Wowza Media Server and Red5 Media Server .
You had better to use a third party tool like red5 or wowza. I already implemented wowza with php.
you can chech http://www.wowza.com/streaming/record. It is easy to implement and video recording is too good and fast. But it is not free.
This can be a good helpful resource for further readers. Click here
Wowza seems a good solution for recordings considering price/documentation&reliability ratio. Many users reported broken videos when trying to record with Red5.
This solution mentioned in Wowza Streaming Engine forums works with latest Wowza server.
http://www.wowza.com/forums/showthread.php?35683-Webcam-Video-Recorder-for-PHP-scripts
It's free to download and try so it could be a great method to test your setup and start such project.

Video thumb creation like youtube for php based websites

Is there any way to create multiple thumbnails from a video through php? I don't have ffmpeg installed in my hosting account's web server. What should I do now?
You have to install FFMpeg package in your server, only then you'll be able to create your required thumbnails for the videos. You can find out the installation process and do follow the steps.
Assuming the videos are hosted on your own server, your best bet would be to request that ffmpeg be installed by your hosting provider. If the videos are hosted by a third-party such as YouTube or Vimeo, you can use their APIs to request the thumbnails (see How do I get a YouTube video thumbnail from the YouTube API? for an example of Youtube thumbnail handling).
You have two options with ffmpeg (after you have made it available on your server) to create multiple thumbnails:
Either you invoke it multiple times, once per thumbnail.
You invoke it once and create a thumbnail every X seconds.
Depending on how many thumbnails you want to create, the one method is faster than the other or vice versa.
For commandline examples, PHP code and speed comparison please see the following blog post: Capturing multiple thumbnails from a movie using ffmpeg.
If you don't have ffmpeg installed on your server, you need some other library/tool that is able to extract thumbnails from videos. However I would say, when something is offered, it's ffmpeg and not something else (e.g. apple quicktime), so I would not look much around for alternatives.

Video Conversion (a la youtube)

So we were going to make a website allowing users to upload video. The website is going to be in PHP/MySQL. Are there any converters out there available for PHP to convert a video from a given format to flash to display on the web page to play?
Basically we would have a file on the server in say .avi format, or quicktime format. How do I grab it from the server, convert it to flash and display it on the php page to play?
Also, does can I use the video capabilities of HTML5 with PHP to make any of this easier?
What I have seen is encoding to flash on the server uses FFMPEG, Which must be installed onto the hosting server (some hosts specialize in this market). I've also looked for an open source encoder PHP or Perl, and not found one. I believe the problem is flash has not been open source and that stopped people because of licensing issues.
You can use the VideoToolkit php class, that uses ffmpeg and mencoder to convert the videos.
http://www.phpclasses.org/package/3747-PHP-Manipulate-and-convert-videos-with-ffmpeg-program.html

Categories