
Recherche avancée
Autres articles (66)
-
Mise à jour de la version 0.1 vers 0.2
24 juin 2013, parExplications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...) -
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs
Sur d’autres sites (7861)
-
Use data to develop impactful video content
28 septembre 2021, par Ben Erskine — Analytics Tips, Plugins -
4 ways to create more effective funnels
24 février 2020, par Jake Thornton — Uncategorized -
How to add "ffmpeg" to the Cloud Run environment or to Dockerfile ?
16 janvier 2021, par awabsI am triying to a logo to video that is uploaded to cloud storage using ffmpeg library, I deployed this code as cloud function is runs only with small size videos, so I decided to move to cloud run, but here I have to build container myself so I used this command instead


gcloud builds submit --pack image=europe-west1-docker.pkg.dev/video-sharing-a1mfa/video-sharing-repo/my-image,env=GOOGLE_FUNCTION_TARGET=addLogo



and it builds the image and I just had to create a service in the Cloud Run and it is running, but unfortunately when I trigger this function I get this error


Error: spawn ffmpeg ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:268:19)
at onErrorNT (internal/child_process.js:470:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)



Which I am not sure of but I guess is that ffmpeg in not installed in contanier (where it comes preinstalled in the gcloud functions env). Any idea how to install it or what the docker file configuration might be ?


here is my code :


const { Storage } = require('@google-cloud/storage');
const projectId = 'video-sharing-a1mfa';
let gcs = new Storage({
 projectId
});

const os = require('os');
const path = require('path');
const spawn = require('child-process-promise').spawn;


exports.addLogo = async (req, res) => {

const event = JSON.parse(req.body);
const bucket = event.bucket;
const contentType = event.contentType;
const filePath = event.name;

console.log('File change detected, function execution started');
if (path.basename(filePath).startsWith('resized-')) {
 console.log('We already renamed that file!');
 return;
}
const destBucket = gcs.bucket(bucket);
const tmpFilePath = path.join(os.tmpdir(), path.basename(filePath));
const metadata = { contentType: contentType };
const tmpLogoPath = path.join(os.tmpdir(), 'watermark.png');
await destBucket.file('watermark.png').download({
 destination: tmpLogoPath
})

const newPath = path.join(os.tmpdir(), 'output.mp4')

await destBucket.file(filePath).download({
 destination: tmpFilePath
});
console.log('file downloaded to temp');

console.log('adding watermark');

var str = "overlay=10:10"

await spawn('ffmpeg', ['-i', tmpFilePath, '-i', tmpLogoPath, '-filter_complex', str, newPath]);


console.log('watermark added');

return destBucket.upload(newPath, {
 destination: path.dirname(filePath) + '/resized-' + path.basename(filePath),
 metadata: metadata
});;
};