Recherche avancée

Médias (1)

Mot : - Tags -/MediaSPIP 0.2

Autres articles (95)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

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

  • Le plugin : Gestion de la mutualisation

    2 mars 2010, par

    Le plugin de Gestion de mutualisation permet de gérer les différents canaux de mediaspip depuis un site maître. Il a pour but de fournir une solution pure SPIP afin de remplacer cette ancienne solution.
    Installation basique
    On installe les fichiers de SPIP sur le serveur.
    On ajoute ensuite le plugin "mutualisation" à la racine du site comme décrit ici.
    On customise le fichier mes_options.php central comme on le souhaite. Voilà pour l’exemple celui de la plateforme mediaspip.net :
    < ?php (...)

Sur d’autres sites (9408)

  • How to fix here "EPIPE" in Node js Socket.io

    23 avril, par Mehdi008

    Receiving this error :

    &#xA;

    Error: write EPIPE&#xA;        at afterWriteDispatched (node:internal/stream_base_commons:161:15)&#xA;        at writeGeneric (node:internal/stream_base_commons:152:3)&#xA;        at Socket._writeGeneric (node:net:958:11)&#xA;        at Socket._write (node:net:970:8)&#xA;        at doWrite (node:internal/streams/writable:598:12)&#xA;        at clearBuffer (node:internal/streams/writable:783:7)&#xA;        at onwrite (node:internal/streams/writable:653:7)&#xA;        at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:107:10)&#xA;    Emitted &#x27;error&#x27; event on Socket instance at:&#xA;        at emitErrorNT (node:internal/streams/destroy:169:8)&#xA;        at emitErrorCloseNT (node:internal/streams/destroy:128:3)&#xA;        at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {&#xA;      errno: -4047,&#xA;      code: &#x27;EPIPE&#x27;,&#xA;      syscall: &#x27;write&#x27;&#xA;    }&#xA;

    &#xA;

    // for this code: const { spawn } = require("child_process");&#xA;&#xA;module.exports = (socket, pool) => {&#xA;    &#xA;    let stream_req_token = "";&#xA;    let rtmps_array = [];&#xA;&#xA;    socket.on("stream_request_token",async(token)=>{&#xA;&#xA;        const stream_reqs = await pool`SELECT * FROM stream_request WHERE token=${token}`;&#xA;&#xA;&#xA;        if(stream_reqs.length === 0){&#xA;            &#xA;            socket.emit("token_validation_response",false);&#xA;            return;&#xA;        }&#xA;&#xA;        const stream_req = stream_reqs[0];&#xA;&#xA;        if(!stream_req.is_valid){&#xA;&#xA;            socket.emit("token_validation_response",false);&#xA;            return;&#xA;        }&#xA;&#xA;        socket.emit("token_validation_response",true);&#xA;&#xA;        stream_req_token = token;&#xA;&#xA;&#xA;    })&#xA;&#xA;    socket.on("rtmps_array",async(array)=>{&#xA;&#xA;        try{&#xA;&#xA;            const rtmps = JSON.parse(array);&#xA;&#xA;        const streams_requests = await pool`SELECT id FROM stream_request WHERE token=${stream_req_token}`;&#xA;        const stream_req_id = streams_requests[0].id;&#xA;&#xA;        rtmps_array = rtmps;&#xA;&#xA;        rtmps.map(async(rtmp)=>{&#xA;&#xA;            await pool`INSERT INTO stream (platform,url,url_key,stream_request_id) &#xA;            VALUES(${rtmp.platform},${rtmp.url},${rtmp.key},${stream_req_id})`;&#xA;        })&#xA;&#xA;        socket.emit("rtmps_array_response",true);&#xA;&#xA;        } catch(err){&#xA;&#xA;            console.log(err);&#xA;            socket.emit("rtmps_array_response",false);&#xA;&#xA;        }&#xA;&#xA;&#xA;    })&#xA;&#xA;    //Start Streaming&#xA;    let ffmpegProcess = null;&#xA;    let isStreaming = false; // Flag to track streaming state&#xA;&#xA;  socket.on("stream", (chunk) => {&#xA;    if (!ffmpegProcess) {&#xA;        console.log(&#x27;Initializing FFmpeg process...&#x27;);&#xA;&#xA;        // Spawn FFmpeg process&#xA;        const resolution = "1280x720"; // Change to "1920x1080" for 1080p&#xA;&#xA;        const ffmpegArgs = [&#xA;            "-i", "pipe:0", // Input from stdin&#xA;            "-c:v", "libx264", // Video codec&#xA;            "-preset", "veryfast", // Low latency encoding&#xA;            "-b:v", "4500k", // Target average bitrate (4.5 Mbps)&#xA;            "-minrate", "2500k", // Minimum bitrate&#xA;            "-maxrate", "6000k", // Maximum bitrate&#xA;            "-bufsize", "16000k", // Buffer size (twice the max bitrate)&#xA;            "-r", "30", // **FORCE 30 FPS**&#xA;            "-g", "60", // Keyframe interval (every 2 seconds)&#xA;            "-tune", "zerolatency", // Low latency tuning&#xA;            "-sc_threshold", "0", // Constant bitrate enforcement&#xA;            "-flags", "&#x2B;global_header",&#xA;          &#xA;            // **Resolution Fix**&#xA;            "-s", resolution, // **Set resolution to 720p or 1080p**&#xA;            "-aspect", "16:9", // **Maintain aspect ratio**&#xA;            &#xA;            // **Frame Rate Fix**&#xA;            "-vsync", "cfr", // **Forces Constant Frame Rate (CFR)**&#xA;            "-fps_mode", "cfr", // **Prevents FFmpeg from auto-adjusting FPS**&#xA;            &#xA;            // Audio settings&#xA;            "-c:a", "aac",&#xA;            "-b:a", "128k", // Audio bitrate&#xA;            "-ar", "44100", // Audio sample rate&#xA;            "-ac", "2", // Stereo audio&#xA;          &#xA;            "-f", "flv" // Output format&#xA;          ];&#xA;      &#xA;          // Map the streams to multiple RTMP destinations&#xA;          rtmps_array.forEach((rtmp) => {&#xA;            ffmpegArgs.push("-map", "0:v:0", "-map", "0:a:0", "-f", "flv", `${rtmp.url}/${rtmp.key}`);&#xA;          });&#xA;      &#xA;          // Spawn FFmpeg process&#xA;          ffmpegProcess = spawn("ffmpeg", ffmpegArgs);&#xA;&#xA;        ffmpegProcess.stderr.on(&#x27;data&#x27;, (data) => {&#xA;            console.log(`FFmpeg STDERR: ${data}`);&#xA;    });&#xA;&#xA;        ffmpegProcess.on(&#x27;close&#x27;, (code) => {&#xA;            console.log(`FFmpeg process closed with code ${code}`);&#xA;            ffmpegProcess = null; // Reset process&#xA;            isStreaming = false; // Reset streaming state&#xA;        });&#xA;&#xA;        ffmpegProcess.on(&#x27;error&#x27;, (err) => {&#xA;            console.error(`FFmpeg process error: ${err.message}`);&#xA;            ffmpegProcess = null; // Reset process&#xA;            isStreaming = false; // Reset streaming state&#xA;        });&#xA;&#xA;        console.log(&#x27;FFmpeg process started.&#x27;);&#xA;        isStreaming = true; // Set streaming state to true&#xA;    }&#xA;&#xA;    // Write chunk to FFmpeg process&#xA;    if (isStreaming &amp;&amp; ffmpegProcess &amp;&amp; ffmpegProcess.stdin &amp;&amp; !ffmpegProcess.stdin.destroyed) {&#xA;        try {&#xA;            ffmpegProcess.stdin.write(chunk); // Write chunk to stdin&#xA;            console.log(&#x27;Chunk written to FFmpeg.&#x27;);&#xA;        } catch (err) {&#xA;            console.error(&#x27;Error writing chunk to FFmpeg stdin:&#x27;, err.message);&#xA;        }&#xA;    } else {&#xA;        console.error(&#x27;FFmpeg process or stdin is not ready.&#x27;);&#xA;    }&#xA;});&#xA;&#xA;socket.on("stop-stream", async() => {&#xA;    console.log(&#x27;Stream Stopped.&#x27;);&#xA;&#xA;    if(stream_req_token.length !== 0){&#xA;&#xA;        await pool`UPDATE stream_request &#xA;               SET is_valid=false&#xA;               WHERE token=${stream_req_token}`&#xA;&#xA;        await pool`DELETE FROM current_streams WHERE id=${stream_req_token}`;       &#xA;    }&#xA;&#xA;    if (ffmpegProcess) {&#xA;        isStreaming = false; // Set streaming state to false&#xA;&#xA;        try {&#xA;            // Check if stdin is open before closing&#xA;            if (ffmpegProcess.stdin) {&#xA;                ffmpegProcess.stdin.end(); // End stdin safely&#xA;            }&#xA;&#xA;            // Wait for FFmpeg to close before setting to null&#xA;            ffmpegProcess.on("close", () => {&#xA;                console.log("FFmpeg process closed.");&#xA;                ffmpegProcess = null;&#xA;            });&#xA;&#xA;            // Kill FFmpeg process&#xA;            ffmpegProcess.kill("SIGTERM"); // Use SIGTERM for graceful exit&#xA;&#xA;        } catch (err) {&#xA;            console.error("Error while stopping FFmpeg:", err.message);&#xA;        }&#xA;    } else {&#xA;        console.log("No active FFmpeg process.");&#xA;    }&#xA;});&#xA;&#xA;&#xA;socket.on(&#x27;error&#x27;, (err) => {&#xA;  console.error(&#x27;Socket error:&#x27;, err);&#xA;});&#xA;&#xA;socket.on("disconnect", async() => {&#xA;    console.log(&#x27;Client Disconnected.&#x27;);&#xA;&#xA;    if(stream_req_token.length !== 0){&#xA;&#xA;        await pool`UPDATE stream_request &#xA;               SET is_valid=false&#xA;               WHERE token=${stream_req_token}`;&#xA;&#xA;        await pool`DELETE FROM current_streams WHERE id=${stream_req_token}`;       &#xA;&#xA;    }&#xA;    &#xA;    if (ffmpegProcess) {&#xA;        isStreaming = false; // Set streaming state to false&#xA;&#xA;        try {&#xA;            // Check if stdin is open before closing&#xA;            if (ffmpegProcess.stdin) {&#xA;                ffmpegProcess.stdin.end(); // End stdin safely&#xA;            }&#xA;&#xA;            // Wait for FFmpeg to close before setting to null&#xA;            ffmpegProcess.on("close", () => {&#xA;                console.log("FFmpeg process closed.");&#xA;                ffmpegProcess = null;&#xA;            });&#xA;&#xA;            // Kill FFmpeg process&#xA;            ffmpegProcess.kill("SIGTERM"); // Use SIGTERM for graceful exit&#xA;&#xA;&#xA;        } catch (err) {&#xA;            console.error("Error while stopping FFmpeg:", err.message);&#xA;        }&#xA;    } else {&#xA;        console.log("No active FFmpeg process.");&#xA;    }&#xA;});&#xA;&#xA;};&#xA;

    &#xA;

    &#xA;

  • Is there a way to convert HLS stream into RTSP stream by FFMPEG ?

    19 août 2021, par k0342

    I have a hls stream which i am tying to convert into an rtsp stream so that i can use it further in a gstreamer application. Actually I could have used the hls stream itself but since the stream is secured and have session token, I am facing issues ingesting with souphttpsrc and demuxng with hlsdemux. As a backup, I want to explore a solution with ffmpeg otherwise I will have to use opencv to write frames in a gstreamer pipeline via appsrc.

    &#xA;

    I was able to convert the hls stream into a container format file by going through some sample examples, but I could not find any sample example on rtsp stream conversion. Since I am new to ffmpeg, If any one has a working solution for it, It would be very helpful.

    &#xA;

    Thanks in advance.

    &#xA;

  • How to save variables at start of script for use later if script needs to be re-run due to errors or bad user input

    28 novembre 2023, par slyfox1186

    I have a script that uses GitHub's API to get the latest version number of the repositories that I am trying to download and then compile.

    &#xA;

    Due to the fact that without using a specialized token from GitHub you are only allowed 50 API calls a day vs the 5000 a day with the API user token.

    &#xA;

    I want to be able to parse all of the repositories and grab the version numbers that my script will then import into the code up front so in case someone who accidentally cancels the build in the middle of it (for who knows what reasons) wont have to eat up their 50 day API call allowance.

    &#xA;

    Essentially, store each repo's version number, if the user then needs to rerun the script and version numbers that have been saved so far will be skipped (thus eliminating an API call) and any numbers that are still needing to be sourced will be called and then stored for used in the script.

    &#xA;

    I am kinda of lost for a method on how to go about this.

    &#xA;

    Maybe some sort of external file can be generated ?

    &#xA;

    So what my script does is it builds FFmpeg from source code and all of the external libraries that you can link to it are also built from their latest source code.

    &#xA;

    The code calls the function git_ver_fn and passes arguments to it which are parsed inside the function and directed to another functions git_1_fn or git_2_fn which passed those parsed arguments that have been passed on to the CURL command which changes the URL based on the arguments passed. It uses the jq command to capture the GitHub version number and download link for the tar.gz file.

    &#xA;

    It is the version number I am and trying to figure out the best way to store in case the script fails and has to be rerun, which will eat up all of the 50 APT limit that GitHub imposes without a token. I can't post my token in the script because GitHub deactivates it and thus the users will be SOL if they need to run the script more than once.

    &#xA;

    curl_timeout=&#x27;5&#x27;&#xA;&#xA;git_1_fn()&#xA;{&#xA;    # SCRAPE GITHUB WEBSITE FOR LATEST REPO VERSION&#xA;    github_repo="$1"&#xA;    github_url="$2"&#xA;&#xA;    if curl_cmd="$(curl -m "$curl_timeout" -sSL "https://api.github.com/repos/$github_repo/$github_url")"; then&#xA;        g_ver="$(echo "$curl_cmd" | jq -r &#x27;.[0].name&#x27;)"&#xA;        g_ver="${g_ver#v}"&#xA;        g_ssl="$(echo "$curl_cmd" | jq -r &#x27;.[0].name&#x27;)"&#xA;        g_ssl="${g_ssl#OpenSSL }"&#xA;        g_pkg="$(echo "$curl_cmd" | jq -r &#x27;.[0].name&#x27;)"&#xA;        g_pkg="${g_pkg#pkg-config-}"&#xA;        g_url="$(echo "$curl_cmd" | jq -r &#x27;.[0].tarball_url&#x27;)"&#xA;    fi&#xA;}&#xA;&#xA;git_2_fn()&#xA;{&#xA;    videolan_repo="$1"&#xA;    videolan_url="$2"&#xA;    if curl_cmd="$(curl -m "$curl_timeout" -sSL "https://code.videolan.org/api/v4/projects/$videolan_repo/repository/$videolan_url")"; then&#xA;        g_ver="$(echo "$curl_cmd" | jq -r &#x27;.[0].commit.id&#x27;)"&#xA;        g_sver="$(echo "$curl_cmd" | jq -r &#x27;.[0].commit.short_id&#x27;)"&#xA;        g_ver1="$(echo "$curl_cmd" | jq -r &#x27;.[0].name&#x27;)"&#xA;        g_ver1="${g_ver1#v}"&#xA;    fi&#xA;}&#xA;&#xA;git_ver_fn()&#xA;{&#xA;    local v_flag v_tag url_tag&#xA;&#xA;    v_url="$1"&#xA;    v_tag="$2"&#xA;&#xA;    if [ -n "$3" ]; then v_flag="$3"; fi&#xA;&#xA;    if [ "$v_flag" = &#x27;B&#x27; ] &amp;&amp; [  "$v_tag" = &#x27;2&#x27; ]; then&#xA;        url_tag=&#x27;git_2_fn&#x27; gv_url=&#x27;branches&#x27;&#xA;    fi&#xA;&#xA;    if [ "$v_flag" = &#x27;X&#x27; ] &amp;&amp; [  "$v_tag" = &#x27;5&#x27; ]; then&#xA;        url_tag=&#x27;git_5_fn&#x27;&#xA;    fi&#xA;&#xA;    if [ "$v_flag" = &#x27;T&#x27; ] &amp;&amp; [  "$v_tag" = &#x27;1&#x27; ]; then&#xA;        url_tag=&#x27;git_1_fn&#x27; gv_url=&#x27;tags&#x27;&#xA;    elif [ "$v_flag" = &#x27;T&#x27; ] &amp;&amp; [  "$v_tag" = &#x27;2&#x27; ]; then&#xA;        url_tag=&#x27;git_2_fn&#x27; gv_url=&#x27;tags&#x27;&#xA;    fi&#xA;&#xA;    if [ "$v_flag" = &#x27;R&#x27; ] &amp;&amp; [  "$v_tag" = &#x27;1&#x27; ]; then&#xA;        url_tag=&#x27;git_1_fn&#x27;; gv_url=&#x27;releases&#x27;&#xA;    elif [ "$v_flag" = &#x27;R&#x27; ] &amp;&amp; [  "$v_tag" = &#x27;2&#x27; ]; then&#xA;        url_tag=&#x27;git_2_fn&#x27;; gv_url=&#x27;releases&#x27;&#xA;    fi&#xA;&#xA;    case "$v_tag" in&#xA;        2)          url_tag=&#x27;git_2_fn&#x27;;;&#xA;    esac&#xA;&#xA;    "$url_tag" "$v_url" "$gv_url" 2>/dev/null&#xA;}&#xA;&#xA;# begin source code building&#xA;git_ver_fn &#x27;freedesktop/pkg-config&#x27; &#x27;1&#x27; &#x27;T&#x27;&#xA;if build &#x27;pkg-config&#x27; "$g_pkg"; then&#xA;    download "https://pkgconfig.freedesktop.org/releases/$g_ver.tar.gz" "$g_ver.tar.gz"&#xA;    execute ./configure --silent --prefix="$workspace" --with-pc-path="$workspace"/lib/pkgconfig/ --with-internal-glib&#xA;    execute make -j "$cpu_threads"&#xA;    execute make install&#xA;    build_done &#x27;pkg-config&#x27; "$g_pkg"&#xA;fi&#xA;&#xA;git_ver_fn &#x27;yasm/yasm&#x27; &#x27;1&#x27; &#x27;T&#x27;&#xA;if build &#x27;yasm&#x27; "$g_ver"; then&#xA;    download "https://github.com/yasm/yasm/releases/download/v$g_ver/yasm-$g_ver.tar.gz" "yasm-$g_ver.tar.gz"&#xA;    execute ./configure --prefix="$workspace"&#xA;    execute make -j "$cpu_threads"&#xA;    execute make install&#xA;    build_done &#x27;yasm&#x27; "$g_ver"&#xA;fi&#xA;

    &#xA;