Recherche avancée

Médias (1)

Mot : - Tags -/lev manovitch

Autres articles (58)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • Mise à disposition des fichiers

    14 avril 2011, par

    Par défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
    Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
    Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...)

Sur d’autres sites (10034)

  • Passing streams from Fluent-ffmpeg to Google Cloud Storage

    31 octobre 2019, par Emilio Faria

    Is there a way to pass a stream from Fluent-mmpeg to Google Cloud Storage ? I’m trying to allow the user to upload any kind of media (audio or video), and I want to convert it to flac before uploading it to GCS.

    I’m using a few middlewares on my route, such as :

    routes.post(
     '/upload',
     multer.single('audio'),
     ConvertController.convert,
     UploadController.upload,
     FileController.save,
     (req, res, next) => res.send('ok')
    );

    I was able to stream from Multer to Fluent-mmpeg and save to a file using this code on ConvertController :

    async convert(req, res, next) {
       ffmpeg(streamifier.createReadStream(req.file.buffer))
         .format('flac')
         .output('outputfile.flac')
         .audioChannels(1)
         .on('progress', function(progress) {
           console.log(progress);
         })
         .run();
     }

    But I would like to use .pipe() to pass it to UploadController, where I would then upload to GCS :

    class UploadController {
     async upload(req, res, next) {
       const gcsHelpers = require('../helpers/google-cloud-storage');
       const { storage } = gcsHelpers;

       const DEFAULT_BUCKET_NAME = 'my-bucket-name';

       const bucketName = DEFAULT_BUCKET_NAME;
       const bucket = storage.bucket(bucketName);
       const fileName = `test.flac`;
       const newFile = bucket.file(fileName);

       newFile.createWriteStream({
         metadata: {
           contentType: file.mimetype
         }
       })

       file.on('error', err => {
         throw err;
       });

       file.on('finish', () => console.log('finished'));
     }

    The problem is that I cannot find anywhere explaining how I can pass down a stream to the next middleware.

    Is it possible ?

  • AWS Lambda for generate thumbnail save empty file

    30 octobre 2019, par Milousel

    I need to create aws lambda for creating thumbnail from video by using ffmpeg, which is saved on S3 and this thumbnail saved into S3 too.

    I downloaded ffmpeg from https://johnvansickle.com/ffmpeg/ page, set ffmpeg into nodejs file and send it into .zip. From this zip file I created ffmpeg layer. After that I connect my lambda with this ffmpeg layer. When I test it I receive Success response, but I save empty file (0 B size) into S3.

    const AWS = require("aws-sdk");
    const { spawn } = require("child_process");
    const { createReadStream, createWriteStream } = require("fs");

    const s3 = new AWS.S3();
    const ffmpegPath = "/opt/nodejs/ffmpeg";
    const allowedTypes = ["mov", "mpg", "mpeg", "mp4", "wmv", "avi", "webm"];
    const width = process.env.WIDTH;
    const height = process.env.HEIGHT;

    module.exports.handler = async (event, context) => {
     const srcKey = "test/0255f240-efef-11e9-862e-3949600f0ec9.mp4";
     const bucket = "video.devel.abc.com";
     const target = s3.getSignedUrl("getObject", {
       Bucket: bucket,
       Key: srcKey,
       Expires: 1000
     });
     let fileType = "mp4";
     console.log("srcKey: " + srcKey);
     console.log("bucket: " + bucket);
     console.log("target: " + target);
     if (!fileType) {
       throw new Error(`invalid file type found for key: ${srcKey}`);
     }

     if (allowedTypes.indexOf(fileType) === -1) {
       throw new Error(`filetype: ${fileType} is not an allowed type`);
     }

     function createImage(seek) {
       return new Promise((resolve, reject) => {
         let tmpFile = createWriteStream(`/tmp/screenshot.jpg`);
         const ffmpeg = spawn(ffmpegPath, [
           "-ss",
           seek,
           "-i",
           target,
           "-vf",
           `thumbnail,scale=${width}:${height}`,
           "-qscale:v",
           "2",
           "-frames:v",
           "1",
           "-f",
           "image2",
           "-c:v",
           "mjpeg",
           "pipe:1"
         ]);

         ffmpeg.stdout.pipe(tmpFile);
         ffmpeg.on("close", function(code) {
             console.log('code: ' + code);
           tmpFile.end();
           resolve();
         });

         ffmpeg.on("error", function(err) {
           console.log(err);
           reject();
         });
       });
     }

     function uploadToS3() {
       return new Promise((resolve, reject) => {
         let tmpFile = createReadStream(`/tmp/screenshot.jpg`);
         let dstKey = srcKey
           .replace(/\.\w+$/, `.jpg`)
           .replace("test/", "test/shots/");
         //const screensFile = "test/shots/";
         console.log("dstKey: " + dstKey);
         var params = {
           Bucket: bucket,
           Key: dstKey,
           Body: tmpFile,
           ContentType: `image/jpg`
         };

         s3.upload(params, function(err, data) {
           if (err) {
             console.log(err);
             reject();
           }
           console.log(`successful upload to ${bucket}/${dstKey}`);
           resolve();
         });
       });
     }

     await createImage(1);
     await uploadToS3();
     return console.log(`processed ${bucket}/${srcKey} successfully`);
    };

    When I test it I receive these logs :

  • srcKey : test/0255f240-efef-11e9-862e-3949600f0ec9.mp4
  • bucket : video.devel.abc.com
  • INFO processed video.devel.abc.com successfully
  • code : 1
  • bucket : video.devel.abc.com
  • dstKey : test/shots/0255f240-efef-11e9-862e-3949600f0ec9.jpg
  • successful upload to video.devel.abc.com/test/shots/0255f240-efef-11e9-862e-3949600f0ec9.jpg
  • processed video.devel.abc.com/test/0255f240-efef-11e9-862e-3949600f0ec9.mp4 successfully
  • So file is really created, but it is empty (size is 0 B), which is not ideal.

  • FFmpeg raw video size parameter

    3 novembre 2019, par Yanick Salzmann

    I am using libavformat in my library to read a stream of raw i420 images and transform them into an mp4 video. I’ve found CLI commands that perform this but since I am using the library in my program I need to reconstruct the same thing.

    Currently the code that is having a problem is looking like this :

           const auto raw_format = av_find_input_format("rawvideo");
           if (raw_format == nullptr) {
               log->error("Could not find RAW input parser in FFmpeg");
               throw std::runtime_error("RAW not found");
           }

           _format_context->pb = _io_context.get();

           AVDictionary *input_options = nullptr;
           av_dict_set(&input_options, "framerate", std::to_string(fps).c_str(), 0);
           av_dict_set(&input_options, "pix_fmt", "yuv420p", 0);
           av_dict_set(&input_options, "s:v", fmt::format("{}x{}", width, height).c_str(), 0);
           av_dict_set(&input_options, "size", fmt::format("{}x{}", width, height).c_str(), 0);

           auto formatPtr = _format_context.get();
           auto res = avformat_open_input(&formatPtr, "(memory file)", raw_format, &input_options);

    Finding the rawvideo is no problem, but it fails in avformat_open_input with the error : [2019-11-03 15:03:22.953] [11599:11663] [ffmpeg] [error] Picture size 0x0 is invalid

    I assumed the sizes are something I can insert using the input options, since in the CLI version it is passed using -s:v 1920x1080, however this does not seem to be true.

    Where do I have to specify the dimensions of my raw input stream ?

  • Boussole SPIP

    SPIP.net-La documentation officielle et téléchargement de (...) SPIP Code-La documentation du code de SPIP Programmer SPIP-La documentation pour développer avec (...) Traduire SPIP-Espace de traduction de SPIP et de ses (...) Plugins SPIP-L'annuaire des plugins SPIP SPIP-Contrib-L'espace des contributions à SPIP Forge SPIP-L'espace de développement de SPIP et de ses (...) Discuter sur SPIP-Les nouveaux forums de la communauté (...) SPIP Party-L'agenda des apéros et autres rencontres (...) Médias SPIP-La médiathèque de SPIP SPIP Syntaxe-Tester l'édition de texte dans SPIP