How to write own video service? - python-3.x

I need to write own video hosting with player on client side.
My required approaches:
The user can upload video to hosting
The user can watch any video from hosting
I don't ask to write me solution, I am asking for help where should I start from to lean about it? Which technologies or frameworks should I learn for my task to realize it using python?
P.S. Each detail will be very useful, especially some links to articles because I couldn't find by myself not knowing accurately what do I need to search.
Added
Now, I think to store videos in the file system directly and use postgresql to store additional information about videos and users. Of course, large services use Hadoop, BigTable and etc but for my task so solution will be enough I think.
When the user uploaded a new video, my server saves it into a temporary directory and puts in the processing queue. Small programs takes new videos one by one, generates thumbnails and decrease a quality of videos and moves it to the base storage. Is it a good idea?
But I still can't get how make a video streaming

Ok So I dont want to encourage the behavior of people thinking SO is a codewriting service, But this is a truly legitimate answer. So first of all, you want to choose a language. Currently I'd recommend the use of javascript and Node.js (Java needs to die). However, IDK Node as well as I know Python. Python is an all purpose language yadda yadda yadda blah blah blah. Whats important in this case is your framework of choice (or library). The libraries that allow you to make websites in python (or make it easier to do so) are very interesting. There are several but my favorite is Python Flask. Python flask is actually very similar to Node.js + Express.js. Use this link to get started. Take a few days to learn the insides of this framework. VERY MODULAR, VERY POWERFUL. Using basing logic and database knowledge, one can easily accomplish a simple file upload and authentication-using, web service. However I Know of 2 really good guides that will help you with the streaming of the videos. I mean yes, You don't really need to know this. You could potentially load the requested video using a <video> tag, but streaming is a much MUCH
more favorable solution. Take some time to learn about video streaming and compression, and after you think about it, check out these links: AUDIO STREAMING GIST and MIGUEL GRINBERG FLASK VIDEO STREAMING BLOG POST
Good luck with flask and
Pro tip: learn about http(s) and the get and post methods
You would never imagine how many times I struggled with a bad request error or a method not allowed because I didn't do my research

Related

Technology advice for mobile application

I would like to develop a mobile game, kind of like an interactive ARG.
The players would see POI-s on a map, and they can interact with them in various ways. Some interactions on a POI should be visible to other players real time, and players should receive push notifications when a new POI appears in their area.
Up until now, I mostly worked with web technologies, so I figured a Node.js for backend, and a React Native for the application would be nice choices and I could learn both along the way. Since I have little experience with both, and don't really know about their capabilities performance-wise.
Are these technologies a good choice for an application like this? Is there a reason to go full native iOS/Android instead of React Native?
Could Node.js and React Native handle like 1-200k players daily? (It will probably never get there, lol)
I know it's just a pet project, but I'm interested in what would be the "industry standard" stack for something like this?
I would think using React native should be fine for this genre of game for your frontend/client. Where it seem to involves a lot of point click, drag and drop, present player with information. If more real time rendering and interactivity then you may need to use a library/framework that are suitable for more real time rendering and interactivity.
As for the backend using Node.js is fine for handling your data requests. For scaling to support lots of user, then that's quite a big topic that you'll need to work out. You'll typically have to look at how complex your data/requests are and so how much your server can handle the load. From there you will need to load balance on multiple servers.
For game or any type of application, where you need a backend it's very similar in needs. You'll use a language that's best for backend development and performance. From there you have to serve it and scale accordingly base on your loads. You can leverage AWS or other cloud providers to do a lot of these.
Hopefully this answer some of the things you're asking for.

How can i structure my Messenger Chatbot in NodeJS?

I'm currently working on a NodeJS powered Messenger Chatbot, using Wit.ai and Firebase, hosted on Heroku. I've followed an udemy course to learn the basics about chatbots and I've made a decent chatbot imo.
But, as I'm adding new features, I don't really know how to correctly structure and organize my project. To be honest, I've currently have one big index.js file, of about 1 000 lines, because in the middle there is a giant Switch Case structure managing all of the intents a user can possibly have.
I'm also making nodejs modules with "exports.function" but it seems it's an old way to do and it doesn't solve my switch case problem.
Do you any suggestions to solve my structure issue ?
I've found this post suggesting some structures but I don't know if it can really fit a Chatbot project.
Thanks for you time, have a nice day.
personally, i suggest to try out node-red as it is easier to visualise if you have many APIs you want to connect to.
I've currently have one big index.js file, of about 1 000 lines, because in the middle there is a giant Switch Case structure managing all of the intents a user can possibly have
This is clearly to avoid. In these conditions the code is hardly readable and untestable. I wrote an article on how to structure a Node webhook for a chatbot. Jump to the section Chatbot Webhook to have an example on the implementation. It is for a Dialogflow chatbot but you won't be lost as Wit.ai and Dialogflow have many similarities.

