LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-22-2021, 09:39 AM   #1
kzo81
Member
 
Registered: Aug 2014
Location: Hungary
Distribution: Debian, Linux Mint, CentOS
Posts: 197

Rep: Reputation: Disabled
ffserver - Web UI


Hi,

I'd like to be able to set the /etc/ffserver.conf file's parameters from a web UI.

The hardware is a Raspberry Pi and a drone controller which has a USB cable attached to the RPI.

My goal is to be able to set the resolutions at runtime from the Rpi's web interface (NGinX)

This is the html skeleton:

Code:
<!DOCTYPE html>
<html>
<body>


<label for="resolutions">Resolutions:</label>

<select id="resolutions">
  <option value="640x480">SD</option>
  <option value="1024x768">HD</option>
  <option value="1920x1080">Full HD</option>
</select>

<button type="button" onclick="alert('Hello world!')">Apply</button>
  
</body>
</html>
I'd like the config file's line:

VideoSize 640x480

be changed when the Apply button is pressed and restart the systemd service. It doesnt matter if the web server runs as root. Do you have an easy and elegant way to change the config file?

I wouldnt like to create a shell sript with sed that changes the appripriate values for each and every properties.
I dont know much about nodeJS but I think that an object could be built up with the ffserver's config file's properties, changed at runtime and written back as a new config file, or just update the appropriate segments.

Thnaks

Last edited by kzo81; 09-22-2021 at 11:33 AM.
 
Old 09-23-2021, 01:57 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,792

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
a simple html page won't do that.
Probably this helps: https://unix.stackexchange.com/quest...m-from-website
 
Old 09-24-2021, 03:59 PM   #3
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by kzo81 View Post
Hi,

I'd like to be able to set the /etc/ffserver.conf file's parameters from a web UI.

The hardware is a Raspberry Pi and a drone controller which has a USB cable attached to the RPI.

My goal is to be able to set the resolutions at runtime from the Rpi's web interface (NGinX)

This is the html skeleton:

Code:
<!DOCTYPE html>
<html>
<body>


<label for="resolutions">Resolutions:</label>

<select id="resolutions">
  <option value="640x480">SD</option>
  <option value="1024x768">HD</option>
  <option value="1920x1080">Full HD</option>
</select>

<button type="button" onclick="alert('Hello world!')">Apply</button>
  
</body>
</html>
I'd like the config file's line:

VideoSize 640x480

be changed when the Apply button is pressed and restart the systemd service. It doesnt matter if the web server runs as root. Do you have an easy and elegant way to change the config file?

I wouldnt like to create a shell sript with sed that changes the appripriate values for each and every properties.
I dont know much about nodeJS but I think that an object could be built up with the ffserver's config file's properties, changed at runtime and written back as a new config file, or just update the appropriate segments.

Thnaks
What is ffserver? What are you trying to achieve here?
Thnaks.
 
Old 09-26-2021, 01:26 AM   #4
kzo81
Member
 
Registered: Aug 2014
Location: Hungary
Distribution: Debian, Linux Mint, CentOS
Posts: 197

Original Poster
Rep: Reputation: Disabled
I'd like to be able to set the /etc/ffserver.conf file from the web interface.
But I dont know ho to do this. I really dot like php, its an old rusty thing.

Something like this:

Here is an example ffserver config file: https://raw.githubusercontent.com/fh.../ffserver.conf


Code:
<!DOCTYPE html>
<html>
<body>

    <script>
        function changePort(){
            var port = document.getElementById("ports").value;
                       
            if(1024 <= port && port <= 65535){

                try {
                    var fs = require('fs')
                    fs.readFile('ffserver.conf', 'utf-8', function(err, data){
                    
                        var result = data.replace(/Port [0-9]*/g, 'Port ' + port);
            
                        fs.writeFile('ffserver.conf', result, 'utf-8', function(err){
                            if(err) return console.log(err);
                        });
                    });
                } catch (error) {
                    console.error(error);
                }
            }    
        }
    </script>

<label for="ports">Streaming Ports:</label>

<select id="ports">
  <option value="554">RTSP</option>
  <option value="8080">HTTP</option>
</select>

<button type="button" onclick="changePort()">Set</button>
  
</body>
</html>

Last edited by kzo81; 09-29-2021 at 03:23 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ffserver ffmpeg live stream from webcam Micah Linux - Software 2 08-31-2011 08:50 PM
Streaming mp3 with ffmeg and ffserver Dan_1983 Linux - General 1 04-21-2011 04:04 AM
does ffserver support RTSP ? maverick18t Linux - Software 7 02-27-2010 08:45 AM
FFserver syrushcw *BSD 0 05-21-2008 09:44 AM
Can't we use ffserver to stream mpeg,rm files? tuxfood Linux - Software 0 01-05-2006 01:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration