Recherche avancée

Médias (0)

Mot : - Tags -/page unique

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

Autres articles (34)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • Librairies et logiciels spécifiques aux médias

    10 décembre 2010, par

    Pour un fonctionnement correct et optimal, plusieurs choses sont à prendre en considération.
    Il est important, après avoir installé apache2, mysql et php5, d’installer d’autres logiciels nécessaires dont les installations sont décrites dans les liens afférants. Un ensemble de librairies multimedias (x264, libtheora, libvpx) utilisées pour l’encodage et le décodage des vidéos et sons afin de supporter le plus grand nombre de fichiers possibles. Cf. : ce tutoriel ; FFMpeg avec le maximum de décodeurs et (...)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

Sur d’autres sites (5373)

  • How to Correctly Implement ffmpeg Complex Filters in Node.js for Image Processing ?

    24 janvier 2024, par Luke

    Problem :

    


    I am trying to add filters and transitions between my image slideshow array, and am struggling to apply the proper filters. For example, I get errors like this :

    


    {&#xA;  "errorType": "Error",&#xA;  "errorMessage": "ffmpeg exited with code 234: Failed to set value &#x27;fade=type=in:start_time=0:duration=1,zoompan=z=zoom&#x2B;0.002:d=120:x=if(gte(zoom,1.2),x,x&#x2B;1):y=if(gte(zoom,1.2),y,y&#x2B;1)&#x27; for option &#x27;filter_complex&#x27;: Invalid argument\nError parsing global options: Invalid argument\n",&#xA;  "trace": [&#xA;    "Error: ffmpeg exited with code 234: Failed to set value &#x27;fade=type=in:start_time=0:duration=1,zoompan=z=zoom&#x2B;0.002:d=120:x=if(gte(zoom,1.2),x,x&#x2B;1):y=if(gte(zoom,1.2),y,y&#x2B;1)&#x27; for option &#x27;filter_complex&#x27;: Invalid argument",&#xA;    "Error parsing global options: Invalid argument",&#xA;    "",&#xA;    "    at ChildProcess.<anonymous> (/opt/nodejs/node_modules/fluent-ffmpeg/lib/processor.js:182:22)",&#xA;    "    at ChildProcess.emit (node:events:517:28)",&#xA;    "    at ChildProcess._handle.onexit (node:internal/child_process:292:12)"&#xA;  ]&#xA;}&#xA;</anonymous>

    &#xA;

    Lambda Function Code :

    &#xA;

     async function concat(bucketName, imageKeys) {&#xA;      const imageStreams = await Promise.all(&#xA;        imageKeys.map(async (key, i) => {&#xA;          const command = new GetObjectCommand({ Bucket: bucketName, Key: key });&#xA;          const response = await s3.send(command);&#xA;          // Define the temporary file path based on the index&#xA;          const tempFilePath = `/tmp/${i}.png`;&#xA;    &#xA;          // Write the image data to the temporary file&#xA;          await fs.writeFile(tempFilePath, response.Body);&#xA;    &#xA;          // Return the file path to be used later&#xA;          return tempFilePath;&#xA;        })&#xA;      );&#xA;    &#xA;      // Create a file list content with durations&#xA;      let fileContent = "";&#xA;      for (let i = 0; i &lt; imageStreams.length; i&#x2B;&#x2B;) {&#xA;        fileContent &#x2B;= `file &#x27;${imageStreams[i]}&#x27;\nduration 1\n`;&#xA;    &#xA;        // Check if it&#x27;s the last image, and if so, add it again&#xA;        if (i === imageStreams.length - 1) {&#xA;          fileContent &#x2B;= `file &#x27;${imageStreams[i]}&#x27;\nduration 1\n`;&#xA;        }&#xA;      }&#xA;    &#xA;      // Define the file path for the file list&#xA;      const fileListPath = "/tmp/file_list.txt";&#xA;    &#xA;      // Write the file list content to the file&#xA;      await fs.writeFile(fileListPath, fileContent);&#xA;    &#xA;      try {&#xA;        await fs.writeFile(fileListPath, fileContent);&#xA;      } catch (error) {&#xA;        console.error("Error writing file list:", error);&#xA;        throw error;&#xA;      }&#xA;    &#xA;      // Create a complex filter to add zooms and pans&#xA;      // Simplified filter example&#xA;  let complexFilter = [&#xA;    // Example of a fade transition&#xA;    {&#xA;      filter: &#x27;fade&#x27;,&#xA;      options: { type: &#x27;in&#x27;, start_time: 0, duration: 1 },&#xA;      inputs: &#x27;0:v&#x27;, // first video stream&#xA;      outputs: &#x27;fade0&#x27;&#xA;    },&#xA;    // Example of dynamic zoompan&#xA;    {&#xA;      filter: &#x27;zoompan&#x27;,&#xA;      options: {&#xA;        z: &#x27;zoom&#x2B;0.002&#x27;,&#xA;        d: 120, // duration for this image&#xA;        x: &#x27;if(gte(zoom,1.2),x,x&#x2B;1)&#x27;, // dynamic x position&#xA;        y: &#x27;if(gte(zoom,1.2),y,y&#x2B;1)&#x27; // dynamic y position&#xA;      },&#xA;      inputs: &#x27;fade0&#x27;,&#xA;      outputs: &#x27;zoom0&#x27;&#xA;    }&#xA;    // Continue adding filters for each image&#xA;  ];&#xA;&#xA;  let filterString = complexFilter&#xA;    .map(&#xA;      (f) =>&#xA;        `${f.filter}=${Object.entries(f.options)&#xA;          .map(([key, value]) => `${key}=${value}`)&#xA;          .join(":")}`&#xA;    )&#xA;    .join(",");&#xA;    &#xA;      let filterString = complexFilter&#xA;        .map(&#xA;          (f) =>&#xA;            `${f.filter}=${Object.entries(f.options)&#xA;              .map(([key, value]) => `${key}=${value}`)&#xA;              .join(":")}`&#xA;        )&#xA;        .join(",");&#xA;    &#xA;      console.log("Filter String:", filterString);&#xA;    &#xA;      return new Promise((resolve, reject) => {&#xA;        ffmpeg()&#xA;          .input(fileListPath)&#xA;          .complexFilter(filterString)&#xA;          .inputOptions(["-f concat", "-safe 0"])&#xA;          .outputOptions("-c copy")&#xA;          .outputOptions("-c:v libx264")&#xA;          .outputOptions("-pix_fmt yuv420p")&#xA;          .outputOptions("-r 30")&#xA;          .on("end", () => {&#xA;            resolve();&#xA;          })&#xA;          .on("error", (err) => {&#xA;            console.error("Error during video concatenation:", err);&#xA;            reject(err);&#xA;          })&#xA;          .saveToFile("/tmp/output.mp4");&#xA;      });&#xA;    }&#xA;

    &#xA;

    Filter String Console Log :

    &#xA;

    Filter String: fade=type=in:start_time=0:duration=1,zoompan=z=zoom&#x2B;0.002:d=120:x=if(gte(zoom,1.2),x,x&#x2B;1):y=if(gte(zoom,1.2),y,y&#x2B;1)&#xA;

    &#xA;

    Questions :

    &#xA;

      &#xA;
    1. What is the correct syntax for implementing complex filters like zoompan and fade in ffmpeg when used in a Node.js environment ?
    2. &#xA;

    3. How do I ensure the filters are applied correctly to each image in the sequence ?
    4. &#xA;

    5. Is there a better way to dynamically generate these filters based on the number of images or their content ?
    6. &#xA;

    &#xA;

    Any insights or examples of correctly implementing this would be greatly appreciated !

    &#xA;

  • How do I merge images and an audio file into a single video ?

    3 janvier 2024, par Anil

    I am creating a web application using next js.&#xA;I want to create a video by combining three images and an audio track in such a way that each image is displayed for an equal duration that collectively matches the length of the audio. It will all happen locally on the browser.

    &#xA;

    This is my code for converting images and audio into a video.

    &#xA;

    import {FFmpeg} from &#x27;@ffmpeg/ffmpeg&#x27;;&#xA;import { fetchFile, toBlobURL } from &#x27;@ffmpeg/util&#x27;;&#xA;&#xA;&#xA;export async function createVideo(ImageFiles, audioFile) {&#xA;&#xA;  try {&#xA;    const baseURL = &#x27;https://unpkg.com/@ffmpeg/core@0.12.4/dist/umd&#x27;;&#xA;    const ffmpeg = new FFmpeg({ log: true});&#xA;&#xA;    console.log(&#x27;Loading ffmpeg core&#x27;);&#xA;    await ffmpeg.load({&#xA;      corePath: await toBlobURL(`${baseURL}/ffmpeg-core.js`, &#x27;text/javascript&#x27;),&#xA;      wasmPath: await toBlobURL(`${baseURL}/ffmpeg-core.wasm`, &#x27;application/wasm&#x27;),&#xA;    });&#xA;    await ffmpeg.load();&#xA;    console.log(&#x27;Finished loading ffmpeg core&#x27;);&#xA;&#xA;    for (let i = 0; i &lt; ImageFiles.length; i&#x2B;&#x2B;) {&#xA;      ffmpeg.writeFile(&#xA;        `image${i&#x2B;1}.jpg`,&#xA;        await fetchFile(ImageFiles[i].imageUrl)&#xA;      );&#xA;    }&#xA;&#xA;    ffmpeg.FS(&#x27;writeFile&#x27;, &#x27;audio.mp3&#x27;, await fetchFile(audioFile));&#xA;&#xA;&#xA;    const durationPerImage = (await getAudioDuration(ffmpeg, &#x27;audio.mp3&#x27;)) / ImageFiles.length;&#xA;    let filterComplex = &#x27;&#x27;;&#xA;    for (let i = 0; i &lt; ImageFiles.length - 1; i&#x2B;&#x2B;) {filterComplex &#x2B;= `[${i}:v]trim=duration=${durationPerImage},setpts=PTS-STARTPTS[v${i}]; `;&#xA;    }&#xA;    filterComplex &#x2B;= `${ImageFiles.slice(0, -1).map((_, i) => `[v${i}]`).join(&#x27;&#x27;)}concat=n=${ImageFiles.length - 1}:v=1:a=0,format=yuv420p[v];`;&#xA;&#xA;    await ffmpeg.run(&#xA;      &#x27;-framerate&#x27;, &#x27;1&#x27;, &#x27;-loop&#x27;, &#x27;1&#x27;, &#x27;-t&#x27;, durationPerImage, &#x27;-i&#x27;, &#x27;image%d.jpg&#x27;, &#x27;-i&#x27;, &#x27;audio.mp3&#x27;,&#xA;      &#x27;-filter_complex&#x27;, filterComplex, &#x27;-map&#x27;, &#x27;[v]&#x27;, &#x27;-map&#x27;, &#x27;1:a&#x27;,&#xA;      &#x27;-c:v&#x27;, &#x27;libx264&#x27;, &#x27;-tune&#x27;, &#x27;stillimage&#x27;, &#x27;-c:a&#x27;, &#x27;aac&#x27;, &#x27;-b:a&#x27;, &#x27;192k&#x27;, &#x27;output.mp4&#x27;&#xA;    );&#xA;&#xA;    const data = ffmpeg.FS(&#x27;readFile&#x27;, &#x27;output.mp4&#x27;);&#xA;&#xA;    const videoURL = URL.createObjectURL(new Blob([data.buffer], { type: &#x27;video/mp4&#x27; }));&#xA;    return videoURL;&#xA;  } catch (error) {&#xA;    console.error(&#x27;Error creating video:&#x27;, error);&#xA;    throw new Error(&#x27;Failed to create video&#x27;);&#xA;  }&#xA;}&#xA;&#xA;async function getAudioDuration(ffmpeg, audioFilename) {&#xA;  await ffmpeg.run(&#x27;-i&#x27;, audioFilename, &#x27;-show_entries&#x27;, &#x27;format=duration&#x27;, &#x27;-of&#x27;, &#x27;default=noprint_wrappers=1:nokey=1&#x27;, &#x27;duration.txt&#x27;);&#xA;  const data = ffmpeg.FS(&#x27;readFile&#x27;, &#x27;duration.txt&#x27;);&#xA;  const durationString = new TextDecoder().decode(data);&#xA;  const duration = Math.floor(parseFloat(durationString.trim())); &#xA;  return duration;&#xA;}&#xA;

    &#xA;

    I am getting this error :

    &#xA;

    CreateVideo.js:65  Error creating video: RuntimeError: Aborted(LinkError: WebAssembly.instantiate(): Import #70 module="a" function="qa": function import requires a callable). Build with -sASSERTIONS for more info.&#xA;

    &#xA;

    Can someone help me with this ?

    &#xA;

  • Black detect ffmpeg and use in a javascript

    6 février 2023, par sol

    I had an ffmpeg script that allow me to detect black frames from a video file sample from the bottom.

    &#xA;

    and i want to create a javascript code that will allow me to do the same function sample from the bottom but its not working.

    &#xA;

    original code from ffmpeg script :

    &#xA;

    `ffmpeg -i LKE-BLACK.mp4 -vf "blackdetect=d=0.5:pix_th=0.10" -an -f null - 2>&1 | findstr blackdetect > output.txt

    &#xA;

    node script :

    &#xA;

    var fs = require(&#x27;fs&#x27;);&#xA;const ffmpeg = require("ffmpeg.js");&#xA;&#xA;var createStream = fs.createWriteStream("data.txt");&#xA;createStream.end();&#xA;&#xA;const transcode = async ({ target: { files }  }) => {&#xA;    message.innerHTML = &#x27;Loading ffmpeg-core.js&#x27;;&#xA;    await ffmpeg.load();&#xA;    message.innerHTML = &#x27;Start transcoding&#x27;;&#xA;    &#xA;    await ffmpeg.transcode(&#x27;-i&#x27;, &#x27;LKE-BLACK.mp4&#x27;, "-vf", "blackdetect=d=0.5:pix_th=0.10", &#x27;-an&#x27;, &#x27;-f&#x27;, &#x27;null - 2>&amp;1&#x27;, );&#xA;    message.innerHTML = &#x27;Complete transcoding&#x27;;&#xA;&#xA;    fs.writeFile("data.txt", function (err) {&#xA;        if (err) throw err;&#xA;        console.log(&#x27;File is created successfully.&#x27;);&#xA;      });&#xA;}&#xA;

    &#xA;