Recherche avancée

Médias (1)

Mot : - Tags -/stallman

Autres articles (43)

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

  • Installation en mode ferme

    4 février 2011, par

    Le mode ferme permet d’héberger plusieurs sites de type MediaSPIP en n’installant qu’une seule fois son noyau fonctionnel.
    C’est la méthode que nous utilisons sur cette même plateforme.
    L’utilisation en mode ferme nécessite de connaïtre un peu le mécanisme de SPIP contrairement à la version standalone qui ne nécessite pas réellement de connaissances spécifique puisque l’espace privé habituel de SPIP n’est plus utilisé.
    Dans un premier temps, vous devez avoir installé les mêmes fichiers que l’installation (...)

Sur d’autres sites (4105)

  • Adding some kind of subtitle to an mp4 with ffmpeg

    23 juin 2017, par Steven Van Ingelgem

    I have a subtitle (it certainly looks like it), but I don’t know how to add it into an MP4 I’m creating.
    First a hexdump of the subtitle :

    00000000  00 00 00 18 66 74 79 70  69 73 6f 36 00 00 00 00  |....ftypiso6....|
    00000010  69 73 6f 36 64 61 73 68  00 00 00 28 66 72 65 65  |iso6dash...(free|
    00000020  55 53 50 20 62 79 20 43  6f 64 65 53 68 6f 70 11  |USP by CodeShop.|
    00000030  11 11 11 11 11 11 11 11  11 11 11 11 11 11 11 11  |................|
    00000040  00 00 02 1d 6d 6f 6f 76  00 00 00 6c 6d 76 68 64  |....moov...lmvhd|
    00000050  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 01  |................|
    00000060  00 00 00 00 00 01 00 00  01 00 00 00 00 00 00 00  |................|
    00000070  00 00 00 00 00 01 00 00  00 00 00 00 00 00 00 00  |................|
    *
    00000090  00 00 00 00 40 00 00 00  00 00 00 00 00 00 00 00  |....@...........|
    000000a0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
    000000b0  00 00 00 02 00 00 01 81  74 72 61 6b 00 00 00 5c  |........trak...\|
    000000c0  74 6b 68 64 00 00 00 07  00 00 00 00 00 00 00 00  |tkhd............|
    000000d0  00 00 00 01 00 00 00 00  00 00 00 00 00 00 00 00  |................|
    000000e0  00 00 00 00 00 00 00 00  00 00 00 00 00 01 00 00  |................|
    *
    00000100  00 00 00 00 00 00 00 00  00 00 00 00 40 00 00 00  |............@...|
    00000110  00 00 00 00 00 00 00 00  00 00 01 1d 6d 64 69 61  |............mdia|
    00000120  00 00 00 20 6d 64 68 64  00 00 00 00 00 00 00 00  |... mdhd........|
    00000130  00 00 00 00 00 00 03 e8  00 00 00 00 39 84 00 00  |............9...|
    00000140  00 00 00 35 68 64 6c 72  00 00 00 00 00 00 00 00  |...5hdlr........|
    00000150  73 75 62 74 00 00 00 00  00 00 00 00 00 00 00 00  |subt............|
    00000160  55 53 50 20 53 75 62 74  69 74 6c 65 20 48 61 6e  |USP Subtitle Han|
    00000170  64 6c 65 72 00 00 00 00  c0 6d 69 6e 66 00 00 00  |dler.....minf...|
    00000180  0c 73 74 68 64 00 00 00  00 00 00 00 24 64 69 6e  |.sthd.......$din|
    00000190  66 00 00 00 1c 64 72 65  66 00 00 00 00 00 00 00  |f....dref.......|
    000001a0  01 00 00 00 0c 75 72 6c  20 00 00 00 01 00 00 00  |.....url .......|
    000001b0  88 73 74 62 6c 00 00 00  3c 73 74 73 64 00 00 00  |.stbl.../www.|
    000001e0  77 33 2e 6f 72 67 2f 6e  73 2f 74 74 6d 6c 00 00  |w3.org/ns/ttml..|
    000001f0  00 00 00 00 10 73 74 74  73 00 00 00 00 00 00 00  |.....stts.......|
    00000200  00 00 00 00 10 73 74 73  63 00 00 00 00 00 00 00  |.....stsc.......|
    00000210  00 00 00 00 14 73 74 73  7a 00 00 00 00 00 00 00  |.....stsz.......|
    00000220  00 00 00 00 00 00 00 00  10 73 74 63 6f 00 00 00  |.........stco...|
    00000230  00 00 00 00 00 00 00 00  28 6d 76 65 78 00 00 00  |........(mvex...|
    00000240  20 74 72 65 78 00 00 00  00 00 00 00 01 00 00 00  | trex...........|
    00000250  01 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
    00000260  18 73 74 79 70 69 73 6f  36 00 00 00 00 69 73 6f  |.stypiso6....iso|
    00000270  36 6d 73 64 68 00 00 00  28 66 72 65 65 55 53 50  |6msdh...(freeUSP|
    00000280  20 62 79 20 43 6f 64 65  53 68 6f 70 11 11 11 11  | by CodeShop....|
    00000290  11 11 11 11 11 11 11 11  11 11 11 11 11 00 00 00  |................|
    000002a0  2c 73 69 64 78 00 00 00  00 00 00 00 01 00 00 03  |,sidx...........|
    000002b0  e8 00 00 00 00 00 00 00  00 00 00 00 01 00 00 0f  |................|
    000002c0  09 00 00 ea 60 90 00 00  00 00 00 00 68 6d 6f 6f  |....`.......hmoo|
    000002d0  66 00 00 00 10 6d 66 68  64 00 00 00 00 00 00 00  |f....mfhd.......|
    000002e0  01 00 00 00 50 74 72 61  66 00 00 00 14 74 66 68  |....Ptraf....tfh|
    000002f0  64 00 02 00 02 00 00 00  01 00 00 00 01 00 00 00  |d...............|
    00000300  14 74 66 64 74 01 00 00  00 00 00 00 00 00 00 00  |.tfdt...........|
    00000310  00 00 00 00 20 74 72 75  6e 00 00 07 01 00 00 00  |.... trun.......|
    00000320  01 00 00 00 70 00 00 ea  60 00 00 0e 99 02 80 00  |....p...`.......|
    00000330  40 00 00 0e a1 6d 64 61  74 3c 3f 78 6d 6c 20 76  |@....mdat<?xml v|
    00000340  65 72 73 69 6f 6e 3d 22  31 2e 30 22 20 65 6e 63  |ersion="1.0" enc|
    00000350  6f 64 69 6e 67 3d 22 75  74 66 2d 38 22 3f 3e 3c  |oding="utf-8"?><|
    00000360  74 74 20 78 6d 6c 6e 73  3d 22 68 74 74 70 3a 2f  |tt xmlns="http:/|
    00000370  2f 77 77 77 2e 77 33 2e  6f 72 67 2f 6e 73 2f 74  |/www.w3.org/ns/t|
    00000380  74 6d 6c 22 20 78 6d 6c  6e 73 3a 73 6d 70 74 65  |tml" xmlns:smpte|
    00000390  3d 22 68 74 74 70 3a 2f  2f 77 77 77 2e 73 6d 70  |="http://www.smp|
    000003a0  74 65 2d 72 61 2e 6f 72  67 2f 73 63 68 65 6d 61  |te-ra.org/schema|
    000003b0  73 2f 32 30 35 32 2d 31  2f 32 30 31 30 2f 73 6d  |s/2052-1/2010/sm|

    I honestly have never seen anything like this before...

    So the command I’m running now is this :

    ffmpeg -y -i ’audionld#24000.mp4’ -i ’audionld#48000.mp4’ -i
    ’textnld.mp4’ -i ’video.mp4’ -map 0:a -map 1:a -map 2:d -map 3:v
    -metadata:s:a:0 language=nld -metadata:s:a:1 language=nld -acodec copy -bsf:a aac_adtstoasc -vcodec copy -c:d copy -movflags faststart "test.mp4" 2>&1

    Which results in this output :

    ffmpeg version 3.2.5-1~bpo8+1 Copyright (c) 2000-2017 the FFmpeg developers
     built with gcc 4.9.2 (Debian 4.9.2-10)
     configuration: --prefix=/usr --extra-version='1~bpo8+1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --disable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
     libavutil      55. 34.101 / 55. 34.101
     libavcodec     57. 64.101 / 57. 64.101
     libavformat    57. 56.101 / 57. 56.101
     libavdevice    57.  1.100 / 57.  1.100
     libavfilter     6. 65.100 /  6. 65.100
     libavresample   3.  1.  0 /  3.  1.  0
     libswscale      4.  2.100 /  4.  2.100
     libswresample   2.  3.100 /  2.  3.100
     libpostproc    54.  1.100 / 54.  1.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'audionld#24000.mp4':
     Metadata:
       major_brand     : iso6
       minor_version   : 0
       compatible_brands: iso6dash
     Duration: 00:03:06.07, start: 0.000000, bitrate: 64 kb/s
       Stream #0:0(nld): Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 62 kb/s (default)
       Metadata:
         handler_name    : USP Sound Handler
    Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'audionld#48000.mp4':
     Metadata:
       major_brand     : iso6
       minor_version   : 0
       compatible_brands: iso6dash
     Duration: 00:03:06.07, start: 0.000000, bitrate: 95 kb/s
       Stream #1:0(nld): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 93 kb/s (default)
       Metadata:
         handler_name    : USP Sound Handler
    Input #2, mov,mp4,m4a,3gp,3g2,mj2, from 'textnld.mp4':
     Metadata:
       major_brand     : iso6
       minor_version   : 0
       compatible_brands: iso6dash
     Duration: 00:03:05.76, bitrate: 0 kb/s
       Stream #2:0(nld): Data: none (stpp / 0x70707473), 0 kb/s (default)
       Metadata:
         handler_name    : USP Subtitle Handler
    Input #3, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
     Metadata:
       major_brand     : iso6
       minor_version   : 0
       compatible_brands: iso6dash
     Duration: 00:03:06.08, start: 0.000000, bitrate: 152 kb/s
       Stream #3:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 416x234 [SAR 1:1 DAR 16:9], 144 kb/s, 25 fps, 25 tbr, 25k tbn, 50 tbc (default)
       Metadata:
         handler_name    : USP Video Handler
         encoder         : Elemental H.264
    [mp4 @ 0x7f15299c4520] Could not find tag for codec none in stream #2, codec not currently supported in container
    Could not write header for output file #0 (incorrect codec parameters ?): Invalid argumentStream mapping:
     Stream #0:0 -> #0:0 (copy)
     Stream #1:0 -> #0:1 (copy)
     Stream #2:0 -> #0:2 (copy)
     Stream #3:0 -> #0:3 (copy)
       Last message repeated 1 times

    This gives the error :
    Could not find tag for codec none in stream #2, codec not currently supported in container
    Could not write header for output file #0 (incorrect codec parameters ?) : Invalid argument

    So I tried playing with the map like this :

    -map 2:s
    ==> Gives me :
    Stream map ’2:s’ matches no streams.
    To ignore this, add a trailing ’ ?’ to the map.

    -map 2:s ?
    ==> Gives me no error, but the subtitle stream isn’t added into the final file.

    Stream mapping:
     Stream #0:0 -> #0:0 (copy)
     Stream #1:0 -> #0:1 (copy)
     Stream #3:0 -> #0:2 (copy)

    Maybe I first have to convert the subtitle into srt or such, but for that I don’t find on google what type of file this is.

    Any help would be greatly appreciated !

    Thanks

    ---EDIT---

    Hereby the code that I am using to convert this in PHP :

     private function convert_TTML_subtitle_file($orig) {
       if ( $orig == '' || !file_exists($orig) ) {
         return false;
       }

       $f = file_get_contents($orig);
       $pos = stripos($f, '<tt xmlns="http://www.w3.org/ns/ttml" if="if" false="false" return="return" while="while">body->div->p as $p ) {
             $txt .= "{$counter}\r\n";
             $counter++;
             $txt .= $p['begin'] . ' --> ' . $p['end'] . "\r\n";
             $txt .= $p->span . "\r\n\r\n";
           }
         }
         $cur += $curSize;
       }

       $fname = tempnam(getcwd(), 'sub');
       file_put_contents($fname, $txt);
       return $fname;
     }
    </tt>
  • Scale filter crashes with error when used from transcoding example

    27 juin 2017, par Vali

    I’ve modified a bit (just to compile in c++) this code example :
    https://github.com/FFmpeg/FFmpeg/blob/master/doc/examples/transcoding.c.

    What works : as is (null filter), a number of other filters like framerate, drawtext, ...

    What doesn’t work : scale filter when scaling down.

    I use the following syntax for scale ( I’ve tried many others also, same effect) :
    "scale=w=iw/2 :-1"

    The error is : "Input picture width (240) is greater than stride (128)" where the values for width and stride depend on the input.

    Misc environment info : windows, VS 2017, input example : rtsp ://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov

    Any clue as to what I’m doing wrong ?

    Thanks !


    EDITED to add working code sample


    #pragma comment(lib, "avcodec.lib")
    #pragma comment(lib, "avutil.lib")
    #pragma comment(lib, "avformat.lib")
    #pragma comment(lib, "avfilter.lib")

    /*
    * Copyright (c) 2010 Nicolas George
    * Copyright (c) 2011 Stefano Sabatini
    * Copyright (c) 2014 Andrey Utkin
    *
    **** EDITED 2017 for testing (see original here: https://github.com/FFmpeg/FFmpeg/blob/master/doc/examples/transcoding.c)
    *
    * Permission is hereby granted, free of charge, to any person obtaining a copy
    * of this software and associated documentation files (the "Software"), to deal
    * in the Software without restriction, including without limitation the rights
    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    * copies of the Software, and to permit persons to whom the Software is
    * furnished to do so, subject to the following conditions:
    *
    * The above copyright notice and this permission notice shall be included in
    * all copies or substantial portions of the Software.
    *
    * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
    * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    * THE SOFTWARE.
    */

    /**
    * @file
    * API example for demuxing, decoding, filtering, encoding and muxing
    * @example transcoding.c
    */

    extern "C"
    {
       #include <libavcodec></libavcodec>avcodec.h>
       #include <libavformat></libavformat>avformat.h>
       #include <libavfilter></libavfilter>avfiltergraph.h>
       #include <libavfilter></libavfilter>buffersink.h>
       #include <libavfilter></libavfilter>buffersrc.h>
       #include <libavutil></libavutil>opt.h>
       #include <libavutil></libavutil>pixdesc.h>
    }


    static AVFormatContext *ifmt_ctx;
    static AVFormatContext *ofmt_ctx;
    typedef struct FilteringContext {
       AVFilterContext *buffersink_ctx;
       AVFilterContext *buffersrc_ctx;
       AVFilterGraph *filter_graph;
    } FilteringContext;
    static FilteringContext *filter_ctx;

    typedef struct StreamContext {
       AVCodecContext *dec_ctx;
       AVCodecContext *enc_ctx;
    } StreamContext;
    static StreamContext *stream_ctx;

    static int open_input_file(const char *filename, int&amp; videoStreamIndex)
    {
       int ret;
       unsigned int i;

       ifmt_ctx = NULL;
       if ((ret = avformat_open_input(&amp;ifmt_ctx, filename, NULL, NULL)) &lt; 0) {
           av_log(NULL, AV_LOG_ERROR, "Cannot open input file\n");
           return ret;
       }

       if ((ret = avformat_find_stream_info(ifmt_ctx, NULL)) &lt; 0) {
           av_log(NULL, AV_LOG_ERROR, "Cannot find stream information\n");
           return ret;
       }

       // Just need video
       videoStreamIndex = -1;
       for (unsigned int i = 0; i &lt; ifmt_ctx->nb_streams; i++)
       {
           if (ifmt_ctx->streams[i]->codecpar->codec_type != AVMEDIA_TYPE_VIDEO)
               continue;
           videoStreamIndex = i;
           break;
       }
       if (videoStreamIndex &lt; 0)
       {
           av_log(NULL, AV_LOG_ERROR, "Cannot find video stream\n");
           return videoStreamIndex;
       }


       stream_ctx = (StreamContext*)av_mallocz_array(ifmt_ctx->nb_streams, sizeof(*stream_ctx));
       if (!stream_ctx)
           return AVERROR(ENOMEM);

       for (i = 0; i &lt; ifmt_ctx->nb_streams; i++) {

           // Just need video
           if (i != videoStreamIndex)
               continue;


           AVStream *stream = ifmt_ctx->streams[i];
           AVCodec *dec = avcodec_find_decoder(stream->codecpar->codec_id);
           AVCodecContext *codec_ctx;
           if (!dec) {
               av_log(NULL, AV_LOG_ERROR, "Failed to find decoder for stream #%u\n", i);
               return AVERROR_DECODER_NOT_FOUND;
           }
           codec_ctx = avcodec_alloc_context3(dec);
           if (!codec_ctx) {
               av_log(NULL, AV_LOG_ERROR, "Failed to allocate the decoder context for stream #%u\n", i);
               return AVERROR(ENOMEM);
           }
           ret = avcodec_parameters_to_context(codec_ctx, stream->codecpar);
           if (ret &lt; 0) {
               av_log(NULL, AV_LOG_ERROR, "Failed to copy decoder parameters to input decoder context "
                   "for stream #%u\n", i);
               return ret;
           }
           /* Reencode video &amp; audio and remux subtitles etc. */
           if (codec_ctx->codec_type == AVMEDIA_TYPE_VIDEO
               || codec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) {
               if (codec_ctx->codec_type == AVMEDIA_TYPE_VIDEO)
                   codec_ctx->framerate = av_guess_frame_rate(ifmt_ctx, stream, NULL);
               /* Open decoder */
               ret = avcodec_open2(codec_ctx, dec, NULL);
               if (ret &lt; 0) {
                   av_log(NULL, AV_LOG_ERROR, "Failed to open decoder for stream #%u\n", i);
                   return ret;
               }
           }
           stream_ctx[i].dec_ctx = codec_ctx;
       }

       av_dump_format(ifmt_ctx, 0, filename, 0);
       return 0;
    }

    static int open_output_file(const char *filename, const int videoStreamIndex)
    {
       AVStream *out_stream;
       AVStream *in_stream;
       AVCodecContext *dec_ctx, *enc_ctx;
       AVCodec *encoder;
       int ret;
       unsigned int i;

       ofmt_ctx = NULL;
       avformat_alloc_output_context2(&amp;ofmt_ctx, NULL, NULL, filename);
       if (!ofmt_ctx) {
           av_log(NULL, AV_LOG_ERROR, "Could not create output context\n");
           return AVERROR_UNKNOWN;
       }


       for (i = 0; i &lt; ifmt_ctx->nb_streams; i++) {
           // Just need video
           if (i != videoStreamIndex)
               continue;

           out_stream = avformat_new_stream(ofmt_ctx, NULL);
           if (!out_stream) {
               av_log(NULL, AV_LOG_ERROR, "Failed allocating output stream\n");
               return AVERROR_UNKNOWN;
           }

           in_stream = ifmt_ctx->streams[i];
           dec_ctx = stream_ctx[i].dec_ctx;

           if (dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO) {
               /* in this example, we choose transcoding to same codec */
               encoder = avcodec_find_encoder(dec_ctx->codec_id);
               if (!encoder) {
                   av_log(NULL, AV_LOG_FATAL, "Necessary encoder not found\n");
                   return AVERROR_INVALIDDATA;
               }
               enc_ctx = avcodec_alloc_context3(encoder);
               if (!enc_ctx) {
                   av_log(NULL, AV_LOG_FATAL, "Failed to allocate the encoder context\n");
                   return AVERROR(ENOMEM);
               }

               /* In this example, we transcode to same properties (picture size,
               * sample rate etc.). These properties can be changed for output
               * streams easily using filters */
               enc_ctx->height = dec_ctx->height;
               enc_ctx->width = dec_ctx->width;
               enc_ctx->sample_aspect_ratio = dec_ctx->sample_aspect_ratio;
               /* take first format from list of supported formats */
               if (encoder->pix_fmts)
                   enc_ctx->pix_fmt = encoder->pix_fmts[0];
               else
                   enc_ctx->pix_fmt = dec_ctx->pix_fmt;

               /* video time_base can be set to whatever is handy and supported by encoder */
               //enc_ctx->time_base = av_inv_q(dec_ctx->framerate);
               enc_ctx->time_base = dec_ctx->time_base;


               /* Third parameter can be used to pass settings to encoder */
               ret = avcodec_open2(enc_ctx, encoder, NULL);
               if (ret &lt; 0) {
                   av_log(NULL, AV_LOG_ERROR, "Cannot open video encoder for stream #%u\n", i);
                   return ret;
               }
               ret = avcodec_parameters_from_context(out_stream->codecpar, enc_ctx);
               if (ret &lt; 0) {
                   av_log(NULL, AV_LOG_ERROR, "Failed to copy encoder parameters to output stream #%u\n", i);
                   return ret;
               }
               if (ofmt_ctx->oformat->flags &amp; AVFMT_GLOBALHEADER)
                   enc_ctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;

               out_stream->time_base = enc_ctx->time_base;
               stream_ctx[i].enc_ctx = enc_ctx;
           }
           else if (dec_ctx->codec_type == AVMEDIA_TYPE_UNKNOWN) {
               av_log(NULL, AV_LOG_FATAL, "Elementary stream #%d is of unknown type, cannot proceed\n", i);
               return AVERROR_INVALIDDATA;
           }
           else {
               /* if this stream must be remuxed */
               ret = avcodec_parameters_copy(out_stream->codecpar, in_stream->codecpar);
               if (ret &lt; 0) {
                   av_log(NULL, AV_LOG_ERROR, "Copying parameters for stream #%u failed\n", i);
                   return ret;
               }
               out_stream->time_base = in_stream->time_base;
           }

       }
       av_dump_format(ofmt_ctx, 0, filename, 1);

       if (!(ofmt_ctx->oformat->flags &amp; AVFMT_NOFILE)) {
           ret = avio_open(&amp;ofmt_ctx->pb, filename, AVIO_FLAG_WRITE);
           if (ret &lt; 0) {
               av_log(NULL, AV_LOG_ERROR, "Could not open output file '%s'", filename);
               return ret;
           }
       }

       /* init muxer, write output file header */
       ret = avformat_write_header(ofmt_ctx, NULL);
       if (ret &lt; 0) {
           av_log(NULL, AV_LOG_ERROR, "Error occurred when opening output file\n");
           return ret;
       }

       return 0;
    }

    static int init_filter(FilteringContext* fctx, AVCodecContext *dec_ctx,
       AVCodecContext *enc_ctx, const char *filter_spec)
    {
       char args[512];
       int ret = 0;
       AVFilter *buffersrc = NULL;
       AVFilter *buffersink = NULL;
       AVFilterContext *buffersrc_ctx = NULL;
       AVFilterContext *buffersink_ctx = NULL;
       AVFilterInOut *outputs = avfilter_inout_alloc();
       AVFilterInOut *inputs = avfilter_inout_alloc();
       AVFilterGraph *filter_graph = avfilter_graph_alloc();

       if (!outputs || !inputs || !filter_graph) {
           ret = AVERROR(ENOMEM);
           goto end;
       }

       if (dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO) {
           buffersrc = avfilter_get_by_name("buffer");
           buffersink = avfilter_get_by_name("buffersink");
           if (!buffersrc || !buffersink) {
               av_log(NULL, AV_LOG_ERROR, "filtering source or sink element not found\n");
               ret = AVERROR_UNKNOWN;
               goto end;
           }

           snprintf(args, sizeof(args),
               "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:pixel_aspect=%d/%d",
               dec_ctx->width, dec_ctx->height, dec_ctx->pix_fmt,
               dec_ctx->time_base.num, dec_ctx->time_base.den,
               dec_ctx->sample_aspect_ratio.num,
               dec_ctx->sample_aspect_ratio.den);

           ret = avfilter_graph_create_filter(&amp;buffersrc_ctx, buffersrc, "in",
               args, NULL, filter_graph);
           if (ret &lt; 0) {
               av_log(NULL, AV_LOG_ERROR, "Cannot create buffer source\n");
               goto end;
           }

           ret = avfilter_graph_create_filter(&amp;buffersink_ctx, buffersink, "out",
               NULL, NULL, filter_graph);
           if (ret &lt; 0) {
               av_log(NULL, AV_LOG_ERROR, "Cannot create buffer sink\n");
               goto end;
           }

           ret = av_opt_set_bin(buffersink_ctx, "pix_fmts",
               (uint8_t*)&amp;enc_ctx->pix_fmt, sizeof(enc_ctx->pix_fmt),
               AV_OPT_SEARCH_CHILDREN);
           if (ret &lt; 0) {
               av_log(NULL, AV_LOG_ERROR, "Cannot set output pixel format\n");
               goto end;
           }
       }
       else {
           ret = AVERROR_UNKNOWN;
           goto end;
       }

       /* Endpoints for the filter graph. */
       outputs->name = av_strdup("in");
       outputs->filter_ctx = buffersrc_ctx;
       outputs->pad_idx = 0;
       outputs->next = NULL;

       inputs->name = av_strdup("out");
       inputs->filter_ctx = buffersink_ctx;
       inputs->pad_idx = 0;
       inputs->next = NULL;

       if (!outputs->name || !inputs->name) {
           ret = AVERROR(ENOMEM);
           goto end;
       }

       if ((ret = avfilter_graph_parse_ptr(filter_graph, filter_spec,
           &amp;inputs, &amp;outputs, NULL)) &lt; 0)
           goto end;

       if ((ret = avfilter_graph_config(filter_graph, NULL)) &lt; 0)
           goto end;

       /* Fill FilteringContext */
       fctx->buffersrc_ctx = buffersrc_ctx;
       fctx->buffersink_ctx = buffersink_ctx;
       fctx->filter_graph = filter_graph;

    end:
       avfilter_inout_free(&amp;inputs);
       avfilter_inout_free(&amp;outputs);

       return ret;
    }

    static int init_filters(const int videoStreamIndex)
    {
       const char *filter_spec;
       unsigned int i;
       int ret;
       filter_ctx = (FilteringContext*)av_malloc_array(ifmt_ctx->nb_streams, sizeof(*filter_ctx));
       if (!filter_ctx)
           return AVERROR(ENOMEM);

       for (i = 0; i &lt; ifmt_ctx->nb_streams; i++) {

           // Just video
           if (i != videoStreamIndex)
               continue;

           filter_ctx[i].buffersrc_ctx = NULL;
           filter_ctx[i].buffersink_ctx = NULL;
           filter_ctx[i].filter_graph = NULL;
           if (!(ifmt_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO
               || ifmt_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO))
               continue;

           filter_spec = "null"; /* passthrough (dummy) filter for video */
           //filter_spec = "scale=w=iw/2:-1";
           // filter_spec = "drawtext=fontfile=FreeSerif.ttf: text='%{localtime}': x=w-text_w: y=0: fontsize=24: fontcolor=yellow@1.0: box=1: boxcolor=red@1.0";
           // filter_spec = "drawtext=fontfile=FreeSerif.ttf :text='test': x=w-text_w: y=text_h: fontsize=24: fontcolor=yellow@1.0: box=1: boxcolor=red@1.0";

           ret = init_filter(&amp;filter_ctx[i], stream_ctx[i].dec_ctx,
               stream_ctx[i].enc_ctx, filter_spec);
           if (ret)
               return ret;
       }
       return 0;
    }

    static int encode_write_frame(AVFrame *filt_frame, unsigned int stream_index, int *got_frame, const int videoStreamIndex) {

       // Just video
       if (stream_index != videoStreamIndex)
           return 0;

       int ret;
       int got_frame_local;
       AVPacket enc_pkt;
       int(*enc_func)(AVCodecContext *, AVPacket *, const AVFrame *, int *) =
           (ifmt_ctx->streams[stream_index]->codecpar->codec_type ==
               AVMEDIA_TYPE_VIDEO) ? avcodec_encode_video2 : avcodec_encode_audio2;

       if (!got_frame)
           got_frame = &amp;got_frame_local;

       // av_log(NULL, AV_LOG_INFO, "Encoding frame\n");
       /* encode filtered frame */
       enc_pkt.data = NULL;
       enc_pkt.size = 0;
       av_init_packet(&amp;enc_pkt);

       ret = enc_func(stream_ctx[stream_index].enc_ctx, &amp;enc_pkt,
           filt_frame, got_frame);

       av_frame_free(&amp;filt_frame);
       if (ret &lt; 0)
           return ret;
       if (!(*got_frame))
           return 0;

       /* prepare packet for muxing */
       /*enc_pkt.stream_index = stream_index;
       av_packet_rescale_ts(&amp;enc_pkt, stream_ctx[stream_index].enc_ctx->time_base, ofmt_ctx->streams[stream_index]->time_base);*/
       enc_pkt.stream_index = 0;
       av_packet_rescale_ts(&amp;enc_pkt, stream_ctx[stream_index].enc_ctx->time_base, ofmt_ctx->streams[0]->time_base);

       av_log(NULL, AV_LOG_DEBUG, "Muxing frame\n");
       /* mux encoded frame */
       ret = av_interleaved_write_frame(ofmt_ctx, &amp;enc_pkt);
       return ret;
    }

    static int filter_encode_write_frame(AVFrame *frame, unsigned int stream_index, const int videoStreamIndex)
    {
       // Just video, all else crashes
       if (stream_index != videoStreamIndex)
           return 0;

       int ret;
       AVFrame *filt_frame;

       // av_log(NULL, AV_LOG_INFO, "Pushing decoded frame to filters\n");
       /* push the decoded frame into the filtergraph */
       ret = av_buffersrc_add_frame_flags(filter_ctx[stream_index].buffersrc_ctx,
           frame, 0);
       if (ret &lt; 0) {
           av_log(NULL, AV_LOG_ERROR, "Error while feeding the filtergraph\n");
           return ret;
       }

       /* pull filtered frames from the filtergraph */
       while (1) {
           filt_frame = av_frame_alloc();
           if (!filt_frame) {
               ret = AVERROR(ENOMEM);
               break;
           }
           // av_log(NULL, AV_LOG_INFO, "Pulling filtered frame from filters\n");
           ret = av_buffersink_get_frame(filter_ctx[stream_index].buffersink_ctx,
               filt_frame);
           if (ret &lt; 0) {
               /* if no more frames for output - returns AVERROR(EAGAIN)
               * if flushed and no more frames for output - returns AVERROR_EOF
               * rewrite retcode to 0 to show it as normal procedure completion
               */
               if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
                   ret = 0;
               av_frame_free(&amp;filt_frame);
               break;
           }

           filt_frame->pict_type = AV_PICTURE_TYPE_NONE;
           ret = encode_write_frame(filt_frame, stream_index, NULL, videoStreamIndex);
           if (ret &lt; 0)
               break;
       }

       return ret;
    }

    static int flush_encoder(unsigned int stream_index, const int videoStreamIndex)
    {
       int ret;
       int got_frame;

       // Just video
       if (stream_index != videoStreamIndex)
           return 0;

       if (!(stream_ctx[stream_index].enc_ctx->codec->capabilities &amp;
           AV_CODEC_CAP_DELAY))
           return 0;

       while (1) {
           av_log(NULL, AV_LOG_INFO, "Flushing stream #%u encoder\n", stream_index);
           ret = encode_write_frame(NULL, stream_index, &amp;got_frame, videoStreamIndex);
           if (ret &lt; 0)
               break;
           if (!got_frame)
               return 0;
       }
       return ret;
    }


    #include <vector>

    int main(int argc, char **argv)
    {
       int ret;

       AVPacket packet;
       packet.data = NULL;
       packet.size = 0;

       AVFrame *frame = NULL;
       enum AVMediaType type;
       unsigned int stream_index;
       unsigned int i;
       int got_frame;
       int(*dec_func)(AVCodecContext *, AVFrame *, int *, const AVPacket *);


    #ifdef _DEBUG
       // Hardcoded arguments
       std::vector varguments;
       {
           varguments.push_back(argv[0]);

           // Source
           varguments.push_back("./big_buck_bunny_short.mp4 ");

           // Destination
           varguments.push_back("./big_buck_bunny_short-processed.mp4");
       }

       char** arguments = new char*[varguments.size()];
       for (unsigned int i = 0; i &lt; varguments.size(); i++)
       {
           arguments[i] = varguments[i];
       }
       argc = varguments.size();
       argv = arguments;
    #endif // _DEBUG


       if (argc != 3) {
           av_log(NULL, AV_LOG_ERROR, "Usage: %s <input file="file" /> <output file="file">\n", argv[0]);
           return 1;
       }

       av_register_all();
       avfilter_register_all();

       int videoStreamIndex = -1;
       if ((ret = open_input_file(argv[1], videoStreamIndex)) &lt; 0)
           goto end;
       if ((ret = open_output_file(argv[2], videoStreamIndex)) &lt; 0)
           goto end;
       if ((ret = init_filters(videoStreamIndex)) &lt; 0)
           goto end;

       // Stop after a couple of frames
       int framesToGet = 100;

       /* read all packets */
       //while (framesToGet--)
       while(1)
       {
           if ((ret = av_read_frame(ifmt_ctx, &amp;packet)) &lt; 0)
               break;
           stream_index = packet.stream_index;

           // I just need video
           if (stream_index != videoStreamIndex) {
               av_packet_unref(&amp;packet);
               continue;
           }

           type = ifmt_ctx->streams[packet.stream_index]->codecpar->codec_type;
           av_log(NULL, AV_LOG_DEBUG, "Demuxer gave frame of stream_index %u\n",
               stream_index);

           if (filter_ctx[stream_index].filter_graph) {
               av_log(NULL, AV_LOG_DEBUG, "Going to reencode&amp;filter the frame\n");
               frame = av_frame_alloc();
               if (!frame) {
                   ret = AVERROR(ENOMEM);
                   break;
               }
               av_packet_rescale_ts(&amp;packet,
                   ifmt_ctx->streams[stream_index]->time_base,
                   stream_ctx[stream_index].dec_ctx->time_base);
               dec_func = (type == AVMEDIA_TYPE_VIDEO) ? avcodec_decode_video2 :
                   avcodec_decode_audio4;
               ret = dec_func(stream_ctx[stream_index].dec_ctx, frame,
                   &amp;got_frame, &amp;packet);
               if (ret &lt; 0) {
                   av_frame_free(&amp;frame);
                   av_log(NULL, AV_LOG_ERROR, "Decoding failed\n");
                   break;
               }

               if (got_frame) {
                   frame->pts = frame->best_effort_timestamp;
                   ret = filter_encode_write_frame(frame, stream_index, videoStreamIndex);
                   av_frame_free(&amp;frame);
                   if (ret &lt; 0)
                       goto end;
               }
               else {
                   av_frame_free(&amp;frame);
               }
           }
           else {
               /* remux this frame without reencoding */
               av_packet_rescale_ts(&amp;packet,
                   ifmt_ctx->streams[stream_index]->time_base,
                   ofmt_ctx->streams[stream_index]->time_base);

               ret = av_interleaved_write_frame(ofmt_ctx, &amp;packet);
               if (ret &lt; 0)
                   goto end;
           }
           av_packet_unref(&amp;packet);
       }

       /* flush filters and encoders */
       for (i = 0; i &lt; ifmt_ctx->nb_streams; i++) {
           /* flush filter */
           if (!filter_ctx[i].filter_graph)
               continue;
           ret = filter_encode_write_frame(NULL, i, videoStreamIndex);
           if (ret &lt; 0) {
               av_log(NULL, AV_LOG_ERROR, "Flushing filter failed\n");
               goto end;
           }

           /* flush encoder */
           ret = flush_encoder(i, videoStreamIndex);
           if (ret &lt; 0) {
               av_log(NULL, AV_LOG_ERROR, "Flushing encoder failed\n");
               goto end;
           }
       }

       av_write_trailer(ofmt_ctx);
    end:
       av_packet_unref(&amp;packet);
       av_frame_free(&amp;frame);
       for (i = 0; i &lt; ifmt_ctx->nb_streams; i++) {
           // Just video
           if (i != videoStreamIndex)
               continue;
           avcodec_free_context(&amp;stream_ctx[i].dec_ctx);
           if (ofmt_ctx &amp;&amp; ofmt_ctx->nb_streams > i &amp;&amp; ofmt_ctx->streams[i] &amp;&amp; stream_ctx[i].enc_ctx)
               avcodec_free_context(&amp;stream_ctx[i].enc_ctx);
           if (filter_ctx &amp;&amp; filter_ctx[i].filter_graph)
               avfilter_graph_free(&amp;filter_ctx[i].filter_graph);
       }
       av_free(filter_ctx);
       av_free(stream_ctx);
       avformat_close_input(&amp;ifmt_ctx);
       if (ofmt_ctx &amp;&amp; !(ofmt_ctx->oformat->flags &amp; AVFMT_NOFILE))
           avio_closep(&amp;ofmt_ctx->pb);
       avformat_free_context(ofmt_ctx);

       /*if (ret &lt; 0)
           av_log(NULL, AV_LOG_ERROR, "Error occurred: %s\n", av_err2str(ret));*/

       return ret ? 1 : 0;
    }
    </output></vector>
  • combine different encoding movie into one [duplicate]

    21 décembre 2017, par Hunne

    We are trying to combine/concat different movie episodes into
    one but when sometimes the video is with different encoding at that time
    FFMPEG command throws an error so I would like you please help me in
    this that if we modify the FFMPEG command and it combine different
    encoding movie into one

    > /bin/ffmpeg \
    -f lavfi -i color=c=black \
    -ss 0.000 -t 16.545 \
    -i "/var/customers/webs/dilip/motions4/upload/public/userfiles/input/fb10209949081578900/1509686278_59fbfc06d394b.mp4" \
    -ss 0.000 -t 32.038 \
    -i "/var/customers/webs/dilip/motions4/upload/public/userfiles/tmp/fb881023855388222/1509704918_59fc44d6ac51b.mp4" \
    -ss 16.545 -t 20.386 \
    -i "/var/customers/webs/dilip/motions4/upload/public/userfiles/input/fb10209949081578900/1509686278_59fbfc06d394b.mp4" \
    -i "/var/customers/webs/dilip/motions4/upload/public/userfiles/input/fb10209949081578900/1509685957_59fbfac5113ff.png" \
    -i "/var/customers/webs/dilip/motions4/upload/public/userfiles/public/1509691135_59fc0effd94c8.mp3" \
    -f lavfi -i color=c=black:s=854x480:r=25:d=3 \
    -f lavfi -i color=c=black:s=854x480:r=25:d=3 \
    -filter_complex " \
    [1:v]fps=fps=25[1_fps]; \
    [1_fps]scale=853:480:force_original_aspect_ratio=increase[1_fps_tmpsize]; \
    [1_fps_tmpsize]pad=854:480:x=0.5:y=0:color=black[1_scaled]; \
    [2:v]fps=fps=25[2_fps]; \
    [2_fps]scale=640:480:force_original_aspect_ratio=increase[2_fps_tmpsize]; \
    [2_fps_tmpsize]pad=854:480:x=107:y=0:color=black[2_scaled]; \
    [3:v]fps=fps=25[3_fps]; \
    [3_fps]scale=853:480:force_original_aspect_ratio=increase[3_fps_tmpsize]; \
    [3_fps_tmpsize]pad=854:480:x=0.5:y=0:color=black[3_scaled]; \
    [2_scaled][1_scaled]scale2ref[scaled_2_scaled][1_scaled]; \
    [3_scaled][1_scaled]scale2ref[scaled_3_scaled][1_scaled]; \
    [1_scaled][scaled_2_scaled][scaled_3_scaled]concat=n=3:v=1:a=0[video_out]; \
    [video_out]drawtext=fontfile='/var/customers/webs/dilip/motions4/upload/public/assets/fonts/libel-suit-rg.ttf' \
    :x=w-tw-25:y=25:fontsize=32:text='www.omegaitech.com':fontcolor=white[video_out_watermarked]; \
    [4:v]scale=100:100[scalled_logo]; [video_out_watermarked][scalled_logo]overlay=10:10 [video_out_watermarked]; \
    [5:a]adelay=300|300|300|300|300|300|300|300[audio_out]; \
    [6]setsar=1[a]; \
    [a]drawtext=fontfile='/var/customers/webs/dilip/motions4/upload/public/assets/fonts/libel-suit-rg.ttf' \
    :x=(w-text_w)/2:y=(h-text_h-line_h)/2:fontsize=32:text='Intro text':fontcolor=white[a]; \
    [7]setsar=1[c]; \
    [c]drawtext=fontfile='/var/customers/webs/dilip/motions4/upload/public/assets/fonts/libel-suit-rg.ttf':x=(w-text_w)/2:y=(h)/2-(line_h*2):fontsize=32:text='Created By':fontcolor=white,drawtext=fontfile='/var/customers/webs/dilip/motions4/upload/public/assets/fonts/libel-suit-rg.ttf':x=(w-text_w)/2:y=(h)/2-(line_h)+10:fontsize=32:text='Dilip Gorasia (omegaitech@yahoo.com)':fontcolor=white,drawtext=fontfile='/var/customers/webs/dilip/motions4/upload/public/assets/fonts/libel-suit-rg.ttf':x=(w-text_w)/2:y=(h)/2+20:fontsize=32:text='Modified By':fontcolor=white,drawtext=fontfile='/var/customers/webs/dilip/motions4/upload/public/assets/fonts/libel-suit-rg.ttf':x=(w-text_w)/2:y=(h)/2+(line_h)+20:fontsize=32:text='Raj Patel (rinpate@gmail.com)':fontcolor=white[c]; \
    [video_out_watermarked]setsar=1[b]; \
    [a][b][c]concat=n=3:v=1:a=0[video_out_watermarked]; \
    [video_out_watermarked]drawtext=fontfile='/var/customers/webs/dilip/motions4/upload/public/assets/fonts/arial.ttf' \
    :x=100:y=100:fontsize=32:text='Raj Patel':fontcolor=white:enable='between(t,0,13.37)'[video_out_watermarked]; \
    [video_out_watermarked]drawtext=fontfile='/var/customers/webs/dilip/motions4/upload/public/assets/fonts/arial.ttf' \
    :x=200:y=200:fontsize=32:text='Raj Patel':fontcolor=white:enable='between(t,13.37,38.78)'[video_out_watermarked] \
    " \
    -map "[video_out_watermarked]" -map "[audio_out]" \
    -s 854x480 \
    -aspect 1.779167 \
    -r 25 \
    -c:v libx264 -b:v 800k -bufsize 64k -crf 24 -movflags faststart -q:v 0 -q:a 0 -c:a aac -strict experimental -b:a 128k -f mp4 -threads 2 -shortest \
    -t 74.969 -async 1 \
    -y "/var/customers/webs/dilip/motions4/upload/public/userfiles/output/fb881023855388222/1509704929_59fc44e122d41.mp4"
    ffmpeg version N-87770-g1954e62 Copyright (c) 2000-2017 the FFmpeg developers
     built with gcc 4.9.2 (Debian 4.9.2-10)
     configuration: --prefix=/root/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --bindir=/root/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
     libavutil      55. 77.101 / 55. 77.101
     libavcodec     57.106.104 / 57.106.104
     libavformat    57. 82.104 / 57. 82.104
     libavdevice    57.  9.102 / 57.  9.102
     libavfilter     6.106.101 /  6.106.101
     libswscale      4.  7.103 /  4.  7.103
     libswresample   2.  8.100 /  2.  8.100
     libpostproc    54.  6.100 / 54.  6.100
    Input #0, lavfi, from 'color=c=black':
     Duration: N/A, start: 0.000000, bitrate: N/A
       Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
    Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '/var/customers/webs/dilip/motions4/upload/public/userfiles/input/fb10209949081578900/1509686278_59fbfc06d394b.mp4':
     Metadata:
       major_brand     : mp42
       minor_version   : 0
       compatible_brands: isommp42
       creation_time   : 2016-09-07T03:10:56.000000Z
     Duration: 00:04:06.76, start: 0.000000, bitrate: 2324 kb/s
       Stream #1:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 2194 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default)
       Metadata:
         creation_time   : 2016-09-07T03:10:56.000000Z
         handler_name    : ISO Media file produced by Google Inc.
       Stream #1:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
       Metadata:
         creation_time   : 2016-09-07T03:10:56.000000Z
         handler_name    : ISO Media file produced by Google Inc.
    Input #2, mov,mp4,m4a,3gp,3g2,mj2, from '/var/customers/webs/dilip/motions4/upload/public/userfiles/tmp/fb881023855388222/1509704918_59fc44d6ac51b.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf57.36.100
       comment         : 1361809051215868
     Duration: 00:00:32.38, start: 0.000000, bitrate: 310 kb/s
       Stream #2:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 182 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #2:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 122 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
    Input #3, mov,mp4,m4a,3gp,3g2,mj2, from '/var/customers/webs/dilip/motions4/upload/public/userfiles/input/fb10209949081578900/1509686278_59fbfc06d394b.mp4':
     Metadata:
       major_brand     : mp42
       minor_version   : 0
       compatible_brands: isommp42
       creation_time   : 2016-09-07T03:10:56.000000Z
     Duration: 00:04:06.76, start: 0.000000, bitrate: 2324 kb/s
       Stream #3:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 2194 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default)
       Metadata:
         creation_time   : 2016-09-07T03:10:56.000000Z
         handler_name    : ISO Media file produced by Google Inc.
       Stream #3:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
       Metadata:
         creation_time   : 2016-09-07T03:10:56.000000Z
         handler_name    : ISO Media file produced by Google Inc.
    Input #4, png_pipe, from '/var/customers/webs/dilip/motions4/upload/public/userfiles/input/fb10209949081578900/1509685957_59fbfac5113ff.png':
     Duration: N/A, bitrate: N/A
       Stream #4:0: Video: png, rgba(pc), 128x128, 25 tbr, 25 tbn, 25 tbc
    Input #5, mp3, from '/var/customers/webs/dilip/motions4/upload/public/userfiles/public/1509691135_59fc0effd94c8.mp3':
     Metadata:
       TOAL            : www.Songs.PK
       TRSN            : www.Songs.PK
       TPE4            : www.Songs.PK
       encoded_by      : Eac * Lame
       EpisodeID       : www.Songs.PK
       comment         : www.Songs.PK
       lyrics-eng      : www.Songs.PK
       title           : Zor Ka Jhatka - www.Songs.PK
       track           : 1
       TGID            : www.Songs.PK
       TIT1            : www.Songs.PK
       TIT3            : www.Songs.PK
       copyright       : www.Songs.PK
       performer       : www.Songs.PK
       publisher       : www.Songs.PK
       genre           : Bollywood Music
       album           : Action Replayy
       album_artist    : www.Songs.PK
       composer        : www.Songs.PK
       TEXT            : www.Songs.PK
       TOLY            : www.Songs.PK
       TOPE            : Music: Pritam | Lyrics: Irshad Kamil
       artist          : Daler Mehndi, Richa Sharma
       TDES            : www.Songs.PK
       TCAT            : www.Songs.PK
       date            : 2010
     Duration: 00:04:10.17, start: 0.025056, bitrate: 164 kb/s
       Stream #5:0: Audio: mp3, 44100 Hz, stereo, s16p, 158 kb/s
       Metadata:
         encoder         : LAME3.98r
       Stream #5:1: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 900x803 [SAR 300:300 DAR 900:803], 90k tbr, 90k tbn, 90k tbc
       Metadata:
         comment         : Cover (front)
    Input #6, lavfi, from 'color=c=black:s=854x480:r=25:d=3':
     Duration: N/A, start: 0.000000, bitrate: N/A
       Stream #6:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 854x480 [SAR 1:1 DAR 427:240], 25 tbr, 25 tbn, 25 tbc
    Input #7, lavfi, from 'color=c=black:s=854x480:r=25:d=3':
     Duration: N/A, start: 0.000000, bitrate: N/A
       Stream #7:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 854x480 [SAR 1:1 DAR 427:240], 25 tbr, 25 tbn, 25 tbc
    Stream mapping:
     Stream #1:0 (h264) -fps
     Stream #2:0 (h264) -fps
     Stream #3:0 (h264) -fps
     Stream #4:0 (png) -scale
     Stream #5:0 (mp3) -adelay
     Stream #6:0 (rawvideo) -setsar
     Stream #7:0 (rawvideo) -setsar
     drawtext -Stream #0:0 (libx264)
     adelay -Stream #0:1 (aac)
    Press [q] to stop, [?] for help
    -async is forwarded to lavfi similarly to -af aresample=async=1:min_hard_comp=0.100000:first_pts=0.
    [Parsed_concat_11 @ 0x340f840] Input link in1:v0 parameters (size 854x480, SAR 1:1) do not match the corresponding output link in0:v0 parameters (854x480, SAR 2560:2559)
    [Parsed_concat_11 @ 0x340f840] Failed to configure output pad on Parsed_concat_11
    Error reinitializing filters!
    Failed to inject frame into filter network: Invalid argument
    Error while processing the decoded data for stream #7:0
    Conversion failed!`enter code here`

    Thx for your help