Recherche avancée

Médias (3)

Mot : - Tags -/pdf

Autres articles (73)

  • Personnaliser les catégories

    21 juin 2013, par

    Formulaire de création d’une catégorie
    Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
    Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire.
    Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
    Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)

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

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

Sur d’autres sites (8437)

  • Transcode GCS files using ffmpeg

    12 août 2020, par hudsonhooper

    My ultimate goal is to transcode video files uploaded to one GCS bucket, transcode them for HLS using App Engine, then store them in another bucket for streaming. I started with code someone else made which closely fit my use case. Right now I just have it set up to save the files as mp4 to see if it works and I receive no error messages and is logs 'Success' to the console but when I check GCS the output file it has created is only around a kb (basically its just the metadata). I believe the issue has to do with the .pipe(remoteWriteStream, { end: true }); line and something with ffmpeg because if I instead run the line originStream.pipe(remoteWriteStream, {end: true}); to test the .pipe functionality I get what I'd expect (a copy of the file of the correct size). I've seen a lot of other people such as here use essentially the same method just with cloud functions and have success. Any idea where I went wrong ?

    



    import { Storage } from &#x27;@google-cloud/storage&#x27;;&#xA;&#xA;import ffmpegInstaller from &#x27;@ffmpeg-installer/ffmpeg&#x27;;&#xA;import ffmpeg from &#x27;fluent-ffmpeg&#x27;;&#xA;&#xA;ffmpeg.setFfmpegPath(ffmpegInstaller.path);&#xA;&#xA;export default async function transcode(&#xA;  //My try&#xA;  name: String,&#xA;  bucket: String,&#xA;  suffix: String,&#xA;  size: String,&#xA;&#xA;): Promise<void> {&#xA;  return new Promise((resolve, reject) => {&#xA;    const storage = new Storage();&#xA;&#xA;    const originBucket = storage.bucket(bucket);&#xA;    const destinationBucket = storage.bucket(&#x27;storieshls-2e4b1&#x27;);&#xA;&#xA;    const originFile = originBucket.file(name);&#xA;    const originStream = originFile.createReadStream();&#xA;&#xA;    const remoteWriteStream = destinationBucket.file(name.replace(".MOV", ".mp4")).createWriteStream({&#xA;      metadata: {&#xA;        contentType: &#x27;video/mp4&#x27;, // This could be whatever else you are transcoding to&#xA;      },&#xA;    });&#xA;&#xA;    //originStream.pipe(remoteWriteStream, {end: true});&#xA;&#xA;    ffmpeg()&#xA;      .input(originStream)&#xA;      .outputOptions(&#x27;-c:v copy&#x27;) // Change these options to whatever suits your needs&#xA;      .outputOptions(&#x27;-c:a aac&#x27;)&#xA;      .outputOptions(&#x27;-b:a 160k&#x27;)&#xA;      .outputOptions(&#x27;-f mp4&#x27;)&#xA;      .outputOptions(&#x27;-preset fast&#x27;)&#xA;      .outputOptions(&#x27;-movflags frag_keyframe&#x2B;empty_moov&#x27;)&#xA;      .on(&#x27;start&#x27;, cmdLine => {&#xA;        console.log(`[${suffix}] Started FFMpeg`, cmdLine);&#xA;      })&#xA;      .on(&#x27;end&#x27;, () => {&#xA;        console.log(`[${suffix}] Success!.`);&#xA;        resolve();&#xA;      })&#xA;      .on(&#x27;error&#x27;, (err: Error, stdout, stderr) => {&#xA;        console.log(`[${suffix}] Error:`, err.message);&#xA;        console.error(&#x27;stdout:&#x27;, stdout);&#xA;        console.error(&#x27;stderr:&#x27;, stderr);&#xA;&#xA;        reject();&#xA;      })&#xA;      .pipe(remoteWriteStream, { end: true });&#xA;  });&#xA;}&#xA;</void>

    &#xA;

  • How to add a watermark to video on firebase storage using ffmpeg

    31 décembre 2020, par awabs

    I am trying to add a watermark to a video using firebase functions and ffmpeg, but I do know the right code for it. I know is that ffmpen is now available in google cloud env so this approach should work.&#xA;Any help is appreciated.

    &#xA;

    const functions = require(&#x27;firebase-functions&#x27;);&#xA;const { Storage } = require(&#x27;@google-cloud/storage&#x27;);&#xA;const projectId = &#x27;video-demo-a57fa&#x27;;&#xA;let gcs = new Storage ({&#xA;  projectId&#xA;});&#xA;const os =require(&#x27;os&#x27;);&#xA;const path =require(&#x27;path&#x27;);&#xA;const spawn = require(&#x27;child-process-promise&#x27;).spawn;&#xA;&#xA;&#xA;exports.addLogo = functions.storage.object().onFinalize(event =>{&#xA;   &#xA;    const bucket =event.bucket;&#xA;    const contentType =event.contentType;&#xA;    const filePath =event.name;&#xA;    console.log(path.dirname(filePath));&#xA;&#xA;    console.log(&#x27;File change detected, function execution started&#x27;);&#xA;&#xA;&#xA;    if (path.basename(filePath).startsWith(&#x27;resized-&#x27;)) {&#xA;        console.log(&#x27;We already renamed that file!&#x27;);&#xA;        return;&#xA;    }&#xA;&#xA;    const destBucket = gcs.bucket(bucket);&#xA;    const tmpFilePath = path.join(os.tmpdir(), path.basename(filePath));&#xA;    const metadata = { contentType: contentType };&#xA;    return destBucket.file(filePath).download({&#xA;        destination: tmpFilePath&#xA;    }).then(()=>{&#xA;        return spawn(&#x27;ffmpeg&#x27;,[&#x27;-i&#x27;, &#x27;video.mp4&#x27;], tmpFilePath )&#xA;    }).then(() => {&#xA;        console.log(tmpFilePath);&#xA;        return destBucket.upload(tmpFilePath, {&#xA;            destination: path.dirname(filePath)&#x2B;&#x27;/resized-&#x27; &#x2B; path.basename(filePath),&#xA;            metadata: metadata&#xA;            &#xA;        })&#xA;    }).catch(err=>{&#xA;        console.log(err);&#xA;    });&#xA;})&#xA;

    &#xA;

  • Creating GIF with FFMPEG in AWS Lambda creates an empty gif ?

    29 décembre 2020, par blablubla12

    I'm trying to create a gif using an existing command (which I have no idea what it's doing as I don't really understand ffmpeg). That command worked perfectly on a C# Console App (as a string), however once I migrated to AWS Lambda (Node.js 12.x - which I'm also new at) it uploads an empty gif (0 B). Here is a part of the code :

    &#xA;

    const bucket = eventObject.BucketName;&#xA;const srcKey = eventObject.ObjectKey;&#xA;const target = s3.getSignedUrl(&#x27;getObject&#x27;, { Bucket: bucket, Key: srcKey, Expires: 1000 });&#xA;const overlayTarget = s3.getSignedUrl(&#x27;getObject&#x27;, { Bucket: bucket, Key: &#x27;overlays/overlay.png&#x27;, Expires: 1000 });&#xA;const fileName = guid &#x2B; "_gif.gif";&#xA;const tempPath = &#x27;/tmp/&#x27; &#x2B; fileName;&#xA;&#xA;function CreateGif() {&#xA;    return new Promise((resolve, reject) => {&#xA;&#xA;        const ffmpeg = spawn(ffmpegPath, [&#xA;            "-ss",&#xA;            eventObject.GifTimecode,&#xA;            "-i",&#xA;            target,&#xA;            "-i",&#xA;            overlayTarget,&#xA;            "-filter_complex",&#xA;            `[0:v] trim = duration = ${eventObject.GifDuration}, setpts = PTS - STARTPTS, scale = 450:-1[trimmed]; [trimmed] split[trimmed1][trimmed2];     [trimmed2] reverse[rev];     [trimmed1] [rev] concat=n=2:v=1:a=0 [v];     [v] [1:v] overlay=0:0:format=rgb[overlayed];     [overlayed] split[a][b];     [a] palettegen=stats_mode=diff[palette];     [b] [palette] paletteuse=bayer:bayer_scale=3.5[out] `,&#xA;            "-map",&#xA;            &#x27;[out]&#x27;,&#xA;            tempPath&#xA;        ]);&#xA;&#xA;        ffmpeg.stderr.setEncoding(&#x27;utf8&#x27;);&#xA;        ffmpeg.stderr.on(&#x27;data&#x27;, (data) => {&#xA;            console.log(data);&#xA;        });&#xA;&#xA;        ffmpeg.on(&#x27;close&#x27;, function (code) {&#xA;            console.log(&#x27;closed&#x27;);&#xA;            resolve();&#xA;        });&#xA;&#xA;        ffmpeg.on(&#x27;error&#x27;, function (err) {&#xA;            console.log(err);&#xA;            reject();&#xA;            throw new Error(err);&#xA;        });&#xA;    });&#xA;}&#xA;&#xA;function uploadToS3() {&#xA;    return new Promise((resolve, reject) => {&#xA;        let tmpFile = createReadStream(tempPath);&#xA;&#xA;        var params = {&#xA;            Bucket: bucket,&#xA;            Key: &#x27;gifs/&#x27; &#x2B; fileName,&#xA;            Body: tmpFile,&#xA;            ContentType: `image/gif`&#xA;        };&#xA;&#xA;        s3.upload(params, function (err, data) {&#xA;            if (err) {&#xA;                console.log(err);&#xA;                reject();&#xA;            }&#xA;            console.log(`successful upload to ${bucket}/${fileName}`);&#xA;            resolve();&#xA;        });&#xA;    });&#xA;}&#xA;&#xA;await CreateGif();&#xA;await uploadToS3();&#xA;

    &#xA;

    I'm sure the issue is the args that are being passed, however I've not found a way to separate the args in the array in a way that works.

    &#xA;

    Here's the same command in C# (this one works fine) :

    &#xA;

    var command = "-ss " &#x2B; timeCode &#x2B; " -i "&#xA;                  &#x2B; "\"" &#x2B; videoPath &#x2B; "\""&#xA;                  &#x2B; " -i "&#xA;                  &#x2B; "\"" &#x2B; path &#x2B; "/" &#x2B; imageOverlayFilePath &#x2B; "\" "&#xA;                  &#x2B; " -filter_complex "&#xA;                  &#x2B; "\""&#xA;                  &#x2B; $"[0:v] trim = duration = {gifDuration}, setpts = PTS - STARTPTS, scale = 450:-1[trimmed]; [trimmed] split[trimmed1][trimmed2];     [trimmed2] reverse[rev];     [trimmed1] [rev] concat=n=2:v=1:a=0 [v];     [v] [1:v] overlay=0:0:format=rgb[overlayed];     [overlayed] split[a][b];     [a] palettegen=stats_mode=diff[palette];     [b] [palette] paletteuse=bayer:bayer_scale=3.5[out] "&#xA;                  &#x2B; "\""&#xA;                  &#x2B; " -map [out] "&#xA;                  &#x2B; "\"" &#x2B; output &#x2B; "\"";&#xA;

    &#xA;

    How do I separate the command string in the args array spawn(ffmpegPath, [])

    &#xA;