Recherche avancée

Médias (1)

Mot : - Tags -/Christian Nold

Autres articles (25)

  • Encoding and processing into web-friendly formats

    13 avril 2011, par

    MediaSPIP automatically converts uploaded files to internet-compatible formats.
    Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
    Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
    Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
    All uploaded files are stored online in their original format, so you can (...)

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

  • List of compatible distributions

    26 avril 2011, par

    The table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
    If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...)

Sur d’autres sites (5935)

  • ffmpeg transcode to live stream

    14 septembre 2016, par brayancastrop

    I need to display a ip camera stream in an html video tag, i have figured out how to transcode to a file from the rtsp stream like this

    ffmpeg -i "rtsp://user:password@ip" -s 640x480 /tmp/output.mp4

    now i need to be able to be able to live stream the rtsp input in a video tag like this

    <video src="http://domain:port/output.mp4" autoplay="autoplay"></video>

    I was trying to do something like this in my server (an ubuntu micro instance on amazon) in order to reproduce the video in the video tag but didn’t work

    ffmpeg -i "rtsp://user:password@ip" -s 640x480 http://localhost:8080/stream.mp4

    instead i got this log

    [tcp @ 0x747b40] Connection to tcp://localhost:8080 failed: Connection refused
    http://localhost:8080/stream.mp4: Connection refused

    i don’t really understand what’s happening, not sure if it’s sending the output to that url or serving the output there and this, i’ve been checking the ffmpeg man docs but i didn’t find any example related to this use case and also other questiones like this one FFmpeg Stream Transcoding which is similar to my last try without success

    btw, this is the camera i’m using DS-2CD2020F-I(W) - http://www.hikvision.com/en/Products_accessries_157_i5847.html
    they offer an httppreview but it’s just an img tag source which updates but appears to be unstable

    This is my first time trying to do something like this so any insight about how to achieve it will be really usefull and appreciated

  • 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.&#xA;I'm using Lambda with NodeJS and FFMPEG Lambda Layer I took from here :&#xA;https://serverlessrepo.aws.amazon.com/applications/us-east-1/145266761615/ffmpeg-lambda-layer

    &#xA;

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

    &#xA;

    Please help me :)

    &#xA;

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

    &#xA;

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

    &#xA;

    const express = require("express");&#xA;const childProcess = require("child_process");&#xA;const path = require("path");&#xA;const fs = require("fs");&#xA;const util = require("util");&#xA;const os = require("os");&#xA;const { fileURLToPath } = require("url");&#xA;const { v4: uuidv4 } = require("uuid");&#xA;const bodyParser = require("body-parser");&#xA;const awsServerlessExpressMiddleware = require("aws-serverless-express/middleware");&#xA;const AWS = require("aws-sdk");&#xA;const workdir = os.tmpdir();&#xA;&#xA;const s3 = new AWS.S3();&#xA;&#xA;// declare a new express app&#xA;const app = express();&#xA;app.use(bodyParser.json());&#xA;app.use(awsServerlessExpressMiddleware.eventContext());&#xA;&#xA;// Enable CORS for all methods&#xA;app.use(function (req, res, next) {&#xA;  res.header("Access-Control-Allow-Origin", "*");&#xA;  res.header("Access-Control-Allow-Headers", "*");&#xA;  next();&#xA;});&#xA;&#xA;const downloadFileFromS3 = function (bucket, fileKey, filePath) {&#xA;  "use strict";&#xA;  console.log("downloading", bucket, fileKey, filePath);&#xA;  return new Promise(function (resolve, reject) {&#xA;    const file = fs.createWriteStream(filePath),&#xA;      stream = s3&#xA;        .getObject({&#xA;          Bucket: bucket,&#xA;          Key: fileKey,&#xA;        })&#xA;        .createReadStream();&#xA;    stream.on("error", reject);&#xA;    file.on("error", reject);&#xA;    file.on("finish", function () {&#xA;      console.log("downloaded", bucket, fileKey);&#xA;      resolve(filePath);&#xA;    });&#xA;    stream.pipe(file);&#xA;  });&#xA;};&#xA;&#xA;const uploadFileToS3 = function (bucket, fileKey, filePath, contentType) {&#xA;  "use strict";&#xA;  console.log("uploading", bucket, fileKey, filePath);&#xA;  return s3&#xA;    .upload({&#xA;      Bucket: bucket,&#xA;      Key: fileKey,&#xA;      Body: fs.createReadStream(filePath),&#xA;      ACL: "private",&#xA;      ContentType: contentType,&#xA;    })&#xA;    .promise();&#xA;};&#xA;&#xA;const spawnPromise = function (command, argsarray, envOptions) {&#xA;  return new Promise((resolve, reject) => {&#xA;    console.log("executing", command, argsarray.join(" "));&#xA;    const childProc = childProcess.spawn(&#xA;        command,&#xA;        argsarray,&#xA;        envOptions || { env: process.env, cwd: process.cwd() }&#xA;      ),&#xA;      resultBuffers = [];&#xA;    childProc.stdout.on("data", (buffer) => {&#xA;      console.log(buffer.toString());&#xA;      resultBuffers.push(buffer);&#xA;    });&#xA;    childProc.stderr.on("data", (buffer) => console.error(buffer.toString()));&#xA;    childProc.on("exit", (code, signal) => {&#xA;      console.log(`${command} completed with ${code}:${signal}`);&#xA;      if (code || signal) {&#xA;        reject(`${command} failed with ${code || signal}`);&#xA;      } else {&#xA;        resolve(Buffer.concat(resultBuffers).toString().trim());&#xA;      }&#xA;    });&#xA;  });&#xA;};&#xA;&#xA;app.post("/api/addWatermark", async (req, res) => {&#xA;  try {&#xA;    const bucketName = "bucketName ";&#xA;    const uniqeName = uuidv4() &#x2B; Date.now();&#xA;    const outputPath = path.join(workdir, uniqeName &#x2B; ".mp4");&#xA;    const key = "file_example_MP4_480_1_5MG.mp4";&#xA;    const localFilePath = path.join(workdir, key);&#xA;    const watermarkPngKey = "watermark.png";&#xA;    const watermarkLocalFilePath = path.join(workdir, watermarkPngKey);&#xA;&#xA;    downloadFileFromS3(bucketName, key, localFilePath)&#xA;      .then(() => {&#xA;        downloadFileFromS3(bucketName, watermarkPngKey, watermarkLocalFilePath)&#xA;          .then(() => {&#xA;            fs.readFile(localFilePath, (err, data) => {&#xA;              if (!err &amp;&amp; data) {&#xA;                console.log("successsss111");&#xA;              }&#xA;            });&#xA;            fs.readFile(watermarkLocalFilePath, (err, data) => {&#xA;              if (!err &amp;&amp; data) {&#xA;                console.log("successsss222");&#xA;              }&#xA;            });&#xA;&#xA;            fs.readFile(outputPath, (err, data) => {&#xA;              if (!err &amp;&amp; data) {&#xA;                console.log("successsss3333");&#xA;              }&#xA;            });&#xA;&#xA;            spawnPromise(&#xA;              "/opt/bin/ffmpeg",&#xA;              [&#xA;                "-i",&#xA;                localFilePath,&#xA;                "-i",&#xA;                watermarkLocalFilePath,&#xA;                "-filter_complex",&#xA;                `[1]format=rgba,colorchannelmixer=aa=0.5[logo];[0][logo]overlay=5:H-h-5:format=auto,format=yuv420p`,&#xA;                "-c:a",&#xA;                "copy",&#xA;                outputPath,&#xA;              ],&#xA;              { env: process.env, cwd: workdir }&#xA;            )&#xA;              .then(() => {&#xA;                uploadFileToS3(&#xA;                  bucketName,&#xA;                  uniqeName &#x2B; ".mp4",&#xA;                  outputPath,&#xA;                  "mp4"&#xA;                );&#xA;              });&#xA;           });&#xA;      });&#xA;  } catch (err) {&#xA;    console.log({ err });&#xA;    res.json({ err });&#xA;  }&#xA;});&#xA;&#xA;app.listen(8136, function () {&#xA;  console.log("App started");&#xA;});&#xA;&#xA;module.exports = app;&#xA;&#xA;

    &#xA;

  • AWS Lambda execution time for FFMPEG transcoding

    4 janvier 2023, par FlamingMoe

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

    &#xA;

    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)

    &#xA;

    I'm using Node 10x as container.

    &#xA;

    WEBM size   Time to convert.  Memory Lambda.  Memory used (as shown in log)&#xA;&#xA;80Mb             ~44s              3008            410&#xA;40Mb             ~44s              3008            375&#xA;&#xA;80Mb             ~70s              1024            321&#xA;40Mb             ~70s              1024            279&#xA;

    &#xA;

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

    &#xA;

    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.

    &#xA;

    But...

    &#xA;

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

    3. How can I tell ffmpeg to use more memory ?
    4. &#xA;

    5. Is there any option to accelerate the process in Lambda ?
    6. &#xA;

    &#xA;

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

    &#xA;

    cpu-used paramenter)

    &#xA;

      &#xA;
    • 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)
    • &#xA;

    &#xA;

    threads parameter)

    &#xA;

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

    &#xA;

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

    &#xA;

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

    &#xA;