Recherche avancée

Médias (1)

Mot : - Tags -/école

Autres articles (33)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

  • List of compatible distributions

    26 avril 2011, par

    The table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
    If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...)

  • Selection of projects using MediaSPIP

    2 mai 2011, par

    The examples below are representative elements of MediaSPIP specific uses for specific projects.
    MediaSPIP farm @ Infini
    The non profit organizationInfini develops hospitality activities, internet access point, training, realizing innovative projects in the field of information and communication technologies and Communication, and hosting of websites. It plays a unique and prominent role in the Brest (France) area, at the national level, among the half-dozen such association. Its members (...)

Sur d’autres sites (4741)

  • FFMPEG is not working in AWS lambda function

    13 novembre 2022, par Arun

    I am trying to convert a video file into an audio file using AWS lambda function whenever a file is uploaded into an S3 bucket. So I am using FFMPEG for converting a video file into audio. But I keep getting this error while converting a video file. I have seen similar questions but none of the solutions is not working for me. So If anyone knows please share your solutions.

    



    Error message

    



        TypeError: Cannot create property 'stack' on string 
'Could not find ffmpeg executable, tried "/var/task/node_modules/@ffmpeg-installer/linux-x64/ffmpeg" and "/var/task/node_modules/@ffmpeg-installer/ffmpeg/node_modules/@ffmpeg-installer/linux-x64/ffmpeg"'


    



    Code

    



        const
    ffmpegPath = require("@ffmpeg-installer/ffmpeg").path,
    ffmpeg = require("fluent-ffmpeg");

    // set ffmpeg package path
    ffmpeg.setFfmpegPath(ffmpegPath);
    function convert(input, output, callback) {
        ffmpeg(input)
            .output(output)
            .on('end', function() {                    
                console.log('conversion ended');
                callback(null);
            }).on('error', function(err){
                console.log('error: ', err.code, err.msg);
                callback(err);
            }).run();
    }

    exports.handler = function (event, context, callback) {
        const key = decodeURIComponent(event.Records[0].s3.object.key.replace(/\+/g, ' '));
        console.log("key ", key);
        console.log("event ", event.Records[0].s3);
        convert(key, `/tmp/${key}.mp3`, function(err){
            if(!err) {
                console.log('conversion complete');
            } else {
                console.log('Error');
            }
        });
    }


    const
        ffmpegPath = require("@ffmpeg-installer/ffmpeg").path,
        ffmpeg = require("fluent-ffmpeg");

    // set ffmpeg package path
    ffmpeg.setFfmpegPath(ffmpegPath);
    function convert(input, output, callback) {
        ffmpeg(input)
            .output(output)
            .on('end', function() {                    
                console.log('conversion ended');
                callback(null);
            }).on('error', function(err){
                console.log('error: ', err.code, err.msg);
                callback(err);
            }).run();
    }

    exports.handler = function (event, context, callback) {
        const key = decodeURIComponent(event.Records[0].s3.object.key.replace(/\+/g, ' '));
        console.log("key ", key);
        console.log("event ", event.Records[0].s3);
        convert(key, `/tmp/${key}.mp3`, function(err){
            if(!err) {
                console.log('conversion complete');
            } else {
                console.log('Error');
            }
        });
    }


    



    package.json

    



        "dependencies": {
    "@ffmpeg-installer/ffmpeg": "^1.0.17",
    "fluent-ffmpeg": "^2.1.2",
    "fs": "0.0.1-security"
  }


    


  • Cannot convert video file to audio file inside AWS lambda function using Node js

    21 février 2019, par Arun

    I cannot convert a video file into an audio file inside AWS lambda function using Node JS. While running my lambda function it doesn’t throw any error it executes without any error. But the audio file size is still 0 MB size. I am not able to find bugs or any issues in my code.

    Here is my code,

    const fs = require('fs');
    const childProcess = require('child_process');
    const AWS = require('aws-sdk');
    const path = require('path');
    AWS.config.update({
       region : 'us-east-2'
    });
    const s3 = new AWS.S3({apiVersion: '2006-03-01'});


    exports.handler = (event, context, callback) => {
       process.env.PATH = process.env.PATH + ':/tmp/';
       process.env['FFMPEG_PATH'] = '/tmp/ffmpeg';
       const BIN_PATH = process.env['LAMBDA_TASK_ROOT'];
       process.env['PATH'] = process.env['PATH'] + ':' + BIN_PATH;

       childProcess.exec(
           'cp /var/task/ffmpeg /tmp/.; chmod 755 /tmp/ffmpeg;',
           function (error, stdout, stderr) {
               if (error) {
                   console.log('Error occured',error);
               } else {
                   var ffmpeg = '/tmp/ffmpeg';
                   var createStream = fs.createWriteStream("/tmp/video.mp3");
                   createStream.end();
                   var params = {
                       Bucket: "test-bucket",
                       Key: event.Records[0].s3.object.key
                   };
                   s3.getObject(params, function(err, data) {
                       if (err) {
                           console.log("Error", err);
                       }
                       fs.writeFile("/tmp/vid.mp4", data.Body, function (err) {
                           if (err) console.log(err.code, "-", err.message);
                           return callback(err);
                       }, function() {
                           try {
                               var stats = fs.statSync("/tmp/vid.mp4");
                               console.log("size of the file1 ", stats["size"]);
                               try {
                                   console.log("Yeah");
                                   const inputFilename = "/tmp/vid.mp4";
                                   const mp3Filename = "/tmp/video.mp3";
                                   // // Convert the FLV file to an MP3 file using ffmpeg.
                                   const ffmpegArgs = [
                                       '-i', inputFilename,
                                       '-vn', // Disable the video stream in the output.
                                       '-acodec', 'libmp3lame', // Use Lame for the mp3 encoding.
                                       '-ac', '2', // Set 2 audio channels.
                                       '-q:a', '6', // Set the quality to be roughly 128 kb/s.
                                       mp3Filename,
                                   ];
                                   try {
                                       const process = childProcess.spawnSync(ffmpeg, ffmpegArgs);
                                       console.log("stdout ", process.stdout);
                                       console.log("stderr ", process.stderr);
                                       console.log("tmp files ");
                                       fs.readdir('/tmp/', (err, files) => {
                                           files.forEach(file => {
                                               var stats = fs.statSync(`/tmp/${file}`);
                                               console.log("size of the file2 ", stats["size"]);
                                             console.log(file);
                                           });
                                         });

                                   } catch (e) {
                                       console.log("error while converting video to audio ", e);
                                   }

                                   // return process;
                               } catch (e) {
                                   console.log(e);
                               }
                           } catch (e) {
                               console.log("file is not complete", e);
                           }
                       }, function () {
                           console.log("checking ");
                           var stats = fs.statSync("/tmp/video.mp3");
                           console.log("size of the file2 ", stats["size"]);
                       });

                       return callback(err);
                   });
               }
           }
       )
    }

    Code workflow

    First of all, I have downloaded ffmpeg binary exec file and put into my project directory. After that, I compressed my project and put it into the lambda function. This lambda function will be triggered whenever the new files are uploaded into an S3 bucket. I have checked /tmp/ storage files and the audio file .mp3 present but the size is 0 MB.

    Note

    And also, in my code the below is not calling or this part is not reaching. When I look into Cloudwatch logs I can’t see this console log messages. I don’t know why this function is not calling.

    function () {
           console.log("checking ");
           var stats = fs.statSync("/tmp/video.mp3");
           console.log("size of the file2 ", stats["size"]);
       });

    Please help me to find the solution of this issue. I have spent a lot of times to figure out this issue. But I am not able to find the solution. Any suggestions are welcome !!
    Thanks,

  • How to fix "Unable to find a suitable output format for '/'" error in ffmpeg running with PHP [on hold]

    4 avril 2019, par C.Pietro

    I want to compress video on the server after the upload.
    I installed correctly ffmpeg and when i run from the command line

    ffmpeg -i input.mp4 -vcodec libx265 -crf 28 -vcodec h264 -acodec aac -strict -2 output.mp4

    it works !

    But if i run the same command from PHP with exec,

    class VideoCompress {
       function compress($path, $name){
           if (`which ffmpeg`) {
               exec("cd \"$path\";ffmpeg -i \"$name\" -vcodec libx265 -crf 28 -vcodec h264 -acodec aac -strict -2 \"bk_$name\" / 2>&1", $o);
               print_r8($o);
           }
       }
    }

    it fails and return this error

    Array
    (
       [0] => ffmpeg version N-48518-g27c94c57dc-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2019 the FFmpeg developers
       [1] =>   built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
       [2] =>   configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
       [3] =>   libavutil      56. 26.100 / 56. 26.100
       [4] =>   libavcodec     58. 48.100 / 58. 48.100
       [5] =>   libavformat    58. 26.101 / 58. 26.101
       [6] =>   libavdevice    58.  7.100 / 58.  7.100
       [7] =>   libavfilter     7. 48.100 /  7. 48.100
       [8] =>   libswscale      5.  4.100 /  5.  4.100
       [9] =>   libswresample   3.  4.100 /  3.  4.100
       [10] =>   libpostproc    55.  4.100 / 55.  4.100
       [11] => Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'WebHD_720p.mp4':
       [12] =>   Metadata:
       [13] =>     major_brand     : isom
       [14] =>     minor_version   : 512
       [15] =>     compatible_brands: isomiso2avc1mp41
       [16] =>     encoder         : Lavf57.71.100
       [17] =>   Duration: 00:03:23.22, start: 0.000000, bitrate: 1890 kb/s
       [18] =>     Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 9:10 DAR 8:5], 1754 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
       [19] =>     Metadata:
       [20] =>       handler_name    : VideoHandler
       [21] =>     Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
       [22] =>     Metadata:
       [23] =>       handler_name    : SoundHandler
       [24] => [NULL @ 0x59fb100] Unable to find a suitable output format for '/'
       [25] => /: Invalid argument
    )

    Any idea on how can i fix it ?