Recherche avancée

Médias (0)

Mot : - Tags -/signalement

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

Autres articles (94)

  • Configuration spécifique d’Apache

    4 février 2011, par

    Modules spécifiques
    Pour la configuration d’Apache, il est conseillé d’activer certains modules non spécifiques à MediaSPIP, mais permettant d’améliorer les performances : mod_deflate et mod_headers pour compresser automatiquement via Apache les pages. Cf ce tutoriel ; mode_expires pour gérer correctement l’expiration des hits. Cf ce tutoriel ;
    Il est également conseillé d’ajouter la prise en charge par apache du mime-type pour les fichiers WebM comme indiqué dans ce tutoriel.
    Création d’un (...)

  • Submit bugs and patches

    13 avril 2011

    Unfortunately a software is never perfect.
    If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
    If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
    You may also (...)

  • Contribute to translation

    13 avril 2011

    You can help us to improve the language used in the software interface to make MediaSPIP more accessible and user-friendly. You can also translate the interface into any language that allows it to spread to new linguistic communities.
    To do this, we use the translation interface of SPIP where the all the language modules of MediaSPIP are available. Just subscribe to the mailing list and request further informantion on translation.
    MediaSPIP is currently available in French and English (...)

Sur d’autres sites (7210)

  • Using ffmpeg and ffserver to create a 2x1 live stream fails with unconnected output error

    31 janvier 2021, par weevilknievel

    I want to combine 2 RTSP streams (CCTV cameras) into a horizontal 2x1 strip and convert to webm for use in a HTML5 webpage.

    



    I am able to convert the streams into an mpeg or avi file easily, but as soon as I try to post it to ffserver ffm feed, I hit a wall.

    



    Here is my working ffmpeg command which writes out to a file :

    



    ffmpeg -rtsp_transport tcp -thread_queue_size 12 -i "rtsp://192.168.1.132:554/user=admin&password=mypassword&channel=1&stream=1.sdp" -i "rtsp://192.168.1.132:554/user=admin&password=mypassword&channel=2&stream=1.sdp" -filter_complex "[0:v][1:v] hstack=inputs=2 [v]" -map "[v]" -r 30 output.mpg


    



    It seems the ffmpeg process is outputting two streams and one of them is MPEG ? In the above command I had to put a frame rate "-r 30" into the command otherwise I got an error which said that MPEG 1/2 did not support a framerate of 5/1 ??

    



    As soon as I try and stream to ffserver, I get an error :

    



    ffmpeg -rtsp_transport tcp -thread_queue_size 12 -i "rtsp://192.168.1.132:554/user=admin&password=mypassword&channel=1&stream=1.sdp" -i "rtsp://192.168.1.132:554/user=admin&password=mypassword&channel=2&stream=1.sdp" -filter_complex "[0:v][1:v] hstack=inputs=2 [v]" -map "[v]" -r 30 http://localhost:8090/feed5.ffm


    



    The error I get is "Filter hstack has an unconnected output" :

    



    ffmpeg version N-86111-ga441aa90e8-static http://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 5.4.1 (Debian 5.4.1-8) 20170304
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-5 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg
  libavutil      55. 63.100 / 55. 63.100
  libavcodec     57. 96.101 / 57. 96.101
  libavformat    57. 72.101 / 57. 72.101
  libavdevice    57.  7.100 / 57.  7.100
  libavfilter     6. 89.101 /  6. 89.101
  libswscale      4.  7.101 /  4.  7.101
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
Input #0, rtsp, from 'rtsp://192.168.1.132:554/user=admin&password=mypassword&channel=1&stream=1.sdp':
  Duration: N/A, start: 0.166667, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuv420p(progressive), 352x288, 6 fps, 6 tbr, 90k tbn, 180k tbc
Input #1, rtsp, from 'rtsp://192.168.1.132:554/user=admin&password=mypassword&channel=2&stream=1.sdp':
  Duration: N/A, start: 0.166667, bitrate: N/A
    Stream #1:0: Video: h264 (High), yuv420p(progressive), 352x288, 6 fps, 6 tbr, 90k tbn, 180k tbc