About project using Node.js with openCV

I am planning a project CCTV system using Node.js and openCV, WebGL.
Would you please take a look at my plan and find flaw or give me advice?
My plan is: Entire system consists of 3 types of host, CCTV-server-watchmen. Numbers of each host may be (more than 10)-1-3? CCTV take a video and send it to the server. The server identifies persons in the video, and analyzes who this person is and where he or she is(using OpenCV). Finally, watchmen can seize entire status of field he or she manages(map drawn by webGL helps it). I will use node.js as network method.
I have a few issues about my plan.
Is it efficient to use Node.js as video data transmitter?
Basic concept of Node.js is single-thread, so maybe large data like video does not fit to it. But, count of CCTV and watchmen is limited and fixed(It is system for closed intranet)
Is there any method can replace Node.js?
I will not replace openCV and WebGL. But Node.js could matters. At the beginning of planning, I was finding other means for networking between C/C++ program and web-browser. Honestly, I got failed at school-project last year. One of problems that I can't find solution was "How to send/receive data between C program installed at Raspberry Pi and web Browser". I chose Node.js as method this project, but also heard other means of Qt, DB, CGI. Is there a better way?
Thank you for reading it.

Use Socket.IO to update data in real-time?

I am writing a nodejs / express / mongodb based web application and all is working great.
What I've made for learning purposes is a twitter clone.
People can tweet whatever they want and it will show up on their profile and anyone who follows them stream.
On my home page it shows everyone who you are followings posts.
I want this stream to automatically update when someone they are following posts something new.
So they can just sit their on the home page and see all new posts come in in real time.
I've worked with Socket.IO in the past and loved it for it's awesome simplicity of use.
But is Socket.IO an appropriate use for this sort of situation?
Are their better options I can use, perhaps going with a simpler approach of AJAX polling would be more efficient for scalability?
So basically what is the best to use for an application like this?
I need:
Realtime updates to the client
Scalability and effeciency
Thanks!
You have multiple option
My firstoption RacerJS
and Socket.IO
Get data from mongodb and send through racerjs or socket.io
RacerJS is synchronization model built on top of ShareJS, which has underlying technique called Operational Transformation, this is used to do collaborative work on the same data in real-time (like Google docs) I guess it does not really apply to your case or its not the case where it should be used. Because ShareJS does a lot of work to keep clients able to edit at the same time on the same data. This is not the case with Activity streams like your case.
A good option would be Meteor

Managing image workflow with Node.js webapp?

I'm new to Node, and was hoping to use Node.js for a a small internal webapp for managing workflow for product photos.
The image files are RAW camera files, and stored on a local NAS device.
The webapp should:
Have a concept of workflow, and be able to jump back/forth between states, and handle error states.
Watch certain directories for image files, and react to new files being added, or existing files being moved/removed.
Send out emails in response to events.
Scan photos for QR barcodes, and generate events based on these.
Rename photos based on user-defined batch patterns in response to events.
Questions:
Is Node.js a suitable tool for something like this? Why or why not?
Any libraries to help manage the workflow? I could only find node-workflow (http://kusor.github.io/node-workflow/) - curious for anybody's experiences with this? Alternatives?
Likewise for file watching? I saw many wrappers for fs.watch (e.g. https://github.com/mikeal/watch), as well as some alternatives (e.g. https://github.com/paulmillr/chokidar) - any advice for somebody new to Node?
Apart from using a NAS with a network filesystem, are there any other alternatives stores I can use for the image files?
I'm open to other alternatives here. I'm worried that the system will get confused or lose track of files.
The Node.js docs also mention that watching files on network file systems might be unreliable (http://nodejs.org/api/fs.html#fs_fs_watch_filename_options_listener). Are there more robust solutions?
Any other tips/suggestions for this project?
Cheers,
Victor
Node.js is a fine platform for building an application like the one you describe. The key question is file storage. You might find this post very interesting:
Storing Images in DB - Yea or Nay?
This other post enumerates a few interesting options for writing workflows:
Workflow engine in Javascript
Shameless add: I have been working on an event coordination library that you might find useful and interesting.
http://durablejs.org

Resources