I am trying to make an online examination portal. When students start the exam, their webcam will start automatically and record the stream live and store in the server. Invigilators will either watch the students live or they can watch the saved live streams later.
After many research on various technologies I came across this link. It uses Node JS with websockets and ffmpeg. I ran the ffmpeg command and it streamed the live video successfully.
But the problem is, in order to live stream, the students have to have ffmpeg installed in their system and they should run the command directly from the terminal. So how can I change this? The students will live stream from their browser, because this is a web portal. If we put this command in a PHP script, then the command will run at the server side. But client side command should run in this case. How can I run command from client side?
Any suggestions will be helpful.
Related
So I am trying to display memory and cpu usage of my minecraft server on my website. But i dont know how could i do that. I have searched it up on youtube, but havent found anything.
There are many things that you can use to do.
Linux/ Hosting
If you are using a hosting company that gives you a nice looking website/panel to look at: web scraping their statistics and using it, such as taking it from this area using sort of bot. If they don't then you could look at getting a plugin or creating one such as Lag Monitor
They may be using Multicraft, statistics will be at the top if they have some measurement for it.
If you host the Minecraft server in a docker container then you should have a look at docker stats
If you host the Minecraft server just on the system itself using a service(systemctl) then you should refer to Retrieve CPU usage and memory usage of a single process on Linux?
You would need to create a script to get these things, return and format the value. You could either publish the statistics in almost real-time using some sort of socket connection like socket.io.
However, if that is not available then you could create an API server where ever you run the server(if on your own machine) to run these commands and allow your website to fetch the results every so often or on page load.
Windows
If you are hosting your Minecraft server on Windows then you are doing something wrong. Getting memory and CPU usage would be the least of your problems in this case and you should look into getting some proper hosting for your server.
If you are running the server on your own computer on your own network. Unless you have the experience and knowledge of doing so safely, which clearly you don't have, then you should definitely migrate to a Linux based hosting solution such as a VPS.
TL;DR:
Get a VPS, set up an API server, get statistics from that. There probably is no tutorial for you to follow.
I have a HTML5 app that allows users to upload and play their audio files. The server is Node running on Heroku.
To allow cross-browser audio play, what I understand is that I have to at least maintain two formats of each audio file, let's say .mp3 and .ogg. So, I need to transcode the files automatically on the server side.
The problem is that Heroku does not run ffmpeg. I found this project that creates a custom buildpack for heroku that supports ffmpeg but it seems to be for Rails apps: https://github.com/dzello/ffmpeg-heroku.
I was thinking to run an external server for transcoding, which my nodejs app sends the file to, it does the transcoding, and reuploads the new file on my nodejs server. But I don't know how to set up such a server, and whether there is already a ready solution which does this kind of work?
So, here are my questions:
1- Is there a solution to run ffmpeg on heroku+nodejs?
2- How can I set up a transcoding server that communicates with my nodejs+heroku server?
Thanks!
Why do you need to run it on heroku? Just setup some virtual server, for example on Digital Ocean
And use a linux server to setup node. It's pretty easy and will run every package needed. It already has droplet with preconfigured node.js+mongodb stack
I am currently adding features to a custom access control server at work and what I would like to do is access the camera at the door and store at least 1 still image after the door is unlocked (each door has an RFID reader that interfaces with this server).
For example one of the Cameras is a Vivotek FD8136, which has multiple output steams that i can access as long as I have a username and password......
With this camera I can access a stream by going to the local address http://xxx.xxx.xxx.xxx:8002/video2.mjpg
I am just unsure how to go about saving just a simple image to the server from that stream.....
any and all help will be appreciated. I know I am probably trying to over complicate it in my head....
I found one possible way to do it using avconv... But if anyone knows a better way please feel free to leave a message so that if anyone else needs this it can help them as well.
With avconv it is the command as follows (i believe it will work with ffmpeg as well)
avconv -i http://xxx.xxx.xxx.x:8002/video2.mjpg -vframes 1 output%.jpg
That will output a single file for testing but a bash script with date can make the file name with a date and time in it easily. Then when needed just run the desired script and there is an image to access later.
Sorry about the really ambiguous question, I really have no idea how to word it though hopefully I can give you more detail here.
I am developing a project where a user can log into a website and book a server to run a game for a specific amount of time. When the time is up the server stops running and the players on the server are kicked off. The website part is not a problem, I am doing this in PHP and everything works. It has a calendar system to book a server and can generate config files based on what the user wants.
My question is what should I use to run the specific game server on the linux box with those config files at the correct time? I have got this working with bash scripts and cron, but it seems very un-elegant. It literally uses FTP to connect to the website so it can download all the necessary config files and put them in a folder for that game and time. I was wondering if there was a better way of doing this. Perhaps writing a program in C, but I am not sure how to go about doing this.
(I am not asking for someone to hold my hand and tell me "write this code here", just some ideas of a better way of approaching this problem)
Thanks so much guys!
Edit: The webserver is a totaly different machine. I would theoreticaly like to have more than one game server where each of them "connects" (at the moment FTP) to the webserver, gets a file saying what it has to do at a specific time and downloads any associated files then disconnects.
I think at is better suited for running one time jobs than cron.
For a better approach for the downloading files etc, you should give more details on your setup (like, the website and the game server, are they on the same machine? Or the same network? etc etc.
You need a distributed task scheduler. With that, you can:
Schedule command "X" to be run at a certain time.
Specify the machine (or ask it to pick a machine from a pool of available machines)
Webserver would send request to this scheduler via command line or via web service when user selects a game server and a time.
You can have a look at : http://www.acelet.com/super/SuperWatchdog/index.html
EDIT :
One more option :http://jobscheduler.sourceforge.net/
I am just wondering how node.js is compared to other frameworks. Is it possible to develop rich internet applications using node.js? How is it compared to java NIO?
In short I am looking for the target domain of Node.js
not sure why there are people voting to close this question when I think it's perfectly viable, Node.JS is a new server side framework that is still undergoing heavy development.
to answer your question may be a little difficult for myself as I know nothing of Java, but I know a little about Node and use it on a regular basis whilst it's under development.
Node JS is basically a framework built up of several components that are built for speed, such as Google's Javascript Engine (V8), it was originally designed for Google Chrome but released as an Open Source project.
Many developers have taken V8 and placed it on the server, combining it with custom libraries integrated into V8 to allow File I/O and network access.
So what is Node.JS
Node JS is basically Googles V8 javascript engine as the language platform, Mixed in with Lib Event, which is a technique of using 1 thread to perform multiple tasks by creating Events from the kernel.
The primary usage of Node it's it's networking functionality, Ryan has contributed a really powerful HTTP Library that has helped it take of with Web Services, which is what it's main intention is for.
Why do I use NodeJS
I like Node JS simply because it's easy, fast and very modular, being able to supply information such as Files, Images, Text to a web browser directly from the Servers Memory (RAM) in under 10 lines simply helps understand the power behind it.
For instance, Nearly every web-browser makes a request for favicon.ico, which is usually ~10KB, Now if i had 100 Requests per second and every request was requesting my favicon, my hard drive would have to locate that file, blocking all other reads in the mean time.
I can just load the data, store it within a variable and send it to every client much much faster then the traditional methods.
What's the best part about Node.JS
The best part about node.js personally is the concept, the idea of being able to search thousands of clients concurrently without blocking any other client is the drive behind the speed, every thing is speed motivated, hence Google V8, it's called V8 for a reason, Lib Event, it's removes the requirement for loads of threads, which can be heavy on resources.
Getting Started
I seems like you have not really had a play with Node.JS, and if you have not then is suggest you isntall it and have a play for a few days, Join there IRC Chat and speak to some of the guys over there, there is usually a member of the immediate team there that will help you.
You can simply install node.JS on Ubuntu like so (In Bash):
if you do not have git
sudo apt-get install git-core
install node JS:
cd /etc/
sudo git clone git://github.com/joyent/node.git
cd node
sudo ./configure
sudo make
sudo make install
to test make sure you have it installed
node --version
if you get the version your ready to go, go to your home directy
cd ~/
mkdir Nodes
cd Nodes/
create a simple file in you ~/Nodes Directory called test.js and start away, you can run the code lie so:
cd ~/Nodes
node test.js
I had written that small guide to setting NodeJS up not just for yourself but for others who may read this and would like to set things up.