Filter hstack has an unconnected output


    



    My ffserver conf is very basic :

    



    HTTPPort 8090&#xA;HTTPBindAddress 0.0.0.0&#xA;MaxHTTPConnections 2000&#xA;MaxClients 1000&#xA;MaxBandwidth 100000&#xA;CustomLog -&#xA;&#xA;<feed>&#xA;File /mnt/ramdisk/feed5.ffm&#xA;Truncate&#xA;FileMaxSize 5M&#xA;ACL allow 127.0.0.1&#xA;</feed>&#xA;&#xA;<stream>&#xA;     Format webm&#xA;     Feed feed5.ffm&#xA;     VideoCodec libvpx&#xA;     VideoSize 640x360&#xA;     NoAudio&#xA;   AVOptionVideo quality realtime&#xA;   StartSendOnKey&#xA;   VideoBitRate 140&#xA;</stream>&#xA;&#xA;<stream>&#xA;Format status&#xA;ACL allow localhost&#xA;ACL allow 192.168.0.0 192.168.255.255&#xA;</stream>&#xA;<redirect>&#xA;URL http://www.ffmpeg.org/&#xA;</redirect>&#xA;

    &#xA;&#xA;

    Edit :

    &#xA;&#xA;

    Here is the debug output from the ffmpeg command above :

    &#xA;&#xA;

    ffmpeg -v debug -rtsp_transport tcp -thread_queue_size 12 -i "rtsp://192.168.1.132:554/user=admin&amp;password=mypassword&amp;channel=1&amp;stream=1.sdp" -i "rtsp://192.168.1.132:554/user=admin&amp;password=mypassword&amp;channel=2&amp;stream=1.sdp" -filter_complex "[0:v][1:v] hstack=inputs=2 [v]" -map "[v]" -r 30 http://localhost:8090/feed5.ffm&#xA;ffmpeg version N-86111-ga441aa90e8-static http://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2017 the FFmpeg developers&#xA;  built with gcc 5.4.1 (Debian 5.4.1-8) 20170304&#xA;  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-5 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg&#xA;  libavutil      55. 63.100 / 55. 63.100&#xA;  libavcodec     57. 96.101 / 57. 96.101&#xA;  libavformat    57. 72.101 / 57. 72.101&#xA;  libavdevice    57.  7.100 / 57.  7.100&#xA;  libavfilter     6. 89.101 /  6. 89.101&#xA;  libswscale      4.  7.101 /  4.  7.101&#xA;  libswresample   2.  8.100 /  2.  8.100&#xA;  libpostproc    54.  6.100 / 54.  6.100&#xA;Splitting the commandline.&#xA;Reading option &#x27;-v&#x27; ... matched as option &#x27;v&#x27; (set logging level) with argument &#x27;debug&#x27;.&#xA;Reading option &#x27;-rtsp_transport&#x27; ... matched as AVOption &#x27;rtsp_transport&#x27; with argument &#x27;tcp&#x27;.&#xA;Reading option &#x27;-thread_queue_size&#x27; ... matched as option &#x27;thread_queue_size&#x27; (set the maximum number of queued packets from the demuxer) with argument &#x27;12&#x27;.&#xA;Reading option &#x27;-i&#x27; ... matched as input url with argument &#x27;rtsp://192.168.1.132:554/user=admin&amp;password=mypassword&amp;channel=1&amp;stream=1.sdp&#x27;.&#xA;Reading option &#x27;-i&#x27; ... matched as input url with argument &#x27;rtsp://192.168.1.132:554/user=admin&amp;password=mypassword&amp;channel=2&amp;stream=1.sdp&#x27;.&#xA;Reading option &#x27;-filter_complex&#x27; ... matched as option &#x27;filter_complex&#x27; (create a complex filtergraph) with argument &#x27;[0:v][1:v] hstack=inputs=2 [v]&#x27;.&#xA;Reading option &#x27;-map&#x27; ... matched as option &#x27;map&#x27; (set input stream mapping) with argument &#x27;[v]&#x27;.&#xA;Reading option &#x27;-r&#x27; ... matched as option &#x27;r&#x27; (set frame rate (Hz value, fraction or abbreviation)) with argument &#x27;30&#x27;.&#xA;Reading option &#x27;http://localhost:8090/feed5.ffm&#x27; ... matched as output url.&#xA;Finished splitting the commandline.&#xA;Parsing a group of options: global .&#xA;Applying option v (set logging level) with argument debug.&#xA;Applying option filter_complex (create a complex filtergraph) with argument [0:v][1:v] hstack=inputs=2 [v].&#xA;Successfully parsed a group of options.&#xA;Parsing a group of options: input url rtsp://192.168.1.132:554/user=admin&amp;password=mypassword&amp;channel=1&amp;stream=1.sdp.&#xA;Applying option thread_queue_size (set the maximum number of queued packets from the demuxer) with argument 12.&#xA;Successfully parsed a group of options.&#xA;Opening an input file: rtsp://192.168.1.132:554/user=admin&amp;password=mypassword&amp;channel=1&amp;stream=1.sdp.&#xA;[tcp @ 0x58fb5e0] No default whitelist set&#xA;[rtsp @ 0x58f9700] SDP:&#xA;v=0&#xA;o=- 38990265062388 38990265062388 IN IP4 192.168.1.132&#xA;a=range:npt=0-&#xA;m=video 0 RTP/AVP 96&#xA;c=IN IP4 0.0.0.0&#xA;a=rtpmap:96 H264/90000&#xA;a=framerate:0S&#xA;a=fmtp:96 profile-level-id=640014; packetization-mode=1; sprop-parameter-sets=Z2QAFK2EAQwgCGEAQwgCGEAQwgCEK1CwSyA=,aO48sA==&#xA;a=control:trackID=3&#xA;&#xA;Failed to parse interval end specification &#x27;&#x27;&#xA;[rtsp @ 0x58f9700] video codec set to: h264&#xA;[rtsp @ 0x58f9700] RTP Profile IDC: 64 Profile IOP: 0 Level: 14&#xA;[rtsp @ 0x58f9700] RTP Packetization Mode: 1&#xA;[rtsp @ 0x58f9700] Extradata set to 0x58fb940 (size: 38)&#xA;[rtsp @ 0x58f9700] setting jitter buffer size to 0&#xA;[rtsp @ 0x58f9700] hello state=0&#xA;[h264 @ 0x58fca00] nal_unit_type: 7, nal_ref_idc: 3&#xA;[h264 @ 0x58fca00] nal_unit_type: 8, nal_ref_idc: 3&#xA;[h264 @ 0x58fca00] nal_unit_type: 7, nal_ref_idc: 3&#xA;[h264 @ 0x58fca00] nal_unit_type: 8, nal_ref_idc: 3&#xA;[h264 @ 0x58fca00] unknown SEI type 229&#xA;[h264 @ 0x58fca00] nal_unit_type: 7, nal_ref_idc: 3&#xA;[h264 @ 0x58fca00] nal_unit_type: 8, nal_ref_idc: 3&#xA;[h264 @ 0x58fca00] nal_unit_type: 6, nal_ref_idc: 0&#xA;[h264 @ 0x58fca00] nal_unit_type: 5, nal_ref_idc: 3&#xA;[h264 @ 0x58fca00] unknown SEI type 229&#xA;[h264 @ 0x58fca00] Reinit context to 352x288, pix_fmt: yuv420p&#xA;[h264 @ 0x58fca00] nal_unit_type: 1, nal_ref_idc: 3&#xA;    Last message repeated 5 times&#xA;[h264 @ 0x58fca00] unknown SEI type 229&#xA;    Last message repeated 1 times&#xA;[rtsp @ 0x58f9700] All info found&#xA;[rtsp @ 0x58f9700] Setting avg frame rate based on r frame rate&#xA;Input #0, rtsp, from &#x27;rtsp://192.168.1.132:554/user=admin&amp;password=mypassword&amp;channel=1&amp;stream=1.sdp&#x27;:&#xA;  Duration: N/A, start: 0.166667, bitrate: N/A&#xA;    Stream #0:0, 28, 1/90000: Video: h264 (High), 1 reference frame, yuv420p(progressive, left), 352x288, 0/1, 6 fps, 6 tbr, 90k tbn, 180k tbc&#xA;Successfully opened the file.&#xA;Parsing a group of options: input url rtsp://192.168.1.132:554/user=admin&amp;password=mypassword&amp;channel=2&amp;stream=1.sdp.&#xA;Successfully parsed a group of options.&#xA;Opening an input file: rtsp://192.168.1.132:554/user=admin&amp;password=mypassword&amp;channel=2&amp;stream=1.sdp.&#xA;[tcp @ 0x59f4280] No default whitelist set&#xA;[rtsp @ 0x59f7620] SDP:&#xA;v=0&#xA;o=- 38990265062388 38990265062388 IN IP4 192.168.1.132&#xA;a=range:npt=0-&#xA;m=video 0 RTP/AVP 96&#xA;c=IN IP4 0.0.0.0&#xA;a=rtpmap:96 H264/90000&#xA;a=framerate:0S&#xA;a=fmtp:96 profile-level-id=640014; packetization-mode=1; sprop-parameter-sets=Z2QAFK2EAQwgCGEAQwgCGEAQwgCEK1CwSyA=,aO48sA==&#xA;a=control:trackID=3&#xA;&#xA;Failed to parse interval end specification &#x27;&#x27;&#xA;[rtsp @ 0x59f7620] video codec set to: h264&#xA;[rtsp @ 0x59f7620] RTP Profile IDC: 64 Profile IOP: 0 Level: 14&#xA;[rtsp @ 0x59f7620] RTP Packetization Mode: 1&#xA;[rtsp @ 0x59f7620] Extradata set to 0x59f3670 (size: 38)&#xA;[rtp @ 0x59f62a0] No default whitelist set&#xA;[udp @ 0x58fb6a0] No default whitelist set&#xA;[udp @ 0x58fb6a0] end receive buffer size reported is 131072&#xA;[udp @ 0x591b940] No default whitelist set&#xA;[udp @ 0x591b940] end receive buffer size reported is 131072&#xA;[rtsp @ 0x59f7620] setting jitter buffer size to 500&#xA;[rtsp @ 0x59f7620] hello state=0&#xA;[h264 @ 0x59e4b20] nal_unit_type: 7, nal_ref_idc: 3&#xA;[h264 @ 0x59e4b20] nal_unit_type: 8, nal_ref_idc: 3&#xA;[h264 @ 0x59e4b20] nal_unit_type: 7, nal_ref_idc: 3&#xA;[h264 @ 0x59e4b20] nal_unit_type: 8, nal_ref_idc: 3&#xA;[h264 @ 0x59e4b20] unknown SEI type 229&#xA;[h264 @ 0x59e4b20] nal_unit_type: 7, nal_ref_idc: 3&#xA;[h264 @ 0x59e4b20] nal_unit_type: 8, nal_ref_idc: 3&#xA;[h264 @ 0x59e4b20] nal_unit_type: 6, nal_ref_idc: 0&#xA;[h264 @ 0x59e4b20] nal_unit_type: 5, nal_ref_idc: 3&#xA;[h264 @ 0x59e4b20] unknown SEI type 229&#xA;[h264 @ 0x59e4b20] Reinit context to 352x288, pix_fmt: yuv420p&#xA;[h264 @ 0x59e4b20] nal_unit_type: 1, nal_ref_idc: 3&#xA;    Last message repeated 5 times&#xA;[h264 @ 0x59e4b20] unknown SEI type 229&#xA;    Last message repeated 1 times&#xA;[rtsp @ 0x59f7620] All info found&#xA;[rtsp @ 0x59f7620] Setting avg frame rate based on r frame rate&#xA;Input #1, rtsp, from &#x27;rtsp://192.168.1.132:554/user=admin&amp;password=mypassword&amp;channel=2&amp;stream=1.sdp&#x27;:&#xA;  Duration: N/A, start: 0.166667, bitrate: N/A&#xA;    Stream #1:0, 28, 1/90000: Video: h264 (High), 1 reference frame, yuv420p(progressive, left), 352x288, 0/1, 6 fps, 6 tbr, 90k tbn, 180k tbc&#xA;Successfully opened the file.&#xA;detected 2 logical cores&#xA;[Parsed_hstack_0 @ 0x59f7cc0] Setting &#x27;inputs&#x27; to value &#x27;2&#x27;&#xA;Parsing a group of options: output url http://localhost:8090/feed5.ffm.&#xA;Applying option map (set input stream mapping) with argument [v].&#xA;Applying option r (set frame rate (Hz value, fraction or abbreviation)) with argument 30.&#xA;Successfully parsed a group of options.&#xA;Opening an output file: http://localhost:8090/feed5.ffm.&#xA;[http @ 0x59aa700] Setting default whitelist &#x27;http,https,tls,rtp,tcp,udp,crypto,httpproxy&#x27;&#xA;[http @ 0x59aa700] request: GET /feed5.ffm HTTP/1.1&#xA;User-Agent: Lavf/57.72.101&#xA;Accept: */*&#xA;Range: bytes=0-&#xA;Connection: close&#xA;Host: localhost:8090&#xA;Icy-MetaData: 1&#xA;&#xA;&#xA;[ffm @ 0x5917d00] Format ffm probed with size=2048 and score=101&#xA;[NULL @ 0x5bce3e0] Setting entry with key &#x27;video_size&#x27; to value &#x27;640x360&#x27;&#xA;[NULL @ 0x5bce3e0] Setting entry with key &#x27;b&#x27; to value &#x27;140000&#x27;&#xA;[NULL @ 0x5bce3e0] Setting entry with key &#x27;time_base&#x27; to value &#x27;1/5&#x27;&#xA;[NULL @ 0x5bce3e0] Setting entry with key &#x27;bt&#x27; to value &#x27;35000&#x27;&#xA;[NULL @ 0x5bce3e0] Setting entry with key &#x27;rc_eq&#x27; to value &#x27;tex^qComp&#x27;&#xA;[NULL @ 0x5bce3e0] Setting entry with key &#x27;maxrate&#x27; to value &#x27;280000&#x27;&#xA;[NULL @ 0x5bce3e0] Setting entry with key &#x27;bufsize&#x27; to value &#x27;280000&#x27;&#xA;[AVIOContext @ 0x5915b80] Statistics: 4096 bytes read, 0 seeks&#xA;[http @ 0x5915f00] Setting default whitelist &#x27;http,https,tls,rtp,tcp,udp,crypto,httpproxy&#x27;&#xA;[http @ 0x5915f00] request: POST /feed5.ffm HTTP/1.1&#xA;Transfer-Encoding: chunked&#xA;User-Agent: Lavf/57.72.101&#xA;Accept: */*&#xA;Connection: close&#xA;Host: localhost:8090&#xA;Icy-MetaData: 1&#xA;&#xA;&#xA;Successfully opened the file.&#xA;Filter hstack has an unconnected output&#xA;[AVIOContext @ 0x59ab080] Statistics: 0 seeks, 0 writeouts&#xA;

    &#xA;&#xA;

    I am stumped - any clues ?

    &#xA;&#xA;

    Thanks in advance.

    &#xA;

  • ffmpeg C api cutting a video when packet dts is greater than pts

    10 mars 2017, par TastyCatFood

    Corrupted videos

    In trying to cut out a duration of one of videos using ffmpeg C api, using the code posted here : How to cut video with FFmpeg C API , ffmpeg spit out the log below :

    D/logger: Loop count:9   out: pts:0 pts_time:0 dts:2002 dts_time:0.0333667 duration:2002 duration_time:0.0333667 stream_index:1
    D/trim_video: Error muxing packet Invalid argument

    ffmpeg considercs an instruction to decompress a frame after presenting it to be a nonsense, which is well...reasonable but stringent.

    My VLC player finds the video alright and plays it of course.

    Note :

    The code immediately below is in c++ written to be compiled with g++ as I’m developing for android. For C code, scroll down further.

    My solution(g++) :

    extern "C" {
    #include "libavformat/avformat.h"
    #include "libavutil/mathematics.h"
    #include "libavutil/timestamp.h"



    static void log_packet(
           const AVFormatContext *fmt_ctx,
           const AVPacket *pkt, const char *tag,
           long count=0)
    {

       printf("loop count %d pts:%f dts:%f duration:%f stream_index:%d\n",
              count,
              static_cast<double>(pkt->pts),
              static_cast<double>(pkt->dts),
              static_cast<double>(pkt->duration),
              pkt->stream_index);
       return;
    }

    int trimVideo(
           const char* in_filename,
           const char* out_filename,
           double cutFrom,
           double cutUpTo)
    {
       AVOutputFormat *ofmt = NULL;
       AVFormatContext *ifmt_ctx = NULL, *ofmt_ctx = NULL;
       AVPacket pkt;
       int ret, i;
       //jboolean  copy = true;
       //const char *in_filename = env->GetStringUTFChars(jstring_in_filename,&amp;copy);
       //const char *out_filename = env->GetStringUTFChars(jstring_out_filename,&amp;copy);
       long loopCount = 0;

       av_register_all();

       // Cutting may change the pts and dts of the resulting video;
       // if frames in head position are removed.
       // In the case like that, src stream's copy start pts
       // need to be recorded and is used to compute the new pts value.
       // e.g.
       //    new_pts = current_pts - trim_start_position_pts;

       // nb-streams is the number of elements in AVFormatContext.streams.
       // Initial pts value must be recorded for each stream.

       //May be malloc and memset should be replaced with [].
       int64_t *dts_start_from = NULL;
       int64_t *pts_start_from = NULL;

       if ((ret = avformat_open_input(&amp;ifmt_ctx, in_filename, 0, 0)) &lt; 0) {
           printf( "Could not open input file '%s'", in_filename);
           goto end;
       }

       if ((ret = avformat_find_stream_info(ifmt_ctx, 0)) &lt; 0) {
           printf("Failed to retrieve input stream information");
           goto end;
       }

       av_dump_format(ifmt_ctx, 0, in_filename, 0);

       avformat_alloc_output_context2(&amp;ofmt_ctx, NULL, NULL, out_filename);
       if (!ofmt_ctx) {
           printf( "Could not create output context\n");
           ret = AVERROR_UNKNOWN;
           goto end;
       }

       ofmt = ofmt_ctx->oformat;

       //preparing streams
       for (i = 0; i &lt; ifmt_ctx->nb_streams; i++) {
           AVStream *in_stream = ifmt_ctx->streams[i];
           AVStream *out_stream = avformat_new_stream(ofmt_ctx, in_stream->codec->codec);
           if (!out_stream) {
               printf( "Failed allocating output stream\n");
               ret = AVERROR_UNKNOWN;
               goto end;
           }

           ret = avcodec_copy_context(out_stream->codec, in_stream->codec);
           if (ret &lt; 0) {
               printf( "Failed to copy context from input to output stream codec context\n");
               goto end;
           }
           out_stream->codec->codec_tag = 0;
           if (ofmt_ctx->oformat->flags &amp; AVFMT_GLOBALHEADER)
               out_stream->codec->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
       }
       av_dump_format(ofmt_ctx, 0, out_filename, 1);

       if (!(ofmt->flags &amp; AVFMT_NOFILE)) {
           ret = avio_open(&amp;ofmt_ctx->pb, out_filename, AVIO_FLAG_WRITE);
           if (ret &lt; 0) {
               printf( "Could not open output file '%s'", out_filename);
               goto end;
           }
       }
       //preparing the header
       ret = avformat_write_header(ofmt_ctx, NULL);
       if (ret &lt; 0) {
           printf( "Error occurred when opening output file\n");
           goto end;
       }

       // av_seek_frame translates AV_TIME_BASE into an appropriate time base.
       ret = av_seek_frame(ifmt_ctx, -1, cutFrom*AV_TIME_BASE, AVSEEK_FLAG_ANY);
       if (ret &lt; 0) {
           printf( "Error seek\n");
           goto end;
       }
       dts_start_from = static_cast(
               malloc(sizeof(int64_t) * ifmt_ctx->nb_streams));
       memset(dts_start_from, 0, sizeof(int64_t) * ifmt_ctx->nb_streams);
       pts_start_from = static_cast(
               malloc(sizeof(int64_t) * ifmt_ctx->nb_streams));
       memset(pts_start_from, 0, sizeof(int64_t) * ifmt_ctx->nb_streams);

       //writing
       while (1) {
           AVStream *in_stream, *out_stream;
           //reading frame into pkt
           ret = av_read_frame(ifmt_ctx, &amp;pkt);
           if (ret &lt; 0)
               break;
           in_stream  = ifmt_ctx->streams[pkt.stream_index];
           out_stream = ofmt_ctx->streams[pkt.stream_index];

           //if end reached
           if (av_q2d(in_stream->time_base) * pkt.pts > cutUpTo) {
               av_packet_unref(&amp;pkt);
               break;
           }


           // Recording the initial pts value for each stream
           // Recording dts does not do the trick because AVPacket.dts values
           // in some video files are larger than corresponding pts values
           // and ffmpeg does not like it.
           if (dts_start_from[pkt.stream_index] == 0) {
               dts_start_from[pkt.stream_index] = pkt.pts;
               printf("dts_initial_value: %f for stream index: %d \n",
                       static_cast<double>(dts_start_from[pkt.stream_index]),
                                   pkt.stream_index

               );
           }
           if (pts_start_from[pkt.stream_index] == 0) {
               pts_start_from[pkt.stream_index] = pkt.pts;
               printf( "pts_initial_value:  %f for stream index %d\n",
                       static_cast<double>(pts_start_from[pkt.stream_index]),
                                   pkt.stream_index);
           }

           log_packet(ifmt_ctx, &amp;pkt, "in",loopCount);

           /* Computes pts etc
            *      av_rescale_q_rend etc are countering changes in time_base between
            *      out_stream and in_stream, so regardless of time_base values for
            *      in and out streams, the rate at which frames are refreshed remains
            *      the same.
            *
                   pkt.pts = pkt.pts * (in_stream->time_base/ out_stream->time_base)
                   As `time_base == 1/frame_rate`, the above is an equivalent of

                   (out_stream_frame_rate/in_stream_frame_rate)*pkt.pts where
                   frame_rate is the number of frames to be displayed per second.

                   AV_ROUND_PASS_MINMAX may set pts or dts to AV_NOPTS_VALUE
            * */


           pkt.pts =
                   av_rescale_q_rnd(
                   pkt.pts - pts_start_from[pkt.stream_index],
                   static_cast<avrational>(in_stream->time_base),
                   static_cast<avrational>(out_stream->time_base),
                   static_cast<avrounding>(AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX));
           pkt.dts =
                   av_rescale_q_rnd(
                   pkt.dts - dts_start_from[pkt.stream_index],
                   static_cast<avrational>(in_stream->time_base),
                   static_cast<avrational>(out_stream->time_base),
                   static_cast<avrounding>(AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX));

           if(pkt.dts>pkt.pts) pkt.dts = pkt.pts -1;
           if(pkt.dts &lt; 0) pkt.dts = 0;
           if(pkt.pts &lt; 0) pkt.pts = 0;

           pkt.duration = av_rescale_q(
                   pkt.duration,
                   in_stream->time_base,
                   out_stream->time_base);
           pkt.pos = -1;
           log_packet(ofmt_ctx, &amp;pkt, "out",loopCount);

           // Writes to the file after buffering packets enough to generate a frame
           // and probably sorting packets in dts order.
           ret = av_interleaved_write_frame(ofmt_ctx, &amp;pkt);
    //        ret = av_write_frame(ofmt_ctx, &amp;pkt);
           if (ret &lt; 0) {
               printf( "Error muxing packet %d \n", ret);
               //continue;
               break;
           }
           av_packet_unref(&amp;pkt);
           ++loopCount;
       }

       //Writing end code?
       av_write_trailer(ofmt_ctx);

       end:
       avformat_close_input(&amp;ifmt_ctx);

       if(dts_start_from)free(dts_start_from);
       if(pts_start_from)free(pts_start_from);

       /* close output */
       if (ofmt_ctx &amp;&amp; !(ofmt->flags &amp; AVFMT_NOFILE))
           avio_closep(&amp;ofmt_ctx->pb);
       avformat_free_context(ofmt_ctx);

       if (ret &lt; 0 &amp;&amp; ret != AVERROR_EOF) {
           //printf( "Error occurred: %s\n", av_err2str(ret));
           return 1;
       }

       return 0;
    }

    }
    </avrounding></avrational></avrational></avrounding></avrational></avrational></double></double></double></double></double>

    c compatible(Console says g++ but I’m sure this is C code)

    #include "libavformat/avformat.h"
    #include "libavutil/mathematics.h"
    #include "libavutil/timestamp.h"



    static void log_packet(
           const AVFormatContext *fmt_ctx,
           const AVPacket *pkt, const char *tag,
           long count)
    {

       printf("loop count %d pts:%f dts:%f duration:%f stream_index:%d\n",
              count,
              (double)pkt->pts,
              (double)pkt->dts,
              (double)pkt->duration,
              pkt->stream_index);
       return;
    }

    int trimVideo(
           const char* in_filename,
           const char* out_filename,
           double cutFrom,
           double cutUpTo)
    {
       AVOutputFormat *ofmt = NULL;
       AVFormatContext *ifmt_ctx = NULL, *ofmt_ctx = NULL;
       AVPacket pkt;
       int ret, i;
       //jboolean  copy = true;
       //const char *in_filename = env->GetStringUTFChars(jstring_in_filename,&amp;copy);
       //const char *out_filename = env->GetStringUTFChars(jstring_out_filename,&amp;copy);
       long loopCount = 0;

       av_register_all();

       // Cutting may change the pts and dts of the resulting video;
       // if frames in head position are removed.
       // In the case like that, src stream's copy start pts
       // need to be recorded and is used to compute the new pts value.
       // e.g.
       //    new_pts = current_pts - trim_start_position_pts;

       // nb-streams is the number of elements in AVFormatContext.streams.
       // Initial pts value must be recorded for each stream.

       //May be malloc and memset should be replaced with [].
       int64_t *dts_start_from = NULL;
       int64_t *pts_start_from = NULL;

       if ((ret = avformat_open_input(&amp;ifmt_ctx, in_filename, 0, 0)) &lt; 0) {
           printf( "Could not open input file '%s'", in_filename);
           goto end;
       }

       if ((ret = avformat_find_stream_info(ifmt_ctx, 0)) &lt; 0) {
           printf("Failed to retrieve input stream information");
           goto end;
       }

       av_dump_format(ifmt_ctx, 0, in_filename, 0);

       avformat_alloc_output_context2(&amp;ofmt_ctx, NULL, NULL, out_filename);
       if (!ofmt_ctx) {
           printf( "Could not create output context\n");
           ret = AVERROR_UNKNOWN;
           goto end;
       }

       ofmt = ofmt_ctx->oformat;

       //preparing streams
       for (i = 0; i &lt; ifmt_ctx->nb_streams; i++) {
           AVStream *in_stream = ifmt_ctx->streams[i];
           AVStream *out_stream = avformat_new_stream(ofmt_ctx, in_stream->codec->codec);
           if (!out_stream) {
               printf( "Failed allocating output stream\n");
               ret = AVERROR_UNKNOWN;
               goto end;
           }

           ret = avcodec_copy_context(out_stream->codec, in_stream->codec);
           if (ret &lt; 0) {
               printf( "Failed to copy context from input to output stream codec context\n");
               goto end;
           }
           out_stream->codec->codec_tag = 0;
           if (ofmt_ctx->oformat->flags &amp; AVFMT_GLOBALHEADER)
               out_stream->codec->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
       }
       av_dump_format(ofmt_ctx, 0, out_filename, 1);

       if (!(ofmt->flags &amp; AVFMT_NOFILE)) {
           ret = avio_open(&amp;ofmt_ctx->pb, out_filename, AVIO_FLAG_WRITE);
           if (ret &lt; 0) {
               printf( "Could not open output file '%s'", out_filename);
               goto end;
           }
       }
       //preparing the header
       ret = avformat_write_header(ofmt_ctx, NULL);
       if (ret &lt; 0) {
           printf( "Error occurred when opening output file\n");
           goto end;
       }

       // av_seek_frame translates AV_TIME_BASE into an appropriate time base.
       ret = av_seek_frame(ifmt_ctx, -1, cutFrom*AV_TIME_BASE, AVSEEK_FLAG_ANY);
       if (ret &lt; 0) {
           printf( "Error seek\n");
           goto end;
       }
       dts_start_from = (int64_t*)
               malloc(sizeof(int64_t) * ifmt_ctx->nb_streams);
       memset(dts_start_from, 0, sizeof(int64_t) * ifmt_ctx->nb_streams);
       pts_start_from = (int64_t*)
               malloc(sizeof(int64_t) * ifmt_ctx->nb_streams);
       memset(pts_start_from, 0, sizeof(int64_t) * ifmt_ctx->nb_streams);

       //writing
       while (1) {
           AVStream *in_stream, *out_stream;
           //reading frame into pkt
           ret = av_read_frame(ifmt_ctx, &amp;pkt);
           if (ret &lt; 0)
               break;
           in_stream  = ifmt_ctx->streams[pkt.stream_index];
           out_stream = ofmt_ctx->streams[pkt.stream_index];

           //if end reached
           if (av_q2d(in_stream->time_base) * pkt.pts > cutUpTo) {
               av_packet_unref(&amp;pkt);
               break;
           }


           // Recording the initial pts value for each stream
           // Recording dts does not do the trick because AVPacket.dts values
           // in some video files are larger than corresponding pts values
           // and ffmpeg does not like it.
           if (dts_start_from[pkt.stream_index] == 0) {
               dts_start_from[pkt.stream_index] = pkt.pts;
               printf("dts_initial_value: %f for stream index: %d \n",
                       (double)dts_start_from[pkt.stream_index],
                                   pkt.stream_index

               );
           }
           if (pts_start_from[pkt.stream_index] == 0) {
               pts_start_from[pkt.stream_index] = pkt.pts;
               printf( "pts_initial_value:  %f for stream index %d\n",
                       (double)pts_start_from[pkt.stream_index],
                                   pkt.stream_index);
           }

           log_packet(ifmt_ctx, &amp;pkt, "in",loopCount);

           /* Computes pts etc
            *      av_rescale_q_rend etc are countering changes in time_base between
            *      out_stream and in_stream, so regardless of time_base values for
            *      in and out streams, the rate at which frames are refreshed remains
            *      the same.
            *
                   pkt.pts = pkt.pts * (in_stream->time_base/ out_stream->time_base)
                   As `time_base == 1/frame_rate`, the above is an equivalent of

                   (out_stream_frame_rate/in_stream_frame_rate)*pkt.pts where
                   frame_rate is the number of frames to be displayed per second.

                   AV_ROUND_PASS_MINMAX may set pts or dts to AV_NOPTS_VALUE
            * */


           pkt.pts =
                   av_rescale_q_rnd(
                   pkt.pts - pts_start_from[pkt.stream_index],
                   (AVRational)in_stream->time_base,
                   (AVRational)out_stream->time_base,
                   (AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX));
           pkt.dts =
                   av_rescale_q_rnd(
                   pkt.dts - dts_start_from[pkt.stream_index],
                   (AVRational)in_stream->time_base,
                   (AVRational)out_stream->time_base,
                   AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);

           if(pkt.dts>pkt.pts) pkt.dts = pkt.pts -1;
           if(pkt.dts &lt; 0) pkt.dts = 0;
           if(pkt.pts &lt; 0) pkt.pts = 0;

           pkt.duration = av_rescale_q(
                   pkt.duration,
                   in_stream->time_base,
                   out_stream->time_base);
           pkt.pos = -1;
           log_packet(ofmt_ctx, &amp;pkt, "out",loopCount);

           // Writes to the file after buffering packets enough to generate a frame
           // and probably sorting packets in dts order.
           ret = av_interleaved_write_frame(ofmt_ctx, &amp;pkt);
    //        ret = av_write_frame(ofmt_ctx, &amp;pkt);
           if (ret &lt; 0) {
               printf( "Error muxing packet %d \n", ret);
               //continue;
               break;
           }
           av_packet_unref(&amp;pkt);
           ++loopCount;
       }

       //Writing end code?
       av_write_trailer(ofmt_ctx);

       end:
       avformat_close_input(&amp;ifmt_ctx);

       if(dts_start_from)free(dts_start_from);
       if(pts_start_from)free(pts_start_from);

       /* close output */
       if (ofmt_ctx &amp;&amp; !(ofmt->flags &amp; AVFMT_NOFILE))
           avio_closep(&amp;ofmt_ctx->pb);
       avformat_free_context(ofmt_ctx);

       if (ret &lt; 0 &amp;&amp; ret != AVERROR_EOF) {
           //printf( "Error occurred: %s\n", av_err2str(ret));
           return 1;
       }

       return 0;
    }

    What is the problem

    My code does not produce the error because I’m doing new_dts = current_dts - initial_pts_for_current_stream. It works but now dts values are not properly computed.

    How to recalculate dts properly ?

    P.S

    Since Olaf seems to have a very strong opinion, posting the build console message for my main.c.
    I don’t really know C or C++ but GNU gcc seems to be calling gcc for compiling and g++ for linking.
    Well, the extension for my main is now .c and the compiler being called is gcc, so that should at least mean I have got a code written in C language...

    ------------- Build: Debug in videoTrimmer (compiler: GNU GCC Compiler)---------------

    gcc -Wall -fexceptions -std=c99 -g -I/home/d/Android/Sdk/ndk-bundle/sources/FFmpeg/local/include -I/usr/include -I/usr/local/include -c /home/d/CodeBlockWorkplace/videoTrimmer/main.c -o obj/Debug/main.o
    /home/d/CodeBlockWorkplace/videoTrimmer/main.c: In function ‘log_packet’:
    /home/d/CodeBlockWorkplace/videoTrimmer/main.c:15:12: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
        printf("loop count %d pts:%f dts:%f duration:%f stream_index:%d\n",
               ^
    /home/d/CodeBlockWorkplace/videoTrimmer/main.c: In function ‘trimVideo’:
    /home/d/CodeBlockWorkplace/videoTrimmer/main.c:79:9: warning: ‘codec’ is deprecated [-Wdeprecated-declarations]
            AVStream *out_stream = avformat_new_stream(ofmt_ctx, in_stream->codec->codec);
            ^
    In file included from /home/d/CodeBlockWorkplace/videoTrimmer/main.c:3:0:
    /home/d/Android/Sdk/ndk-bundle/sources/FFmpeg/local/include/libavformat/avformat.h:893:21: note: declared here
        AVCodecContext *codec;
                        ^
    /home/d/CodeBlockWorkplace/videoTrimmer/main.c:86:9: warning: ‘avcodec_copy_context’ is deprecated [-Wdeprecated-declarations]
            ret = avcodec_copy_context(out_stream->codec, in_stream->codec);
            ^
    In file included from /home/d/Android/Sdk/ndk-bundle/sources/FFmpeg/local/include/libavformat/avformat.h:319:0,
                    from /home/d/CodeBlockWorkplace/videoTrimmer/main.c:3:
    /home/d/Android/Sdk/ndk-bundle/sources/FFmpeg/local/include/libavcodec/avcodec.h:4286:5: note: declared here
    int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src);
        ^
    /home/d/CodeBlockWorkplace/videoTrimmer/main.c:86:9: warning: ‘codec’ is deprecated [-Wdeprecated-declarations]
            ret = avcodec_copy_context(out_stream->codec, in_stream->codec);
            ^
    In file included from /home/d/CodeBlockWorkplace/videoTrimmer/main.c:3:0:
    /home/d/Android/Sdk/ndk-bundle/sources/FFmpeg/local/include/libavformat/avformat.h:893:21: note: declared here
        AVCodecContext *codec;
                        ^
    /home/d/CodeBlockWorkplace/videoTrimmer/main.c:86:9: warning: ‘codec’ is deprecated [-Wdeprecated-declarations]
            ret = avcodec_copy_context(out_stream->codec, in_stream->codec);
            ^
    In file included from /home/d/CodeBlockWorkplace/videoTrimmer/main.c:3:0:
    /home/d/Android/Sdk/ndk-bundle/sources/FFmpeg/local/include/libavformat/avformat.h:893:21: note: declared here
        AVCodecContext *codec;
                        ^
    /home/d/CodeBlockWorkplace/videoTrimmer/main.c:91:9: warning: ‘codec’ is deprecated [-Wdeprecated-declarations]
            out_stream->codec->codec_tag = 0;
            ^
    In file included from /home/d/CodeBlockWorkplace/videoTrimmer/main.c:3:0:
    /home/d/Android/Sdk/ndk-bundle/sources/FFmpeg/local/include/libavformat/avformat.h:893:21: note: declared here
        AVCodecContext *codec;
                        ^
    /home/d/CodeBlockWorkplace/videoTrimmer/main.c:93:13: warning: ‘codec’ is deprecated [-Wdeprecated-declarations]
                out_stream->codec->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
                ^
    In file included from /home/d/CodeBlockWorkplace/videoTrimmer/main.c:3:0:
    /home/d/Android/Sdk/ndk-bundle/sources/FFmpeg/local/include/libavformat/avformat.h:893:21: note: declared here
        AVCodecContext *codec;
                        ^
    g++ -L/home/d/Android/Sdk/ndk-bundle/sources/FFmpeg/local/lib -L/usr/lib -L/usr/local/lib -o bin/Debug/videoTrimmer obj/Debug/main.o   ../../Android/Sdk/ndk-bundle/sources/FFmpeg/local/lib/libavformat.a ../../Android/Sdk/ndk-bundle/sources/FFmpeg/local/lib/libavcodec.a ../../Android/Sdk/ndk-bundle/sources/FFmpeg/local/lib/libavutil.a ../../Android/Sdk/ndk-bundle/sources/FFmpeg/local/lib/libswresample.a ../../Android/Sdk/ndk-bundle/sources/FFmpeg/local/lib/libswscale.a ../../Android/Sdk/ndk-bundle/sources/FFmpeg/local/lib/libavfilter.a ../../Android/Sdk/ndk-bundle/sources/FFmpeg/local/lib/libpostproc.a ../../Android/Sdk/ndk-bundle/sources/FFmpeg/local/lib/libavdevice.a -lX11 -lvdpau -lva -lva-drm -lva-x11 -ldl -lpthread -lz -llzma -lx264
    Output file is bin/Debug/videoTrimmer with size 77.24 MB
    Process terminated with status 0 (0 minute(s), 16 second(s))
    0 error(s), 8 warning(s) (0 minute(s), 16 second(s))
  • Error converting .flv to .avi with ffmpeg

    5 juillet 2012, par user1504396

    When i try the 2d code, with a 5 minutes 7 second video, I get a 28 minutes 29 seconds video, What did I do wrong ?

    Here is the ffmpeg output :

    [Me@Hewlett-Packard Downloads]$ ffmpeg -i "0042473.flv" -s 400x240 -aspect 2:1 -r 20 -vcodec mjpeg -qscale 1 -acodec adpcm_ima_wav -ac 2 "VID_0001.AVI"
    ffmpeg version 0.8.10, Copyright © 2000-2011 the FFmpeg developers
    built on Feb 29 2012 16:30:44 with gcc 4.6.2 20111027 (Red Hat 4.6.2-1)
    configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --extra-cflags=&#39;-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic&#39; --enable-bzlib --enable-libcelt --enable-libdc1394 --enable-libdirac --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab --enable-avfilter --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
    libavutil 51. 9. 1 / 51. 9. 1
    libavcodec 53. 8. 0 / 53. 8. 0
    libavformat 53. 5. 0 / 53. 5. 0
    libavdevice 53. 1. 1 / 53. 1. 1
    libavfilter 2. 23. 0 / 2. 23. 0
    libswscale 2. 0. 0 / 2. 0. 0
    libpostproc 51. 2. 0 / 51. 2. 0
    [flv @ 0x2165600] Estimating duration from bitrate, this may be inaccurate

    Seems stream 0 codec frame rate differs from container frame rate: 59.94 (2997/50) -> 29.97 (30000/1001)
    Input #0, flv, from &#39;0042473.flv&#39;:
    Metadata:
    minor_version : 1
    stereo : true
    videocodecid : 7
    audiodatarate : 62
    audiosamplerate : 44100
    audiosize : 2476815
    canSeekToEnd : true
    creation_time : 2011-05-01 18:06:43
    copyright :
    compatible_brands: isomavc1
    datasize : 16589374
    duration : 308
    copyright-eng :
    encoder : Lavf52.104.0
    videodatarate : 351
    hasAudio : true
    hasCuePoints : false
    hasKeyframes : true
    hasMetadata : true
    hasVideo : true
    width : 480
    lasttimestamp : 308
    audiocodecid : 10
    metadatacreator : flvtool++ (Facebook, Motion project, dweatherford)
    major_brand : isom
    audiosamplesize : 16
    totalframes : 9225
    framerate : 30
    height : 272
    videosize : 13863389
    filesize : 16587742
    Duration: 00:05:07.94, start: 0.000000, bitrate: 423 kb/s
    Stream #0.0: Video: h264 (High), yuv420p, 480x272 [PAR 1:1 DAR 30:17], 359 kb/s, 29.97 tbr, 1k tbn, 59.94 tbc
    Stream #0.1: Audio: aac, 44100 Hz, stereo, s16, 63 kb/s
    Incompatible pixel format &#39;yuv420p&#39; for codec &#39;mjpeg&#39;, auto-selecting format &#39;yuvj420p&#39;
    [buffer @ 0x216b180] w:480 h:272 pixfmt:yuv420p tb:1/1000000 sar:1/1 sws_param:
    [scale @ 0x216bf40] w:480 h:272 fmt:yuv420p -> w:400 h:240 fmt:yuvj420p flags:0x4
    Output #0, avi, to &#39;VID_0001.AVI&#39;:
    Metadata:
    minor_version : 1
    stereo : true
    videocodecid : 7
    audiodatarate : 62
    audiosamplerate : 44100
    audiosize : 2476815
    canSeekToEnd : true
    creation_time : 2011-05-01 18:06:43
    ICOP :
    compatible_brands: isomavc1
    datasize : 16589374
    duration : 308
    copyright-eng :
    filesize : 16587742
    videodatarate : 351
    hasAudio : true
    hasCuePoints : false
    hasKeyframes : true
    hasMetadata : true
    hasVideo : true
    width : 480
    lasttimestamp : 308
    audiocodecid : 10
    metadatacreator : flvtool++ (Facebook, Motion project, dweatherford)
    major_brand : isom
    audiosamplesize : 16
    totalframes : 9225
    framerate : 30
    height : 272
    videosize : 13863389
    ISFT : Lavf53.5.0
    Stream #0.0: Video: mjpeg, yuvj420p, 400x240 [PAR 6:5 DAR 2:1], q=2-31, 200 kb/s, 20 tbn, 20 tbc
    Stream #0.1: Audio: adpcm_ima_wav, 44100 Hz, stereo, s16, 352 kb/s
    Stream mapping:
    Stream #0.0 -> #0.0
    Stream #0.1 -> #0.1
    Press [q] to stop, [?] for help
    frame= 43 fps= 0 q=1.0 size= 1330kB time=00:00:02.12 bitrate=5135.7kbits/sframe= 87 fps= 86 q=1.0 size= 2712kB time=00:00:04.35 bitrate=5097.2kbits/sframe= 135 fps= 89 q=1.0 size= 3579kB time=00:00:06.78 bitrate=4324.9kbits/sframe= 185 fps= 92 q=1.0 size= 4307kB time=00:00:09.27 bitrate=3805.9kbits/sframe= 231 fps= 92 q=1.0 size= 5208kB time=00:00:11.55 bitrate=3692.4kbits/sframe= 276 fps= 91 q=1.0 size= 6129kB time=00:00:13.83 bitrate=3628.5kbits/sframe= 318 fps= 90 q=1.0 size= 6978kB time=00:00:15.91 bitrate=3592.6kbits/sframe= 366 fps= 91 q=1.0 size= 7990kB time=00:00:18.33 bitrate=3570.2kbits/sframe= 408 fps= 90 q=1.0 size= 8912kB time=00:00:20.43 bitrate=3573.2kbits/sframe= 451 fps= 90 q=1.0 size= 9831kB time=00:00:22.55 bitrate=3570.9kbits/sframe= 495 fps= 89 q=1.0 size= 10827kB time=00:00:24.74 bitrate=3584.4kbits/sframe= 539 fps= 89 q=1.0 size= 11845kB time=00:00:26.91 bitrate=3605.5kbits/sframe= 583 fps= 89 q=1.0 size= 12939kB time=00:00:29.14 bitrate=3636.2kbits/sframe= 630 fps= 89 q=1.0 size= 13790kB time=00:00:31.52 bitrate=3583.5kbits/sframe= 676 fps= 89 q=1.0 size= 14710kB time=00:00:33.80 bitrate=3564.4kbits/sframe= 723 fps= 90 q=1.0 size= 15651kB time=00:00:36.16 bitrate=3545.7kbits/sframe= 767 fps= 90 q=1.0 size= 16589kB time=00:00:38.35 bitrate=3543.6kbits/sframe= 809 fps= 89 q=1.0 size= 17576kB time=00:00:40.42 bitrate=3561.7kbits/sframe= 852 fps= 89 q=1.0 size= 18598kB time=00:00:42.61 bitrate=3575.0kbits/sframe= 898 fps= 89 q=1.0 size= 19548kB time=00:00:44.90 bitrate=3566.6kbits/sframe= 940 fps= 89 q=1.0 size= 20666kB time=00:00:46.97 bitrate=3603.9kbits/sframe= 982 fps= 89 q=1.0 size= 21739kB time=00:00:49.12 bitrate=3625.5kbits/sframe= 1024 fps= 88 q=1.0 size= 22711kB time=00:00:51.25 bitrate=3630.2kbits/sframe= 1070 fps= 88 q=1.0 size= 23769kB time=00:00:53.47 bitrate=3640.9kbits/sframe= 1118 fps= 89 q=1.0 size= 24935kB time=00:00:55.90 bitrate=3654.2kbits/sframe= 1165 fps= 89 q=1.0 size= 26047kB time=00:00:58.22 bitrate=3664.3kbits/sframe= 1213 fps= 89 q=1.0 size= 27187kB time=00:01:00.62 bitrate=3673.5kbits/sframe= 1265 fps= 90 q=1.0 size= 27935kB time=00:01:03.23 bitrate=3619.0kbits/sframe= 1315 fps= 90 q=1.0 size= 28590kB time=00:01:05.79 bitrate=3559.7kbits/sframe= 1366 fps= 90 q=1.0 size= 29229kB time=00:01:08.30 bitrate=3505.3kbits/sframe= 1415 fps= 91 q=1.0 size= 29928kB time=00:01:10.75 bitrate=3465.2kbits/sframe= 1464 fps= 91 q=1.0 size= 30612kB time=00:01:13.25 bitrate=3423.5kbits/sframe= 1512 fps= 91 q=1.0 size= 31309kB time=00:01:15.64 bitrate=3390.8kbits/sframe= 1561 fps= 91 q=1.0 size= 31997kB time=00:01:18.06 bitrate=3357.8kbits/sframe= 1608 fps= 91 q=1.0 size= 32760kB time=00:01:20.36 bitrate=3339.3kbits/sframe= 1654 fps= 91 q=1.0 size= 33563kB time=00:01:22.69 bitrate=3324.7kbits/sframe= 1700 fps= 91 q=1.0 size= 34318kB time=00:01:24.98 bitrate=3308.2kbits/sframe= 1745 fps= 91 q=1.0 size= 35041kB time=00:01:27.24 bitrate=3290.4kbits/sframe= 1791 fps= 91 q=1.0 size= 35749kB time=00:01:29.56 bitrate=3269.6kbits/sframe= 1837 fps= 91 q=1.0 size= 36442kB time=00:01:31.85 bitrate=3250.1kbits/sframe= 1884 fps= 91 q=1.0 size= 37121kB time=00:01:34.20 bitrate=3228.0kbits/sframe= 1931 fps= 91 q=1.0 size= 37840kB time=00:01:36.53 bitrate=3211.1kbits/sframe= 1978 fps= 91 q=1.0 size= 38561kB time=00:01:38.90 bitrate=3193.8kbits/sframe= 2025 fps= 91 q=1.0 size= 39279kB time=00:01:41.28 bitrate=3176.9kbits/sframe= 2072 fps= 91 q=1.0 size= 40005kB time=00:01:43.59 bitrate=3163.6kbits/sframe= 2117 fps= 91 q=1.0 size= 40833kB time=00:01:45.87 bitrate=3159.5kbits/sframe= 2158 fps= 91 q=1.0 size= 41561kB time=00:01:47.90 bitrate=3155.3kbits/sframe= 2202 fps= 91 q=1.0 size= 42407kB time=00:01:50.14 bitrate=3154.1kbits/sframe= 2248 fps= 91 q=1.0 size= 43201kB time=00:01:52.42 bitrate=3147.9kbits/sframe= 2295 fps= 91 q=1.0 size= 43975kB time=00:01:54.75 bitrate=3139.3kbits/sframe= 2342 fps= 91 q=1.0 size= 44739kB time=00:01:57.10 bitrate=3129.7kbits/sframe= 2388 fps= 91 q=1.0 size= 45532kB time=00:01:59.43 bitrate=3123.0kbits/sframe= 2435 fps= 91 q=1.0 size= 46306kB time=00:02:01.80 bitrate=3114.5kbits/sframe= 2481 fps= 91 q=1.0 size= 47095kB time=00:02:04.02 bitrate=3110.7kbits/sframe= 2530 fps= 91 q=1.0 size= 47778kB time=00:02:06.49 bitrate=3094.3kbits/sframe= 2578 fps= 91 q=1.0 size= 48507kB time=00:02:08.91 bitrate=3082.5kbits/sframe= 2622 fps= 91 q=1.0 size= 49169kB time=00:02:11.08 bitrate=3072.9kbits/sframe= 2670 fps= 91 q=1.0 size= 49851kB time=00:02:13.54 bitrate=3057.9kbits/sframe= 2718 fps= 91 q=1.0 size= 50531kB time=00:02:15.92 bitrate=3045.5kbits/sframe= 2764 fps= 91 q=1.0 size= 51242kB time=00:02:18.18 bitrate=3037.8kbits/sframe= 2810 fps= 92 q=1.0 size= 51959kB time=00:02:20.51 bitrate=3029.3kbits/sframe= 2835 fps= 90 q=1.0 size= 52376kB time=00:02:21.78 bitrate=3026.2kbits/sframe= 2879 fps= 90 q=1.0 size= 53093kB time=00:02:23.94 bitrate=3021.5kbits/sframe= 2923 fps= 90 q=1.0 size= 53853kB time=00:02:26.18 bitrate=3017.8kbits/sframe= 2968 fps= 90 q=1.0 size= 54594kB time=00:02:28.39 bitrate=3013.7kbits/sframe= 3012 fps= 90 q=1.0 size= 55444kB time=00:02:30.63 bitrate=3015.2kbits/sframe= 3056 fps= 90 q=1.0 size= 56495kB time=00:02:32.78 bitrate=3029.2kbits/sframe= 3098 fps= 90 q=1.0 size= 57463kB time=00:02:34.90 bitrate=3039.0kbits/sframe= 3141 fps= 90 q=1.0 size= 58433kB time=00:02:37.04 bitrate=3048.0kbits/sframe= 3186 fps= 90 q=1.0 size= 59457kB time=00:02:39.33 bitrate=3057.0kbits/sframe= 3232 fps= 90 q=1.0 size= 60471kB time=00:02:41.59 bitrate=3065.6kbits/sframe= 3277 fps= 90 q=1.0 size= 61485kB time=00:02:43.82 bitrate=3074.5kbits/sframe= 3322 fps= 90 q=1.0 size= 62297kB time=00:02:46.11 bitrate=3072.3kbits/sframe= 3365 fps= 90 q=1.0 size= 63043kB time=00:02:48.27 bitrate=3069.0kbits/sframe= 3409 fps= 90 q=1.0 size= 63752kB time=00:02:50.46 bitrate=3063.7kbits/sframe= 3455 fps= 90 q=1.0 size= 64529kB time=00:02:52.75 bitrate=3060.0kbits/sframe= 3499 fps= 90 q=1.0 size= 65306kB time=00:02:54.96 bitrate=3057.7kbits/sframe= 3545 fps= 90 q=1.0 size= 66070kB time=00:02:57.24 bitrate=3053.6kbits/sframe= 3594 fps= 90 q=1.0 size= 66804kB time=00:02:59.71 bitrate=3045.1kbits/sframe= 3644 fps= 90 q=1.0 size= 67554kB time=00:03:02.18 bitrate=3037.6kbits/sframe= 3690 fps= 90 q=1.0 size= 68436kB time=00:03:04.48 bitrate=3038.8kbits/sframe= 3740 fps= 90 q=1.0 size= 69121kB time=00:03:07.00 bitrate=3028.0kbits/sframe= 3787 fps= 90 q=1.0 size= 69953kB time=00:03:09.33 bitrate=3026.7kbits/sframe= 3832 fps= 90 q=1.0 size= 70857kB time=00:03:11.59 bitrate=3029.7kbits/sframe= 3878 fps= 90 q=1.0 size= 71622kB time=00:03:13.92 bitrate=3025.6kbits/sframe= 3925 fps= 90 q=1.0 size= 72343kB time=00:03:16.25 bitrate=3019.8kbits/sframe= 3973 fps= 90 q=1.0 size= 73100kB time=00:03:18.64 bitrate=3014.5kbits/sframe= 4021 fps= 90 q=1.0 size= 73867kB time=00:03:21.07 bitrate=3009.5kbits/sframe= 4070 fps= 90 q=1.0 size= 74643kB time=00:03:23.53 bitrate=3004.2kbits/sframe= 4119 fps= 90 q=1.0 size= 75363kB time=00:03:25.95 bitrate=2997.6kbits/sframe= 4167 fps= 90 q=1.0 size= 76077kB time=00:03:28.35 bitrate=2991.1kbits/sframe= 4216 fps= 91 q=1.0 size= 76751kB time=00:03:30.77 bitrate=2983.0kbits/sframe= 4263 fps= 91 q=1.0 size= 77432kB time=00:03:33.15 bitrate=2975.9kbits/sframe= 4315 fps= 91 q=1.0 size= 78087kB time=00:03:35.73 bitrate=2965.1kbits/sframe= 4367 fps= 91 q=1.0 size= 78795kB time=00:03:38.34 bitrate=2956.3kbits/sframe= 4418 fps= 91 q=1.0 size= 79475kB time=00:03:40.90 bitrate=2947.2kbits/sframe= 4469 fps= 91 q=1.0 size= 80174kB time=00:03:43.46 bitrate=2939.1kbits/sframe= 4519 fps= 91 q=1.0 size= 80865kB time=00:03:45.90 bitrate=2932.4kbits/sframe= 4567 fps= 91 q=1.0 size= 81621kB time=00:03:48.32 bitrate=2928.4kbits/sframe= 4611 fps= 91 q=1.0 size= 82613kB time=00:03:50.56 bitrate=2935.2kbits/sframe= 4655 fps= 91 q=1.0 size= 83653kB time=00:03:52.80 bitrate=2943.7kbits/sframe= 4699 fps= 91 q=1.0 size= 84646kB time=00:03:54.97 bitrate=2951.1kbits/sframe= 4743 fps= 91 q=1.0 size= 85543kB time=00:03:57.20 bitrate=2954.3kbits/sframe= 4789 fps= 91 q=1.0 size= 86344kB time=00:03:59.42 bitrate=2954.3kbits/sframe= 4836 fps= 91 q=1.0 size= 87090kB time=00:04:01.79 bitrate=2950.6kbits/sframe= 4883 fps= 91 q=1.0 size= 87821kB time=00:04:04.17 bitrate=2946.4kbits/sframe= 4930 fps= 91 q=1.0 size= 88571kB time=00:04:06.50 bitrate=2943.5kbits/sframe= 4977 fps= 91 q=1.0 size= 89318kB time=00:04:08.85 bitrate=2940.3kbits/sframe= 5024 fps= 91 q=1.0 size= 90014kB time=00:04:11.18 bitrate=2935.7kbits/sframe= 5070 fps= 91 q=1.0 size= 90743kB time=00:04:13.55 bitrate=2931.8kbits/sframe= 5120 fps= 91 q=1.0 size= 91438kB time=00:04:16.00 bitrate=2926.0kbits/sframe= 5165 fps= 91 q=1.0 size= 92265kB time=00:04:18.28 bitrate=2926.4kbits/sframe= 5211 fps= 91 q=1.0 size= 93079kB time=00:04:20.56 bitrate=2926.3kbits/sframe= 5258 fps= 91 q=1.0 size= 93913kB time=00:04:22.87 bitrate=2926.6kbits/sframe= 5304 fps= 91 q=1.0 size= 94739kB time=00:04:25.20 bitrate=2926.4kbits/sframe= 5351 fps= 91 q=1.0 size= 95565kB time=00:04:27.60 bitrate=2925.5kbits/sframe= 5398 fps= 91 q=1.0 size= 96368kB time=00:04:29.90 bitrate=2924.9kbits/sframe= 5444 fps= 91 q=1.0 size= 97176kB time=00:04:32.16 bitrate=2924.9kbits/sframe= 5490 fps= 91 q=1.0 size= 98049kB time=00:04:34.54 bitrate=2925.6kbits/sframe= 5538 fps= 91 q=1.0 size= 98914kB time=00:04:36.91 bitrate=2926.1kbits/sframe= 5587 fps= 91 q=1.0 size= 99817kB time=00:04:39.36 bitrate=2927.0kbits/sframe= 5636 fps= 91 q=1.0 size= 100709kB time=00:04:41.83 bitrate=2927.3kbits/sframe= 5682 fps= 91 q=1.0 size= 101490kB time=00:04:44.11 bitrate=2926.3kbits/sframe= 5732 fps= 91 q=1.0 size= 102230kB time=00:04:46.60 bitrate=2922.0kbits/sframe= 5781 fps= 91 q=1.0 size= 102991kB time=00:04:49.07 bitrate=2918.6kbits/sframe= 5827 fps= 91 q=1.0 size= 103918kB time=00:04:51.35 bitrate=2921.8kbits/sframe= 5874 fps= 92 q=1.0 size= 104873kB time=00:04:53.73 bitrate=2924.9kbits/sframe= 5921 fps= 92 q=1.0 size= 105844kB time=00:04:56.08 bitrate=2928.5kbits/sframe= 5970 fps= 92 q=1.0 size= 106670kB time=00:04:58.50 bitrate=2927.4kbits/sframe= 6028 fps= 92 q=1.0 size= 108198kB time=00:05:01.43 bitrate=2940.5kbits/sframe= 6080 fps= 91 q=1.0 size= 109527kB time=00:05:03.99 bitrate=2951.5kbits/sframe= 6138 fps= 92 q=1.0 size= 110623kB time=00:05:06.85 bitrate=2953.3kbits/sframe= 6156 fps= 92 q=1.0 Lsize= 111017kB time=00:05:07.85 bitrate=2954.2kbits/s dup=0 drop=3067

    video:97193kB audio:13354kB global headers:0kB muxing overhead 0.425158%

    Where is my problem ?