Recherche avancée

Médias (91)

Autres articles (30)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

  • 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 (...)

  • Installation en mode ferme

    4 février 2011, par

    Le mode ferme permet d’héberger plusieurs sites de type MediaSPIP en n’installant qu’une seule fois son noyau fonctionnel.
    C’est la méthode que nous utilisons sur cette même plateforme.
    L’utilisation en mode ferme nécessite de connaïtre un peu le mécanisme de SPIP contrairement à la version standalone qui ne nécessite pas réellement de connaissances spécifique puisque l’espace privé habituel de SPIP n’est plus utilisé.
    Dans un premier temps, vous devez avoir installé les mêmes fichiers que l’installation (...)

Sur d’autres sites (4856)

  • How can I create a write stream for res for a child_process.spawn method as it says cp.spawn().pipe(res) is not a method

    11 juin 2022, par niishaaant
    const express = require('express');
const router = express.Router();
const ytdl = require('ytdl-core');
const cp = require('child_process');
const ffmpeg = require('ffmpeg-static');

router.get('/', async (req, res) => {
    const { v, f, q } = req.query;
    if (!ytdl.validateID(v) && !ytdl.validateURL(v)) {
        return res
            .status(400)
            .json({ success: false, error: 'No valid YouTube Id!' });
    }
    try {
        let info = await ytdl.getInfo(v);

        //set format and title
        // const title = info.videoDetails.title;
        // res.setHeader('Content-disposition', contentDisposition(`${title}${f}`));

        //define audio and video stream seperately and download them
        const audio = ytdl(v, { quality: 'highestaudio' }).on(
            'progress',
            (_, downloaded, total) => {
                console.log({ downloaded, total });
            }
        );
        let format = ytdl.chooseFormat(info.formats, { quality: q });
        const video = ytdl(v, { format }).on('progress', (_, downloaded, total) => {
            console.log({ downloaded, total });
        });

        const ffmpegProcess = cp
            .spawn(
                ffmpeg,
                [
                    // Remove ffmpeg's console spamming
                    '-loglevel',
                    '8',
                    '-hide_banner',
                    // Redirect/Enable progress messages
                    '-progress',
                    'pipe:3',
                    // Set inputs
                    '-i',
                    'pipe:4',
                    '-i',
                    'pipe:5',
                    // Map audio & video from streams
                    '-map',
                    '0:a',
                    '-map',
                    '1:v',
                    // Keep encoding
                    '-c:v',
                    'copy',
                    // Define output file
                    `out.${f}`,
                ],
                {
                    windowsHide: true,
                    stdio: [
                        /* Standard: stdin, stdout, stderr */
                        'inherit',
                        'inherit',
                        'inherit',
                        /* Custom: pipe:3, pipe:4, pipe:5 */
                        'pipe',
                        'pipe',
                        'pipe',
                    ],
                }
            )
            .on('close', () => {
                console.log('done');
            });

        // Link streams
        // FFmpeg creates the transformer streams and we just have to insert / read data
        ffmpegProcess.stdio[3].on('data', (chunk) => {
            // Parse the param=value list returned by ffmpeg
            const lines = chunk.toString().trim().split('\n');
            const args = {};
            for (const l of lines) {
                const [key, value] = l.split('=');
                args[key.trim()] = value.trim();
            }
        });
        audio.pipe(ffmpegProcess.stdio[4]);
        video.pipe(ffmpegProcess.stdio[5]);
    } catch (error) {
        res.status(400);
        console.log('error ', error);
    }
});

module.exports = router;


    


    


    I am trying to create a youtube downloader app and this is the code for downloading a video using the ytdl and ffmpeg packages in an express route but i don't know how i can download the result (out.mp4) for the client. when I try to pipe it to res error occurs saying cp.spawn().pipe() is not a method.

    


    


  • FFmpeg + HTTP Images - How to recover from lost connection ?

    20 juin 2019, par user11588722

    I have a command which works very well, but stops dead if the connection is lost for even a second. The images are remotely hosted. Is there a way to prevent the command from completely stopping ? Maybe make it continue after the connection comes back ?

    ffmpeg -y -f concat -safe 0 -protocol_whitelist "file,http,https,tcp,tls" -i "Temp/images.txt" -i "Assets/screen.png" -i "Temp/audio.mp3" -filter_complex "[0]scale=3840x2160,zoompan=z='if(lte(zoom,1.0),1.2,max(1.001,zoom-0.0010))':x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)':fps=15:d=200[p];[p][1]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2, drawtext=fontfile=Assets/Fonts/Heathergreen.otf:text='%%~ni':fontcolor=black:fontsize=32:x=90:y=582[v];[2:a]showwaves=mode=cline:s=110x36:r=15:scale=sqrt:colors=0x222222,colorkey=0x000000:0.01:0.1,format=yuva420p[w];[v][w]overlay=77:444,scale=1280:720[outv]" -map "[outv]" -map 2:a -c:v libx264 -c:a aac -preset ultrafast -shortest "Temp/video.mp4"

    I’ve tried looking into FFmpeg documentation and tried timeouts and other options, but either they don’t work or (more likely) I’m doing something wrong.
    Any advice would be appreciated. Thank you.

  • Automatically fade audio

    25 mars 2019, par Nadav Tasher

    I have a working script that plays a different audio every 45 minutes.

    The audio files change on a daily basis, so i cant manually fade them in/out in Audacity.

    In the script, i have the following line :

    ffplay -i /home/user/Ringtone1.mp3 -ss 00:00:7 -t 20 -nodisp -autoexit

    But every time, the audio cuts abruptly after 20 seconds, which isn’t very ear-pleasing.

    I want to make the audio fade in from 0 to max in 5 seconds and then fade out from max to 0 in 5 seconds (at the end of the 20 seconds).

    How can i do that ?