Recherche avancée

Médias (1)

Mot : - Tags -/biographie

Autres articles (60)

  • Use, discuss, criticize

    13 avril 2011, par

    Talk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
    The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
    A discussion list is available for all exchanges between users.

  • Support de tous types de médias

    10 avril 2011

    Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

Sur d’autres sites (9124)

  • popen returns output after delay ?

    7 février 2013, par Scarface

    I am executing FFMPEG with popen() to get the result of the process. The main reason I am doing this is so I can stream constant output and build a progress bar.

    The issue is that the process starts and I receive some initial information. The rest of the information does not appear until after the process is done however. So essentially, the rest of the output (output on the progress) which comes on intervals when the process is going is delayed right before the process and all comes at once after the process is done which is useless.

    I need the output to constantly come so I can update a progress bar. If I change 2>&1 to 2> stderr.txt that text file receives output consistently but I would like to receive in php since many processes may be running. Anyone have any ideas on solving this ? It seems noone can figure this out...and it is driving me crazy ! IF anyone helps me figure this out (and actually solve it), I will start a bounty and then accept their answer.

    $handle = popen ('/usr/local/bin/ffmpeg -i /home/g/Desktop/cave.wmv -deinterlace -acodec libfaac -ab 96k -ar 44100 -vcodec libx264 -s 480x320 -f flv /home/g/Desktop/file.flv 2>&1', 'r');
    if ($handle) {

       while(! feof ($handle)) {

    echo $read = fgets ($handle);

    ob_flush();
       flush();
       }
       pclose ($handle);
    }

    OUTPUTS

       ffmpeg version git-N-30561-g6700aa8, Copyright (c) 2000-2011 the FFmpeg developers built on Jun 5 2011 21:10:26 with gcc 4.5.2 configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-x11grab libavutil 51. 4. 0 / 51. 4. 0 libavcodec 53. 6. 1 / 53. 6. 1 libavformat 53. 2. 0 / 53. 2. 0 libavdevice 53. 1. 1 / 53. 1. 1 libavfilter 2. 13. 0 / 2. 13. 0 libswscale 0. 14. 1 / 0. 14. 1 libpostproc 51. 2. 0 / 51. 2. 0 Seems stream 0 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 29.97 (30000/1001) Input #0, asf, from '/home/geoff/Desktop/cave.wmv': Metadata: WMFSDKVersion : 11.0.5721.5145 WMFSDKNeeded : 0.0.0.0000 IsVBR : 0 Duration: 00:01:37.93, bitrate: 263 kb/s Stream #0.0(eng): Video: vc1 (Advanced), yuv420p, 320x240, 256 kb/s, PAR 1:1 DAR 4:3, 29.97 tbr, 1k tbn, 1k tbc [buffer @ 0xacae200] w:320 h:240 pixfmt:yuv420p tb:1/1000000 sar:1/1 sws_param: [scale @ 0xacbc120] w:320 h:240 fmt:yuv420p -> w:480 h:320 fmt:yuv420p flags:0x4 [libx264 @ 0xacbb7e0] Default settings detected, using medium profile [libx264 @ 0xacbb7e0] using SAR=1/1 [libx264 @ 0xacbb7e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle Cache64 [libx264 @ 0xacbb7e0] profile High, level 2.1 [libx264 @ 0xacbb7e0] 264 - core 115 r1995 c1e60b9 - H.264/MPEG-4 AVC codec - Copyleft 2003-2011 - 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=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=1 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 Output #0, flv, to '/home/geoff/Desktop/file.flv': Metadata: WMFSDKVersion : 11.0.5721.5145 WMFSDKNeeded : 0.0.0.0000 IsVBR : 0 encoder : Lavf53.2.0 Stream #0.0(eng): Video: libx264, yuv420p, 480x320 [PAR 1:1 DAR 3:2], q=2-31, 200 kb/s, 1k tbn, 29.97 tbc Stream mapping: Stream #0.0 -> #0.0 Press [q] to stop, [?] for help

    **THEN AFTER THE PROCESS IS COMPLETE OUTPUTS**

    frame= 49 fps= 0 q=29.0 size= 17kB time=00:00:00.23 bitrate= 593.9kbits/s frame= 58 fps= 52 q=29.0 size= 29kB time=00:00:00.53 bitrate= 448.9kbits/s frame= 71 fps= 44 q=29.0 size= 48kB time=00:00:00.96 bitrate= 405.7kbits/s frame= 85 fps= 39 q=29.0 size= 69kB time=00:00:01.43 bitrate= 393.2kbits/s frame= 104 fps= 38 q=29.0 size= 90kB time=00:00:02.06 bitrate= 358.3kbits/s frame= 117 fps= 36 q=29.0 size= 104kB time=00:00:02.50 bitrate= 339.5kbits/s frame= 134 fps= 36 q=29.0 size= 119kB time=00:00:03.06 bitrate= 317.6kbits/s frame= 153 fps= 36 q=29.0 size= 137kB time=00:00:03.70 bitrate= 303.5kbits/s frame= 167 fps= 35 q=29.0 size= 153kB time=00:00:04.17 bitrate= 300.1kbits/s frame= 185 fps= 35 q=29.0 size= 173kB time=00:00:04.77 bitrate= 296.8kbits/s frame= 201 fps= 35 q=29.0 size= 199kB time=00:00:05.30 bitrate= 306.8kbits/s frame= 218 fps= 35 q=29.0 size= 222kB time=00:00:05.87 bitrate= 310.3kbits/s frame= 237 fps= 35 q=29.0 size= 245kB time=00:00:06.50 bitrate= 309.1kbits/s frame= 254 fps= 35 q=29.0 size= 267kB time=00:00:07.07 bitrate= 309.7kbits/s frame= 270 fps= 34 q=29.0 size= 285kB time=00:00:07.60 bitrate= 307.2kbits/s frame= 292 fps= 35 q=29.0 size= 314kB time=00:00:08.34 bitrate= 308.5kbits/s frame= 316 fps= 36 q=29.0 size= 334kB time=00:00:09.14 bitrate= 299.3kbits/s frame= 336 fps= 36 q=29.0 size= 356kB time=00:00:09.80 bitrate= 297.0kbits/s frame= 356 fps= 36 q=29.0 size= 381kB time=00:00:10.47 bitrate= 297.9kbits/s frame= 375 fps= 36 q=29.0 size= 405kB time=00:00:11.11 bitrate= 298.5kbits/s frame= 391 fps= 36 q=29.0 size= 431kB time=00:00:11.64 bitrate= 303.5kbits/s frame= 408 fps= 36 q=29.0 size= 456kB time=00:00:12.21 bitrate= 305.8kbits/s frame= 424 fps= 35 q=29.0 size= 479kB time=00:00:12.74 bitrate= 307.8kbits/s frame= 441 fps= 35 q=29.0 size= 503kB time=00:00:13.31 bitrate= 309.3kbits/s frame= 462 fps= 36 q=29.0 size= 526kB time=00:00:14.01 bitrate= 307.4kbits/s frame= 483 fps= 36 q=29.0 size= 546kB time=00:00:14.71 bitrate= 304.2kbits/s frame= 501 fps= 36 q=29.0 size= 583kB time=00:00:15.31 bitrate= 311.9kbits/s frame= 520 fps= 36 q=29.0 size= 609kB time=00:00:15.95 bitrate= 312.7kbits/s frame= 541 fps= 36 q=29.0 size= 636kB time=00:00:16.65 bitrate= 313.1kbits/s frame= 559 fps= 36 q=29.0 size= 668kB time=00:00:17.25 bitrate= 317.3kbits/s frame= 574 fps= 36 q=29.0 size= 698kB time=00:00:17.75 bitrate= 321.9kbits/s frame= 593 fps= 36 q=29.0 size= 732kB time=00:00:18.38 bitrate= 326.1kbits/s frame= 611 fps= 36 q=29.0 size= 760kB time=00:00:18.98 bitrate= 328.0kbits/s frame= 631 fps= 36 q=29.0 size= 788kB time=00:00:19.65 bitrate= 328.5kbits/s frame= 651 fps= 36 q=29.0 size= 817kB time=00:00:20.32 bitrate= 329.2kbits/s frame= 670 fps= 36 q=29.0 size= 842kB time=00:00:20.95 bitrate= 329.0kbits/s frame= 689 fps= 36 q=29.0 size= 868kB time=00:00:21.58 bitrate= 329.4kbits/s frame= 707 fps= 36 q=29.0 size= 896kB time=00:00:22.18 bitrate= 330.8kbits/s frame= 723 fps= 36 q=29.0 size= 924kB time=00:00:22.72 bitrate= 333.0kbits/s frame= 741 fps= 36 q=29.0 size= 955kB time=00:00:23.32 bitrate= 335.4kbits/s frame= 761 fps= 36 q=29.0 size= 999kB time=00:00:23.99 bitrate= 341.0kbits/s frame= 783 fps= 36 q=29.0 size= 1025kB time=00:00:24.72 bitrate= 339.8kbits/s frame= 802 fps= 36 q=29.0 size= 1047kB time=00:00:25.35 bitrate= 338.3kbits/s frame= 821 fps= 36 q=29.0 size= 1076kB time=00:00:25.99 bitrate= 339.3kbits/s frame= 841 fps= 36 q=29.0 size= 1104kB time=00:00:26.66 bitrate= 339.2kbits/s frame= 861 fps= 36 q=29.0 size= 1137kB time=00:00:27.32 bitrate= 340.7kbits/s frame= 881 fps= 36 q=29.0 size= 1164kB time=00:00:27.99 bitrate= 340.7kbits/s frame= 901 fps= 36 q=29.0 size= 1196kB time=00:00:28.66 bitrate= 341.9kbits/s frame= 919 fps= 36 q=29.0 size= 1223kB time=00:00:29.26 bitrate= 342.5kbits/s frame= 939 fps= 36 q=29.0 size= 1259kB time=00:00:29.93 bitrate= 344.7kbits/s frame= 954 fps= 36 q=29.0 size= 1301kB time=00:00:30.43 bitrate= 350.1kbits/s frame= 970 fps= 36 q=29.0 size= 1337kB time=00:00:30.96 bitrate= 353.7kbits/s frame= 988 fps= 36 q=29.0 size= 1373kB time=00:00:31.56 bitrate= 356.3kbits/s frame= 1005 fps= 36 q=29.0 size= 1418kB time=00:00:32.13 bitrate= 361.4kbits/s frame= 1023 fps= 36 q=29.0 size= 1448kB time=00:00:32.73 bitrate= 362.4kbits/s frame= 1040 fps= 36 q=29.0 size= 1483kB time=00:00:33.30 bitrate= 364.9kbits/s frame= 1058 fps= 36 q=29.0 size= 1519kB time=00:00:33.90 bitrate= 367.1kbits/s frame= 1074 fps= 36 q=29.0 size= 1546kB time=00:00:34.43 bitrate= 367.7kbits/s frame= 1091 fps= 36 q=29.0 size= 1573kB time=00:00:35.00 bitrate= 368.3kbits/s frame= 1111 fps= 36 q=29.0 size= 1593kB time=00:00:35.66 bitrate= 365.9kbits/s frame= 1126 fps= 36 q=29.0 size= 1612kB time=00:00:36.17 bitrate= 365.1kbits/s frame= 1140 fps= 36 q=29.0 size= 1637kB time=00:00:36.63 bitrate= 366.1kbits/s frame= 1151 fps= 35 q=29.0 size= 1657kB time=00:00:37.00 bitrate= 366.9kbits/s frame= 1170 fps= 35 q=29.0 size= 1692kB time=00:00:37.63 bitrate= 368.3kbits/s frame= 1190 fps= 35 q=29.0 size= 1724kB time=00:00:38.30 bitrate= 368.6kbits/s frame= 1208 fps= 35 q=29.0 size= 1751kB time=00:00:38.90 bitrate= 368.6kbits/s frame= 1225 fps= 35 q=29.0 size= 1776kB time=00:00:39.47 bitrate= 368.6kbits/s frame= 1242 fps= 35 q=29.0 size= 1806kB time=00:00:40.04 bitrate= 369.4kbits/s frame= 1265 fps= 35 q=29.0 size= 1840kB time=00:00:40.80 bitrate= 369.4kbits/s frame= 1283 fps= 35 q=29.0 size= 1858kB time=00:00:41.40 bitrate= 367.5kbits/s frame= 1298 fps= 35 q=29.0 size= 1874kB time=00:00:41.90 bitrate= 366.3kbits/s frame= 1317 fps= 35 q=29.0 size= 1898kB time=00:00:42.54 bitrate= 365.5kbits/s frame= 1335 fps= 35 q=29.0 size= 1931kB time=00:00:43.14 bitrate= 366.7kbits/s frame= 1353 fps= 35 q=29.0 size= 1966kB time=00:00:43.74 bitrate= 368.2kbits/s frame= 1371 fps= 35 q=29.0 size= 1996kB time=00:00:44.34 bitrate= 368.8kbits/s frame= 1391 fps= 35 q=29.0 size= 2029kB time=00:00:45.01 bitrate= 369.3kbits/s frame= 1410 fps= 35 q=29.0 size= 2062kB time=00:00:45.64 bitrate= 370.2kbits/s frame= 1430 fps= 35 q=29.0 size= 2089kB time=00:00:46.31 bitrate= 369.4kbits/s frame= 1449 fps= 35 q=29.0 size= 2114kB time=00:00:46.94 bitrate= 368.8kbits/s frame= 1469 fps= 35 q=29.0 size= 2140kB time=00:00:47.61 bitrate= 368.1kbits/s frame= 1488 fps= 35 q=29.0 size= 2169kB time=00:00:48.24 bitrate= 368.3kbits/s frame= 1506 fps= 35 q=29.0 size= 2212kB time=00:00:48.84 bitrate= 371.0kbits/s frame= 1522 fps= 35 q=29.0 size= 2248kB time=00:00:49.38 bitrate= 372.8kbits/s frame= 1540 fps= 35 q=29.0 size= 2278kB time=00:00:49.98 bitrate= 373.4kbits/s frame= 1558 fps= 35 q=29.0 size= 2314kB time=00:00:50.58 bitrate= 374.7kbits/s frame= 1577 fps= 35 q=29.0 size= 2346kB time=00:00:51.21 bitrate= 375.2kbits/s frame= 1598 fps= 35 q=29.0 size= 2377kB time=00:00:51.91 bitrate= 375.1kbits/s frame= 1615 fps= 35 q=29.0 size= 2409kB time=00:00:52.48 bitrate= 375.9kbits/s frame= 1633 fps= 35 q=29.0 size= 2440kB time=00:00:53.08 bitrate= 376.4kbits/s frame= 1651 fps= 35 q=29.0 size= 2470kB time=00:00:53.68 bitrate= 376.9kbits/s frame= 1670 fps= 35 q=29.0 size= 2501kB time=00:00:54.32 bitrate= 377.2kbits/s frame= 1690 fps= 35 q=29.0 size= 2539kB time=00:00:54.98 bitrate= 378.3kbits/s frame= 1707 fps= 35 q=29.0 size= 2570kB time=00:00:55.55 bitrate= 378.9kbits/s frame= 1725 fps= 35 q=29.0 size= 2601kB time=00:00:56.15 bitrate= 379.4kbits/s frame= 1743 fps= 35 q=29.0 size= 2632kB time=00:00:56.75 bitrate= 379.8kbits/s frame= 1762 fps= 35 q=29.0 size= 2677kB time=00:00:57.39 bitrate= 382.2kbits/s frame= 1781 fps= 35 q=29.0 size= 2706kB time=00:00:58.02 bitrate= 382.0kbits/s frame= 1800 fps= 35 q=29.0 size= 2738kB time=00:00:58.65 bitrate= 382.3kbits/s frame= 1821 fps= 35 q=29.0 size= 2765kB time=00:00:59.36 bitrate= 381.6kbits/s frame= 1841 fps= 36 q=29.0 size= 2793kB time=00:01:00.02 bitrate= 381.2kbits/s frame= 1857 fps= 35 q=29.0 size= 2822kB time=00:01:00.56 bitrate= 381.7kbits/s frame= 1875 fps= 35 q=29.0 size= 2849kB time=00:01:01.16 bitrate= 381.6kbits/s frame= 1894 fps= 35 q=29.0 size= 2874kB time=00:01:01.79 bitrate= 381.0kbits/s frame= 1914 fps= 35 q=29.0 size= 2900kB time=00:01:02.46 bitrate= 380.4kbits/s frame= 1933 fps= 35 q=29.0 size= 2924kB time=00:01:03.09 bitrate= 379.7kbits/s frame= 1954 fps= 36 q=29.0 size= 2946kB time=00:01:03.79 bitrate= 378.3kbits/s frame= 1974 fps= 36 q=29.0 size= 2971kB time=00:01:04.46 bitrate= 377.5kbits/s frame= 1991 fps= 36 q=29.0 size= 3005kB time=00:01:05.03 bitrate= 378.5kbits/s frame= 2006 fps= 35 q=29.0 size= 3043kB time=00:01:05.53 bitrate= 380.4kbits/s frame= 2024 fps= 35 q=29.0 size= 3074kB time=00:01:06.13 bitrate= 380.8kbits/s frame= 2042 fps= 35 q=29.0 size= 3099kB time=00:01:06.73 bitrate= 380.5kbits/s frame= 2059 fps= 35 q=29.0 size= 3122kB time=00:01:07.30 bitrate= 380.0kbits/s frame= 2077 fps= 35 q=29.0 size= 3149kB time=00:01:07.90 bitrate= 379.9kbits/s frame= 2096 fps= 35 q=29.0 size= 3172kB time=00:01:08.53 bitrate= 379.2kbits/s frame= 2117 fps= 35 q=29.0 size= 3196kB time=00:01:09.23 bitrate= 378.2kbits/s frame= 2129 fps= 35 q=29.0 size= 3214kB time=00:01:09.63 bitrate= 378.0kbits/s frame= 2147 fps= 35 q=29.0 size= 3246kB time=00:01:10.23 bitrate= 378.6kbits/s frame= 2167 fps= 35 q=29.0 size= 3268kB time=00:01:10.90 bitrate= 377.5kbits/s frame= 2185 fps= 35 q=29.0 size= 3298kB time=00:01:11.50 bitrate= 377.8kbits/s frame= 2204 fps= 35 q=29.0 size= 3327kB time=00:01:12.13 bitrate= 377.8kbits/s frame= 2222 fps= 35 q=29.0 size= 3359kB time=00:01:12.74 bitrate= 378.3kbits/s frame= 2242 fps= 35 q=29.0 size= 3386kB time=00:01:13.40 bitrate= 377.9kbits/s frame= 2261 fps= 35 q=29.0 size= 3428kB time=00:01:14.04 bitrate= 379.3kbits/s frame= 2280 fps= 35 q=29.0 size= 3459kB time=00:01:14.67 bitrate= 379.5kbits/s frame= 2299 fps= 35 q=29.0 size= 3494kB time=00:01:15.30 bitrate= 380.1kbits/s frame= 2318 fps= 35 q=29.0 size= 3514kB time=00:01:15.94 bitrate= 379.1kbits/s frame= 2340 fps= 36 q=29.0 size= 3539kB time=00:01:16.67 bitrate= 378.1kbits/s frame= 2360 fps= 36 q=29.0 size= 3563kB time=00:01:17.34 bitrate= 377.4kbits/s frame= 2377 fps= 36 q=29.0 size= 3586kB time=00:01:17.91 bitrate= 377.1kbits/s frame= 2393 fps= 36 q=29.0 size= 3606kB time=00:01:18.44 bitrate= 376.6kbits/s frame= 2410 fps= 35 q=29.0 size= 3625kB time=00:01:19.01 bitrate= 375.9kbits/s frame= 2427 fps= 35 q=29.0 size= 3639kB time=00:01:19.57 bitrate= 374.7kbits/s frame= 2444 fps= 35 q=29.0 size= 3656kB time=00:01:20.14 bitrate= 373.7kbits/s frame= 2461 fps= 35 q=29.0 size= 3680kB time=00:01:20.71 bitrate= 373.5kbits/s frame= 2473 fps= 35 q=29.0 size= 3702kB time=00:01:21.11 bitrate= 373.9kbits/s frame= 2488 fps= 35 q=29.0 size= 3722kB time=00:01:21.61 bitrate= 373.6kbits/s frame= 2506 fps= 35 q=29.0 size= 3764kB time=00:01:22.21 bitrate= 375.0kbits/s frame= 2522 fps= 35 q=29.0 size= 3788kB time=00:01:22.75 bitrate= 375.0kbits/s frame= 2539 fps= 35 q=29.0 size= 3820kB time=00:01:23.31 bitrate= 375.6kbits/s frame= 2556 fps= 35 q=29.0 size= 3851kB time=00:01:23.88 bitrate= 376.1kbits/s frame= 2571 fps= 35 q=29.0 size= 3885kB time=00:01:24.38 bitrate= 377.2kbits/s frame= 2587 fps= 35 q=29.0 size= 3919kB time=00:01:24.91 bitrate= 378.1kbits/s frame= 2600 fps= 35 q=29.0 size= 3949kB time=00:01:25.35 bitrate= 379.0kbits/s frame= 2616 fps= 35 q=29.0 size= 3975kB time=00:01:25.88 bitrate= 379.1kbits/s frame= 2633 fps= 35 q=29.0 size= 4003kB time=00:01:26.45 bitrate= 379.3kbits/s frame= 2653 fps= 35 q=29.0 size= 4029kB time=00:01:27.12 bitrate= 378.9kbits/s frame= 2665 fps= 35 q=29.0 size= 4045kB time=00:01:27.52 bitrate= 378.6kbits/s frame= 2682 fps= 35 q=29.0 size= 4068kB time=00:01:28.08 bitrate= 378.3kbits/s frame= 2701 fps= 35 q=29.0 size= 4084kB time=00:01:28.72 bitrate= 377.1kbits/s frame= 2719 fps= 35 q=29.0 size= 4124kB time=00:01:29.32 bitrate= 378.2kbits/s frame= 2735 fps= 35 q=29.0 size= 4154kB time=00:01:29.85 bitrate= 378.7kbits/s frame= 2753 fps= 35 q=29.0 size= 4201kB time=00:01:30.45 bitrate= 380.5kbits/s frame= 2771 fps= 35 q=29.0 size= 4230kB time=00:01:31.05 bitrate= 380.6kbits/s frame= 2788 fps= 35 q=29.0 size= 4259kB time=00:01:31.62 bitrate= 380.8kbits/s frame= 2805 fps= 35 q=29.0 size= 4287kB time=00:01:32.19 bitrate= 380.9kbits/s frame= 2825 fps= 35 q=29.0 size= 4318kB time=00:01:32.86 bitrate= 380.9kbits/s frame= 2847 fps= 35 q=29.0 size= 4334kB time=00:01:33.59 bitrate= 379.3kbits/s frame= 2866 fps= 35 q=29.0 size= 4371kB time=00:01:34.22 bitrate= 380.0kbits/s frame= 2885 fps= 35 q=29.0 size= 4395kB time=00:01:34.86 bitrate= 379.6kbits/s frame= 2903 fps= 35 q=29.0 size= 4424kB time=00:01:35.46 bitrate= 379.6kbits/s frame= 2921 fps= 35 q=29.0 size= 4450kB time=00:01:36.06 bitrate= 379.5kbits/s frame= 2934 fps= 35 q=29.0 Lsize= 4512kB time=00:01:37.86 bitrate= 377.7kbits/s dup=0 drop=1 video:4454kB audio:0kB global headers:0kB muxing overhead 1.293893% frame I:13 Avg QP:19.66 size: 13557 [libx264 @ 0x95737e0] frame P:1221 Avg QP:23.87 size: 2962 [libx264 @ 0x95737e0] frame B:1700 Avg QP:30.26 size: 451 [libx264 @ 0x95737e0] consecutive B-frames: 7.2% 33.5% 39.7% 19.6% [libx264 @ 0x95737e0] mb I I16..4: 9.6% 73.3% 17.0% [libx264 @ 0x95737e0] mb P I16..4: 0.4% 2.5% 0.4% P16..4: 37.8% 18.9% 8.1% 0.0% 0.0% skip:31.8% [libx264 @ 0x95737e0] mb B I16..4: 0.0% 0.1% 0.0% B16..8: 30.9% 1.9% 0.4% direct: 0.9% skip:65.8% L0:30.8% L1:63.8% BI: 5.4% [libx264 @ 0x95737e0] 8x8 transform intra:74.5% inter:72.0% [libx264 @ 0x95737e0] coded y,uvDC,uvAC intra: 79.7% 84.7% 50.5% inter: 14.2% 13.9% 0.7% [libx264 @ 0x95737e0] i16 v,h,dc,p: 60% 18% 4% 18% [libx264 @ 0x95737e0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 12% 10% 4% 10% 15% 7% 10% 7% [libx264 @ 0x95737e0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 19% 9% 4% 10% 13% 6% 8% 4% [libx264 @ 0x95737e0] i8c dc,h,v,p: 46% 21% 22% 12% [libx264 @ 0x95737e0] Weighted P-Frames: Y:0.8% UV:0.4% [libx264 @ 0x95737e0] ref P L0: 65.4% 20.8% 10.8% 2.9% 0.0% [libx264 @ 0x95737e0] ref B L0: 91.4% 8.0% 0.6% [libx264 @ 0x95737e0] ref B L1: 95.6% 4.4% [libx264 @ 0x95737e0] kb/s:372.66
  • Transcoding videos with LibAvFormat for playback on iOS devices

    18 mai 2016, par user361526

    I’m trying to transcode a video on my iOS app using FFMpeg/LibAv.
    What I’m trying to accomplish is to transcode a video in order to resize each frame and possibly lower the bitrate in order to save valuable MB in the device.

    The resulting video must be playable on all iPhone5+ devices.

    After reading the documentation I found out that :

    • I do not need to encode/decode the audio stream -> I’ll copy as-is to the output file
    • I need to encode the video using the h264 codec (LibX264) with a profile supported by iOS (baseline profile with level 3.0 - https://trac.ffmpeg.org/wiki/Encode/H.264#Compatibility)
    • I’m also setting the picture format to YUV planar since it’s the only one supported by iOS
    • For the sake of testing I’m not using any filter (I’m using a dummy/passthrough) at all or even trying to lower the bitrate, I’m just trying to decode the video stream and encode it again
    • Most of the code is based on the transcoding.c and filtering.c available on the FFMpeg examples directory

    FFMpeg-wise what I’m trying to achieve with LibAv is :

    ffmpeg -i INPUT.MOV -c:v libx264 -preset ultrafast -profile:v baseline -level 3.0  -c:a copy output.MOV

    (the resulting file - which can be found below - is playable on QuickTime if it’s generated by FFMpeg through the command line)

    The original video was generated with a regular iPhone using iOS 8.2 but the problem is not device specific or iOS specific, it occurs on all videos generated with LibAv.

    Although both resulting files are playable by VideoLan (VLC) the one I generated through LibAv is not playable by QuickTime even though I can’t find anything wrong with it.

    As you can see below, I create the video stream with the proper video codec on the call to avformat_new_stream :

    AVStream *out_stream; // output stream
    AVStream *in_stream; // input stream
    AVCodecContext *dec_ctx, *enc_ctx; // codec context for the stream
    AVCodec *encoder; // codec used
    int ret;
    unsigned int i;

    ofmt_ctx = NULL;
    // Allocate an AVFormatContext for an output format. This will be the file header (similar to avformat_open_input but with an zero'ed memory)
    avformat_alloc_output_context2(&ofmt_ctx, NULL, NULL, filename);
    if (!ofmt_ctx) {
       av_log(NULL, AV_LOG_ERROR, "Could not create output context\n");
       [self errorWith:kErrorCreatingOutputContext and:@"Could not create output context"];
       return AVERROR_UNKNOWN;
    }
    // we must not use the AVCodecContext from the video stream directly! So we have to use avcodec_copy_context() to copy the context to a new location (after allocating memory for it, of course).
    // iterate over all input streams
    for (i = 0; i < ifmt_ctx->nb_streams; i++) {
       in_stream = ifmt_ctx->streams[i]; // input stream
       dec_ctx = in_stream->codec; // get the codec context for the decoder

       if (dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO) {
           // lets use h264
           encoder = avcodec_find_encoder(AV_CODEC_ID_H264);
           if (!encoder) {
               [self errorWith:kErrorCodecNotFound and:@"H264 Codec Not Found"];
               return AVERROR_UNKNOWN;
           }
           out_stream = avformat_new_stream(ofmt_ctx, encoder); // create a new stream with h264 codec
           if (!out_stream) {
               av_log(NULL, AV_LOG_ERROR, "Failed allocating output stream\n");
               [self errorWith:kErrorAllocateOutputStream and:@"Failed allocating output stream"];
               return AVERROR_UNKNOWN;
           }
           enc_ctx = out_stream->codec; // pointer to the stream codec context
           /* we transcode to same properties (picture size,
            * sample rate etc.). These properties can be changed for output
            * streams easily using filters */
           if (dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO) {
               enc_ctx->width = dec_ctx->width;
               enc_ctx->height = dec_ctx->height;
               enc_ctx->sample_aspect_ratio = dec_ctx->sample_aspect_ratio;
               enc_ctx->pix_fmt = AV_PIX_FMT_YUV420P;
               enc_ctx->time_base = dec_ctx->time_base;
               av_opt_set(enc_ctx->priv_data, "preset", "ultrafast", 0);
               av_opt_set(enc_ctx->priv_data, "profile", "baseline", 0);
               av_opt_set(enc_ctx->priv_data, "level", "3.0", 0);
           }

           out_stream->time_base = in_stream->time_base;

           AVDictionaryEntry *tag = NULL;
           while ((tag = av_dict_get(in_stream->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
               printf("%s=%s\n", tag->key, tag->value);
               char *k = av_strdup(tag->key);       // if your strings are already allocated,
               char *v = av_strdup(tag->value);     // you can avoid copying them like this
               av_dict_set(&out_stream->metadata, k, v, 0);
           }

           ret = avcodec_open2(enc_ctx, encoder, NULL);
           if (ret < 0) {
               av_log(NULL, AV_LOG_ERROR, "Cannot open video encoder for stream #%u\n", i);
               [self errorWith:kErrorCantOpenOutputFile and:[NSString stringWithFormat:@"Cannot open video encoder for stream #%u",i]];
               return ret;
           }

       }
       else if(dec_ctx->codec_type == AVMEDIA_TYPE_UNKNOWN) {
           // if we cant figure out the stream type, fail
           av_log(NULL, AV_LOG_FATAL, "Elementary stream #%d is of unknown type, cannot proceed\n", i);
           [self errorWith:kErrorUnknownStream and:[NSString stringWithFormat:@"Elementary stream #%d is of unknown type, cannot proceed",i]];
           return AVERROR_INVALIDDATA;
       }
       else {
           out_stream = avformat_new_stream(ofmt_ctx, NULL);
           if (!out_stream) {
               av_log(NULL, AV_LOG_ERROR, "Failed allocating output stream\n");
               [self errorWith:kErrorAllocateOutputStream and:@"Failed allocating output stream"];
               return AVERROR_UNKNOWN;
           }
           enc_ctx = out_stream->codec;
           /* this stream must be remuxed */
           // copies ifmt_ctx->streams[i]->codec into ofmt_ctx->streams[i]->codec - Copy the settings of the source AVCodecContext into the destination AVCodecContext.
           ret = avcodec_copy_context(ofmt_ctx->streams[i]->codec,
                                      ifmt_ctx->streams[i]->codec);
           if (ret < 0) {
               av_log(NULL, AV_LOG_ERROR, "Copying stream context failed\n");
               [self errorWith:kErrorCopyStreamFailed and:@"Copying stream context failed"];
               return ret;
           }

       }
       // dunno what this is for
       if (ofmt_ctx->oformat->flags & AVFMT_GLOBALHEADER)
           enc_ctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;

    }
    if (!(ofmt_ctx->oformat->flags & AVFMT_NOFILE)) {
       // Create and initialize a AVIOContext for accessing the
       // resource indicated by url.
       ret = avio_open(&ofmt_ctx->pb, filename, AVIO_FLAG_WRITE);
       if (ret < 0) {
           av_log(NULL, AV_LOG_ERROR, "Could not open output file '%s'", filename);
           [self errorWith:kErrorCantOpenOutputFile and:[NSString stringWithFormat:@"Could not open output file '%s'", filename]];
           return ret;
       }
    }

    /* init muxer, write output file header */
    // Allocate the stream private data and write the stream header to an output media file.
    ret = avformat_write_header(ofmt_ctx, NULL);
    if (ret < 0) {
       av_log(NULL, AV_LOG_ERROR, "Error occurred when opening output file\n");
       [self errorWith:kErrorOutFileCantWriteHeader and:@"Error occurred when opening output file"];
       return ret;
    }
    return 0;

    You can find the files here :

    1. Original final : https://www.dropbox.com/s/2jjs1uy2pu2veyy/IMG_5705.MOV?dl=0
    2. File generated with FFMpeg - https://www.dropbox.com/s/9hfmq3fcifgpfqc/local-ffmpeg.MOV?dl=0
    3. File generated by code - https://www.dropbox.com/s/rttvny39rj7ejpf/generated-by-Ze.MOV?dl=0

    Thank you so much,
    Ze

  • Use FFMPEG mux flv and send rtmp on IOS

    3 janvier 2017, par downloss

    I would like to use iphone camera & microphone to capture information pushed out through FFMPEG RTMP Streaming

    The following Function capture information on IOS

    - (void)captureOutput:(AVCaptureOutput *)captureOutput  didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection
    {    
       if (connection == videoCaptureConnection)
       {
           [manager264 encoderToH264:sampleBuffer];
       }
       else if (connection == audioCaptureConnection)
       {
           [manager264 encoderToMP3:sampleBuffer];
       }
    }

    Initialization FFMPEG

    - (int)setX264Resource
    {
       Global_Variables_VVV = (AppDelegate *)[[UIApplication sharedApplication] delegate];
       avformat_network_init();
       av_register_all();

       pFormatCtx = avformat_alloc_context();
       avformat_alloc_output_context2(&pFormatCtx, NULL, "flv", out_file);
       fmt = pFormatCtx->oformat;

       //Open output URL
       if (avio_open(&pFormatCtx->pb, out_file, AVIO_FLAG_READ_WRITE) < 0)
       {
           printf("Failed to open output file! \n");
           return -1;
       }

       /* Add the audio and video streams using the default format codecs
        * and initialize the codecs. */
       video_st = NULL;
       audio_st = NULL;
      if (fmt->video_codec != AV_CODEC_ID_NONE) {
           video_st = add_stream(pFormatCtx, &pCodec, AV_CODEC_ID_H264);
       }
      if (fmt->audio_codec != AV_CODEC_ID_NONE) {
           audio_st = add_stream(pFormatCtx, &aCodec, AV_CODEC_ID_MP3);
       }

       /* Now that all the parameters are set, we can open the audio and
        * video codecs and allocate the necessary encode buffers. */
       if (video_st)
           [self open_video:pFormatCtx avcodec:pCodec avstream:video_st];

       if (audio_st)
           [self open_audio:pFormatCtx avcodec:aCodec avstream:audio_st];

       // Show some Information
       av_dump_format(pFormatCtx, 0, out_file, 1);

       //Write File Header
       avformat_write_header(pFormatCtx, NULL);

       av_new_packet(&pkt, picture_size);
       av_new_packet(&pkt2, picture_size);

       AVCodecContext *c = video_st->codec;

       y_size = c->width * c->height;

       if (pFrame)
           pFrame->pts = 0;

       if(aFrame)
       {
           aFrame->pts = 0;
       }

       return 0;
    }

    static AVStream *add_stream(AVFormatContext *oc, AVCodec **codec, enum AVCodecID codec_id)
    {
       AVCodecContext *c;
       AVStream *st;
       /* find the encoder */
       *codec = avcodec_find_encoder(codec_id);
       if (!(*codec))
       {
           NSLog(@"Could not find encoder for '%s'\n",
             avcodec_get_name(codec_id));
       }
       st = avformat_new_stream(oc, *codec);
       if (!st)
       {
           NSLog(@"Could not allocate stream\n");
       }
       st->id = oc->nb_streams-1;
       c = st->codec;
       switch ((*codec)->type)
       {
           case AVMEDIA_TYPE_AUDIO:
               c->codec_id = AV_CODEC_ID_MP3;
               c->codec_type = AVMEDIA_TYPE_AUDIO;
               c->channels = 1;

               c->sample_fmt = AV_SAMPLE_FMT_S16P;
               c->bit_rate = 128000;
               c->sample_rate = 44100;
               c->channel_layout = AV_CH_LAYOUT_MONO;
               break;
           case AVMEDIA_TYPE_VIDEO:
               c->codec_id = AV_CODEC_ID_H264;
               c->codec_type=AVMEDIA_TYPE_VIDEO;
               /* Resolution must be a multiple of two. */
               c->width    = 720;
               c->height   = 1280;
               /* timebase: This is the fundamental unit of time (in seconds) in terms
                * of which frame timestamps are represented. For fixed-fps content,
                * timebase should be 1/framerate and timestamp increments should be
                * identical to 1. */
               c->time_base.den = 30;
               c->time_base.num = 1;
               c->gop_size      = 15; /* emit one intra frame every twelve frames at most */
               c->pix_fmt       = PIX_FMT_YUV420P;
               c->max_b_frames = 0;
               c->bit_rate = 3000000;
               c->qmin = 10;
               c->qmax = 51;

               break;
           default:
               break;
       }
       /* Some formats want stream headers to be separate. */
       if (oc->oformat->flags & AVFMT_GLOBALHEADER)
           c->flags |= CODEC_FLAG_GLOBAL_HEADER;
       return st;
    }

    SampleBuffer will turn into H264 and pushed out RTMP Streaming

    - (void)encoderToH264:(CMSampleBufferRef)sampleBuffer
    {
       CVPixelBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);
       if (CVPixelBufferLockBaseAddress(imageBuffer, 0) == kCVReturnSuccess)
       {
           UInt8 *bufferbasePtr = (UInt8 *)CVPixelBufferGetBaseAddress(imageBuffer);
           UInt8 *bufferPtr = (UInt8 *)CVPixelBufferGetBaseAddressOfPlane(imageBuffer,0);
           UInt8 *bufferPtr1 = (UInt8 *)CVPixelBufferGetBaseAddressOfPlane(imageBuffer,1);
           size_t buffeSize = CVPixelBufferGetDataSize(imageBuffer);
           size_t width = CVPixelBufferGetWidth(imageBuffer);
           size_t height = CVPixelBufferGetHeight(imageBuffer);
           size_t bytesPerRow = CVPixelBufferGetBytesPerRow(imageBuffer);
           size_t bytesrow0 = CVPixelBufferGetBytesPerRowOfPlane(imageBuffer,0);
           size_t bytesrow1  = CVPixelBufferGetBytesPerRowOfPlane(imageBuffer,1);
           size_t bytesrow2 = CVPixelBufferGetBytesPerRowOfPlane(imageBuffer,2);
           UInt8 *yuv420_data = (UInt8 *)malloc(width * height *3/ 2); // buffer to store YUV with layout YYYYYYYYUUVV


           /* convert NV12 data to YUV420*/
           UInt8 *pY = bufferPtr ;
           UInt8 *pUV = bufferPtr1;
           UInt8 *pU = yuv420_data + width*height;
           UInt8 *pV = pU + width*height/4;
           for(int i =0;i/Read raw YUV data
           picture_buf = yuv420_data;
           pFrame->data[0] = picture_buf;              // Y
           pFrame->data[1] = picture_buf+ y_size;      // U
           pFrame->data[2] = picture_buf+ y_size*5/4;  // V

           int got_picture = 0;

           // Encode
           pFrame->width = 720;
           pFrame->height = 1280;
           pFrame->format = PIX_FMT_YUV420P;

           AVCodecContext *c = video_st->codec;
           int ret = avcodec_encode_video2(c, &pkt, pFrame, &got_picture);
           if(ret < 0)
           {
               printf("Failed to encode! \n");
           }

           if (got_picture==1)
           {
               /* Compute current audio and video time. */
               video_time = video_st ? video_st->pts.val * av_q2d(video_st->time_base) : 0.0;
               pFrame->pts += av_rescale_q(1, video_st->codec->time_base, video_st->time_base);

               if(pkt.size != 0)
               {
                   printf("Succeed to encode frame: %5lld\tsize:%5d\n", pFrame->pts, pkt.size);
                   pkt.stream_index = video_st->index;
                   ret = av_write_frame(pFormatCtx, &pkt);
                   av_free_packet(&pkt);
               }
           }
           free(yuv420_data);
       }
       CVPixelBufferUnlockBaseAddress(imageBuffer, 0);
    }

    SampleBuffer will turn into MP3 and pushed out RTMP Streaming

    -(void)encoderToMP3:(CMSampleBufferRef)sampleBuffer
    {
       CMSampleTimingInfo timing_info;
       CMSampleBufferGetSampleTimingInfo(sampleBuffer, 0, &timing_info);
       double  pts=0;
       double  dts=0;
       AVCodecContext *c;
       int got_packet, ret;
       c = audio_st->codec;
       CMItemCount numSamples = CMSampleBufferGetNumSamples(sampleBuffer);

       NSUInteger channelIndex = 0;

       CMBlockBufferRef audioBlockBuffer = CMSampleBufferGetDataBuffer(sampleBuffer);

       size_t audioBlockBufferOffset = (channelIndex * numSamples * sizeof(SInt16));
       size_t lengthAtOffset = 0;
       size_t totalLength = 0;
       SInt16 *samples = NULL;
       CMBlockBufferGetDataPointer(audioBlockBuffer, audioBlockBufferOffset, &lengthAtOffset, &totalLength, (char **)(&samples));

       const AudioStreamBasicDescription *audioDescription = CMAudioFormatDescriptionGetStreamBasicDescription(CMSampleBufferGetFormatDescription(sampleBuffer));

       SwrContext *swr = swr_alloc();

       int in_smprt = (int)audioDescription->mSampleRate;
       av_opt_set_int(swr, "in_channel_layout",  AV_CH_LAYOUT_MONO, 0);
       av_opt_set_int(swr, "out_channel_layout", audio_st->codec->channel_layout,  0);

       av_opt_set_int(swr, "in_channel_count", audioDescription->mChannelsPerFrame,  0);
       av_opt_set_int(swr, "out_channel_count", 1,  0);

       av_opt_set_int(swr, "out_channel_layout", audio_st->codec->channel_layout,  0);
       av_opt_set_int(swr, "in_sample_rate",     audioDescription->mSampleRate,0);

       av_opt_set_int(swr, "out_sample_rate",    audio_st->codec->sample_rate,0);

       av_opt_set_sample_fmt(swr, "in_sample_fmt",  AV_SAMPLE_FMT_S16, 0);

       av_opt_set_sample_fmt(swr, "out_sample_fmt", audio_st->codec->sample_fmt,  0);

       swr_init(swr);
       uint8_t **input = NULL;
       int src_linesize;
       int in_samples = (int)numSamples;
       ret = av_samples_alloc_array_and_samples(&input, &src_linesize, audioDescription->mChannelsPerFrame, in_samples, AV_SAMPLE_FMT_S16P, 0);

       *input=(uint8_t*)samples;
       uint8_t *output=NULL;

       int out_samples = av_rescale_rnd(swr_get_delay(swr, in_smprt) +in_samples, (int)audio_st->codec->sample_rate, in_smprt, AV_ROUND_UP);

       av_samples_alloc(&output, NULL, audio_st->codec->channels, out_samples, audio_st->codec->sample_fmt, 0);
       in_samples = (int)numSamples;
       out_samples = swr_convert(swr, &output, out_samples, (const uint8_t **)input, in_samples);

       aFrame->nb_samples =(int) out_samples;

       ret = avcodec_fill_audio_frame(aFrame, audio_st->codec->channels, audio_st->codec->sample_fmt,
                                      (uint8_t *)output,
                                      (int) out_samples *
                                      av_get_bytes_per_sample(audio_st->codec->sample_fmt) *
                                      audio_st->codec->channels, 1);
       if (ret < 0)
       {
           fprintf(stderr, "Error fill audio frame: %s\n", av_err2str(ret));
       }
       aFrame->channel_layout = audio_st->codec->channel_layout;
       aFrame->channels=audio_st->codec->channels;
       aFrame->sample_rate= audio_st->codec->sample_rate;

       if (timing_info.presentationTimeStamp.timescale!=0)
           pts=(double) timing_info.presentationTimeStamp.value/timing_info.presentationTimeStamp.timescale;


       aFrame->pts = pts*audio_st->time_base.den;
       aFrame->pts = av_rescale_q(aFrame->pts, audio_st->time_base, audio_st->codec->time_base);

       ret = avcodec_encode_audio2(c, &pkt2, aFrame, &got_packet);

       if (ret < 0)
       {
           fprintf(stderr, "Error encoding audio frame: %s\n", av_err2str(ret));
       }
       swr_free(&swr);

       if (got_packet)
       {
           pkt2.stream_index = audio_st->index;        

           // Write the compressed frame to the media file.

           ret = av_interleaved_write_frame(pFormatCtx, &pkt2);
           if (ret != 0)
           {
               fprintf(stderr, "Error while writing audio frame: %s\n", av_err2str(ret));
               av_free_packet(&pkt2);
           }
       }
    }

    Soon "Broken pipe" problem occurs after execution.
    PTS is currently feeling is not adjusted, but do not know how to adjust the PTS.

    2016-03-09 16:57:41.058 PoliceCamPlayer[1004:193465] recordVideo....
    [libx264 @ 0x12f8b6e00] using cpu capabilities: ARMv8 NEON
    [libx264 @ 0x12f8b6e00] profile Constrained Baseline, level 3.1
    [libx264 @ 0x12f8b6e00] 264 - core 148 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=2 lookahead_threads=2 sliced_threads=1 slices=2 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=15 keyint_min=1 scenecut=40 intra_refresh=0 rc=abr mbtree=0 bitrate=3000 ratetol=1.0 qcomp=0.60 qpmin=25 qpmax=51 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, flv, to 'rtmp://XXX.XX.XXX.XX/myapp/jackal':
       Stream #0:0: Video: h264 (libx264), yuv420p, 720x1280, q=25-51, 3000 kb/s, 23 tbc
       Stream #0:1: Audio: mp3 (libmp3lame), 44100 Hz, mono, s16p, 64 kb/s
    [flv @ 0x12f8b5400] Using AVStream.codec.time_base as a timebase hint to the muxer is deprecated. Set AVStream.time_base instead.
    [flv @ 0x12f8b5400] Using AVStream.codec.time_base as a timebase hint to the muxer is deprecated. Set AVStream.time_base instead.
    [libx264 @ 0x12f8b6e00] Provided packet is too small, needs to be 33468
    Failed to encode!
    Audio_pts:4154432515 pts_time:4.15443e+06 dts:4154432515 dts_time:4.15443e+06 duration:1152 duration_time:1.152 stream_index:1
    Video_pts:43 pts_time:0.043 dts:43 dts_time:0.043 duration:0 duration_time:0 stream_index:0
    Audio_pts:4154433667 pts_time:4.15443e+06 dts:4154433667 dts_time:4.15443e+06 duration:1152 duration_time:1.152 stream_index:1
    Audio_pts:4154434854 pts_time:4.15443e+06 dts:4154434854 dts_time:4.15443e+06 duration:1152 duration_time:1.152 stream_index:1
    Video_pts:86 pts_time:0.086 dts:86 dts_time:0.086 duration:0 duration_time:0 stream_index:0
    Audio_pts:4154435996 pts_time:4.15444e+06 dts:4154435996 dts_time:4.15444e+06 duration:1152 duration_time:1.152 stream_index:1
    Audio_pts:4154437138 pts_time:4.15444e+06 dts:4154437138 dts_time:4.15444e+06 duration:1152 duration_time:1.152 stream_index:1
    Video_pts:129 pts_time:0.129 dts:129 dts_time:0.129 duration:0 duration_time:0 stream_index:0
    Audio_pts:4154438281 pts_time:4.15444e+06 dts:4154438281 dts_time:4.15444e+06 duration:1152 duration_time:1.152 stream_index:1
    Video_pts:172 pts_time:0.172 dts:172 dts_time:0.172 duration:0 duration_time:0 stream_index:0
    Audio_pts:4154439467 pts_time:4.15444e+06 dts:4154439467 dts_time:4.15444e+06 duration:1152 duration_time:1.152 stream_index:1
    Video_pts:215 pts_time:0.215 dts:215 dts_time:0.215 duration:0 duration_time:0 stream_index:0
    Audio_pts:4154440609 pts_time:4.15444e+06 dts:4154440609 dts_time:4.15444e+06 duration:1152 duration_time:1.152 stream_index:1
    Audio_pts:4154441752 pts_time:4.15444e+06 dts:4154441752 dts_time:4.15444e+06 duration:1152 duration_time:1.152 stream_index:1
    Video_pts:258 pts_time:0.258 dts:258 dts_time:0.258 duration:0 duration_time:0 stream_index:0
    Audio_pts:4154442884 pts_time:4.15444e+06 dts:4154442884 dts_time:4.15444e+06 duration:1152 duration_time:1.152 stream_index:1
    Audio_pts:4154444071 pts_time:4.15444e+06 dts:4154444071 dts_time:4.15444e+06 duration:1152 duration_time:1.152 stream_index:1
    Video_pts:301 pts_time:0.301 dts:301 dts_time:0.301 duration:0 duration_time:0 stream_index:0
    Audio_pts:4154445213 pts_time:4.15445e+06 dts:4154445213 dts_time:4.15445e+06 duration:1152 duration_time:1.152 stream_index:1
    Audio_pts:4154446355 pts_time:4.15445e+06 dts:4154446355 dts_time:4.15445e+06 duration:1152 duration_time:1.152 stream_index:1
    Video_pts:344 pts_time:0.344 dts:344 dts_time:0.344 duration:0 duration_time:0 stream_index:0
    Audio_pts:4154447498 pts_time:4.15445e+06 dts:4154447498 dts_time:4.15445e+06 duration:1152 duration_time:1.152 stream_index:1
    Video_pts:387 pts_time:0.387 dts:387 dts_time:0.387 duration:0 duration_time:0 stream_index:0
    Audio_pts:4154448640 pts_time:4.15445e+06 dts:4154448640 dts_time:4.15445e+06 duration:1152 duration_time:1.152 stream_index:1
    Audio_pts:4154449826 pts_time:4.15445e+06 dts:4154449826 dts_time:4.15445e+06 duration:1152 duration_time:1.152 stream_index:1
    Video_pts:430 pts_time:0.43 dts:430 dts_time:0.43 duration:0 duration_time:0 stream_index:0
    Audio_pts:4154450969 pts_time:4.15445e+06 dts:4154450969 dts_time:4.15445e+06 duration:1152 duration_time:1.152 stream_index:1
    Audio_pts:4154452101 pts_time:4.15445e+06 dts:4154452101 dts_time:4.15445e+06 duration:1152 duration_time:1.152 stream_index:1
    ...................
    ...................
    ...................
    Video_pts:4343 pts_time:4.343 dts:4343 dts_time:4.343 duration:0 duration_time:0 stream_index:0
    Audio_pts:4154622619 pts_time:4.15462e+06 dts:4154622619 dts_time:4.15462e+06 duration:1152 duration_time:1.152 stream_index:1
    Video_pts:4386 pts_time:4.386 dts:4386 dts_time:4.386 duration:0 duration_time:0 stream_index:0
    Audio_pts:4154623761 pts_time:4.15462e+06 dts:4154623761 dts_time:4.15462e+06 duration:1152 duration_time:1.152 stream_index:1
    Audio_pts:4154624903 pts_time:4.15462e+06 dts:4154624903 dts_time:4.15462e+06 duration:1152 duration_time:1.152 stream_index:1
    Audio_pts:4154626090 pts_time:4.15463e+06 dts:4154626090 dts_time:4.15463e+06 duration:1152 duration_time:1.152 stream_index:1
    Video_pts:4429 pts_time:4.429 dts:4429 dts_time:4.429 duration:0 duration_time:0 stream_index:0
    Audio_pts:4154627222 pts_time:4.15463e+06 dts:4154627222 dts_time:4.15463e+06 duration:1152 duration_time:1.152 stream_index:1
    Video_pts:4472 pts_time:4.472 dts:4472 dts_time:4.472 duration:0 duration_time:0 stream_index:0
    Error while writing audio frame: Broken pipe
    Audio_pts:4154628365 pts_time:4.15463e+06 dts:4154628365 dts_time:4.15463e+06 duration:1152 duration_time:1.152 stream_index:1
    Error while writing audio frame: Broken pipe
    Audio_pts:4154629507 pts_time:4.15463e+06 dts:4154629507 dts_time:4.15463e+06 duration:1152 duration_time:1.152 stream_index:1
    Error while writing audio frame: Broken pipe
    Audio_pts:4154630693 pts_time:4.15463e+06 dts:4154630693 dts_time:4.15463e+06 duration:1152 duration_time:1.152 stream_index:1
    Error while writing audio frame: Broken pipe
    Audio_pts:4154631836 pts_time:4.15463e+06 dts:4154631836 dts_time:4.15463e+06 duration:1152 duration_time:1.152 stream_index:1
    Error while writing audio frame: Broken pipe
    Audio_pts:4154632978 pts_time:4.15463e+06 dts:4154632978 dts_time:4.15463e+06 duration:1152 duration_time:1.152 stream_index:1
    .......................
    .......................
    .......................
    2016-03-09 16:57:49.345 PoliceCamPlayer[1004:193465] stopRecord!!!
    Video_pts:7783 pts_time:7.783 dts:7783 dts_time:7.783 duration:0 duration_time:0 stream_index:0
    [flv @ 0x12f8b5400] Failed to update header with correct duration.
    [flv @ 0x12f8b5400] Failed to update header with correct filesize.
    [libx264 @ 0x12f8b6e00] frame I:28    Avg QP:25.36  size: 24181
    [libx264 @ 0x12f8b6e00] frame P:154   Avg QP:25.34  size:  6603
    [libx264 @ 0x12f8b6e00] mb I  I16..4: 80.9%  0.0% 19.1%
    [libx264 @ 0x12f8b6e00] mb P  I16..4:  5.9%  0.0%  0.2%  P16..4: 28.2%  4.4%  1.0%  0.0%  0.0%    skip:60.2%
    [libx264 @ 0x12f8b6e00] final ratefactor: 16.70
    [libx264 @ 0x12f8b6e00] coded y,uvDC,uvAC intra: 35.8% 9.3% 0.4% inter: 8.8% 1.6% 0.0%
    [libx264 @ 0x12f8b6e00] i16 v,h,dc,p: 28% 26% 26% 21%
    [libx264 @ 0x12f8b6e00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 13% 26% 25%  3%  7%  4%  5%  3% 13%
    [libx264 @ 0x12f8b6e00] i8c dc,h,v,p: 85%  9%  5%  0%
    [libx264 @ 0x12f8b6e00] kb/s:1712.63