Recherche avancée

Médias (0)

Mot : - Tags -/tags

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (34)

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

  • Ajouter notes et légendes aux images

    7 février 2011, par

    Pour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
    Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
    Modification lors de l’ajout d’un média
    Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

Sur d’autres sites (3914)

  • 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;

  • after restarting the page in the browser, the player stops loading

    28 juillet 2024, par Uximy

    I have a problem which is that when I start icecast server on ubuntu and not only on ubuntu but also on windows regardless of the operating system, when I first go to the radio station in icecast2 http://localhost:8000/radio the music plays but after restarting the page in the browser, the player stops loading, I tried the solution with nocache in the browser in the address bar, nothing helps, I looked at many users configs, they did not encounter such problems, I will leave my config below, I also wrote a code on nodejs I will also leave it below, the problem plays the same that if I go to a direct icecast link, what I will do through the node js code + ffmpeg, also about the logs, nothing outputs even a hint of any error that is related to this problem

    &#xA;

    Config IceCast :

    &#xA;

    <icecast>&#xA;    <location>Earth</location>&#xA;    <admin>icemaster@localhost</admin>&#xA;    <hostname>localhost</hostname>&#xA;&#xA;    <limits>&#xA;        <clients>100</clients>&#xA;        <sources>10</sources>&#xA;        524288&#xA;        60&#xA;        30&#xA;        10&#xA;        1&#xA;        65536&#xA;    </limits>&#xA;&#xA;    <authentication>&#xA;        hackme&#xA;        hackme&#xA;        admin&#xA;        hackme&#xA;    </authentication>&#xA;&#xA;    &#xA;        <port>8000</port>&#xA;        0.0.0.0&#xA;    &#xA;    &#xA;    &#xA;        <port>8443</port>&#xA;        0.0.0.0&#xA;        <ssl>1</ssl>&#xA;    &#xA;&#xA;    &#xA;        <header value="*"></header>&#xA;        <header value="Origin, X-Requested-With, Content-Type, Accept"></header>&#xA;        <header value="GET, POST, OPTIONS"></header>&#xA;        <header value="no-cache, no-store, must-revalidate"></header>&#xA;        <header value="no-cache"></header>&#xA;        <header value="0"></header>&#xA;    &#xA;&#xA;    &#xA;    <mount type="normal">&#xA;        /radio&#xA;        <password>mypassword</password>&#xA;        <public>1</public>&#xA;        100&#xA;        Anime Vibes&#xA;        Anime Vibes&#xA;        <genre>various</genre>&#xA;        audio/ogg&#xA;        65536&#xA;        &#xA;        &#xA;            <header value="*"></header>&#xA;            <header value="Origin, X-Requested-With, Content-Type, Accept"></header>&#xA;            <header value="GET, POST, OPTIONS"></header>&#xA;            <header value="no-cache, no-store, must-revalidate"></header>&#xA;            <header value="no-cache"></header>&#xA;            <header value="0"></header>&#xA;        &#xA;    </mount>&#xA;&#xA;    <fileserve>1</fileserve>&#xA;&#xA;    <paths>&#xA;        <logdir>/var/log/icecast2</logdir>&#xA;        <webroot>/etc/icecast2/web</webroot>&#xA;        <adminroot>/etc/icecast2/admin</adminroot>&#xA;       &#xA;        <alias source="/" destination="/status.xsl"></alias>&#xA;        &#xA;        /etc/icecast2/cert/icecast.pem&#xA;        &#xA;    </paths>&#xA;&#xA;    <logging>&#xA;        <accesslog>access.log</accesslog>&#xA;        <errorlog>error.log</errorlog>&#xA;        <playlistlog>playlist.log</playlistlog>&#xA;        <loglevel>1</loglevel> &#xA;        <logsize>10000</logsize> &#xA;        <logarchive>1</logarchive>&#xA;    </logging>&#xA;</icecast>&#xA;

    &#xA;

    Code Node.js :

    &#xA;

    const express = require(&#x27;express&#x27;);&#xA;const { spawn } = require(&#x27;child_process&#x27;);&#xA;const path = require(&#x27;path&#x27;);&#xA;const fs = require(&#x27;fs&#x27;);&#xA;const https = require(&#x27;https&#x27;);&#xA;const app = express();&#xA;const port = 3000;&#xA;&#xA;const privateKey = fs.readFileSync(&#x27;./cert/privateKey.key&#x27;, &#x27;utf8&#x27;);&#xA;const certificate = fs.readFileSync(&#x27;./cert/certificate.crt&#x27;, &#x27;utf8&#x27;);&#xA;&#xA;const credentials = {&#xA;    key: privateKey,&#xA;    cert: certificate&#xA;};&#xA;&#xA;app.use(express.static(path.join(__dirname)));&#xA;&#xA;// Check if playlist file exists&#xA;const playlistPath = path.join(__dirname, &#x27;playlist.txt&#x27;);&#xA;if (!fs.existsSync(playlistPath)) {&#xA;    console.error(&#x27;Playlist file does not exist&#x27;);&#xA;    process.exit(1);&#xA;}&#xA;&#xA;console.log(`Playlist path: ${playlistPath}`);&#xA;&#xA;// Start FFmpeg process to create continuous stream from playlist&#xA;const ffmpegProcess = spawn(&#x27;ffmpeg&#x27;, [&#xA;    &#x27;-re&#x27;,&#xA;    &#x27;-f&#x27;, &#x27;concat&#x27;,&#xA;    &#x27;-safe&#x27;, &#x27;0&#x27;,&#xA;    &#x27;-protocol_whitelist&#x27;, &#x27;file,http,https,tcp,tls&#x27;,&#xA;    &#x27;-i&#x27;, playlistPath,&#xA;    &#x27;-c:a&#x27;, &#x27;libvorbis&#x27;,&#xA;    &#x27;-f&#x27;, &#x27;ogg&#x27;,&#xA;    &#x27;-tls&#x27;, &#x27;1&#x27;,&#xA;    &#x27;icecast://source:mypassword@localhost:8443/radio&#x27;&#xA;]);&#xA;&#xA;ffmpegProcess.stdout.on(&#x27;data&#x27;, (data) => {&#xA;    console.log(`FFmpeg stdout: ${data}`);&#xA;});&#xA;&#xA;ffmpegProcess.stderr.on(&#x27;data&#x27;, (data) => {&#xA;    console.error(`FFmpeg stderr: ${data}`);&#xA;});&#xA;&#xA;ffmpegProcess.on(&#x27;close&#x27;, (code) => {&#xA;    console.log(`FFmpeg process exited with code ${code}`);&#xA;});&#xA;&#xA;app.get(&#x27;/radio&#x27;, (req, res) => {&#xA;    res.setHeader(&#x27;Content-Type&#x27;, &#x27;audio/ogg&#x27;);&#xA;    res.setHeader(&#x27;Transfer-Encoding&#x27;, &#x27;chunked&#x27;);&#xA;&#xA;    const requestOptions = {&#xA;        hostname: &#x27;localhost&#x27;,&#xA;        port: 8443,&#xA;        path: &#x27;/radio&#x27;,&#xA;        method: &#x27;GET&#x27;,&#xA;        headers: {&#xA;            &#x27;Accept&#x27;: &#x27;audio/ogg&#x27;&#xA;        },&#xA;        rejectUnauthorized: false&#xA;    };&#xA;&#xA;    const request = https.request(requestOptions, (response) => {&#xA;        response.pipe(res);&#xA;&#xA;        response.on(&#x27;end&#x27;, () => {&#xA;            res.end();&#xA;        });&#xA;    });&#xA;&#xA;    request.on(&#x27;error&#x27;, (err) => {&#xA;        console.error(`Request error: ${err.message}`);&#xA;        res.status(500).send(&#x27;Internal Server Error&#x27;);&#xA;    });&#xA;&#xA;    request.end();&#xA;});&#xA;https.globalAgent.options.ca = [certificate];&#xA;// Create HTTPS server&#xA;const httpsServer = https.createServer(credentials, app);&#xA;&#xA;httpsServer.listen(port, () => {&#xA;    console.log(`Server is running at https://localhost:${port}`);&#xA;});&#xA;

    &#xA;

    I hope for your help and any advice, thanks in advance

    &#xA;

  • Generating test data – Introducing the Piwik Platform

    9 octobre 2014, par Thomas Steur — Development

    This is the next post of our blog series where we introduce the capabilities of the Piwik platform (our previous post was How to create a command). This time you’ll learn how to generate test data.

    Developers are developing on their local Piwik instance which usually does not contain useful data compared to a real Piwik installation in production (only a few test visits and a few tests users and websites). The ‘VisitorGenerator’ plugin lets you generate any number of visits, websites, users, goals and more. The generator makes sure there will be data for each report so you can easily test anything.

    Getting started

    In this series of posts, we assume that you have already installed Piwik. If not, visit the Piwik Developer Zone where you’ll find the Installation guide for developers.

    Installing the VisitorGenerator plugin

    The easiest way to install the plugin is by using the Marketplace in Piwik itself. It is accessible via Settings => Marketplace => Get new functionality. There you’ll find the plugin “VisitorGenerator” which you can install and activate in one click.

    If your Piwik instance is not connected to the internet you can download the plugin from the VisitorGenerator page on the Marketplace. Afterwards you can install the plugin by going to Settings => Marketplace => Uploading a plugin and uploading the previously downloaded ZIP file.

    If you have already installed the plugin make sure it is activated by going to Settings => Plugins.

    Generating websites

    After you have installed the plugin you can add as many websites as you need. This is useful for instance when you want to test something that affects many websites such as the ‘All Websites’ dashboard or the Websites manager. To generate any number of websites use the following command :

    ./console visitorgenerator:generate-website --limit=10

    This will generate 10 websites. If you need more websites simply specify a higher limit. In case you are wondering the names and URLs of the websites are randomly generated by the Faker PHP library.

    Generating goals

    In case you want to test anything related to Goals you should execute the following command :

    ./console visitorgenerator:generate-goals --idsite=1

    This will generate a few goals for the specified site. The generated goals are defined in a way to make sure there will be conversions when generating the visits in the next step.

    Generating visits

    To generate visits there are two possibilities. Either via the Piwik UI by going to Settings => Visitor Generator or by using the command line. The UI is a bit limited in generating visits so we recommend to use the command line. There you can generate visits as follows :

    ./console visitorgenerator:generate-visits --idsite=1

    This will generate many different visits for the current day. Don’t worry if it takes a while, it will insert quite a few visits by default.

    In case you want to generate visits for multiple days in the past as well you can specify the --days option.

    ./console visitorgenerator:generate-visits --idsite=1 --days=5

    Providing your own logs

    Half of the generated visits are randomly generated and half of the visits are based on real logs to make sure there is data for each report. If you want to generate visits based on your own logs for a more realistic testing just place your log files in the plugins/VisitorGenerator/data folder and make sure the file name ends with .log. You can find a few examples in the VisitorGenerator data folder.

    To generate visits based only on real log files then use the --no-fake option.

    ./console visitorgenerator:generate-visits --idsite=1 --no-fake

    All generated visits will come from the logs and no random visits nor random fake data will be used.

    Advanced features

    We are regularly adding new commands, tools and runtime checks to make your life as a developer easier. For instance you can also generate users and annotations. In the future we want to extend the plugin to create visits in the background to make sure there will be constantly new actions in the real time report.

    Are you missing any kind of generator or any other feature to make your life as a developer easier ? Let us know by email, we are listening !

    Would you like to know more about the Piwik platform ? Go to our Piwik Developer Zone where you’ll find guides and references on how to develop plugin and themes.