Recherche avancée

Médias (2)

Mot : - Tags -/map

Autres articles (89)

  • Organiser par catégorie

    17 mai 2013, par

    Dans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
    Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
    Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...)

  • Récupération d’informations sur le site maître à l’installation d’une instance

    26 novembre 2010, par

    Utilité
    Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
    Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...)

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

Sur d’autres sites (9840)

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

  • fs.readFile is failed to read thumbnail generated file using ffmpeg in nodejs

    5 avril 2019, par Schüler

    I am using ffmpeg to extract the screenshot from the video it is working as expected but that file is unable to read/buffer using fs.read, later I will have to upload the image to the s3 bucket, So who can I make the file readable ?

    var thumPath =  path.join(global.__base, 'Temp/');
       ffmpeg(req.file.path).screenshots({
               count: 1,
               filename: req.file.filename + 'thumbnail-at-%s-seconds.png',
               folder: thumPath,
               size: '320x240'
           });

          fs.readFile(thumPath + req.file.filename + 'thumbnail-at-%s-seconds.png', function(err, thumb) {
             console.log(thumb)
    //s3 bucket feature will come
          })
  • How to get native frame rate of vide with FFmpex ?

    18 juin 2021, par Flame_Phoenix

    Background

    


    I have an .mp4 video and I need to get the video's frame rate. Using ffmepg (in Linux) I know I can get this information via the following command :

    


    ffprobe -v 0 -of compact=p=0 -select_streams 0 -show_entries stream=r_frame_rate 'MyVideoFIle.mp4'


    


    Which returns :

    


    r_frame_rate=24000/1001


    


    FFmpex

    


    Doing this in bash is fine, but what I really want is to use it in my Elixir application. To this end I found out about ffmpex.

    


    First I tried using FFprobe :

    


    > FFprobe.format("Devil May Cry 5 Bury the Light LITTLE V COVER.mp4")

{:ok,
 %{
   "bit_rate" => "611784",
   "duration" => "482.999000",
   "filename" => "Devil May Cry 5 Bury the Light LITTLE V COVER.mp4",
   "format_long_name" => "QuickTime / MOV",
   "format_name" => "mov,mp4,m4a,3gp,3g2,mj2",
   "nb_programs" => 0,
   "nb_streams" => 2,
   "probe_score" => 100, 
   "size" => "36936415",
   "start_time" => "0.000000",
   "tags" => %{
     "compatible_brands" => "isomiso2avc1mp41",
     "encoder" => "Lavf58.19.102",
     "major_brand" => "isom",
     "minor_version" => "512"
   }
 }}


    


    Which gives me some information, but not the frame rate.

    


    My next tentative was to use the command options :

    


    command = 
  FFmpex.new_command() 
  |> add_input_file("Devil May Cry 5 Bury the Light LITTLE V COVER.mp4") 
  |> add_video_option(???) 


    


    But the problem here is that I can't find in the documentation the video option I need to get the native frame rate. I only found vframe which is used to set the video frame rate.

    


    Question

    


      

    • How can I get the native fps of a video using ffmpex ?
    • 


    


  • 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