Recherche avancée

Médias (1)

Mot : - Tags -/école

Autres articles (23)

  • Support de tous types de médias

    10 avril 2011

    Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)

  • D’autres logiciels intéressants

    12 avril 2011, par

    On ne revendique pas d’être les seuls à faire ce que l’on fait ... et on ne revendique surtout pas d’être les meilleurs non plus ... Ce que l’on fait, on essaie juste de le faire bien, et de mieux en mieux...
    La liste suivante correspond à des logiciels qui tendent peu ou prou à faire comme MediaSPIP ou que MediaSPIP tente peu ou prou à faire pareil, peu importe ...
    On ne les connais pas, on ne les a pas essayé, mais vous pouvez peut être y jeter un coup d’oeil.
    Videopress
    Site Internet : (...)

  • Supporting all media types

    13 avril 2011, par

    Unlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)

Sur d’autres sites (4425)

  • Why does ffmpeg hang indefinitely when composing videos ?

    11 octobre 2022, par Brendan Hill

    I am executing ffmpeg commands in a Java microservice (which runs dockerised in kubernetes in a temporary pod created by KEDA from an Amazon SQS queue... but unlikely to be relevant).

    


    About 30% of the time, the ffmpeg process hangs indefinitely :

    


    
/usr/local/bin/ffmpeg 
     -i /tmp/transcode-3b928f5f-3cd9-4cd6-9175-b7c1621aa7ce13592236077853079159/person1.mkv 
     -i /tmp/transcode-3b928f5f-3cd9-4cd6-9175-b7c1621aa7ce13592236077853079159/person2.mkv
     -filter_complex [0:v][1:v]hstack=inputs=2[v];[0:a]aresample=async=1000[0sync];[1:a]aresample=async=1000[1sync];[0sync][1sync]amix[a] 
     -map [v] 
     -map [a] 
     -c:v libx264 
     -crf 18 
     -ac 2 
     -vsync 1 
     -r 25 
     -shortest /tmp/transcode-3b928f5f-3cd9-4cd6-9175-b7c1621aa7ce13592236077853079159/composed.mp4



    


    This causes the Java code to wait indefinitely :

    


    
        Process proc = Runtime.getRuntime().exec(cmd);

        StreamConsumer outConsumer = new StreamConsumer(proc.getInputStream(), stdout);
        StreamConsumer errConsumer = new StreamConsumer(proc.getErrorStream(), stderr);

        // execute data read/write in separate threads
        outExecutor.submit(outConsumer);
        errorExecutor.submit(errConsumer);

        proc.waitFor() // Hangs indefinitely, with ~30% probability



    


    It is not specifically about the video files because they generally work on retry (with similar 30% failure probability so sometimes several retries are necessary). Of course, since it hangs indefinitely instead of exiting with failure, it has to wait hours before we risk another retry.

    


      

    1. Why is ffmpeg hanging indefinitely and how to fix ?

      


    2. 


    3. Can I get ffmpeg to fail early instead of hanging indefinitely (so I can trigger retry immediately) ?

      


    4. 


    5. I see many questions and posts about ffmpeg hanging indefinitely. Is ffmpeg inherently unstable ?

      


    6. 


    


  • librosa can't load wav file in aws lambda docker

    30 novembre 2022, par Luka Savic

    I have an AWS Lambda function created using Docker.
I have librosa installed, ffmpeg installed using the solution from this question : install ffmpeg on amazon ecr linux python

    


    I checked in a Lambda function with os.system("ffmpeg -version") and I managed to get valid output, stating different versions and parts of ffmpeg.

    


    Problem is that when I do librosa.load(wav_file) it gives the following error :

    


    /your/path/.venv/lib/python3.9/site-packages/librosa/util/decorators.py:88: UserWarning: PySoundFile failed. Trying audioread instead.
  return f(*args, **kwargs) 


    


    From what I've read, librosa should natively support .wav files, even without ffmpeg, and even though I have ffmpeg installed, it doesn't work.

    


    One more information, .wav file was downloaded, player, and loaded with librosa on my local PC without any problems. I tried also on different wav and mp3 files, and the problems were still there.

    


  • AWS Lambda in Node JS with FFMPEG Lambda Layer

    29 mars 2023, par mwcwge23

    I'm trying to make a Lambda that takes a video and puts a watermark image on it.
I'm using Lambda with NodeJS and FFMPEG Lambda Layer I took from here :
https://serverlessrepo.aws.amazon.com/applications/us-east-1/145266761615/ffmpeg-lambda-layer

    


    I got these two errors and I don't have a clue what do I did wrong :
