I need to implement some sort of online video server, however, its not a common one.
It is not intended to serve complete videos to any user, but very specific sections of a video that are considered relevant to a client.
For instance, there's a 2 hour video stored in server, name it "a.ext"
Client Bob determined some parameters ouppon register, for which we determine (with IA analysis) that, for Bob, tyhe relevant part of the video goes from timestamp 00:05:30 to 01:02:38. I could store it separatedly, but it turns out that Alice needs 00:07:30 - 00:10:10, which is contained inside the other fragment. Storing them twice would soon start to add up dangerously, specially with Google's storage fees.
My idea is that, somehow, I give Bob the url http://example.com/a.ext?user=Bob, the system will query my database (I can implement this part myself, no troubles with it) and determine starting and ending time for bob (and credentials and so on, obviously) and give him ONLY that part of the file, preferably extracted form the original on the fly.
I don't really need this to be a full streamming server like DLNA or MiniDLNA, serving the content to the user as an octec-stream attachment would be just fine.
The current demostration cuts the file using ffmpeg, stores it in a temporal tmpfs ramdisk, serves the section to the user and deletes the temporal file. It works just fine, but it doesn't look clean enough for my own standards.
Ideas so far:
- Use ffmpeg to cut the file every time it is requested. Do so on RAM disk to decrease disk I/O. Works, but its not clean and could introduce delay.
- DLNA or other advanced streamming protocol, which seems to have the con of controling that Bob is ONLY allowed to access his section of the file, and not the whole file itself. I know the played can tell DLNA start and ending position, however, the user could easilly trick it out. Doing so in a secure way could easilly grow to a project itself...
We also need to do this with audio, however, it doesnt matter audio or video, except that maybe there is some additional software capable of doing so with audio and not video, but we preffer to use a single software for both