Recherche avancée

Médias (91)

Autres articles (52)

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

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

Sur d’autres sites (8120)

  • Cannot merge audio and video streams from ytdl-core

    20 août 2022, par Abhigyan Kumar

    I am trying to merge ytdl-core video only and audio only streams and sending the merged stream are response to user (for download in browser). With JavaScript only, its working perfectly fine. But typeScript is saying child process stdio is undefined

    


    import express, { Request } from "express";
import ytdl from "ytdl-core";
import cp from "child_process";
import ffmpeg from "ffmpeg-static";    
app.get("/downloadmerged", (req, res) => {
res.setHeader("Content-Type", "video/mp4");
res.setHeader(
  `Content-Disposition`,
  `attachment; filename="Merged.mp4"`
);
  const ref = "https://www.youtube.com/watch?v=aR-KAldshAE";
  const audio = ytdl(ref, { filter: "audioonly", quality: "highestaudio" });
  const video = ytdl(ref, { filter: "videoonly", quality: "highestvideo" });
  const ffmpegProcess = cp.spawn(
    ffmpeg,
    [
      // Remove ffmpeg's console spamming
      "-loglevel",
      "0",
      "-hide_banner",
      // 3 second audio offset
      "-itsoffset",
      "3.0",
      "-i",
      "pipe:3",
      "-i",
      "pipe:4",
      // Rescale the video
      "-vf",
      "scale=320:240",
      // Choose some fancy codes
      "-c:v",
      "libx265",
      "-x265-params",
      "log-level=0",
      "-c:a",
      "flac",
      // Define output container
      "-f",
      "matroska",
      "pipe:5",
    ],
    {
      windowsHide: true,
      stdio: [
        /* Standard: stdin, stdout, stderr */
        "inherit",
        "inherit",
        "inherit",
        /* Custom: pipe:3, pipe:4, pipe:5 */
        "pipe",
        "pipe",
        "pipe",
      ],
    }
  );
  ffmpegProcess.on("close", () => {
    process.stdout.write("\n\n\n");
    console.log("done");
  });
 
  audio.pipe(ffmpegProcess.stdio[3]);
  video.pipe(ffmpegProcess.stdio[4]);
  ffmpegProcess.stdio[5].pipe(res);
});


    


    line ffmpegProcess.stdio[3] and ffmpegProcess.stdio[4] are giving type error

    


    Argument of type 'Readable | Writable | null | undefined' is not assignable to parameter of type 'WritableStream'.Type 'undefined' is not assignable to type 'WritableStream'

  


    


  • How to store output of ffmpeg in a variable using NodeJS / execFile and ffmpeg ?

    22 août 2022, par Radespy

    I'm running an Electron app which uses the 'ffmpeg-static-electron' package to process a local video file.

    


    I am trying to store the output as a buffer in a variable for subsequent processing.

    


    Using IPC, I can successfully execute the following in the main.js file (running Node), which produces a cropped video file.

    


    const { execFile } = require("child-process")
const ffmpeg = require("ffmpeg-static-electron")

ipcMain.on("crop_video", () => {

execFile(
    `${ffmpeg.path}`,
    [
      "-i",
      `${testVideoCropPath}`,
      "-filter:v",
      `crop=600:600:100:100`,
      "-preset",
      "fast",
      "-progress",
      "pipe:1",
      `${path.join(desktopDirPath, "cropped-video.mp4")}`,
    ],
    (error, stdout, stderr) => {
      if (error) {
        console.error("stderr", stderr);
        throw error;
      }
      console.log("Success", stdout);
    }
  );
})


    


    Here's the output :

    


    Success frame=238
[1] fps=0.0
...
[1] dup_frames=0
[1] drop_frames=0
[1] speed=8.23x
[1] progress=end


    


    What I wish to do is to store the cropped-video as a buffer in a variable.

    


    To experiment, I tried :

    


    ipcMain.on("crop_video", () => {

const test = execFile(
    `${ffmpeg.path}`,
    [
      "-i",
      `${testVideoCropPath}`,
      "-filter:v",
      `crop=600:600:100:100`,
      "-preset",
      "fast",
      `${path.join(desktopDirPath, "cropped-video.mp4")}`,
       "pipe:1",
    ],
    (error, stdout, stderr) => {
      if (error) {
        console.error("stderr", stderr);
        throw error;
      }
      console.log("Success", stdout);
    }
  );

   test.on('data', (data) => {console.log(typeof data)}
})


    


    Which doesn't print anything to the console.

    


    How can I access sdout in buffer format ?

    


    Is there a way to store the output with something like :

    


    test.on('data', (data)=> {
let var = Buffer.from(data)})


    


    Thanks.

    


  • MediaStream WebM to HLS server

    2 septembre 2022, par DNS

    I'm trying to create my custom stream server like Twitch.

    


    For this, I'm using mediastream from mediaapi to get the camera buffer and send it to my HLS server with WebSockets and MediaRecorder.

    


    this.mediaRecorder = new MediaRecorder(this.stream, {
    mimeType: 'video/webm',
});
this.mediaRecorder.ondataavailable = async (event) => {
    const ab = await event.data.arrayBuffer();
    const message = {
        title: 'dataUserCameraAudioVideo',
        data: Array.from(new Uint8Array(ab))
    };
    this.mediaSocket.send(JSON.stringify(message));
};
this.mediaRecorder.start(1000);


    


    So now I send the buffer (which is working very well), I try to transcode it into hls file with ffmpeg. For this I use child process of nodejs.

    


    const ffmpeg = ChildProcess.spawn('ffmpeg', ffmpegArgs());

ffmpeg.on('close', (code, signal) => {
    console.log('FFmpeg child process closed, code ' + code + ', signal ' + signal);
}); 

function ffmpegArgs(iceUrl) {
    const args = [
        '-i','-',
        '-f', 'hls',
        '-hls_time', '4',
        'output.m3u8'
    ];
    return args;
}


    


    I don't understand why my child process is closing :

    


    output from ffmpeg :

dataUserCameraAudioVideo
dataUserCameraAudioVideo
dataUserCameraAudioVideo
dataUserCameraAudioVideo
dataUserCameraAudioVideo
dataUserCameraAudioVideo
FFmpeg child process closed, code 1, signal null


    


    Of course I don't have any output.m3u8 created. Are my ffmpeg args wrong ?