errors

    


    Please help me :)

    


    (by the way, if you have an easier solution to put a watermark image on video that'll also be great)

    


    That's my code (trying to put a watermark image on a video file) :

    


    const express = require("express");
const childProcess = require("child_process");
const path = require("path");
const fs = require("fs");
const util = require("util");
const os = require("os");
const { fileURLToPath } = require("url");
const { v4: uuidv4 } = require("uuid");
const bodyParser = require("body-parser");
const awsServerlessExpressMiddleware = require("aws-serverless-express/middleware");
const AWS = require("aws-sdk");
const workdir = os.tmpdir();

const s3 = new AWS.S3();

// declare a new express app
const app = express();
app.use(bodyParser.json());
app.use(awsServerlessExpressMiddleware.eventContext());

// Enable CORS for all methods
app.use(function (req, res, next) {
  res.header("Access-Control-Allow-Origin", "*");
  res.header("Access-Control-Allow-Headers", "*");
  next();
});

const downloadFileFromS3 = function (bucket, fileKey, filePath) {
  "use strict";
  console.log("downloading", bucket, fileKey, filePath);
  return new Promise(function (resolve, reject) {
    const file = fs.createWriteStream(filePath),
      stream = s3
        .getObject({
          Bucket: bucket,
          Key: fileKey,
        })
        .createReadStream();
    stream.on("error", reject);
    file.on("error", reject);
    file.on("finish", function () {
      console.log("downloaded", bucket, fileKey);
      resolve(filePath);
    });
    stream.pipe(file);
  });
};

const uploadFileToS3 = function (bucket, fileKey, filePath, contentType) {
  "use strict";
  console.log("uploading", bucket, fileKey, filePath);
  return s3
    .upload({
      Bucket: bucket,
      Key: fileKey,
      Body: fs.createReadStream(filePath),
      ACL: "private",
      ContentType: contentType,
    })
    .promise();
};

const spawnPromise = function (command, argsarray, envOptions) {
  return new Promise((resolve, reject) => {
    console.log("executing", command, argsarray.join(" "));
    const childProc = childProcess.spawn(
        command,
        argsarray,
        envOptions || { env: process.env, cwd: process.cwd() }
      ),
      resultBuffers = [];
    childProc.stdout.on("data", (buffer) => {
      console.log(buffer.toString());
      resultBuffers.push(buffer);
    });
    childProc.stderr.on("data", (buffer) => console.error(buffer.toString()));
    childProc.on("exit", (code, signal) => {
      console.log(`${command} completed with ${code}:${signal}`);
      if (code || signal) {
        reject(`${command} failed with ${code || signal}`);
      } else {
        resolve(Buffer.concat(resultBuffers).toString().trim());
      }
    });
  });
};

app.post("/api/addWatermark", async (req, res) => {
  try {
    const bucketName = "bucketName ";
    const uniqeName = uuidv4() + Date.now();
    const outputPath = path.join(workdir, uniqeName + ".mp4");
    const key = "file_example_MP4_480_1_5MG.mp4";
    const localFilePath = path.join(workdir, key);
    const watermarkPngKey = "watermark.png";
    const watermarkLocalFilePath = path.join(workdir, watermarkPngKey);

    downloadFileFromS3(bucketName, key, localFilePath)
      .then(() => {
        downloadFileFromS3(bucketName, watermarkPngKey, watermarkLocalFilePath)
          .then(() => {
            fs.readFile(localFilePath, (err, data) => {
              if (!err && data) {
                console.log("successsss111");
              }
            });
            fs.readFile(watermarkLocalFilePath, (err, data) => {
              if (!err && data) {
                console.log("successsss222");
              }
            });

            fs.readFile(outputPath, (err, data) => {
              if (!err && data) {
                console.log("successsss3333");
              }
            });

            spawnPromise(
              "/opt/bin/ffmpeg",
              [
                "-i",
                localFilePath,
                "-i",
                watermarkLocalFilePath,
                "-filter_complex",
                `[1]format=rgba,colorchannelmixer=aa=0.5[logo];[0][logo]overlay=5:H-h-5:format=auto,format=yuv420p`,
                "-c:a",
                "copy",
                outputPath,
              ],
              { env: process.env, cwd: workdir }
            )
              .then(() => {
                uploadFileToS3(
                  bucketName,
                  uniqeName + ".mp4",
                  outputPath,
                  "mp4"
                );
              });
           });
      });
  } catch (err) {
    console.log({ err });
    res.json({ err });
  }
});

app.listen(8136, function () {
  console.log("App started");
});

module.exports = app;