Recherche avancée

Médias (1)

Mot : - Tags -/swfupload

Autres articles (103)

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • 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

Sur d’autres sites (13420)

  • increasing memory occupancy while recording screen save to disk with ffmpeg [on hold]

    19 mai 2016, par vbtang

    wonder if there are any resoures i didn’t free ?or do i need to do something special so that i can free these momery ?

    ps. run the demo step by step, and found it has the same problem, until it quit the main function, it still have 40MB memory occupancy. And i found the memory increase obviously in the screen capture thread,but when it increased to about 150MB, it won’t increase, until i quit the program, it will have 40MB memory left. i feel confused.

    pss. i download ffmpeg dev and shared version form here https://ffmpeg.zeranoe.com/builds/,it seems a dll of debug version ? do i need a release version ?
    here is my demo code.

       #include "stdafx.h"

    #ifdef  __cplusplus
    extern "C"
    {
    #endif
    #include "libavcodec/avcodec.h"
    #include "libavformat/avformat.h"
    #include "libswscale/swscale.h"
    #include "libavdevice/avdevice.h"
    #include "libavutil/audio_fifo.h"

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

    //#pragma comment(lib, "avfilter.lib")
    //#pragma comment(lib, "postproc.lib")
    //#pragma comment(lib, "swresample.lib")
    #pragma comment(lib, "swscale.lib")
    #ifdef __cplusplus
    };
    #endif

    AVFormatContext *pFormatCtx_Video = NULL, *pFormatCtx_Audio = NULL, *pFormatCtx_Out = NULL;
    AVCodecContext  *pCodecCtx_Video;
    AVCodec         *pCodec_Video;
    AVFifoBuffer    *fifo_video = NULL;
    AVAudioFifo     *fifo_audio = NULL;
    int VideoIndex, AudioIndex;

    CRITICAL_SECTION AudioSection, VideoSection;



    SwsContext *img_convert_ctx;
    int frame_size = 0;

    uint8_t *picture_buf = NULL, *frame_buf = NULL;

    bool bCap = true;

    DWORD WINAPI ScreenCapThreadProc( LPVOID lpParam );
    DWORD WINAPI AudioCapThreadProc( LPVOID lpParam );

    int OpenVideoCapture()
    {
       AVInputFormat *ifmt=av_find_input_format("gdigrab");
       //
       AVDictionary *options = NULL;
       av_dict_set(&options, "framerate", "15", NULL);
       //av_dict_set(&options,"offset_x","20",0);
       //The distance from the top edge of the screen or desktop
       //av_dict_set(&options,"offset_y","40",0);
       //Video frame size. The default is to capture the full screen
       //av_dict_set(&options,"video_size","320x240",0);
       if(avformat_open_input(&pFormatCtx_Video, "desktop", ifmt, &options)!=0)
       {
           printf("Couldn't open input stream.(无法打开视频输入流)\n");
           return -1;
       }
       if(avformat_find_stream_info(pFormatCtx_Video,NULL)<0)
       {
           printf("Couldn't find stream information.(无法获取视频流信息)\n");
           return -1;
       }
       if (pFormatCtx_Video->streams[0]->codec->codec_type != AVMEDIA_TYPE_VIDEO)
       {
           printf("Couldn't find video stream information.(无法获取视频流信息)\n");
           return -1;
       }
       pCodecCtx_Video = pFormatCtx_Video->streams[0]->codec;
       pCodec_Video = avcodec_find_decoder(pCodecCtx_Video->codec_id);
       if(pCodec_Video == NULL)
       {
           printf("Codec not found.(没有找到解码器)\n");
           return -1;
       }
       if(avcodec_open2(pCodecCtx_Video, pCodec_Video, NULL) < 0)
       {
           printf("Could not open codec.(无法打开解码器)\n");
           return -1;
       }



       img_convert_ctx = sws_getContext(pCodecCtx_Video->width, pCodecCtx_Video->height, pCodecCtx_Video->pix_fmt,
           pCodecCtx_Video->width, pCodecCtx_Video->height, PIX_FMT_YUV420P, SWS_BICUBIC, NULL, NULL, NULL);

       frame_size = avpicture_get_size(pCodecCtx_Video->pix_fmt, pCodecCtx_Video->width, pCodecCtx_Video->height);
       //
       fifo_video = av_fifo_alloc(30 * avpicture_get_size(AV_PIX_FMT_YUV420P, pCodecCtx_Video->width, pCodecCtx_Video->height));

       return 0;
    }

    static char *dup_wchar_to_utf8(wchar_t *w)
    {
       char *s = NULL;
       int l = WideCharToMultiByte(CP_UTF8, 0, w, -1, 0, 0, 0, 0);
       s = (char *) av_malloc(l);
       if (s)
           WideCharToMultiByte(CP_UTF8, 0, w, -1, s, l, 0, 0);
       return s;
    }

    int OpenAudioCapture()
    {
       //
       AVInputFormat *pAudioInputFmt = av_find_input_format("dshow");

       //
       char * psDevName = dup_wchar_to_utf8(L"audio=virtual-audio-capturer");

       if (avformat_open_input(&pFormatCtx_Audio, psDevName, pAudioInputFmt,NULL) < 0)
       {
           printf("Couldn't open input stream.(无法打开音频输入流)\n");
           return -1;
       }

       if(avformat_find_stream_info(pFormatCtx_Audio,NULL)<0)  
           return -1;

       if(pFormatCtx_Audio->streams[0]->codec->codec_type != AVMEDIA_TYPE_AUDIO)
       {
           printf("Couldn't find video stream information.(无法获取音频流信息)\n");
           return -1;
       }

       AVCodec *tmpCodec = avcodec_find_decoder(pFormatCtx_Audio->streams[0]->codec->codec_id);
       if(0 > avcodec_open2(pFormatCtx_Audio->streams[0]->codec, tmpCodec, NULL))
       {
           printf("can not find or open audio decoder!\n");
       }



       return 0;
    }

    int OpenOutPut()
    {
       AVStream *pVideoStream = NULL, *pAudioStream = NULL;
       const char *outFileName = "test.mp4";
       avformat_alloc_output_context2(&pFormatCtx_Out, NULL, NULL, outFileName);

       if (pFormatCtx_Video->streams[0]->codec->codec_type == AVMEDIA_TYPE_VIDEO)
       {
           VideoIndex = 0;
           pVideoStream = avformat_new_stream(pFormatCtx_Out, NULL);

           if (!pVideoStream)
           {
               printf("can not new stream for output!\n");
               return -1;
           }

           //set codec context param
           pVideoStream->codec->codec = avcodec_find_encoder(AV_CODEC_ID_MPEG4);
           pVideoStream->codec->height = pFormatCtx_Video->streams[0]->codec->height;
           pVideoStream->codec->width = pFormatCtx_Video->streams[0]->codec->width;

           pVideoStream->codec->time_base = pFormatCtx_Video->streams[0]->codec->time_base;
           pVideoStream->codec->sample_aspect_ratio = pFormatCtx_Video->streams[0]->codec->sample_aspect_ratio;
           // take first format from list of supported formats
           pVideoStream->codec->pix_fmt = pFormatCtx_Out->streams[VideoIndex]->codec->codec->pix_fmts[0];

           //open encoder
           if (!pVideoStream->codec->codec)
           {
               printf("can not find the encoder!\n");
               return -1;
           }

           if (pFormatCtx_Out->oformat->flags & AVFMT_GLOBALHEADER)
               pVideoStream->codec->flags |= CODEC_FLAG_GLOBAL_HEADER;

           if ((avcodec_open2(pVideoStream->codec, pVideoStream->codec->codec, NULL)) < 0)
           {
               printf("can not open the encoder\n");
               return -1;
           }
       }

       if(pFormatCtx_Audio->streams[0]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
       {
           AVCodecContext *pOutputCodecCtx;
           AudioIndex = 1;
           pAudioStream = avformat_new_stream(pFormatCtx_Out, NULL);

           pAudioStream->codec->codec = avcodec_find_encoder(pFormatCtx_Out->oformat->audio_codec);

           pOutputCodecCtx = pAudioStream->codec;

           pOutputCodecCtx->sample_rate = pFormatCtx_Audio->streams[0]->codec->sample_rate;
           pOutputCodecCtx->channel_layout = pFormatCtx_Out->streams[0]->codec->channel_layout;
           pOutputCodecCtx->channels = av_get_channel_layout_nb_channels(pAudioStream->codec->channel_layout);
           if(pOutputCodecCtx->channel_layout == 0)
           {
               pOutputCodecCtx->channel_layout = AV_CH_LAYOUT_STEREO;
               pOutputCodecCtx->channels = av_get_channel_layout_nb_channels(pOutputCodecCtx->channel_layout);

           }
           pOutputCodecCtx->sample_fmt = pAudioStream->codec->codec->sample_fmts[0];
           AVRational time_base={1, pAudioStream->codec->sample_rate};
           pAudioStream->time_base = time_base;
           //audioCodecCtx->time_base = time_base;

           pOutputCodecCtx->codec_tag = 0;  
           if (pFormatCtx_Out->oformat->flags & AVFMT_GLOBALHEADER)  
               pOutputCodecCtx->flags |= CODEC_FLAG_GLOBAL_HEADER;

           if (avcodec_open2(pOutputCodecCtx, pOutputCodecCtx->codec, 0) < 0)
           {
               //
               return -1;
           }
       }

       if (!(pFormatCtx_Out->oformat->flags & AVFMT_NOFILE))
       {
           if(avio_open(&pFormatCtx_Out->pb, outFileName, AVIO_FLAG_WRITE) < 0)
           {
               printf("can not open output file handle!\n");
               return -1;
           }
       }

       if(avformat_write_header(pFormatCtx_Out, NULL) < 0)
       {
           printf("can not write the header of the output file!\n");
           return -1;
       }

       return 0;
    }

    int _tmain(int argc, _TCHAR* argv[])
    {
       av_register_all();
       avdevice_register_all();
       if (OpenVideoCapture() < 0)
       {
           return -1;
       }
       if (OpenAudioCapture() < 0)
       {
           return -1;
       }
       if (OpenOutPut() < 0)
       {
           return -1;
       }

       InitializeCriticalSection(&VideoSection);
       InitializeCriticalSection(&AudioSection);

       AVFrame *picture = av_frame_alloc();
       int size = avpicture_get_size(pFormatCtx_Out->streams[VideoIndex]->codec->pix_fmt,
           pFormatCtx_Out->streams[VideoIndex]->codec->width, pFormatCtx_Out->streams[VideoIndex]->codec->height);
       picture_buf = new uint8_t[size];

       avpicture_fill((AVPicture *)picture, picture_buf,
           pFormatCtx_Out->streams[VideoIndex]->codec->pix_fmt,
           pFormatCtx_Out->streams[VideoIndex]->codec->width,
           pFormatCtx_Out->streams[VideoIndex]->codec->height);



       //star cap screen thread
       CreateThread( NULL, 0, ScreenCapThreadProc, 0, 0, NULL);
       //star cap audio thread
       CreateThread( NULL, 0, AudioCapThreadProc, 0, 0, NULL);
       int64_t cur_pts_v=0,cur_pts_a=0;
       int VideoFrameIndex = 0, AudioFrameIndex = 0;

       while(1)
       {
           if (_kbhit() != 0 && bCap)
           {
               bCap = false;
               Sleep(2000);//
           }
           if (fifo_audio && fifo_video)
           {
               int sizeAudio = av_audio_fifo_size(fifo_audio);
               int sizeVideo = av_fifo_size(fifo_video);
               //
               if (av_audio_fifo_size(fifo_audio) <= pFormatCtx_Out->streams[AudioIndex]->codec->frame_size &&
                   av_fifo_size(fifo_video) <= frame_size && !bCap)
               {
                   break;
               }
           }

           if(av_compare_ts(cur_pts_v, pFormatCtx_Out->streams[VideoIndex]->time_base,
               cur_pts_a,pFormatCtx_Out->streams[AudioIndex]->time_base) <= 0)
           {
               //read data from fifo
               if (av_fifo_size(fifo_video) < frame_size && !bCap)
               {
                   cur_pts_v = 0x7fffffffffffffff;
               }
               if(av_fifo_size(fifo_video) >= size)
               {
                   EnterCriticalSection(&VideoSection);
                   av_fifo_generic_read(fifo_video, picture_buf, size, NULL);
                   LeaveCriticalSection(&VideoSection);

                   avpicture_fill((AVPicture *)picture, picture_buf,
                       pFormatCtx_Out->streams[VideoIndex]->codec->pix_fmt,
                       pFormatCtx_Out->streams[VideoIndex]->codec->width,
                       pFormatCtx_Out->streams[VideoIndex]->codec->height);

                   //pts = n * ((1 / timbase)/ fps);
                   picture->pts = VideoFrameIndex * ((pFormatCtx_Video->streams[0]->time_base.den / pFormatCtx_Video->streams[0]->time_base.num) / 15);

                   int got_picture = 0;
                   AVPacket pkt;
                   av_init_packet(&pkt);

                   pkt.data = NULL;
                   pkt.size = 0;
                   int ret = avcodec_encode_video2(pFormatCtx_Out->streams[VideoIndex]->codec, &pkt, picture, &got_picture);
                   if(ret < 0)
                   {
                       //
                       continue;
                   }

                   if (got_picture==1)
                   {
                       pkt.stream_index = VideoIndex;
                       pkt.pts = av_rescale_q_rnd(pkt.pts, pFormatCtx_Video->streams[0]->time_base,
                           pFormatCtx_Out->streams[VideoIndex]->time_base, (AVRounding)(AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX));  
                       pkt.dts = av_rescale_q_rnd(pkt.dts,  pFormatCtx_Video->streams[0]->time_base,
                           pFormatCtx_Out->streams[VideoIndex]->time_base, (AVRounding)(AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX));  

                       pkt.duration = ((pFormatCtx_Out->streams[0]->time_base.den / pFormatCtx_Out->streams[0]->time_base.num) / 15);

                       cur_pts_v = pkt.pts;

                       ret = av_interleaved_write_frame(pFormatCtx_Out, &pkt);
                       //delete[] pkt.data;
                       av_free_packet(&pkt);
                   }
                   VideoFrameIndex++;
               }
           }
           else
           {
               if (NULL == fifo_audio)
               {
                   continue;//
               }
               if (av_audio_fifo_size(fifo_audio) < pFormatCtx_Out->streams[AudioIndex]->codec->frame_size && !bCap)
               {
                   cur_pts_a = 0x7fffffffffffffff;
               }
               if(av_audio_fifo_size(fifo_audio) >=
                   (pFormatCtx_Out->streams[AudioIndex]->codec->frame_size > 0 ? pFormatCtx_Out->streams[AudioIndex]->codec->frame_size : 1024))
               {
                   AVFrame *frame;
                   frame = av_frame_alloc();
                   frame->nb_samples = pFormatCtx_Out->streams[AudioIndex]->codec->frame_size>0 ? pFormatCtx_Out->streams[AudioIndex]->codec->frame_size: 1024;
                   frame->channel_layout = pFormatCtx_Out->streams[AudioIndex]->codec->channel_layout;
                   frame->format = pFormatCtx_Out->streams[AudioIndex]->codec->sample_fmt;
                   frame->sample_rate = pFormatCtx_Out->streams[AudioIndex]->codec->sample_rate;
                   av_frame_get_buffer(frame, 0);

                   EnterCriticalSection(&AudioSection);
                   av_audio_fifo_read(fifo_audio, (void **)frame->data,
                       (pFormatCtx_Out->streams[AudioIndex]->codec->frame_size > 0 ? pFormatCtx_Out->streams[AudioIndex]->codec->frame_size : 1024));
                   LeaveCriticalSection(&AudioSection);

                   if (pFormatCtx_Out->streams[0]->codec->sample_fmt != pFormatCtx_Audio->streams[AudioIndex]->codec->sample_fmt
                       || pFormatCtx_Out->streams[0]->codec->channels != pFormatCtx_Audio->streams[AudioIndex]->codec->channels
                       || pFormatCtx_Out->streams[0]->codec->sample_rate != pFormatCtx_Audio->streams[AudioIndex]->codec->sample_rate)
                   {
                       //
                   }

                   AVPacket pkt_out;
                   av_init_packet(&pkt_out);
                   int got_picture = -1;
                   pkt_out.data = NULL;
                   pkt_out.size = 0;

                   frame->pts = AudioFrameIndex * pFormatCtx_Out->streams[AudioIndex]->codec->frame_size;
                   if (avcodec_encode_audio2(pFormatCtx_Out->streams[AudioIndex]->codec, &pkt_out, frame, &got_picture) < 0)
                   {
                       printf("can not decoder a frame");
                   }
                   av_frame_free(&frame);
                   if (got_picture)
                   {
                       pkt_out.stream_index = AudioIndex;
                       pkt_out.pts = AudioFrameIndex * pFormatCtx_Out->streams[AudioIndex]->codec->frame_size;
                       pkt_out.dts = AudioFrameIndex * pFormatCtx_Out->streams[AudioIndex]->codec->frame_size;
                       pkt_out.duration = pFormatCtx_Out->streams[AudioIndex]->codec->frame_size;

                       cur_pts_a = pkt_out.pts;

                       int ret = av_interleaved_write_frame(pFormatCtx_Out, &pkt_out);
                       av_free_packet(&pkt_out);
                   }
                   AudioFrameIndex++;
               }
           }
       }

       delete[] picture_buf;

       delete[]frame_buf;
       av_fifo_free(fifo_video);
       av_audio_fifo_free(fifo_audio);

       av_write_trailer(pFormatCtx_Out);

       avio_close(pFormatCtx_Out->pb);
       avformat_free_context(pFormatCtx_Out);

       if (pFormatCtx_Video != NULL)
       {
           avformat_close_input(&pFormatCtx_Video);
           pFormatCtx_Video = NULL;
       }
       if (pFormatCtx_Audio != NULL)
       {
           avformat_close_input(&pFormatCtx_Audio);
           pFormatCtx_Audio = NULL;
       }
       if (NULL != img_convert_ctx)
       {
           sws_freeContext(img_convert_ctx);
           img_convert_ctx = NULL;
       }

       return 0;
    }

    DWORD WINAPI ScreenCapThreadProc( LPVOID lpParam )
    {
       AVPacket packet;/* = (AVPacket *)av_malloc(sizeof(AVPacket))*/;
       int got_picture;
       AVFrame *pFrame;
       pFrame= av_frame_alloc();

       AVFrame *picture = av_frame_alloc();
       int size = avpicture_get_size(pFormatCtx_Out->streams[VideoIndex]->codec->pix_fmt,
           pFormatCtx_Out->streams[VideoIndex]->codec->width, pFormatCtx_Out->streams[VideoIndex]->codec->height);
       //picture_buf = new uint8_t[size];

       avpicture_fill((AVPicture *)picture, picture_buf,
           pFormatCtx_Out->streams[VideoIndex]->codec->pix_fmt,
           pFormatCtx_Out->streams[VideoIndex]->codec->width,
           pFormatCtx_Out->streams[VideoIndex]->codec->height);

    //  FILE *p = NULL;
    //  p = fopen("proc_test.yuv", "wb+");
       av_init_packet(&packet);
       int height = pFormatCtx_Out->streams[VideoIndex]->codec->height;
       int width = pFormatCtx_Out->streams[VideoIndex]->codec->width;
       int y_size=height*width;
       while(bCap)
       {
           packet.data = NULL;
           packet.size = 0;
           if (av_read_frame(pFormatCtx_Video, &packet) < 0)
           {
               av_free_packet(&packet);
               continue;
           }
           if(packet.stream_index == 0)
           {
               if (avcodec_decode_video2(pCodecCtx_Video, pFrame, &got_picture, &packet) < 0)
               {
                   printf("Decode Error.(解码错误)\n");
                   continue;
               }
               if (got_picture)
               {
                   sws_scale(img_convert_ctx, (const uint8_t* const*)pFrame->data, pFrame->linesize, 0,
                       pFormatCtx_Out->streams[VideoIndex]->codec->height, picture->data, picture->linesize);

                   if (av_fifo_space(fifo_video) >= size)
                   {
                       EnterCriticalSection(&VideoSection);                    
                       av_fifo_generic_write(fifo_video, picture->data[0], y_size, NULL);
                       av_fifo_generic_write(fifo_video, picture->data[1], y_size/4, NULL);
                       av_fifo_generic_write(fifo_video, picture->data[2], y_size/4, NULL);
                       LeaveCriticalSection(&VideoSection);
                   }
               }
           }
           av_free_packet(&packet);
           //Sleep(50);
       }
       av_frame_free(&pFrame);
       av_frame_free(&picture);
       //delete[] picture_buf;
       return 0;
    }

    DWORD WINAPI AudioCapThreadProc( LPVOID lpParam )
    {
       AVPacket pkt;
       AVFrame *frame;
       frame = av_frame_alloc();
       int gotframe;
       while(bCap)
       {
           pkt.data = NULL;
           pkt.size = 0;
           if(av_read_frame(pFormatCtx_Audio,&pkt) < 0)
           {
               av_free_packet(&pkt);
               continue;
           }

           if (avcodec_decode_audio4(pFormatCtx_Audio->streams[0]->codec, frame, &gotframe, &pkt) < 0)
           {
               av_frame_free(&frame);
               printf("can not decoder a frame");
               break;
           }
           av_free_packet(&pkt);

           if (!gotframe)
           {
               continue;//
           }

           if (NULL == fifo_audio)
           {
               fifo_audio = av_audio_fifo_alloc(pFormatCtx_Audio->streams[0]->codec->sample_fmt,
                   pFormatCtx_Audio->streams[0]->codec->channels, 30 * frame->nb_samples);
           }

           int buf_space = av_audio_fifo_space(fifo_audio);
           if (av_audio_fifo_space(fifo_audio) >= frame->nb_samples)
           {
               EnterCriticalSection(&AudioSection);
               av_audio_fifo_write(fifo_audio, (void **)frame->data, frame->nb_samples);
               LeaveCriticalSection(&AudioSection);
           }
       }
       av_frame_free(&frame);
       return 0;
    }
  • Why calling libav* library doesn't have same quality as ffmpeg command line ?

    10 mai 2016, par seaguest

    I am using the ffmpeg 3 to do the video format conversion, it works fine when I use the command line mode, but when I call the libav* library, I get a audio quality loss problem (there is a lot of noises in the audio).

    Here are the two files :

    mv.webm - original file
    mv2.mp4 converted with libarary , a lot of noises

    Here is the probe information for the mv.webm :

    $ ffprobe mv.webm
    ffprobe version N-79826-g64fd62d Copyright (c) 2007-2016 the FFmpeg developers
     built with gcc 5.3.1 (Ubuntu 5.3.1-14ubuntu2) 20160413
     configuration: --prefix=/home/seaguest/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/seaguest/ffmpeg_build/include --extra-ldflags=-L/home/seaguest/ffmpeg_build/lib --enable-gpl --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-nonfree
     libavutil      55. 24.100 / 55. 24.100
     libavcodec     57. 39.100 / 57. 39.100
     libavformat    57. 36.100 / 57. 36.100
     libavdevice    57.  0.101 / 57.  0.101
     libavfilter     6. 45.100 /  6. 45.100
     libswscale      4.  1.100 /  4.  1.100
     libswresample   2.  0.101 /  2.  0.101
     libpostproc    54.  0.100 / 54.  0.100
    Input #0, matroska,webm, from 'mv.webm':
     Metadata:
       encoder         : Lavf57.36.100
     Duration: 00:00:30.00, start: 0.000000, bitrate: 935 kb/s
       Stream #0:0: Video: vp8, yuv420p, 640x480, SAR 1:1 DAR 4:3, 25 fps, 25 tbr, 1k tbn (default)
       Stream #0:1: Audio: vorbis, 44100 Hz, stereo, fltp (default)

    I checked the log printed by command line mode and calling code mode, the setting looks like the same, here are the logs :

    $ ffmpeg -i mv.webm -c:a aac -c:v libx264  mv.mp4
    ffmpeg version N-79826-g64fd62d Copyright (c) 2000-2016 the FFmpeg developers
     built with gcc 5.3.1 (Ubuntu 5.3.1-14ubuntu2) 20160413
     configuration: --prefix=/home/seaguest/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/seaguest/ffmpeg_build/include --extra-ldflags=-L/home/seaguest/ffmpeg_build/lib --enable-gpl --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-nonfree
     libavutil      55. 24.100 / 55. 24.100
     libavcodec     57. 39.100 / 57. 39.100
     libavformat    57. 36.100 / 57. 36.100
     libavdevice    57.  0.101 / 57.  0.101
     libavfilter     6. 45.100 /  6. 45.100
     libswscale      4.  1.100 /  4.  1.100
     libswresample   2.  0.101 /  2.  0.101
     libpostproc    54.  0.100 / 54.  0.100
    Input #0, matroska,webm, from 'mv.webm':
     Metadata:
       encoder         : Lavf57.36.100
     Duration: 00:00:30.00, start: 0.000000, bitrate: 935 kb/s
       Stream #0:0: Video: vp8, yuv420p, 640x480, SAR 1:1 DAR 4:3, 25 fps, 25 tbr, 1k tbn (default)
       Stream #0:1: Audio: vorbis, 44100 Hz, stereo, fltp (default)
    [libx264 @ 0x3e5d880] using SAR=1/1
    [libx264 @ 0x3e5d880] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
    [libx264 @ 0x3e5d880] profile High, level 3.0
    [libx264 @ 0x3e5d880] 264 - core 148 r2643 5c65704 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    [mp4 @ 0x3e2f680] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
       Last message repeated 1 times
    Output #0, mp4, to 'mv.mp4':
     Metadata:
       encoder         : Lavf57.36.100
       Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=2-31, 25 fps, 12800 tbn (default)
       Metadata:
         encoder         : Lavc57.39.100 libx264
       Side data:
         cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
       Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp, 128 kb/s (default)
       Metadata:
         encoder         : Lavc57.39.100 aac
    Stream mapping:
     Stream #0:0 -> #0:0 (vp8 (native) -> h264 (libx264))
     Stream #0:1 -> #0:1 (vorbis (native) -> aac (native))
    Press [q] to stop, [?] for help
    frame=  750 fps=229 q=-1.0 Lsize=    2508kB time=00:00:30.02 bitrate= 684.5kbits/s speed=9.17x
    video:2023kB audio:459kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.052857%
    [libx264 @ 0x3e5d880] frame I:11    Avg QP:15.29  size: 20395
    [libx264 @ 0x3e5d880] frame P:345   Avg QP:20.93  size:  4350
    [libx264 @ 0x3e5d880] frame B:394   Avg QP:23.55  size:   879
    [libx264 @ 0x3e5d880] consecutive B-frames: 25.2%  3.2% 33.2% 38.4%
    [libx264 @ 0x3e5d880] mb I  I16..4: 44.1% 32.5% 23.4%
    [libx264 @ 0x3e5d880] mb P  I16..4:  1.5%  3.6%  0.6%  P16..4: 28.9% 11.2%  4.7%  0.0%  0.0%    skip:49.5%
    [libx264 @ 0x3e5d880] mb B  I16..4:  0.0%  0.1%  0.0%  B16..8: 27.4%  2.0%  0.4%  direct: 0.8%  skip:69.3%  L0:40.0% L1:53.3% BI: 6.7%
    [libx264 @ 0x3e5d880] 8x8 transform intra:52.6% inter:74.9%
    [libx264 @ 0x3e5d880] coded y,uvDC,uvAC intra: 57.5% 68.6% 35.9% inter: 10.6% 11.9% 2.6%
    [libx264 @ 0x3e5d880] i16 v,h,dc,p: 36% 42%  7% 15%
    [libx264 @ 0x3e5d880] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 23% 15% 6%  7%  7% 10%  7% 10%
    [libx264 @ 0x3e5d880] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 27% 14% 6%  8%  7%  7%  6%  6%
    [libx264 @ 0x3e5d880] i8c dc,h,v,p: 46% 34% 11%  9%
    [libx264 @ 0x3e5d880] Weighted P-Frames: Y:0.0% UV:0.0%
    [libx264 @ 0x3e5d880] ref P L0: 63.9% 20.8% 11.2%  4.1%
    [libx264 @ 0x3e5d880] ref B L0: 93.1%  6.1%  0.8%
    [libx264 @ 0x3e5d880] ref B L1: 95.8%  4.2%
    [libx264 @ 0x3e5d880] kb/s:552.32
    [aac @ 0x3e5ec00] Qavg: 3030.804


    $ ffprobe mv.mp4
    ffprobe version N-79826-g64fd62d Copyright (c) 2007-2016 the FFmpeg developers
     built with gcc 5.3.1 (Ubuntu 5.3.1-14ubuntu2) 20160413
     configuration: --prefix=/home/seaguest/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/seaguest/ffmpeg_build/include --extra-ldflags=-L/home/seaguest/ffmpeg_build/lib --enable-gpl --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-nonfree
     libavutil      55. 24.100 / 55. 24.100
     libavcodec     57. 39.100 / 57. 39.100
     libavformat    57. 36.100 / 57. 36.100
     libavdevice    57.  0.101 / 57.  0.101
     libavfilter     6. 45.100 /  6. 45.100
     libswscale      4.  1.100 /  4.  1.100
     libswresample   2.  0.101 /  2.  0.101
     libpostproc    54.  0.100 / 54.  0.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'mv.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf57.36.100
     Duration: 00:00:30.01, start: 0.000000, bitrate: 684 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 552 kb/s, 25 fps, 25 tbr, 12800 tbn (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
       Metadata:
         handler_name    : SoundHandler

    For the calling code mode :

    $ go run transcode.go mv.webm mv1.mp4
    # github.com/3d0c/gmf
    ../packet.go: In function ‘_cgo_3c42eeb63b1e_Cfunc_avcodec_decode_audio4’:
    ../packet.go:87:2: warning: ‘avcodec_decode_audio4’ is deprecated [-Wdeprecated-declarations]
    func (this *Packet) decode(cc *CodecCtx, frame *Frame) (*Frame, bool, int, error) {
     ^
    In file included from ../packet.go:7:0:
    /home/seaguest/ffmpeg_build/include/libavcodec/avcodec.h:4685:5: note: declared here
    int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
        ^
    ../packet.go: In function ‘_cgo_3c42eeb63b1e_Cfunc_avcodec_decode_video2’:
    ../packet.go:104:2: warning: ‘avcodec_decode_video2’ is deprecated [-Wdeprecated-declarations]
      }
     ^
    In file included from ../packet.go:7:0:
    /home/seaguest/ffmpeg_build/include/libavcodec/avcodec.h:4734:5: note: declared here
    int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
        ^
    [libx264 @ 0x2d82400] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
    [libx264 @ 0x2d82400] profile High, level 3.0
    [libx264 @ 0x2d82400] 264 - core 148 r2643 5c65704 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    [mp4 @ 0x2d480c0] Using AVStream.codec.time_base as a timebase hint to the muxer is deprecated. Set AVStream.time_base instead.
    [mp4 @ 0x2d480c0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    [mp4 @ 0x2d480c0] Using AVStream.codec.time_base as a timebase hint to the muxer is deprecated. Set AVStream.time_base instead.
    [mp4 @ 0x2d480c0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.



    $ ffprobe mv1.mp4
    ffprobe version N-79826-g64fd62d Copyright (c) 2007-2016 the FFmpeg developers
     built with gcc 5.3.1 (Ubuntu 5.3.1-14ubuntu2) 20160413
     configuration: --prefix=/home/seaguest/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/seaguest/ffmpeg_build/include --extra-ldflags=-L/home/seaguest/ffmpeg_build/lib --enable-gpl --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-nonfree
     libavutil      55. 24.100 / 55. 24.100
     libavcodec     57. 39.100 / 57. 39.100
     libavformat    57. 36.100 / 57. 36.100
     libavdevice    57.  0.101 / 57.  0.101
     libavfilter     6. 45.100 /  6. 45.100
     libswscale      4.  1.100 /  4.  1.100
     libswresample   2.  0.101 /  2.  0.101
     libpostproc    54.  0.100 / 54.  0.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'mv1.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf57.36.100
     Duration: 00:00:30.00, start: 0.000000, bitrate: 751 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x480, 613 kb/s, 25 fps, 25 tbr, 12800 tbn (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 130 kb/s (default)
       Metadata:
         handler_name    : SoundHandler

    Checking the setting section, crf=23.0 for both (the rest are exactly the same), but the output bitrate are different (the audio for calling code mode has a lot of noises), how is that possible ?

    Why the command line mode and use libav* library mode with same setting, but have different output ?
    What should I do to call libav* library to get lossless video conversion ?

  • ffmpeg concat command of many files loses quality or makes result video to stall

    28 avril 2016, par edotom

    I have a Project that intends to have the union of several images and several videos converted to mp4 output.
    Source images come from a Windows App that converted bmps to jpgs. Those images were converted to mp4 using the following command :

    ffmpeg -report  -framerate 1/7 -i source.jpg -c:v libx264 -r 30 -pix_fmt yuv420p  destination.mp4

    Result video can be seen without problems.

    Source videos come from a vms in mkv format and are converted into mp4 using the following :

    ffmpeg -i source.mkv -vcodec copy -acodec copy destination.mp4

    As a result I have a series for different mp4 files that are copied to a txt file which will allow us to make a concatenation into a result mp4.

    The contents of txt will be something like this (jpgs should be placed alternately to videos) :

    file '1_VideoMkvto.mp4'
    file '2_VideoMkvto.mp4'
    file '3_BmptoJpg.mp4'
    file '4_VideoMkvto.mp4'
    file '5_BmptoJpg.mp4'
    file '7_VideoMkvto.mp4'
    file '8_JpgtoMp4.mp4'
    ....

    I use the following instruction :

     ffmpeg -report -f concat -i allVideos.txt -c copy results.mp4

    The issue that I’m experiencing is that in joined video, videos created originally from images (they were originally bmps converted to jpg) show problems like not being shown, shown for more or less time than original video or even worse... they make video player to stall when their part is played or closed without warning.

    Pd. I tried to concat all videos into one single file and all jpgs-mp4 into one single file and individually they can be seen easily, but when joined together, that’s when everything starts to fail.

    Raw jpg :

    "D:\\ffmpeg\\bin\\ffmpeg.exe" -loop 1 -i "D:\\Project2\\files
    \\12278\\PRU_SONOMETRO.jpg" -c:v libx264 -t 5 -y -vf "fps=7,format=yuv420p" "D:\
    \Project2\\files\\12278\\Video\\PRU_SONOMETRO.mp4"
    ffmpeg version N-76456-g6df2c94 Copyright (c) 2000-2015 the FFmpeg developers
    built with gcc 5.2.0 (GCC)
    configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
    isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
    le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
    enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l
    ibilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enab
    le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --en
    able-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --ena
    ble-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
    --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enabl
    e-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --ena
    ble-decklink --enable-zlib
    libavutil      55.  5.100 / 55.  5.100
    libavcodec     57. 14.100 / 57. 14.100
    libavformat    57. 14.100 / 57. 14.100
    libavdevice    57.  0.100 / 57.  0.100
    libavfilter     6. 14.101 /  6. 14.101
    libswscale      4.  0.100 /  4.  0.100
    libswresample   2.  0.100 /  2.  0.100
    libpostproc    54.  0.100 / 54.  0.100
    [mjpeg @ 008e3300] ignoring invalid SAR: 0/0
    Input #0, image2, from 'D:\\Project2\\files\\12278\\PRU_SONOMETRO
    .jpg':
    Duration: 00:00:00.04, start: 0.000000, bitrate: 31662 kb/s
       Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1920x1080,
    25 fps, 25 tbr, 25 tbn, 25 tbc
    [swscaler @ 00931d20] deprecated pixel format used, make sure you did set range
    correctly
    [libx264 @ 00900de0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
    [libx264 @ 00900de0] profile High, level 4.0
    [libx264 @ 00900de0] 264 - core 148 r2638 7599210 - H.264/MPEG-4 AVC codec - Cop
    yleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deb
    lock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 m
    e_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chro
    ma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 i
    nterlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1
    b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=7 scenecu
    t=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0
    qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to 'D:\\Project2\\files\\12278\\Video\\PRU_SONOME
    TRO.mp4':
    Metadata:
       encoder         : Lavf57.14.100
       Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1
    080, q=-1--1, 7 fps, 14336 tbn, 7 tbc
       Metadata:
       encoder         : Lavc57.14.100 libx264
    Stream mapping:
    Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
    Press [q] to stop, [?] for help
    [mjpeg @ 008e5700] ignoring invalid SAR: 0/0
       Last message repeated 18 times
    [mjpeg @ 008e5700] ignoring invalid SAR: 0/0me=00:00:00.00 bitrate=N/A
       Last message repeated 18 times
    [mjpeg @ 008e5700] ignoring invalid SAR: 0/0me=00:00:00.00 bitrate=N/A
       Last message repeated 18 times
    [mjpeg @ 008e5700] ignoring invalid SAR: 0/0me=00:00:00.00 bitrate=N/A
       Last message repeated 17 times
    [mjpeg @ 008e5700] ignoring invalid SAR: 0/0me=00:00:00.00 bitrate=N/A
       Last message repeated 17 times
    [mjpeg @ 008e5700] ignoring invalid SAR: 0/0me=00:00:00.00 bitrate=N/A
       Last message repeated 17 times
    [mjpeg @ 008e5700] ignoring invalid SAR: 0/0me=00:00:00.00 bitrate=N/A
       Last message repeated 16 times
    frame=   35 fps=6.1 q=-1.0 Lsize=     212kB time=00:00:04.71 bitrate= 368.6kbits
    /s
    video:211kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing o
    verhead: 0.582017%
    [libx264 @ 00900de0] frame I:1     Avg QP:10.59  size:211484
    [libx264 @ 00900de0] frame P:9     Avg QP:19.90  size:   194
    [libx264 @ 00900de0] frame B:25    Avg QP:30.36  size:    82
    [libx264 @ 00900de0] consecutive B-frames:  2.9%  5.7%  0.0% 91.4%
    [libx264 @ 00900de0] mb I  I16..4:  1.4% 95.8%  2.8%
    [libx264 @ 00900de0] mb P  I16..4:  0.0%  0.0%  0.0%  P16..4:  0.5%  0.0%  0.0%
    0.0%  0.0%    skip:99.5%
    [libx264 @ 00900de0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.3%  0.0%  0.0%
    direct: 0.0%  skip:99.7%  L0:42.3% L1:57.7% BI: 0.0%
    [libx264 @ 00900de0] 8x8 transform intra:95.8% inter:73.4%
    [libx264 @ 00900de0] coded y,uvDC,uvAC intra: 92.7% 31.6% 11.8% inter: 0.0% 0.1%
    0.0%
    [libx264 @ 00900de0] i16 v,h,dc,p: 10% 51% 37%  2%
    [libx264 @ 00900de0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 13% 15% 54%  3%  2%  2%  3%
    3%  4%
    [libx264 @ 00900de0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 30% 20%  3%  3%  3%  2%
    3%  5%
    [libx264 @ 00900de0] i8c dc,h,v,p: 56% 23% 20%  1%
    [libx264 @ 00900de0] Weighted P-Frames: Y:0.0% UV:0.0%
    [libx264 @ 00900de0] ref P L0: 94.3%  0.0%  2.7%  3.1%
    [libx264 @ 00900de0] ref B L0: 83.1% 15.0%  2.0%
    [libx264 @ 00900de0] ref B L1: 88.4% 11.6%
    [libx264 @ 00900de0] kb/s:344.46

    mkv converted to mp4 :

    D:\>"D:\\ffmpeg\\bin\\ffmpeg.exe" -i "D:\\Project2\\files\\12278\
    \46_REGISTROSALIDA1.mkv" -c:v copy -c:a libfdk_aac -b:a 128k "D:\\Project2\\CDA\
    \SicovCDA\\files\\12278\\video\\46_REGISTROSALIDA1.mp4"
    ffmpeg version N-76456-g6df2c94 Copyright (c) 2000-2015 the FFmpeg developers
    built with gcc 5.2.0 (GCC)
    configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
    isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
    le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
    enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l
    ibilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enab
    le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --en
    able-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --ena
    ble-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
    --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enabl
    e-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --ena
    ble-decklink --enable-zlib
    libavutil      55.  5.100 / 55.  5.100
    libavcodec     57. 14.100 / 57. 14.100
    libavformat    57. 14.100 / 57. 14.100
    libavdevice    57.  0.100 / 57.  0.100
    libavfilter     6. 14.101 /  6. 14.101
    libswscale      4.  0.100 /  4.  0.100
    libswresample   2.  0.100 /  2.  0.100
    libpostproc    54.  0.100 / 54.  0.100
    [matroska,webm @ 02fa0d40] Could not find codec parameters for stream 1 (Video:
    mjpeg, none(bt470bg/unknown/unknown), 1920x1080): unspecified pixel format
    Consider increasing the value for the 'analyzeduration' and 'probesize' options
    Input #0, matroska,webm, from 'D:\\Project2\\files\\12278\\46_REG
    ISTROSALIDA1.mkv':
    Metadata:
       encoder         : MilestoneMux
    Duration: 00:03:17.97, start: 0.000000, bitrate: 994 kb/s
       Stream #0:0(eng): Video: h264 (Main), yuvj420p(pc, bt709), 1920x1080 [SAR 1:
    1 DAR 16:9], 30 fps, 30 tbr, 1k tbn, 2k tbc (default)
       Stream #0:1(eng): Video: mjpeg, none(bt470bg/unknown/unknown), 1920x1080, SA
    R 1:1 DAR 16:9, 1k tbr, 1k tbn, 1k tbc (default)
    Codec AVOption b (set bitrate (in bits/s)) specified for output file #0 (D:\\Pro
    ject2\\files\\12278\\video\\46_REGISTROSALIDA1.mp4) has not been
    used for any stream. The most likely reason is either wrong type (e.g. a video o
    ption with no video streams) or that it is a private option of some encoder whic
    h was not actually used for any stream.
    File 'D:\\Project2\\files\\12278\\video\\46_REGISTROSALIDA1.mp4'
    already exists. Overwrite ? [y/N] y
    [mp4 @ 05d02580] Codec for stream 0 does not use global headers but container fo
    rmat requires global headers
    Output #0, mp4, to 'D:\\Project2\\files\\12278\\video\\46_REGISTR
    OSALIDA1.mp4':
    Metadata:
       encoder         : Lavf57.14.100
       Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), yuvj420p, 1920x1080
    [SAR 1:1 DAR 16:9], q=2-31, 30 fps, 30 tbr, 16k tbn, 1k tbc (default)
    Stream mapping:
    Stream #0:0 -> #0:0 (copy)
    Press [q] to stop, [?] for help
    frame= 5940 fps=0.0 q=-1.0 Lsize=   24016kB time=00:03:17.97 bitrate= 993.8kbits
    /s
    video:23960kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing
    overhead: 0.234450%

    jpg(originally bmp) to mp4 :

       "D:\\ffmpeg\\bin\\ffmpeg.exe" -loop 1 -i "D:\\Project2\\files
    \\12278\\Sensorial.jpg" -c:v libx264 -t 5 -y -vf "fps=7,format=yuv420p" "D
    :\\Project2\\files\\12278\\Video\\Sensorial.mp4"
    ffmpeg version N-76456-g6df2c94 Copyright (c) 2000-2015 the FFmpeg developers
    built with gcc 5.2.0 (GCC)
    configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
    isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
    le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
    enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l
    ibilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enab
    le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --en
    able-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --ena
    ble-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
    --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enabl
    e-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --ena
    ble-decklink --enable-zlib
    libavutil      55.  5.100 / 55.  5.100
    libavcodec     57. 14.100 / 57. 14.100
    libavformat    57. 14.100 / 57. 14.100
    libavdevice    57.  0.100 / 57.  0.100
    libavfilter     6. 14.101 /  6. 14.101
    libswscale      4.  0.100 /  4.  0.100
    libswresample   2.  0.100 /  2.  0.100
    libpostproc    54.  0.100 / 54.  0.100
    Input #0, image2, from 'D:\\Project2\\files\\12278\\39_BmpSensori
    al.jpg':
    Duration: 00:00:00.04, start: 0.000000, bitrate: 25444 kb/s
       Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1920x1080
    [SAR 96:96 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc
    [swscaler @ 058663a0] deprecated pixel format used, make sure you did set range
    correctly
    [libx264 @ 00df0020] using SAR=1/1
    [libx264 @ 00df0020] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
    [libx264 @ 00df0020] profile High, level 4.0
    [libx264 @ 00df0020] 264 - core 148 r2638 7599210 - H.264/MPEG-4 AVC codec - Cop
    yleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deb
    lock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 m
    e_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chro
    ma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 i
    nterlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1
    b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=7 scenecu
    t=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0
    qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to 'D:\\Project2\\files\\12278\\Video\\39_BmpSens
    orial.mp4':
    Metadata:
       encoder         : Lavf57.14.100
       Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1
    080 [SAR 1:1 DAR 16:9], q=-1--1, 7 fps, 14336 tbn, 7 tbc
       Metadata:
       encoder         : Lavc57.14.100 libx264
    Stream mapping:
    Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
    Press [q] to stop, [?] for help
    frame=   35 fps= 11 q=-1.0 Lsize=      83kB time=00:00:04.71 bitrate= 144.7kbits
    /s
    video:82kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing ov
    erhead: 1.497583%
    [libx264 @ 00df0020] frame I:1     Avg QP:13.49  size: 80298
    [libx264 @ 00df0020] frame P:9     Avg QP: 9.09  size:   127
    [libx264 @ 00df0020] frame B:25    Avg QP: 8.68  size:    75
    [libx264 @ 00df0020] consecutive B-frames:  2.9%  5.7%  0.0% 91.4%
    [libx264 @ 00df0020] mb I  I16..4: 51.4% 39.7%  8.8%
    [libx264 @ 00df0020] mb P  I16..4:  0.0%  0.0%  0.0%  P16..4:  0.1%  0.0%  0.0%
    0.0%  0.0%    skip:99.9%
    [libx264 @ 00df0020] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.1%  0.0%  0.0%
    direct: 0.0%  skip:99.9%  L0:44.9% L1:55.1% BI: 0.0%
    [libx264 @ 00df0020] 8x8 transform intra:39.7% inter:17.3%
    [libx264 @ 00df0020] coded y,uvDC,uvAC intra: 7.1% 9.4% 8.8% inter: 0.0% 0.0% 0.
    0%
    [libx264 @ 00df0020] i16 v,h,dc,p: 79% 18%  3%  0%
    [libx264 @ 00df0020] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 57% 36%  6%  0%  0%  0%  0%
    0%  0%
    [libx264 @ 00df0020] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 29% 28% 13%  3%  5%  6%  6%
    4%  6%
    [libx264 @ 00df0020] i8c dc,h,v,p: 83% 12%  4%  1%
    [libx264 @ 00df0020] Weighted P-Frames: Y:0.0% UV:0.0%
    [libx264 @ 00df0020] ref P L0: 88.9%  1.7%  2.7%  6.8%
    [libx264 @ 00df0020] ref B L0:  4.2% 95.8%
    [libx264 @ 00df0020] ref B L1: 98.3%  1.7%
    [libx264 @ 00df0020] kb/s:133.30

    final trimmed concat output :

       ffmpeg started on 2016-04-27 at 16:06:45
    Report written to "ffmpeg-20160427-160645.log"
    Command line:
    "D:\\ffmpeg\\bin\\ffmpeg.exe" -report -f concat -i "D:\\Project2\\files\\12297\\control.txt" -c copy "D:\\Project2\\files\\12297\\12297resultado.mp4"
    ffmpeg version N-76456-g6df2c94 Copyright (c) 2000-2015 the FFmpeg developers
     built with gcc 5.2.0 (GCC)
     configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
     libavutil      55.  5.100 / 55.  5.100
     libavcodec     57. 14.100 / 57. 14.100
     libavformat    57. 14.100 / 57. 14.100
     libavdevice    57.  0.100 / 57.  0.100
     libavfilter     6. 14.101 /  6. 14.101
     libswscale      4.  0.100 /  4.  0.100
     libswresample   2.  0.100 /  2.  0.100
     libpostproc    54.  0.100 / 54.  0.100
    Splitting the commandline.
    Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
    Reading option '-f' ... matched as option 'f' (force format) with argument 'concat'.
    Reading option '-i' ... matched as input file with argument 'D:\Project2\files\12297\control.txt'.
    Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'.
    Reading option 'D:\Project2\files\12297\12297resultado.mp4' ... matched as output file.
    Finished splitting the commandline.
    Parsing a group of options: global .
    Applying option report (generate a report) with argument 1.
    Successfully parsed a group of options.
    Parsing a group of options: input file D:\Project2\files\12297\control.txt.
    Applying option f (force format) with argument concat.
    Successfully parsed a group of options.
    Opening an input file: D:\Project2\files\12297\control.txt.
    [mov,mp4,m4a,3gp,3g2,mj2 @ 00adb460] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
    [mov,mp4,m4a,3gp,3g2,mj2 @ 00adb460] ISO: File Type Major Brand: isom
    [mov,mp4,m4a,3gp,3g2,mj2 @ 00adb460] rfps: 7.000000 0.000016
    [mov,mp4,m4a,3gp,3g2,mj2 @ 00adb460] rfps: 7.000000 0.000016
    [mov,mp4,m4a,3gp,3g2,mj2 @ 00adb460] rfps: 14.000000 0.000063
    [mov,mp4,m4a,3gp,3g2,mj2 @ 00adb460] rfps: 14.000000 0.000063
    [mov,mp4,m4a,3gp,3g2,mj2 @ 00adb460] rfps: 21.000000 0.000143
    [mov,mp4,m4a,3gp,3g2,mj2 @ 00adb460] rfps: 21.000000 0.000143
    [mov,mp4,m4a,3gp,3g2,mj2 @ 00adb460] rfps: 28.000000 0.000253
    [mov,mp4,m4a,3gp,3g2,mj2 @ 00adb460] rfps: 28.000000 0.000253
    [mov,mp4,m4a,3gp,3g2,mj2 @ 00adb460] Before avformat_find_stream_info() pos: 7702749 bytes read:39314 seeks:1
    [mov,mp4,m4a,3gp,3g2,mj2 @ 00adb460] All info found
    [mov,mp4,m4a,3gp,3g2,mj2 @ 00adb460] After avformat_find_stream_info() pos: 71010 bytes read:110276 seeks:2 frames:1
    [mov,mp4,m4a,3gp,3g2,mj2 @ 00adb460] Auto-inserting h264_mp4toannexb bitstream filter
    [concat @ 00ad1a00] Before avformat_find_stream_info() pos: 2586 bytes read:2586 seeks:0

    ---comment > file 0 of type mkv converted to mp4


    [concat @ 00ad1a00] file:0 stream:0 pts:0 pts_time:0 dts:0 dts_time:0 -> pts:0 pts_time:0 dts:0 dts_time:0
    [concat @ 00ad1a00] All info found
    [concat @ 00ad1a00] After avformat_find_stream_info() pos: 2586 bytes read:2586 seeks:0 frames:1
    Input #0, concat, from 'D:\Project2\files\12297\control.txt':
     Duration: N/A, start: 0.000000, bitrate: 509 kb/s
       Stream #0:0(eng), 1, 1/16000: Video: h264 (Main) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 509 kb/s, 7.01 fps, 7 tbr, 16k tbn, 32k tbc
       Metadata:
         handler_name    : VideoHandler
    Successfully opened the file.
    Parsing a group of options: output file D:\Project2\files\12297\12297resultado.mp4.
    Applying option c (codec name) with argument copy.
    Successfully parsed a group of options.
    Opening an output file: D:\Project2\files\12297\12297resultado.mp4.
    Successfully opened the file.
    [mp4 @ 00ae7780] Codec for stream 0 does not use global headers but container format requires global headers
    Output #0, mp4, to 'D:\Project2\files\12297\12297resultado.mp4':
     Metadata:
       encoder         : Lavf57.14.100
       Stream #0:0(eng), 0, 1/16000: Video: h264 ([33][0][0][0] / 0x0021), yuvj420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 509 kb/s, 7.01 fps, 7 tbr, 16k tbn, 16k tbc
       Metadata:
         handler_name    : VideoHandler
    Stream mapping:
     Stream #0:0 -> #0:0 (copy)
    Press [q] to stop, [?] for help
    [concat @ 00ad1a00] file:0 stream:0 pts:2288 pts_time:0.143 dts:2288 dts_time:0.143 -> pts:2288 pts_time:0.143 dts:2288 dts_time:0.143
    [concat @ 00ad1a00] file:0 stream:0 pts:1929280 pts_time:120.58 dts:1929280 dts_time:120.58 -> pts:1929280 pts_time:120.58 dts:1929280 dts_time:120.58
    [concat @ 00ad1a00] file:0 stream:0 pts:1931568 pts_time:120.723 dts:1931568 dts_time:120.723 -> pts:1931568 pts_time:120.723 dts:1931568 dts_time:120.723
    [concat @ 00ad1a00] file:0 stream:0 pts:1933856 pts_time:120.866 dts:1933856 dts_time:120.866 -> pts:1933856 pts_time:120.866 dts:1933856 dts_time:120.866


    ----comment > file 2 of type bmp to jpg converted to mp4

    [AVIOContext @ 00adbca0] Statistics: 2574258 bytes read, 2 seeks
    [mov,mp4,m4a,3gp,3g2,mj2 @ 00adb460] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
    [mov,mp4,m4a,3gp,3g2,mj2 @ 00adb460] ISO: File Type Major Brand: isom
    [mov,mp4,m4a,3gp,3g2,mj2 @ 00adb460] Before avformat_find_stream_info() pos: 94491 bytes read:35717 seeks:1
    [h264 @ 00b73c20] user data:"x264 - core 148 r2638 7599210 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00"
    [h264 @ 00b73c20] no picture
    [mov,mp4,m4a,3gp,3g2,mj2 @ 00adb460] All info found
    [mov,mp4,m4a,3gp,3g2,mj2 @ 00adb460] After avformat_find_stream_info() pos: 73972 bytes read:109641 seeks:2 frames:1
    [mov,mp4,m4a,3gp,3g2,mj2 @ 00adb460] Auto-inserting h264_mp4toannexb bitstream filter
    [concat @ 00ad1a00] file:2 stream:0 pts:0 pts_time:0 dts:-1024 dts_time:-0.0666667 -> pts:2808269 pts_time:182.83 dts:2807245 dts_time:182.763
    [mp4 @ 00ae7780] Non-monotonous DTS in output stream 0:0; previous: 2925280, current: 2807245; changing to 2925281. This may result in incorrect timestamps in the output file.
    [concat @ 00ad1a00] file:2 stream:0 pts:2048 pts_time:0.133333 dts:-512 dts_time:-0.0333333 -> pts:2810317 pts_time:182.963 dts:2807757 dts_time:182.797
    [mp4 @ 00ae7780] Non-monotonous DTS in output stream 0:0; previous: 2925281, current: 2807757; changing to 2925282. This may result in incorrect timestamps in the output file.
    [concat @ 00ad1a00] file:2 stream:0 pts:1024 pts_time:0.0666667 dts:0 dts_time:0 -> pts:2809293 pts_time:182.897 dts:2808269 dts_time:182.83
    [mp4 @ 00ae7780] Non-monotonous DTS in output stream 0:0; previous: 2925282, current: 2808269; changing to 2925283. This may result in incorrect timestamps in the output file.


    ----comment > file 6 of type jpg converted to mp4

    [AVIOContext @ 00adbca0] Statistics: 347409 bytes read, 2 seeks
    [mov,mp4,m4a,3gp,3g2,mj2 @ 00ae8f40] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
    [mov,mp4,m4a,3gp,3g2,mj2 @ 00ae8f40] ISO: File Type Major Brand: isom
    [mov,mp4,m4a,3gp,3g2,mj2 @ 00ae8f40] Before avformat_find_stream_info() pos: 164080 bytes read:36076 seeks:1
    [h264 @ 04240060] user data:"x264 - core 148 r2638 7599210 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00"
    [h264 @ 04240060] no picture
    [mov,mp4,m4a,3gp,3g2,mj2 @ 00ae8f40] All info found
    [mov,mp4,m4a,3gp,3g2,mj2 @ 00ae8f40] After avformat_find_stream_info() pos: 144712 bytes read:180740 seeks:2 frames:1
    [mov,mp4,m4a,3gp,3g2,mj2 @ 00ae8f40] Auto-inserting h264_mp4toannexb bitstream filter
    [concat @ 00ad1a00] file:6 stream:0 pts:0 pts_time:0 dts:-1024 dts_time:-0.0666667 -> pts:5495132 pts_time:357.756 dts:5494108 dts_time:357.689
    [mp4 @ 00ae7780] Non-monotonous DTS in output stream 0:0; previous: 5724096, current: 5494108; changing to 5724097. This may result in incorrect timestamps in the output file.
    [concat @ 00ad1a00] file:6 stream:0 pts:2048 pts_time:0.133333 dts:-512 dts_time:-0.0333333 -> pts:5497180 pts_time:357.889 dts:5494620 dts_time:357.723
    [mp4 @ 00ae7780] Non-monotonous DTS in output stream 0:0; previous: 5724097, current: 5494620; changing to 5724098. This may result in incorrect timestamps in the output file.
    [mp4 @ 00ae7780] Non-monotonous DTS in output stream 0:0; previous: 5724304, current: 5600604; changing to 5724305. This may result in incorrect timestamps in the output file.
    [concat @ 00ad1a00] file:6 stream:0 pts:107008 pts_time:6.96667 dts:105984 dts_time:6.9 -> pts:5602140 pts_time:364.723 dts:5601116 dts_time:364.656
    [mp4 @ 00ae7780] Non-monotonous DTS in output stream 0:0; previous: 5724305, current: 5601116; changing to 5724306. This may result in incorrect timestamps in the output file.


    --- comment  end of process after 39 streams

    No more output streams to write to, finishing.
    frame=40348 fps=4628 q=-1.0 Lsize=  166581kB time=00:38:21.91 bitrate= 592.8kbits/s    
    video:166231kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.210593%
    Input file #0 (D:\Project2\files\12297\control.txt):
     Input stream #0:0 (video): 40348 packets read (170220039 bytes);
     Total: 40348 packets (170220039 bytes) demuxed
    Output file #0 (D:\Project2\files\12297\12297resultado.mp4):
     Output stream #0:0 (video): 40348 packets muxed (170220039 bytes);
     Total: 40348 packets (170220039 bytes) muxed
    0 frames successfully decoded, 0 decoding errors
    [AVIOContext @ 00ae85e0] Statistics: 34 seeks, 42736 writeouts
    [AVIOContext @ 00af0ca0] Statistics: 3921256 bytes read, 0 seeks
    [AVIOContext @ 00ac0d80] Statistics: 2586 bytes read, 0 seeks