Recherche avancée

Médias (91)

Autres articles (21)

  • Selection of projects using MediaSPIP

    2 mai 2011, par

    The examples below are representative elements of MediaSPIP specific uses for specific projects.
    MediaSPIP farm @ Infini
    The non profit organizationInfini develops hospitality activities, internet access point, training, realizing innovative projects in the field of information and communication technologies and Communication, and hosting of websites. It plays a unique and prominent role in the Brest (France) area, at the national level, among the half-dozen such association. Its members (...)

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

  • Sélection de projets utilisant MediaSPIP

    29 avril 2011, par

    Les exemples cités ci-dessous sont des éléments représentatifs d’usages spécifiques de MediaSPIP pour certains projets.
    Vous pensez avoir un site "remarquable" réalisé avec MediaSPIP ? Faites le nous savoir ici.
    Ferme MediaSPIP @ Infini
    L’Association Infini développe des activités d’accueil, de point d’accès internet, de formation, de conduite de projets innovants dans le domaine des Technologies de l’Information et de la Communication, et l’hébergement de sites. Elle joue en la matière un rôle unique (...)

Sur d’autres sites (4015)

  • Streaming issues with HLS setup using Nginx and FFmpeg, and TS video files

    12 septembre 2024, par Jacob Anderson

    I've been working on setting up an HLS stream on my Raspberry Pi to broadcast video from a security camera that's physically connected to my Raspberry Pi through my web server, making it accessible via my website. The .ts video files and the .m3u8 playlist are correctly being served from /var/www/html/hls. However, when I attempt to load the stream on Safari (as well as other browsers), the video continuously appears to be loading without ever displaying any content.

    


    Here are some details about my setup :

    


      

    • Camera : I am using an Arducam 1080p Day & Night Vision USB Camera which is available on /dev/video0.
    • 


    • Server Configuration : I haven't noticed any errors in the Safari console or on the server logs. When I access the .ts files directly from the browser, they only show a black screen but they do play.
    • 


    


    Given the situation, I suspect there might be an issue with my FFmpeg command or possibly with my Nginx configuration.

    


    Here is what I have :

    


    ffmpeg stream service :
/etc/systemd/system/ffmpeg-stream.service

    


    [Unit]
Description=FFmpeg RTMP Stream
After=network.target

[Service]
ExecStart=/usr/local/bin/start_ffmpeg.sh
Restart=always
User=jacobanderson
Group=jacobanderson
StandardError=syslog
SyslogIdentifier=ffmpeg-stream
Environment=FFMPEG_LOGLEVEL=error

[Install]
WantedBy=multi-user.target


    


    ffmpeg command :
/usr/local/bin/start_ffmpeg.sh

    


    #!/bin/bash

/usr/bin/ffmpeg -f v4l2 -input_format mjpeg -video_size 1280x720 -framerate 30 -i /dev/video0 -vcodec libx264 -preset veryfast -acodec aac -strict -2 -f flv rtmp://localhost/live/


    


    nginx.conf :
/etc/nginx/nginx.conf

    


    user www-data;
