How can I upload videos and convert it async in Laravel? - php

the thing is just like my title says, I am already uploading videos to the server, store their path in the db, and save them to the storage using the Storage facade, the videos have an average weight of 700MB or so, and they are for watching on the own website I am building, I'm using VideoJS to show them, but I need to convert them due to the incompatibility with different browsers, I already know that FFMPEG done this painless, but I want to know how to make it async, just like the Youtube upload video tool. The videos are uploaded from the admin dashboard only, so, there will be only one person uploading videos. Thanks for the time.

Have a look at Laravel's queue features: https://laravel.com/docs/5.3/queues
You can create a job class that takes the path/filename of the video it is supposed to processed. Then in the job's handle method you do the conversion. The Laravel documentation explains how to create a Job class and use it.

Related

How can I save a movie clip symbol in as3 as a PNG on my server?

I'm developing a website in flash for a company and it's going well so far. The website allows people to create custom railings. The owner of the company wants me to save out the demo picture that's shown in flash (movie clip) as an image (pref PNG) so that I can include it in the validation email. Does anyone know how to do this please? I need to save a movie clip symbol on the web server. Thanks in advance!
You need a couple of components to work in order to make this happen. AS3 doesn't execute on the server side (has no access to the servers hard disk) so you'll have to use some other language on the server to receive the file. I would personally recommend PHP as it's great for this kind of simple task and there are lots of tutorials out on the web for handling uploaded files using PHP.
On the AS3 side of things you can use BitmapData.draw method to draw you Sprites or whatever other IBitmapDrawable objects to a BitmapData. Then using PNG encoder (can use the built in or search around there's some other implementations out there) to encode the BitmapData into a PNG. Last step send the encoded PNG to the server and have it save the file somewhere the script has write permissions.
For some references here's some code I wrote:
Basically a save button in my app is clicked and the instance of the class below is shown, this then has the methods for saving. After getting the flattened image it makes a call using a third party PNGEncoder I found called PNGEncoder2
https://github.com/wafflejock/FingerPainting/blob/master/FlashBuilderProject/FingerPainting/src/com/shaunhusain/fingerPainting/view/optionPanels/SaveOptions.as
Below I have a separate class that manages all of the "layers" which are just sprites really for my drawing app. The "LayerManager" below has the method that uses BitmapData.draw to "flatten" all the layers into a single Bitmap/raster drawing.
https://github.com/wafflejock/FingerPainting/blob/master/FlashBuilderProject/FingerPainting/src/com/shaunhusain/fingerPainting/view/managers/LayerManager.as

Architecture for streaming an endless video queue with mysql datasource

right now i'm building a webinterface. It should be something like a media control system. In this interface a user can select some vid's from a coverflow'ish style and put the videos in a queue. The queue is visualized like a timeline. This interface is webbased, made with TYPO3 FLOW. So i got in my database data to play/stream.
I'm trying to figure out how to stream my selected data. I'd prefer a webbased solution but i'm open for everything.
Could anyone please give me a hint what kind of technique would fit best? This is what i need:
the playlist/queue is stored in a database (not the videos itself but the meta-data and file-urls)
people can add items to the queue over a webinterface (already implemented)
if the queue / playlist is empty i'd like to play some random videos
if someone adds a video to the playlist / queue this video needs to be played at a given time (mostly now()+60sec if the queue is empty, endtime last clip +x when not)
if i open the stream while a video is started in the queue the video should start at that time should be at
So i need to stream dynamicly videos with in an endless loop. I'd love to have a webbased solution. Like something with node.js and vidStreamer.js but i'm not familiar with it yet. Would it be possible to play content dynamically, based on mysql input?
I would do that mostly client side with Javascript. Export the metadata and preload the videos hidden from view, then start as needed. With HTML5 video you have easily access to the video and player properties so you can get the timing right.

Movie Streaming Script

I want to develop a Movie information Database and Video Streaming website. I am wondering is there any off the shelf script available for the same ?
Please share some information regarding the same..
I would prefer it to a PHP script
I don't know if there's already a solution for this, but the steps to achieve something like you want are not that hard.
Here's what you need:
Backend for Storing and Delivering files (Simple CRUD) and basic database access
Cron or something like this to convert your uploaded Videos into FLV/HTML5 Video (see ffmpeg)
Frontend to display your encoded videos (see http://videojs.com/)
you can use the html5 video tag

JW Player, I am trying to create a live stream radio using existing mp3 files

I am trying to create a live radio using the existing mp3 files (I have the links saved in a MYSQL database). Using a player like jw player, or any player that can suit my needs. Is there any ways that a PHP script can generate a random playlist for a user and as he reach the end of that playlist, the script would generate another playlist and continue playing without stopping.
Thanks in advance for your help :)
Why not use one of the many existing software packages for doing this? Take a look at Ices, or one of the many other SHOUTcast auto-dj programs.
You would use the JWPlayer Javascript API to update the file that's being played by JW.
http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/12540/javascript-api-reference

Is it possible to run AfterEffects on a server to render videos on the fly with dynamic images?

I'm trying to figure out if this is possible:
web server running PHP collects a number of images from user input
web server takes those images, runs AfterEffects which uses the images instead of placeholders in a template video to create a personalised video for the user
web server makes the video available for download to the user.
Cheers,
Mark.
This would be mighty complex, but I think it might be possible. Here's how I think the process might go down:
Make your After Effects project, importing some placeholder images. Save the project.
Client uploads images. Those images need to be converted to the same image filetype (PNG, JPEG, TIFF, whatever) as your placeholder images, renamed to the same name as your placeholder images, and placed in the same directory as the placeholder images that were referenced in your After Effects project.
Run After Effects from the command line using aerender. More info on that here.
Render to a public directory and give the link to the client.
Delete the client's uploaded images to make room for the next client.
Heres where things would get tricky:
I don't think it's feasible to edit the After Effects project file, so I think the client would be limited to the exact number of images you made in your template. Any more would not appear in the rendered movie, and any less would give a media offline error. I do not think it is possible to have After Effects import media via a script.
Yes. It is possible, our stack is fairly involved. We are doing it at my startup, lumin8.me. Doable but complex, yet fun :)

Categories