Recherche avancée

Médias (0)

Mot : - Tags -/configuration

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

Autres articles (54)

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

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

Sur d’autres sites (8470)

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



    


  • AWS Lambda execution time for FFMPEG transcoding

    4 janvier 2023, par FlamingMoe

    I'm using AWS Lambda for converting files from WEBM to MP4

    


    I'm using ffmpeg version 4.3.1-static https://johnvansickle.com/ffmpeg/ (I have done the following tests also with the ffmpeg in serverless AWS ffmpeg layer (that includes de 4.1.3), but results are even worse (about 25% slower)

    


    I'm using Node 10x as container.

    


    WEBM size   Time to convert.  Memory Lambda.  Memory used (as shown in log)

80Mb             ~44s              3008            410
40Mb             ~44s              3008            375

80Mb             ~70s              1024            321
40Mb             ~70s              1024            279


    


    All videos are 80s length. So as far as I can see, it does not matter the size of the WEBM, if the length of the video is the same, it takes the same to convert. So ffmpeg takes more time if the video length is higher, not if the file size is higher ... curious ;-)

    


    But in the other hand, I'm confused with Lambda memory. I know memory and CPU comes together in Lambda ... the more memory you choose, the more CPU is assigned.

    


    But...

    


      

    1. Why ffmpeg just take about 300/400Mb if it has more to run ?
    2. 


    3. How can I tell ffmpeg to use more memory ?
    4. 


    5. Is there any option to accelerate the process in Lambda ?
    6. 


    


    Btw, In all tests, all ffmpeg are the same, and

    


    cpu-used paramenter)

    


      

    • I added to ffmpeg parameters cpu-used=100, and it does not matter at all if I put cpu-used=5 ... times are the same, so I guess that parameter is useless (i don't know why)
    • 


    


    threads parameter)

    


      

    • Also I did some tests with "threads" parameters, but it's useless also.
    • 


    


    I know it's not a good comparison, but same files takes about 5 seconds to be converted in a simple dedicated server (8 vCores and 8GB RAM in OVH Centos VPS).

    


    Btw, Amazon Elastic Transcoder is not an option :
a) it's extremely more expensive
b) it has just his profiles to convert, and my ffmpeg commands are very complex (watermarks, effects, etc ...)

    


  • rtmp audio out of sync, http works fine

    21 janvier 2014, par marca

    We have encoded and distributed videos for some years now, using FFMPEG to produce h.264/mp4 files that have been working great for us. We have been using HTML mode and fall-backed to flash for browsers that does not support it natively using flowplayer.

    We use cloudfront to serve our files from a s3 bucket and have been using http progressive streaming.

    Recently we started distribute the files in flashmode over rtmp instead, using a cloudfront streaming distribution pointing to the same amazon s3 bucket.

    All good for some weeks, until yesterday when we notice a couple of files with audio sync issues in rtmp mode.
    The same file have no sync problems in flash with direct url to file.

    What can be the case ?

    Not working when streamed via RTMP, but file work with http streaming/progressive.
    You see the sync issue 15 sec's into the video.
    rtmp ://s2xe2avk54qztf.cloudfront.net:1935/cfx/st/mp4:95fvOY255bdPspO3z6tEvGi3Em7/default.mp4
    http://media.shootitlive.com/95fvOY255bdPspO3z6tEvGi3Em7/default.mp4

    Another file that have no sync issue at all.
    rtmp ://s2xe2avk54qztf.cloudfront.net:1935/cfx/st/mp4:P4EuH2TZxfV6BvpupP6dxrrs7gD/default.mp4
    http://media.shootitlive.com/P4EuH2TZxfV6BvpupP6dxrrs7gD/default.mp4

    Both files have the same format for video and audio and have been encoded the exact same way with ffmpeg. It's not player related as we see the audio sync issue on several players and when playing stream in VLC.