worker_processes auto;
pid /run/nginx.pid;
error_log /var/log/nginx/error.log;
include /etc/nginx/modules-enabled/*.conf;

events {
    worker_connections 768;
    # multi_accept on;
}

rtmp {
    server {
        listen 1935;
        chunk_size 4096;
        #allow publish 127.0.0.1;
        #deny publish all;

    application live {
        #allow 192.168.0.100;
        live on;
        hls on;
        hls_path /var/www/html/hls;
        hls_fragment 3;
        hls_nested on; 
        #hls_fragment_naming stream;
        hls_playlist_length 120;
        hls_cleanup on;
        hls_continuous on;
        #deny play all;
    }
    }
}

http {
    ##
    # Basic Settings
    ##

    sendfile on;
    #sendfile off;
    tcp_nopush on;
    types_hash_max_size 2048;
    # server_tokens off;

    # Additional for video
    directio 512;

    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ##
    # SSL Settings
    ##

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
    #ssl_protocols TLSv1.2 TLSv1.3; # Use only secure protocols
    ssl_prefer_server_ciphers on;
    #ssl_ciphers "HIGH:!aNULL:!MD5";

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    ##
    # Gzip Settings
    ##

    #gzip on;
    gzip off;  # Ensure gzip is off for HLS

    ##
    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}


    


    sites-available :
/etc/nginx/sites-available/myStream.mysite.com

    


    server {
    listen 443 ssl;
    server_name myStream.mysite.com;

    ssl_certificate /etc/letsencrypt/live/myStream.mysite.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/myStream.mysite.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

    location / {
        root /var/www/html/hls;
        index index.html;
    }

    location /hls {
        # Password protection
        auth_basic "Restricted Content";
        auth_basic_user_file /etc/nginx/.htpasswd;

        # Disable cache
        add_header Cache-Control no-cache;

        # CORS setup
        add_header 'Access-Control-Allow-Origin' '*' always;
        add_header 'Access-Control-Expose-Headers' 'Content-Length';

        # Allow CORS preflight requests
        if ($request_method = 'OPTIONS') {
            add_header 'Access-Control-Allow-Origin' '*';
            add_header 'Access-Control-Max-Age' 1728000;
            add_header 'Content-Type' 'text/plain charset=UTF-8';
            add_header 'Content-Length' 0;
            return 204;
        }

        types {
            application/vnd.apple.mpegurl m3u8;
            video/mp2t ts;
        text/html html;
        text/css css;
        }

    root /var/www/html;
    }
}

server {
    listen 80;
    server_name myStream.mysite.com;

    if ($host = myStream.mysite.com) {
        return 301 https://$host$request_uri;
    }

    return 404; # managed by Certbot
}


    


    index.html :
/var/www/html/hls/index.html

    


    &#xA;&#xA;&#xA;    &#xA;    &#xA;    &#xA;    &#xA;    <code class="echappe-js">&lt;script src='http://stackoverflow.com/feeds/tag/js/hls.min.js'&gt;&lt;/script&gt;&#xA;&#xA;&#xA;    &#xA;        &#xA;    &#xA;    &#xA;&#xA;    &lt;script src=&quot;https://vjs.zencdn.net/7.10.2/video.js&quot;&gt;&lt;/script&gt;&#xA;    &lt;script&gt;&amp;#xA;        if (Hls.isSupported()) {&amp;#xA;            var video = document.getElementById(&amp;#x27;my-video_html5_api&amp;#x27;); // Updated ID to target the correct video element&amp;#xA;            var hls = new Hls();&amp;#xA;            hls.loadSource(&amp;#x27;https://myStream.mysite.com/hls/index.m3u8&amp;#x27;);&amp;#xA;            hls.attachMedia(video);&amp;#xA;            hls.on(Hls.Events.MANIFEST_PARSED,function() {&amp;#xA;                video.play();&amp;#xA;            });&amp;#xA;        } else if (video.canPlayType(&amp;#x27;application/vnd.apple.mpegurl&amp;#x27;)) {&amp;#xA;            video.src = &amp;#x27;https://myStream.mysite.com/hls/index.m3u8&amp;#x27;;&amp;#xA;            video.addEventListener(&amp;#x27;loadedmetadata&amp;#x27;, function() {&amp;#xA;                video.play();&amp;#xA;            });&amp;#xA;        }&amp;#xA;    &lt;/script&gt;&#xA;&#xA;&#xA;

    &#xA;

    Has anyone experienced similar issues or can spot an error in my configuration ? Any help would be greatly appreciated as I have already invested over 30 hours trying to resolve this.

    &#xA;

  • Very slow writes on MySQL 8 - waiting for handler commit

    23 mai 2023, par Akshat Goel

    I have MySQL 8 docker installation installed on an edge device which has the following two tables to write to

    &#xA;

    video_paths | CREATE TABLE `video_paths` (&#xA;  `entry` int(11) NOT NULL AUTO_INCREMENT,&#xA;  `timestamp` bigint(20) NOT NULL,&#xA;  `duration` int(11) NOT NULL,&#xA;  `path` varchar(255) NOT NULL,&#xA;  `motion` int(11) NOT NULL DEFAULT &#x27;0&#x27;,&#xA;  `cam_id` varchar(255) NOT NULL DEFAULT &#x27;&#x27;,&#xA;  `hd` tinyint(1) NOT NULL DEFAULT &#x27;0&#x27;,&#xA;  PRIMARY KEY (`entry`),&#xA;  KEY `cam_id` (`cam_id`),&#xA;  KEY `timestamp` (`timestamp`)&#xA;) ENGINE=InnoDB AUTO_INCREMENT=7342309 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci&#xA;

    &#xA;

    AND

    &#xA;

    CREATE TABLE `tracker` (&#xA;  `id` int(11) NOT NULL AUTO_INCREMENT,&#xA;  `table_name` varchar(255) NOT NULL,&#xA;  `primary_key_name` varchar(255) NOT NULL,&#xA;  `pointer` int(11) NOT NULL DEFAULT &#x27;0&#x27;,&#xA;  PRIMARY KEY (`id`),&#xA;  UNIQUE KEY `table_name` (`table_name`)&#xA;) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci&#xA;

    &#xA;

    The following queries are run every few secs for up to 32 cameras and are taking a lot of time as indicated by the slow query log.

    &#xA;

    UPDATE tracker SET pointer = 7342046 WHERE table_name = &#x27;video_paths&#x27;&#xA;&#xA;INSERT INTO video_paths (timestamp,duration,path,cam_id,hd) VALUES (1597548365000,5000,&#x27;/s/ss/x-0/v/2020-08-16/3/1.ts&#x27;,&#x27;x-1&#x27;,1)&#xA;&#xA;

    &#xA;

    Most of the time is spent in the waiting for handler commit state

    &#xA;

    The total size of my data (tables + index) is 1GB and I have the following settings enabled to optimise for write

    &#xA;

    skip-log-bin - Disabled the bin log because I don't have a replica and therefore no use for it&#xA;innodb_flush_log_at_trx_commit =2 - I am Optimising for performance rather than consistency here.&#xA;range_optimizer_max_mem_size =0 As mention in this question, I have allowed max memory to range optimiser.&#xA;inndo_buffer_pool_size= 512Mb - This should be enough for my data ?.
    &#xA;innodb_log_file_size= 96Mb *2 files

    &#xA;

    I am seeing queries that are taking up to 90-100 secs sometimes.

    &#xA;

    SET timestamp=1597549337;&#xA;INSERT INTO video_paths (timestamp,duration,path,cam_id,hd) VALUES (1597548365000,5000,&#x27;/s/ss/x-0/v/2020-08-16/3/1.ts&#x27;,&#x27;x-1&#x27;,1);&#xA;# Time: 2020-08-16T03:42:24.533408Z&#xA;# Query_time: 96.712976  Lock_time: 0.000033 Rows_sent: 0  Rows_examined: 0&#xA;

    &#xA;

    ---UPDATE---&#xA;Here's the complete my.cnf file

    &#xA;

    my.cnf&#xA;&#xA;[mysqld]&#xA;pid-file        = /var/run/mysqld/mysqld.pid&#xA;socket          = /var/run/mysqld/mysqld.sock&#xA;datadir         = /var/lib/mysql&#xA;secure-file-priv= NULL&#xA;# Disabling symbolic-links is recommended to prevent assorted security risks&#xA;symbolic-links=0&#xA;&#xA;skip-log-bin&#xA;innodb_buffer_pool_size=536870912&#xA;innodb_log_file_size=100663296&#xA;&#xA;# Custom config should go here&#xA;!includedir /etc/mysql/conf.d/&#xA;&#xA;conf.d/docker.cnf &#xA;[mysqld]&#xA;skip-host-cache&#xA;skip-name-resolve &#xA;

    &#xA;

    The docker container is using the host mode so complete 15GB memory is available to the container.

    &#xA;

    --- UPDATE 2 ---&#xA;After increasing the innodb_buffer_pool_size to 2GB as suggested by @fyrye, the statements have now started getting stuck on STATE = UPDATE instead of waiting for handler commit.

    &#xA;

    ---- UPDATE 3 ---&#xA;Looks like the CPU is causing the bottleneck&#xA;enter image description here

    &#xA;

    ** ---- UPDATE 4 ---- **&#xA;Additional info

    &#xA;

      &#xA;
    1. Ram Size
    2. &#xA;

    &#xA;

                  total        used        free      shared  buff/cache   available&#xA;Mem:          15909        1711        9385        2491        4813       11600&#xA;Swap:             0           0           0&#xA;

    &#xA;

      &#xA;
    1. No SSD/NVMe devices attached
    2. &#xA;

    3. SHOW GLOBAL STATUS - https://pastebin.com/vtWi0PUq
    4. &#xA;

    5. SHOW GLOBAL VARIABLES - https://pastebin.com/MUZeG959
    6. &#xA;

    7. SHOW FULL PROCESSLIST - https://pastebin.com/eebEcYk7
    8. &#xA;

    9. htop - htop here is for the edge system which has 4 other containers running which include the main app, ffmpeg, mqtt, etc.&#xA;enter image description here
    10. &#xA;

    11. ulimit -a :
    12. &#xA;

    &#xA;

    core file size          (blocks, -c) 0&#xA;data seg size           (kbytes, -d) unlimited&#xA;scheduling priority             (-e) 0&#xA;file size               (blocks, -f) unlimited&#xA;pending signals                 (-i) 62576&#xA;max locked memory       (kbytes, -l) 64&#xA;max memory size         (kbytes, -m) unlimited&#xA;open files                      (-n) 1024&#xA;pipe size            (512 bytes, -p) 8&#xA;POSIX message queues     (bytes, -q) 819200&#xA;real-time priority              (-r) 0&#xA;stack size              (kbytes, -s) 8192&#xA;cpu time               (seconds, -t) unlimited&#xA;max user processes              (-u) 62576&#xA;virtual memory          (kbytes, -v) unlimited&#xA;file locks                      (-x) unlimited&#xA;

    &#xA;

      &#xA;
    1. opstat -xm 5 4
    2. &#xA;

    &#xA;

    Linux 4.15.0-106-generic (xxxx)    08/18/2020  _x86_64_    (4 CPU)&#xA;&#xA;avg-cpu:  %user   %nice %system %iowait  %steal   %idle&#xA;         26.97    0.00   22.36   22.53    0.00   28.14&#xA;&#xA;Device:         rrqm/s   wrqm/s     r/s     w/s    rMB/s    wMB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util&#xA;loop0             0.00     0.00    0.00    0.00     0.00     0.00     3.20     0.00    2.40    2.40    0.00   0.00   0.00&#xA;sda              13.78     9.89   32.24   11.44     0.37     4.10   209.51    47.52 1079.07   44.07 3994.87  22.39  97.81&#xA;&#xA;avg-cpu:  %user   %nice %system %iowait  %steal   %idle&#xA;         19.71    0.00   27.85   40.87    0.00   11.57&#xA;&#xA;Device:         rrqm/s   wrqm/s     r/s     w/s    rMB/s    wMB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util&#xA;loop0             0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00&#xA;sda               0.00     0.00    1.40    4.60     0.03     2.71   934.93   142.66 24221.33  666.29 31390.26 166.67 100.00&#xA;&#xA;avg-cpu:  %user   %nice %system %iowait  %steal   %idle&#xA;         20.16    0.00   26.77   28.30    0.00   24.77&#xA;&#xA;Device:         rrqm/s   wrqm/s     r/s     w/s    rMB/s    wMB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util&#xA;loop0             0.00     0.00    0.00    0.00     0.00     0.00     0.00     0.00    0.00    0.00    0.00   0.00   0.00&#xA;sda               0.00     0.00    8.80    5.60     0.03     3.45   496.11   141.28 12507.78  194.00 31858.00  69.44 100.00&#xA;

    &#xA;

      &#xA;
    1. mpstat -P ALL 5 3
    2. &#xA;

    &#xA;

    Linux 4.15.0-106-generic (sn-1f0ce8)    08/18/2020  _x86_64_    (4 CPU)&#xA;&#xA;02:15:47 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle&#xA;02:15:52 PM  all   21.48    0.00   20.40   29.01    0.00    7.94    0.00    0.00    0.00   21.17&#xA;02:15:52 PM    0   24.95    0.00   20.86    5.32    0.00    0.61    0.00    0.00    0.00   48.26&#xA;02:15:52 PM    1   17.59    0.00   18.81   57.67    0.00    5.93    0.00    0.00    0.00    0.00&#xA;02:15:52 PM    2   21.28    0.00   17.36    0.21    0.00   24.79    0.00    0.00    0.00   36.36&#xA;02:15:52 PM    3   22.34    0.00   24.59   52.46    0.00    0.61    0.00    0.00    0.00    0.00&#xA;&#xA;02:15:52 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle&#xA;02:15:57 PM  all   20.56    0.00   20.00   28.26    0.00    7.08    0.00    0.00    0.00   24.10&#xA;02:15:57 PM    0   24.44    0.00   18.89   12.32    0.00    0.21    0.00    0.00    0.00   44.15&#xA;02:15:57 PM    1   17.73    0.00   15.46   33.20    0.00    4.95    0.00    0.00    0.00   28.66&#xA;02:15:57 PM    2   18.93    0.00   22.22   12.35    0.00   22.84    0.00    0.00    0.00   23.66&#xA;02:15:57 PM    3   21.06    0.00   23.31   55.21    0.00    0.41    0.00    0.00    0.00    0.00&#xA;&#xA;02:15:57 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle&#xA;02:16:02 PM  all   21.81    0.00   18.32   26.42    0.00    7.03    0.00    0.00    0.00   26.42&#xA;02:16:02 PM    0   26.43    0.00   19.67    0.20    0.00    0.41    0.00    0.00    0.00   53.28&#xA;02:16:02 PM    1   20.57    0.00   17.11   45.21    0.00    5.30    0.00    0.00    0.00   11.81&#xA;02:16:02 PM    2   19.67    0.00   16.74    0.21    0.00   21.97    0.00    0.00    0.00   41.42&#xA;02:16:02 PM    3   20.45    0.00   19.84   58.91    0.00    0.81    0.00    0.00    0.00    0.00&#xA;&#xA;Average:     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle&#xA;Average:     all   21.28    0.00   19.57   27.90    0.00    7.35    0.00    0.00    0.00   23.90&#xA;Average:       0   25.27    0.00   19.81    5.94    0.00    0.41    0.00    0.00    0.00   48.57&#xA;Average:       1   18.63    0.00   17.13   45.39    0.00    5.39    0.00    0.00    0.00   13.45&#xA;Average:       2   19.96    0.00   18.78    4.28    0.00   23.20    0.00    0.00    0.00   33.77&#xA;Average:       3   21.28    0.00   22.57   55.54    0.00    0.61    0.00    0.00    0.00    0.00&#xA;

    &#xA;

  • I received connection refused error while trying to stream live video through RTMP with FFMPEG

    25 septembre 2020, par Femzy

    I am working on a nodeJs app that can send camera stream to third party plartform i.e Facebook and Youtube using the RTMP protoco ;.. It works well on my localhost but once i deploy to the server, it only give me errors. The error I get is below on this content..&#xA;Here is my codes

    &#xA;

    server.js

    &#xA;

    &#xD;&#xA;
    &#xD;&#xA;
    const child_process = require(&#x27;child_process&#x27;); // To be used later for running FFmpeg&#xA;const express = require(&#x27;express&#x27;);&#xA;const http = require(&#x27;http&#x27;);&#xA;const WebSocketServer = require(&#x27;ws&#x27;).Server;&#xA;&#xA;const app = express();&#xA;const server = http.createServer(app).listen(4000, () => {&#xA;  console.log(&#x27;Listening...&#x27;);&#xA;});&#xA;&#xA;// Serve static files out of the www directory, where we will put our HTML page&#xA;app.use(express.static(__dirname &#x2B; &#x27;/www&#x27;));&#xA;&#xA;&#xA;const wss = new WebSocketServer({&#xA;  server: server&#xA;});&#xA;wss.on(&#x27;connection&#x27;, (ws, req) => {&#xA;  &#xA;  &#xA;  &#xA;  const rtmpUrl = &#x27;rtmp://a.rtmp.youtube.com/live2/MyStreamId&#x27;;&#xA;  console.log(&#x27;Target RTMP URL:&#x27;, rtmpUrl);&#xA;  &#xA;  // Launch FFmpeg to handle all appropriate transcoding, muxing, and RTMP.&#xA;  // If &#x27;ffmpeg&#x27; isn&#x27;t in your path, specify the full path to the ffmpeg binary.&#xA;  const ffmpeg = child_process.spawn(&#x27;ffmpeg&#x27;, [&#xA;    // Facebook requires an audio track, so we create a silent one here.&#xA;    // Remove this line, as well as `-shortest`, if you send audio from the browser.&#xA;    //&#x27;-f&#x27;, &#x27;lavfi&#x27;, &#x27;-i&#x27;, &#x27;anullsrc&#x27;,&#xA;    &#xA;    // FFmpeg will read input video from STDIN&#xA;    &#x27;-i&#x27;, &#x27;-&#x27;,&#xA;    &#xA;    // Because we&#x27;re using a generated audio source which never ends,&#xA;    // specify that we&#x27;ll stop at end of other input.  Remove this line if you&#xA;    // send audio from the browser.&#xA;    //&#x27;-shortest&#x27;,&#xA;    &#xA;    // If we&#x27;re encoding H.264 in-browser, we can set the video codec to &#x27;copy&#x27;&#xA;    // so that we don&#x27;t waste any CPU and quality with unnecessary transcoding.&#xA;    // If the browser doesn&#x27;t support H.264, set the video codec to &#x27;libx264&#x27;&#xA;    // or similar to transcode it to H.264 here on the server.&#xA;    &#x27;-vcodec&#x27;, &#x27;copy&#x27;,&#xA;    &#xA;    // AAC audio is required for Facebook Live.  No browser currently supports&#xA;    // encoding AAC, so we must transcode the audio to AAC here on the server.&#xA;    &#x27;-acodec&#x27;, &#x27;aac&#x27;,&#xA;    &#xA;    // FLV is the container format used in conjunction with RTMP&#xA;    &#x27;-f&#x27;, &#x27;flv&#x27;,&#xA;    &#xA;    // The output RTMP URL.&#xA;    // For debugging, you could set this to a filename like &#x27;test.flv&#x27;, and play&#xA;    // the resulting file with VLC.  Please also read the security considerations&#xA;    // later on in this tutorial.&#xA;    rtmpUrl &#xA;  ]);&#xA;  &#xA;  // If FFmpeg stops for any reason, close the WebSocket connection.&#xA;  ffmpeg.on(&#x27;close&#x27;, (code, signal) => {&#xA;    console.log(&#x27;FFmpeg child process closed, code &#x27; &#x2B; code &#x2B; &#x27;, signal &#x27; &#x2B; signal);&#xA;    ws.terminate();&#xA;  });&#xA;  &#xA;  // Handle STDIN pipe errors by logging to the console.&#xA;  // These errors most commonly occur when FFmpeg closes and there is still&#xA;  // data to write.  If left unhandled, the server will crash.&#xA;  ffmpeg.stdin.on(&#x27;error&#x27;, (e) => {&#xA;    console.log(&#x27;FFmpeg STDIN Error&#x27;, e);&#xA;  });&#xA;  &#xA;  // FFmpeg outputs all of its messages to STDERR.  Let&#x27;s log them to the console.&#xA;  ffmpeg.stderr.on(&#x27;data&#x27;, (data) => {&#xA;    console.log(&#x27;FFmpeg STDERR:&#x27;, data.toString());&#xA;  });&#xA;&#xA;  // When data comes in from the WebSocket, write it to FFmpeg&#x27;s STDIN.&#xA;  ws.on(&#x27;message&#x27;, (msg) => {&#xA;    console.log(&#x27;DATA&#x27;, msg);&#xA;    ffmpeg.stdin.write(msg);&#xA;  });&#xA;  &#xA;  // If the client disconnects, stop FFmpeg.&#xA;  ws.on(&#x27;close&#x27;, (e) => {&#xA;    ffmpeg.kill(&#x27;SIGINT&#x27;);&#xA;  });&#xA;  &#xA;});

    &#xD;&#xA;

    &#xD;&#xA;

    &#xD;&#xA;&#xA;

    On the server.js file i create a websocket to receive stream data from the client side and then use FFMPEG to send the stream data over to youtube via the RTMP url

    &#xA;

    Here is my client.js code

    &#xA;

    &#xD;&#xA;
    &#xD;&#xA;
    const ws = new WebSocket(&#xA;             &#x27;wss://my-websocket-server.com&#x27;&#xA;&#xA;        );&#xA;         ws.addEventListener(&#x27;open&#x27;, (e) => {&#xA;             console.log(&#x27;WebSocket Open&#x27;, e);&#xA;             drawVideosToCanvas();&#xA;             mediaStream = getMixedVideoStream(); // 30 FPS&#xA;             mediaRecorder = new MediaRecorder(mediaStream, {&#xA;               mimeType: &#x27;video/webm;codecs=h264&#x27;,&#xA;               //videoBitsPerSecond : 3000000000&#xA;               bitsPerSecond: 6000000&#xA;             });&#xA;&#xA;             mediaRecorder.addEventListener(&#x27;dataavailable&#x27;, (e) => {&#xA;               ws.send(e.data);&#xA;             });&#xA;             mediaRecorder.onstop = function() {&#xA;              ws.close.bind(ws);&#xA;              isRecording = false;&#xA;              actionBtn.textContent = &#x27;Start Streaming&#x27;;&#xA;              actionBtn.onclick = startRecording;&#xA;             }&#xA;             mediaRecorder.onstart = function() {&#xA;              isRecording = true;&#xA;              actionBtn.textContent = &#x27;Stop Streaming&#x27;;&#xA;              actionBtn.onclick = stopRecording;&#xA;              screenShareBtn.onclick = startSharing;&#xA;              screenShareBtn.disabled = false;&#xA;             }&#xA;             //mediaRecorder.addEventListener(&#x27;stop&#x27;, ws.close.bind(ws));&#xA;&#xA;             mediaRecorder.start(1000); // Start recording, and dump data every second&#xA;&#xA;           });

    &#xD;&#xA;

    &#xD;&#xA;

    &#xD;&#xA;&#xA;

    On my client.js file, i captured users camera and then open the websocket server to send the data to the server.. Every thing works fine on local host expect for when i deploy it to live server..&#xA;i am wondering if there is a bad configuration on the server.. The server is Centos 7.8 and the app was runing on Apache software&#xA;Here is how i configured the virtual host for the websocket domain

    &#xA;

    &#xD;&#xA;
    &#xD;&#xA;
    ServerName my-websocket.com&#xA;&#xA;  RewriteEngine on&#xA;  RewriteCond %{HTTP:Upgrade} websocket [NC]&#xA;  RewriteCond %{HTTP:Connection} upgrade [NC]&#xA;  RewriteRule .* "ws://127.0.0.1:3000/$1" [P,L]&#xA;&#xA;  ProxyPass "/" "http://127.0.0.1:3000/$1"&#xA;  ProxyPassReverse "/" "http://127.0.0.1:3000/$1"&#xA;  ProxyRequests off

    &#xD;&#xA;

    &#xD;&#xA;

    &#xD;&#xA;&#xA;

    I don't know much about server configuration but i just thought may be the configuration has to do with why FFMPEg can not open connection to RTMP protocol on the server.

    &#xA;

    here is the error am getting

    &#xA;

    &#xD;&#xA;
    &#xD;&#xA;
    FFmpeg STDERR: Input #0, lavfi, from &#x27;anullsrc&#x27;:&#xA;  Duration:&#xA;FFmpeg STDERR: N/A, start: 0.000000, bitrate: 705 kb/s&#xA;    Stream #0:0: Audio: pcm_u8, 44100 Hz, stereo, u8, 705 kb/s&#xA;&#xA;DATA <buffer 1a="1a">&#xA;DATA <buffer 45="45" df="df" a3="a3" 42="42" 86="86" 81="81" 01="01" f7="f7" f2="f2" 04="04" f3="f3" 08="08" 82="82" 88="88" 6d="6d" 61="61" 74="74" 72="72" 6f="6f" 73="73" 6b="6b" 87="87" 0442="0442" 85="85" 02="02" 18="18" 53="53" 80="80" 67="67" ff="ff" 53991="53991" more="more" bytes="bytes">&#xA;DATA <buffer 40="40" c1="c1" 81="81" 00="00" f0="f0" 80="80" 7b="7b" 83="83" 3e="3e" 3b="3b" 07="07" d6="d6" 4e="4e" 1c="1c" 11="11" b4="b4" 7f="7f" cb="cb" 5e="5e" 68="68" 9b="9b" d5="d5" 2a="2a" e3="e3" 06="06" c6="c6" f3="f3" 94="94" ff="ff" 29="29" 16="16" b2="b2" 60="60" 04ac="04ac" 37="37" fb="fb" 1a="1a" 15="15" ea="ea" 39="39" a0="a0" cd="cd" 02="02" b8="b8" 56206="56206" more="more" bytes="bytes">&#xA;FFmpeg STDERR: Input #1, matroska,webm, from &#x27;pipe:&#x27;:&#xA;  Metadata:&#xA;    encoder         :&#xA;FFmpeg STDERR: Chrome&#xA;  Duration: N/A, start: 0.000000, bitrate: N/A&#xA;    Stream #1:0(eng): Audio: opus, 48000 Hz, mono, fltp (default)&#xA;    Stream #1:1(eng): Video: h264 (Constrained Baseline), yuv420p(progressive), 1366x768, SAR 1:1 DAR 683:384, 30.30 fps, 30 tbr, 1k tbn, 60 tbc (default)&#xA;&#xA;FFmpeg STDERR: [tcp @ 0xe5fac0] Connection to tcp://a.rtmp.youtube.com:1935 failed (Connection refused), trying next address&#xA;[rtmp @ 0xe0fb80] Cannot open connection tcp://a.rtmp.youtube.com:1935&#xA;&#xA;FFmpeg STDERR: rtmp://a.rtmp.youtube.com/live2/mystreamid: Network is unreachable&#xA;&#xA;FFmpeg child process closed, code 1, signal null</buffer></buffer></buffer>

    &#xD;&#xA;

    &#xD;&#xA;

    &#xD;&#xA;&#xA;

    I will really appreciate if I could get some insight on what may be causing this issue or what i can do to solve it..Thanks in advance..

    &#xA;