
Recherche avancée
Médias (3)
-
The Slip - Artworks
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Texte
-
Podcasting Legal guide
16 mai 2011, par
Mis à jour : Mai 2011
Langue : English
Type : Texte
-
Creativecommons informational flyer
16 mai 2011, par
Mis à jour : Juillet 2013
Langue : English
Type : Texte
Autres articles (80)
-
Support de tous types de médias
10 avril 2011Contrairement à 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) (...)
-
Supporting all media types
13 avril 2011, parUnlike 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 (...)
-
Les tâches Cron régulières de la ferme
1er décembre 2010, parLa 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 (...)
Sur d’autres sites (6398)
-
AWS Lambda in Node JS with FFMPEG Lambda Layer
29 mars 2023, par mwcwge23I'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;




-
avformat/flvdec : Remove one level of indentation
11 mars, par Zhao Zhili -
avcodec/av1dec : honor the requested skip_frame level
7 janvier 2022, par James Almer