Recherche avancée

Médias (0)

Mot : - Tags -/xmlrpc

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (34)

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

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

  • ANNEXE : Les extensions, plugins SPIP des canaux

    11 février 2010, par

    Un plugin est un ajout fonctionnel au noyau principal de SPIP. MediaSPIP consiste en un choix délibéré de plugins existant ou pas auparavant dans la communauté SPIP, qui ont pour certains nécessité soit leur création de A à Z, soit des ajouts de fonctionnalités.
    Les extensions que MediaSPIP nécessite pour fonctionner
    Depuis la version 2.1.0, SPIP permet d’ajouter des plugins dans le répertoire extensions/.
    Les "extensions" ne sont ni plus ni moins que des plugins dont la particularité est qu’ils se (...)

Sur d’autres sites (5833)

  • Encoder (codec png) not found for output stream #0:0 [duplicate]

    7 juin 2016, par Anubhav Dhawan

    This question already has an answer here :

    I’m trying to create a NodeJS app that converts a video into a GIF image.

    I’m using node-gify plugin for this purpose, which uses FFmpeg and GraphicsMagick.

    Here’s my sample code :

    var gify = require('./');
    var http = require('http');
    var fs = require('fs');

    var opts = {
     height: 300,
     rate: 10
    };

    console.time('convert');
    gify('out.mp4', 'out.gif', opts, function(err) {
     if (err) throw err;
     console.timeEnd('convert');
     var s = fs.statSync('out.gif');
     console.log('size: %smb', s.size / 1024 / 1024 | 0);
    });

    And here’s my console error :

    > gify@0.2.0 start /home/daffodil/repos/node-gify-master
    > node example.js

    /home/daffodil/repos/node-gify-master/example.js:24
     if (err) throw err;
              ^

    Error: Command failed: /bin/sh -c ffmpeg -i out.mp4 -filter:v scale=-1:300 -r 10 /tmp/IP5OXJZELd/%04d.png
    ffmpeg version 3.0.2 Copyright (c) 2000-2016 the FFmpeg developers
     built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04)
     configuration: --disable-yasm
     libavutil      55. 17.103 / 55. 17.103
     libavcodec     57. 24.102 / 57. 24.102
     libavformat    57. 25.100 / 57. 25.100
     libavdevice    57.  0.101 / 57.  0.101
     libavfilter     6. 31.100 /  6. 31.100
     libswscale      4.  0.100 /  4.  0.100
     libswresample   2.  0.101 /  2.  0.101
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out.mp4':
     Metadata:
       major_brand     : mp42
       minor_version   : 1
       compatible_brands: mp42mp41
       creation_time   : 2005-02-25 02:35:57
     Duration: 00:01:10.00, start: 0.000000, bitrate: 106 kb/s
       Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 8000 Hz, stereo, fltp, 19 kb/s (default)
       Metadata:
         creation_time   : 2005-02-25 02:35:57
         handler_name    : Apple Sound Media Handler
       Stream #0:1(eng): Video: mpeg4 (Advanced Simple Profile) (mp4v / 0x7634706D), yuv420p, 192x242 [SAR 1:1 DAR 96:121], 76 kb/s, 15 fps, 15 tbr, 600 tbn, 1k tbc (default)
       Metadata:
         creation_time   : 2005-02-25 02:35:57
         handler_name    : Apple Video Media Handler
       Stream #0:2(eng): Data: none (rtp  / 0x20707472), 4 kb/s (default)
       Metadata:
         creation_time   : 2005-02-25 02:35:57
         handler_name    : hint media handler
       Stream #0:3(eng): Data: none (rtp  / 0x20707472), 3 kb/s (default)
       Metadata:
         creation_time   : 2005-02-25 02:35:57
         handler_name    : hint media handler
    Output #0, image2, to '/tmp/IP5OXJZELd/%04d.png':
     Metadata:
       major_brand     : mp42
       minor_version   : 1
       compatible_brands: mp42mp41
       Stream #0:0(eng): Video: png, none, q=2-31, 128 kb/s (default)
       Metadata:
         creation_time   : 2005-02-25 02:35:57
         handler_name    : Apple Video Media Handler
    Stream mapping:
     Stream #0:1 -> #0:0 (mpeg4 (native) -> ? (?))
    Encoder (codec png) not found for output stream #0:0

       at ChildProcess.exithandler (child_process.js:213:12)
       at emitTwo (events.js:100:13)
       at ChildProcess.emit (events.js:185:7)
       at maybeClose (internal/child_process.js:827:16)
       at Socket.<anonymous> (internal/child_process.js:319:11)
       at emitOne (events.js:90:13)
       at Socket.emit (events.js:182:7)
       at Pipe._onclose (net.js:471:12)
    </anonymous>

    PS : I had a couple of problems installing FFmpeg on my Ubuntu 14.04.

    • First, FFmpeg is removed from Ubuntu 14.04 (legal issues AFAIK). But I managed to apt-get it through this.
    • Second, when I tried to ./configure (as mentioned in its README.md), I got this error - yasm/nasm not found or too old. Use --disable-yasm for a crippled build.. So I used ./configure --disable-yasm instead, and it (somehow) worked.

    Update #1

    After read this log a couple of times, I managed to produce a sample GIF from my mp4 file, by changing the command, which example.js tries to run :

    From

    ffmpeg -i out.mp4 -filter:v scale=-1:300 -r 10 /tmp/Lz43nx6wv1/%04d.png

    To

    ffmpeg -i out.mp4 -filter:v scale=-1:300 -r 10 out.gif

    But it’s still using command line, I need to do this by code.

    So I dived into the code and found that this wrong url is coming from the plugin’s index.js :

    ...

    // tmpfile(s)
     var id = uid(10);
     var dir = path.resolve('/tmp/' + id);
     var tmp  = path.join(dir, '/%04d.png');

    ...

    Is this an issue with the plugin, or am I doing something wrong here ?
    In any case, please put the correct stub here, because I don’t want to touch this part unless I know what I’m doing ?

    Update #2

    Now I installed zlib1g-dev, and then reinstalled both FFmpeg and graphicsMagick, and now I see this error :

    gm convert: No decode delegate for this image format (/tmp/ZQbEAynAcf/0702.png).

    Thanks in advance :)

  • Could not open encoder using ffmpeg C APi for MOV format

    22 juin 2016, par lupod

    Context

    I am writing a program for doing some video processing on an input file. I wrote two classes for handling the "reading/writing frames" part that essentially wrap the functions of ffmpeg. These classes may be instantiated by providing an input and output file name, and in their constructor I initialize everything that is needed (or at least I hope so).

    This are the two routines that are called inside the constructors :

    // InputVideoHandler.cpp
    void InputVideoHandler::init(char* name) {
     streamIndex = -1;
     int numStreams;

     if (avformat_open_input(&amp;formatCtx, name, NULL, NULL) != 0)
       throw std::exception("Invalid input file name.");

     if (avformat_find_stream_info(formatCtx, NULL)&lt;0)
       throw std::exception("Could not find stream information.");

     numStreams = formatCtx->nb_streams;

     if (numStreams &lt; 0)
       throw std::exception("No streams in input video file.");

     for (int i = 0; i &lt; numStreams; i++) {
       if (formatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
         streamIndex = i;
         break;
       }
     }

     if (streamIndex &lt; 0)
       throw std::exception("No video stream in input video file.");

     // find decoder using id
     codec = avcodec_find_decoder(formatCtx->streams[streamIndex]->codec->codec_id);
     if (codec == nullptr)
       throw std::exception("Could not find suitable decoder for input file.");

     // copy context from input stream
     codecCtx = avcodec_alloc_context3(codec);
     if (avcodec_copy_context(codecCtx, formatCtx->streams[streamIndex]->codec) != 0)
       throw std::exception("Could not copy codec context from input stream.");

     if (avcodec_open2(codecCtx, codec, NULL) &lt; 0)
       throw std::exception("Could not open decoder.");

     codecCtx->refcounted_frames = 1;
    }

    // OutputVideoBuilder.cpp
    void OutputVideoBuilder::init(char* name, AVCodecContext* inputCtx) {
     if (avformat_alloc_output_context2(&amp;formatCtx, NULL, NULL, name) &lt; 0)
       throw std::exception("Could not determine file extension from provided name.");

     codec = avcodec_find_encoder(inputCtx->codec_id);
     if (codec == nullptr) {
       throw std::exception("Could not find suitable encoder.");
     }

     codecCtx = avcodec_alloc_context3(codec);
     if (avcodec_copy_context(codecCtx, inputCtx) &lt; 0)
       throw std::exception("Could not copy output codec context from input");

     codecCtx->time_base = inputCtx->time_base;

     if (avcodec_open2(codecCtx, codec, NULL) &lt; 0)
       throw std::exception("Could not open encoder.");

     stream = avformat_new_stream(formatCtx, codec);
     if (stream == nullptr) {
       throw std::exception("Could not allocate stream.");
     }

     stream->id = formatCtx->nb_streams - 1;
     stream->codec = codecCtx;
     stream->time_base = codecCtx->time_base;

     av_dump_format(formatCtx, 0, name, 1);
     if (!(formatCtx->oformat->flags &amp; AVFMT_NOFILE)) {
       if (avio_open(&amp;formatCtx->pb, name, AVIO_FLAG_WRITE) &lt; 0) {
         throw std::exception("Could not open output file.");
       }
     }

     if (avformat_write_header(formatCtx, NULL) &lt; 0) {
       throw std::exception("Error occurred when opening output file.");
     }

    }

    As you see, for the Init function of the output handler I require that an AVCodecContext must be provided. In my code, I pass to the constructor the AVCodecContext that is stored in the input handler and that was previously created.

    Question :

    The two functions work fine when I test my program with some video formats, like .mpg or .avi. When I try to process .mov/.mp4 files, however, my code throws the exception that I labeled "Could not open encoder." in OutputVideoBuilder::Init(). Why is this happening ? I read from the General documentation of ffmpeg that that format should be supported as well by ffmpeg. I am assuming that I am doing something wrong in my code, which I do not completely understand because it was created by trying to adapt the tutorials of the documentation to my specific case. Also for this reason, any comments on things that are useless or things that are missing will be greatly appreciated.

  • compile ffmpeg decode only without audio codecs

    28 juillet 2016, par Rob

    I work on a media manager and use ffmpeg.exe to extract screenshots.
    With the latest size of ffmpeg.exe exceeding 35MB, I am attempting to build ffmpeg without the majority of its functions, to allow only saving of a frame of video.

    I had thought disabling many of the filters, Audio Codecs etc would shrink the size of ffmpeg to something more manageable.

    Following this guide
    https://pracucci.com/compile-ffmpeg-on-windows-with-visual-studio-compiler.html
    to allow building of ffmpeg using Visual Studio 2015, I have come to the part of ./configuration and hit a wall.
    With so many options and no idea what all of them mean or do, I am asking if someone in the community can give me laymans instructions.

    I also know that I need to build x264, and possible x265 (HEVC), but am not sure if there is anything other codecs needed.
    In the end, I and am hoping to just have the one file, ffmpeg.exe for use in the media manager project.

    The code I use to get a screenshot is as follows

    Public Shared Function CreateScreenShot(ByVal FullPathAndFilename As String, ByVal SavePath As String, ByVal sec As Integer, Optional ByVal Overwrite As Boolean = False) As Boolean
       If Not File.Exists(SavePath) Or Overwrite Then
           Try
               IO.File.Delete(SavePath)
           Catch
               Return False
           End Try
           If IO.File.Exists(FullPathAndFilename) Then
               Dim myProcess As Process = New Process
               Try
                   Dim seconds As Integer = sec
                   myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
                   myProcess.StartInfo.CreateNoWindow = False
                   myProcess.StartInfo.FileName = Utilities.applicationPath &amp; "\Assets\ffmpeg.exe"
                   Dim proc_arguments As String = "-ss " &amp; seconds.ToString &amp; " -i """ &amp; FullPathAndFilename &amp; """ -vframes:v 1 -an " &amp; """" &amp; SavePath &amp; """"
                   myProcess.StartInfo.Arguments = proc_arguments
                   myProcess.Start()
                   myProcess.WaitForExit()
                   If File.Exists(SavePath) Then Return True
               Catch ex As Exception
                   Throw ex
               Finally
                   myProcess.Close()
               End Try
           End If
       End If
       Return False
    End Function

    I hope this is sufficient information, and appreciated any help or suggestions.