Architecture for streaming an endless video queue with mysql datasource - php

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.

Related

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

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.

How to secure my GeoJSON data?

I am trying to create a website that display Google map mark up with my proprietary data (in form of multiple polygons) on top of it.
I have been studying Google Map API and found the only way to do it is to publish my proprietary data in GeoJSON file then use the following api function to load the data to Google map: map.data.loadGeoJson(xxxxxx);
This means I need to publish my proprietary data by web service in GeoJSON format. However, I don't want users to download my proprietary data and use it for another purpose other than my site. This is similar to a website which allows video streaming but not allowing download the whole video offline.
How can I achieve the purpose? Can I use some language like PHP to generate the map (with markup) at server then send to web client in form of HTML? Or if I cannot achieve this by Google Map API, can other map API support it (like Bing?)
Thanks very much for your help!!!!
Code Mon key
One option is to turn your data into a tile layer. This will limit the user to only seeing an image of the data but would not give them access to the raw data. In a worse case scenario they would only be able to take the images and view the data and not do any kind of analytics against it unless they manually trace all the data.
As an added benefit of rendering the data as a tile layer, you will be able to visualize a lot more data. I've built a few systems that can render 500M rows of polygon data on a map using this approach. The cool thing, if you store the data in a spatial database like SQL Azure, you can easily make your data interactive by taking the point a user clicks on a map and searching the database for any shapes that intersect with that point.
I wrote a simple blog post on how to create a web service that does this many years ago here: https://rbrundritt.wordpress.com/2009/11/26/dynamic-tile-layers-in-the-bing-maps-silverlight-control/
There is also a good open source project here that uses ASP.NET: http://ajaxmapdataconnector.codeplex.com/
I have a whitepaper that is a lot more up to date than my blog post that will be published soon. If you email me at ricky_brundritt at Hotmail.com, I'll send you a draft copy.

Batch PHP image upload slow, architecture change?

I've build a CMS with photo album. Pretty simple, most stuff static, static HTML pages, no database, just (as little as possible) text files containing some JSON stuff.
The webinterface for the admin panel is all in jQuery with a PHP (Zend Framework) based backend. A much as possible is done within the browser so the backend is pretty bare.
Now the photo album works currently like this:
Clicking link 'Media'
Fetching a JSON string from the backend containing an object with all albums and for every album all the photo's
Rendering an unordered list with all the albums
Rendering an unordered list within each album list item with all the pictures
Uploading:
Drop one or more jpeg/png files into the browser to create a new album
Drop one or more jpeg/png files into an album to append those files to the album under the cursor
Send all dropped files (using this jQuery drag drop upload plugin) to the backend
Backend receives all files (while displaying a nice progress bar)
Backend loops through all uploaded files, while the webinterface displays a nice spinner
Each file is resized to a maximum size specified and renders a thumbnail at max 133x133 px
Each file is appended to an array with the serverside filename and thumbnail name
[Not yet implemented: rendering the (updated) static html page for the album overview and for each image]
Array with all newly uploaded files is converted to JSON and sent to client
Webinterface appends all new files as list items (displaying the thumbnail)
Uploading done
This is all going pretty well, upto +- 600 images or +- 900MB. That's fine by me, if the user wants to upload more files at once, well, do it in two stages. The problem is, the backend processing is a bitch. Converting 100+ images at a good size (1.5MB each) to the maximum size and generating the thumbnail is taking way to long. I'm doing this with PHP GD. Didn't take me too much time (or no time at all), to find out that that's the problem. My guess is that there is no way I'm going to speed this up within PHP.
So here are a few questions:
Will ImageMagick be faster? I'm not a fan, so please so no, also, I don't want to install this on my server that badly..
Is there a really, really lightweight command-line program that does the same with just a few commands (and I know that I'm not alluding to ImageMagick)?
If the answer to the previous question is no: what would be the best way to do this? Don't say Java, I'm no that big of a fan of Java also. Some C(-dialect)? Preferably one with a powerful, yet lightweight image library for the nearest neighbor, bilinear and bicubic interpolation algorithms.
Could my architecture be changed? At this moment, the images start appearing in the browser once the thumbnail is inserted, thus after the whole JSON array is received, causing the entire action having to complete and generating all the image data before any kind of feedback is received in the browser. This means that the spinner (without any indication of how long the process is going to take or how many images have been completed) will be displayed for a long, long time. Is it an idea to use Javascripts FileReader to preload the images from the users system, generate the thumbnails in the browser and display them after uploading is done immediately? And on the backend: just receiving the file, writing them to disk, executing a command-line command, immediately send response to browser and converting in the background?
How do I prevent client side abort event of an AJAX request? When uploading and converting, a warning should be displayed when the user want to close the page or when the #hash is being tried to change.
Thanks. Hope you guys can help me. Just so you know: the client side is pretty complex with way to much code. I'd rather change the backend.

Quicktime to Flash using PHP ? And chapters

For a client, i need to write a complex application used to stream tv episodes in flash format, at least, the player will be in flash.
It's a first for me, and i've a lot of question, since i don't really know about streaming.
But well, first, here is the constraints :
Mac server (might be migrated to linux)
PHP5
Flash
external library could be used with PHP
What i need to do at first, is to write some app (php, python, shell), or find one to convert over 500 quicktime videos to be able to be read within a flash player.
Then, i'll a back office, to add videos with meta data (the meta data will be simple html inputs), and, here is an important part of the project, the ability to generate chapters for each video (manually), the client will choose the start of a chapter, give it a name.
My questions :
Is there any flash player able to do that ? or will i have to use 'playlist' such as youtube to simulate chapters ?
Will it be easy to use the quicktime video within a flash player ?
What would be your advices for such application ?
Thanks
You're probably going to want to install and run ffmpeg to convert quicktime movs to flv or f4v. You may be able to add cue points (chapters) by using something like FLVtool.

Merging (mixing, not concatenating) audio files dynamically

I just need to be pointed in the right direction - I can research after knowing the best tools.
The idea is to have a list of audio tracks (guitars, bass, vocals...etc) which are uploaded by different users. I want a user to be able to select which tracks to listen back to then dynamically generate a new stream/file of the selected tracks which is played back or downloaded.
I have no idea where to start (use php to select tracks send to flash for playback?, or do I send it to a command line function? write some java?). It is essentially a very basic social web based DAW (digital audio workstation).
Thanks
Al
On the server side you can use php or java to feed the basic audio files, and to manage them (admin).
On the client side, you may have to write a flash application for playing those files. I preety sure flash knows basic mixing.
Basic playback in flash is easy to do. You need to learn some ActionScript 3.0 (there are tutorials with action script 2.x, but they are deprecated, as AS 2.x is not compatible with AS 3.x), and you need some designer skills to create the interface.
This tutorial may work, there are a lot of resources out there
http://www.thetechlabs.com/3d/create-a-as3-mp3-player-with-papervision3d-spectrum-display/

Categories