I have a model that uses "models.FileField()", which I then display back to the user so they may click the link and have a file rendered in their browser. The user can upload various types of files.
Problem is, I'd like to handle large avi's differently, and have the file stream to the user.
The requirement I have is to simply stream/transcode video files from the media_root dir to an end user's browser, preferably in a mac friendly format. It would be for a couple users at most.
I've search and stumbled upon a few projects:
https://github.com/andrewebdev/django-video
https://github.com/rugginoso/django-transcodeandstream
As I am I a relatively newbie when it comes to django, I'm not sure how to incorporate their code into my proj.
Any thoughts, suggestions?
You can check Amazon Elastic Transcoder. It is a media transcoding in the cloud. It is designed to be a highly scalable, easy to use and a cost effective way for developers and businesses to convert (or “transcode”) media files from their source format into versions that will playback on devices like smartphones, tablets and PCs.
Or else you can check Webfaction, they have Video and image processing on their servers which you can use.
If you will use any of those, you can ask them about the installing process and how to integrate it in your project.
And one more thing, if you want to play the video on the browser, you will need a video player like jwplayer.
Hope this will help you get started! Best wishes!
Related
There are cases in a project where I'd like to store images on a model.
For example:
Company Logos
Profile Pictures
Programming Languages
Etc.
Recently I've been using AWS S3 for file storage (primarily hosting on Heroku) via ImageField uploads.
I feel like there's a better way to store files than what I've been doing.
For some things (like for the examples above) I think it would make sense to actually just get an image url from a more publically available url than take up space in my own database.
For the experts in the Django community who have built and deployed really professional projects, do you typically store files directly into the Django media folder via ImageField?
or do you normally use a URLField and then pull a url from an API or an image link from the web (e.g., go on any Google image, right click and copy then paste image URL)?
Bonus: What does your image storing setup look like?
Hope this makes sense.
Thanks in advance!
The standard is what you've described, using something like AWS S3 to store the actual image and handle the URL in your database. Here's a few reasons why:
It's cheap. like really cheap
Instead of making your web server serve the files, you're offloading that onto the client (e.g. their browser grabbing the file from S3)
If you're using an ephemeral system (like Heroku), your only option is to use something like S3.
Control. Sure, you can pull an image link from somewhere else that isn't managed by you. But this does not scale. What happens if that server goes offline? What if they take that image down? This way, you control what happens to the objects.
An example of a decently large internet company but not large enough to run their own infrastructure (like Facebook/Instagram, Google, etc.) is VSCO. They're taking a decent amount of photo uploads every day and they're handling them with AWS.
Well, these arrays are actually pixel data from DICOM images. When i just send them as an array (size 100) of pixel arrays (each about 1mb) it overloads the browser quite obviously. Being a newbie to programming, i would appreciate being pointed in the right direction to start working on economically loading large files , i.e., image-stacks into browser window , preferably dynamically. Apologies if the query is not clear
Hmmm... So your application is both at the same time? DICOM server and DICOM viewer?
The server is ment to respond to query-retrieve SOP classes and deliver images, the viewer will be the system sending those requests.
DICOM concepts would say your server should just be serving the images, the viewer is displaying them (including local file management, ...).
That would end up with a fat client (e.g. javascript if you want the viewer to be in a web browser), otherwise you won't be able to to interact with images at the speed you would like to (smooth scrolling, maybe 3D reconstruction, etc.).
If you just want to have some image pre-view capabilities on your server, I would suggest making a page with ~10-16 thumbnail images, one view for one or two full-size images, and load them per request if a user wants to preview image series or a single image. With that, you reduce load time significantly and your user is able to pre-select the images prior to sending a full request.
For the full viewer, I would consider a local solution on the client. If it should be web-based or not (or maybe mixed) depends on your further applications.
In past projects, we used existing open source DICOM servers like dcm4che for handlng the server part and just pulled our data from there. But for a teaching system, it might be interesting to build the server on your own as well to show all parts of the concept.
Feel free to comment, I'll try to update the post to answer questions.
I had exactly this same problem trying to develop a multiframe dicom viewer using just plain html5.
In order to be able to load such a big amount of imaging data in the browser, I decided to try using some web storage technology on the client side. In particular, I was considering to do some initial tests with indexedDB.
Sadly, I am currently involved in other tasks, so the web viewer development is now stopped (again!) and these tests are still undone.
Anyway, I would try to do a proof of concept with indexedDB.
I'm looking to stream video's as part of a django app, but I've never done anything with video and don't really know where to start. I don't have all the details of the project yet, but I'm expecting a fairly small library of videos uploaded by one or two people (Think less than 100 videos of about 5 mins length).
I'm looking for a solution that allows users to upload videos using django admin. I want to reach the majority of desktop browsers (95%+), and obviously I want to keep my costs down. Saying that I do like the idea of using some sort of cloud based CDN (I've no idea if that's possible / appropriate for this size of project)
I really want to ask if anyone can point me int he right direction (tutorials / services / projects / code), but I realise that might not be specific enough.
So to be more specific -
Is it possible to stream video to browsers using just django and an apache web server?
What cloud hosting providers will support easy integration with a django app?
Will I need to convert the format of my video's before they're ready to stream?
Can I use Red5 with a cloud hosting solution.
I want to host the project on a Ubuntu server that I use to host a
couple of other (low traffic) django apps - would it be a mistake to install Red5
on a server with existing sites.
From recollection, the server has 12GB RAM and 4 cores (in a 1and1
uk datacentre). Will I have enough power / bandwidth to stream say 3-5 video's simultaneously? (assuming red5 / wowza).
I'm not interested in Flash because I was rooting for Apple. Do I
need to need to re-evaluate my prejudices to be free of my ignorance?
I never streamed videos using Django/Python, but I have some experience in the field of streaming video in frontend apps. I can certainly not answer all your questions. In my experience it does not really matter where the video is hosted, a CDN is fine if you want to distribute the video world-wide.
I personally think you should start with the question on how you want to play the video in the browser. Choose an appropriate video player (could be html5 video) and you have an idea of what is possible to play and what not.
3) The format matters depending on how you want to stream the video. Progressive download (e.g. mp4)? Live streaming (unprogressive, e.g. HLS)? You can find example videos online and test if your video player can play the videos on the platform you want to support.
7) As said, you need to check out which player to use in this case. HTML5 video is not widely supported enough yet in my opinion, but can play most formats in the most modern browsers (Chrome, Safari).
Hope that helps.
I try to create a django app that uses webcam. I would like people to be able to broadcast with their webcam, while other people can watch and listen to them.
I don't know how to do that with Django. Do I have to use flash? Is there a module that would allow me to do that?
Any advice is really welcome. Thank you.
Django can display the page containing the webcam application (and display, for instance, a directory of ongoing broadcasts, a search mechanism, separate urls for separate broadcasts, user authentication, etc.), but the actual software that takes the video from the webcam and streams it is not technically part of Django.
Flash can handle webcam streaming, and is probably the easiest tool to use because of the quality and user-friendliness of the dev tools, but the use of Flash for new projects is strongly discouraged since the vendor (Adobe) is attempting to migrate users away from it. HTML 5 is at least theoretically the correct tool for this task, although it may be challenging to develop in because Flash is, despite being a 'dead' project, still much more frequently used. There are also other browser plugins such as Silverlight, although I don't believe they have much to recommend them over Flash and HTML 5 for most applications.
All of the above are only a solution for the client side of the equation -- you'll need some kind of server software to accept the streaming video content and stream it out to viewers. This is a fairly complex task, and is generally outside of the purview of Django (which is not to say that it's strictly impossible to bolt that functionality on to Django in some sense, but you won't be using any of the standard Django modules for it).
I have a Django application which generates video chunks to a folder in the server's filesystem. I need to stream those chunks as they are generated so that the users can see the output of the application as a single video in their browser.
I have not been able to find a solution in the right direction to accomplish this. Any ideas??
Use a dedicated streaming server
Flash Media Server (propritary, $ to $$$)
Wowza Media Server (propriatary, $)
Red5 (open source)
numerous other esoteric, defunct, or little known but viable servers
Personally and professionally, I'm a big fan of Wowza. Solid, good value for the cost.
Something other than Django. Django is not optimized to serve static resources at all, let alone video. You need an actual media server for best performance.
We have both Flash Media Server and Wowza options that are flexible, with great hand-holding support. IMO this sounds like a job for FMS, which we've been doing for about 10 years.
I would love to find out more :)
Wesley
-Influxis