Newest 'ffmpeg' Questions - Stack Overflow

http://stackoverflow.com/questions/tagged/ffmpeg

Les articles publiés sur le site

  • ffmpeg - How to determine if -movflags faststart is enabled ? PHP

    20 août, par IIIOXIII

    While I am able to encode an mp4 file which I can play on my local windows machine, I am having trouble encoding files to mp4 which are readable when streaming by safari, etc.

    After a bit of reading, I believe my issue is that I must move the metadata from the end of the file to the beginning in order for the converted mp4 files to be streamable.

    To that end, I am trying to find out if the build of ffmpeg that I am currently using is able to use the -movflags faststart option through php - as my current outputted mp4 files are not working when streamed online.

    This is the way I am now echoing the -help, -formats, -codecs, but I am not seeing anything about -movflags faststart in any of the lists:

    exec($ffmpegPath." -help", $codecArr);
    for($ii=0;$iibr>';
    }
    

    Is there a similar method of determining if -movflags fastart is available to my ffmpeg build? Any other way? Should it be listed with any of the previously suggested commands? -help/-formats?

    Can someone that knows it is enabled in their version of ffmpeg check to see if it is listed under -help or -formats, etc.?

    TIA.

    EDIT: COMPLETE CONSOLE OUTPUT FOR BOTH THE CONVERSION COMMAND AND -MOVFLAGS COMMAND BELOW:

    COMMAND:

    ffmpeg -i C:\vidtests\Wildlife.wmv -s 640x480 C:\vidtests\Wildlife.mp4 
    

    OUTPUT:

    ffmpeg version N-54207-ge59fb3f Copyright (c) 2000-2013 the FFmpeg developers
      built on Jun 25 2013 21:55:00 with gcc 4.7.3 (GCC)
      configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
    isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
    le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
    e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
    ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
    ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
    eex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-
    amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --
    enable-libxvid --enable-zlib
      libavutil      52. 37.101 / 52. 37.101
      libavcodec     55. 17.100 / 55. 17.100
      libavformat    55. 10.100 / 55. 10.100
      libavdevice    55.  2.100 / 55.  2.100
      libavfilter     3. 77.101 /  3. 77.101
      libswscale      2.  3.100 /  2.  3.100
      libswresample   0. 17.102 /  0. 17.102
      libpostproc    52.  3.100 / 52.  3.100
    [asf @ 00000000002ed760] Stream #0: not enough frames to estimate rate; consider
     increasing probesize
    Guessed Channel Layout for  Input Stream #0.0 : stereo
    Input #0, asf, from 'C:\vidtests\Wildlife.wmv'
    :
      Metadata:
        SfOriginalFPS   : 299700
        WMFSDKVersion   : 11.0.6001.7000
        WMFSDKNeeded    : 0.0.0.0000
        comment         : Footage: Small World Productions, Inc; Tourism New Zealand
     | Producer: Gary F. Spradling | Music: Steve Ball
        title           : Wildlife in HD
        copyright       : © 2008 Microsoft Corporation
        IsVBR           : 0
        DeviceConformanceTemplate: AP@L3
      Duration: 00:00:30.09, start: 0.000000, bitrate: 6977 kb/s
        Stream #0:0(eng): Audio: wmav2 (a[1][0][0] / 0x0161), 44100 Hz, stereo, fltp
    , 192 kb/s
        Stream #0:1(eng): Video: vc1 (Advanced) (WVC1 / 0x31435657), yuv420p, 1280x7
    20, 5942 kb/s, 29.97 tbr, 1k tbn, 1k tbc
    [libx264 @ 00000000002e6980] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
    
    [libx264 @ 00000000002e6980] profile High, level 3.0
    [libx264 @ 00000000002e6980] 264 - core 133 r2334 a3ac64b - H.264/MPEG-4 AVC cod
    ec - Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 r
    ef=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_pski
    p=1 chroma_qp_offset=-2 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 deci
    mate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_
    adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=2
    5 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.6
    0 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to 'C:\vidtests\Wildlife.mp4':
    
      Metadata:
        SfOriginalFPS   : 299700
        WMFSDKVersion   : 11.0.6001.7000
        WMFSDKNeeded    : 0.0.0.0000
        comment         : Footage: Small World Productions, Inc; Tourism New Zealand
     | Producer: Gary F. Spradling | Music: Steve Ball
        title           : Wildlife in HD
        copyright       : © 2008 Microsoft Corporation
        IsVBR           : 0
        DeviceConformanceTemplate: AP@L3
        encoder         : Lavf55.10.100
        Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 6
    40x480, q=-1--1, 30k tbn, 29.97 tbc
        Stream #0:1(eng): Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 44100
    Hz, stereo, s16, 128 kb/s
    Stream mapping:
      Stream #0:1 -> #0:0 (vc1 -> libx264)
      Stream #0:0 -> #0:1 (wmav2 -> libvo_aacenc)
    Press [q] to stop, [?] for help
    frame=   53 fps= 49 q=29.0 size=       0kB time=00:00:00.13 bitrate=   2.9kbits/
    frame=   63 fps= 40 q=29.0 size=       0kB time=00:00:00.46 bitrate=   0.8kbits/
    frame=   74 fps= 35 q=29.0 size=       0kB time=00:00:00.83 bitrate=   0.5kbits/
    frame=   85 fps= 32 q=29.0 size=       0kB time=00:00:01.20 bitrate=   0.3kbits/
    frame=   95 fps= 30 q=29.0 size=       0kB time=00:00:01.53 bitrate=   0.3kbits/
    frame=  107 fps= 28 q=29.0 size=       0kB time=00:00:01.93 bitrate=   0.2kbits/
    Queue input is backward in time
    [mp4 @ 00000000003ef800] Non-monotonous DTS in output stream 0:1; previous: 7616
    , current: 7063; changing to 7617. This may result in incorrect timestamps in th
    e output file.
    frame=  118 fps= 28 q=29.0 size=     113kB time=00:00:02.30 bitrate= 402.6kbits/
    frame=  129 fps= 26 q=29.0 size=     219kB time=00:00:02.66 bitrate= 670.7kbits/
    frame=  141 fps= 26 q=29.0 size=     264kB time=00:00:03.06 bitrate= 704.2kbits/
    frame=  152 fps= 25 q=29.0 size=     328kB time=00:00:03.43 bitrate= 782.2kbits/
    frame=  163 fps= 25 q=29.0 size=     431kB time=00:00:03.80 bitrate= 928.1kbits/
    frame=  174 fps= 24 q=29.0 size=     568kB time=00:00:04.17 bitrate=1116.3kbits/
    frame=  190 fps= 25 q=29.0 size=     781kB time=00:00:04.70 bitrate=1359.9kbits/
    frame=  204 fps= 25 q=29.0 size=    1006kB time=00:00:05.17 bitrate=1593.1kbits/
    frame=  218 fps= 25 q=29.0 size=    1058kB time=00:00:05.63 bitrate=1536.8kbits/
    frame=  229 fps= 25 q=29.0 size=    1093kB time=00:00:06.00 bitrate=1490.9kbits/
    frame=  239 fps= 24 q=29.0 size=    1118kB time=00:00:06.33 bitrate=1444.4kbits/
    frame=  251 fps= 24 q=29.0 size=    1150kB time=00:00:06.74 bitrate=1397.9kbits/
    frame=  265 fps= 24 q=29.0 size=    1234kB time=00:00:07.20 bitrate=1402.3kbits/
    frame=  278 fps= 25 q=29.0 size=    1332kB time=00:00:07.64 bitrate=1428.3kbits/
    frame=  294 fps= 25 q=29.0 size=    1403kB time=00:00:08.17 bitrate=1405.7kbits/
    frame=  308 fps= 25 q=29.0 size=    1547kB time=00:00:08.64 bitrate=1466.4kbits/
    frame=  323 fps= 25 q=29.0 size=    1595kB time=00:00:09.14 bitrate=1429.5kbits/
    frame=  337 fps= 25 q=29.0 size=    1702kB time=00:00:09.60 bitrate=1450.7kbits/
    frame=  351 fps= 25 q=29.0 size=    1755kB time=00:00:10.07 bitrate=1427.1kbits/
    frame=  365 fps= 25 q=29.0 size=    1820kB time=00:00:10.54 bitrate=1414.1kbits/
    frame=  381 fps= 25 q=29.0 size=    1852kB time=00:00:11.07 bitrate=1369.6kbits/
    frame=  396 fps= 26 q=29.0 size=    1893kB time=00:00:11.57 bitrate=1339.5kbits/
    frame=  409 fps= 26 q=29.0 size=    1923kB time=00:00:12.01 bitrate=1311.8kbits/
    frame=  421 fps= 25 q=29.0 size=    1967kB time=00:00:12.41 bitrate=1298.3kbits/
    frame=  434 fps= 25 q=29.0 size=    1998kB time=00:00:12.84 bitrate=1274.0kbits/
    frame=  445 fps= 25 q=29.0 size=    2018kB time=00:00:13.21 bitrate=1251.3kbits/
    frame=  458 fps= 25 q=29.0 size=    2048kB time=00:00:13.64 bitrate=1229.5kbits/
    frame=  471 fps= 25 q=29.0 size=    2067kB time=00:00:14.08 bitrate=1202.3kbits/
    frame=  484 fps= 25 q=29.0 size=    2189kB time=00:00:14.51 bitrate=1235.5kbits/
    frame=  497 fps= 25 q=29.0 size=    2260kB time=00:00:14.94 bitrate=1238.3kbits/
    frame=  509 fps= 25 q=29.0 size=    2311kB time=00:00:15.34 bitrate=1233.3kbits/
    frame=  523 fps= 25 q=29.0 size=    2429kB time=00:00:15.81 bitrate=1258.1kbits/
    frame=  535 fps= 25 q=29.0 size=    2541kB time=00:00:16.21 bitrate=1283.5kbits/
    frame=  548 fps= 25 q=29.0 size=    2718kB time=00:00:16.64 bitrate=1337.5kbits/
    frame=  560 fps= 25 q=29.0 size=    2845kB time=00:00:17.05 bitrate=1367.1kbits/
    frame=  571 fps= 25 q=29.0 size=    2965kB time=00:00:17.41 bitrate=1394.6kbits/
    frame=  580 fps= 25 q=29.0 size=    3025kB time=00:00:17.71 bitrate=1398.7kbits/
    frame=  588 fps= 25 q=29.0 size=    3098kB time=00:00:17.98 bitrate=1411.1kbits/
    frame=  597 fps= 25 q=29.0 size=    3183kB time=00:00:18.28 bitrate=1426.1kbits/
    frame=  606 fps= 24 q=29.0 size=    3279kB time=00:00:18.58 bitrate=1445.2kbits/
    frame=  616 fps= 24 q=29.0 size=    3441kB time=00:00:18.91 bitrate=1489.9kbits/
    frame=  626 fps= 24 q=29.0 size=    3650kB time=00:00:19.25 bitrate=1553.0kbits/
    frame=  638 fps= 24 q=29.0 size=    3826kB time=00:00:19.65 bitrate=1594.7kbits/
    frame=  649 fps= 24 q=29.0 size=    3950kB time=00:00:20.02 bitrate=1616.3kbits/
    frame=  660 fps= 24 q=29.0 size=    4067kB time=00:00:20.38 bitrate=1634.1kbits/
    frame=  669 fps= 24 q=29.0 size=    4121kB time=00:00:20.68 bitrate=1631.8kbits/
    frame=  682 fps= 24 q=29.0 size=    4274kB time=00:00:21.12 bitrate=1657.9kbits/
    frame=  696 fps= 24 q=29.0 size=    4446kB time=00:00:21.58 bitrate=1687.1kbits/
    frame=  709 fps= 24 q=29.0 size=    4590kB time=00:00:22.02 bitrate=1707.3kbits/
    frame=  719 fps= 24 q=29.0 size=    4772kB time=00:00:22.35 bitrate=1748.5kbits/
    frame=  732 fps= 24 q=29.0 size=    4852kB time=00:00:22.78 bitrate=1744.3kbits/
    frame=  744 fps= 24 q=29.0 size=    4973kB time=00:00:23.18 bitrate=1756.9kbits/
    frame=  756 fps= 24 q=29.0 size=    5099kB time=00:00:23.59 bitrate=1770.8kbits/
    frame=  768 fps= 24 q=29.0 size=    5149kB time=00:00:23.99 bitrate=1758.4kbits/
    frame=  780 fps= 24 q=29.0 size=    5227kB time=00:00:24.39 bitrate=1755.7kbits/
    frame=  797 fps= 24 q=29.0 size=    5377kB time=00:00:24.95 bitrate=1765.0kbits/
    frame=  813 fps= 24 q=29.0 size=    5507kB time=00:00:25.49 bitrate=1769.5kbits/
    frame=  828 fps= 24 q=29.0 size=    5634kB time=00:00:25.99 bitrate=1775.5kbits/
    frame=  843 fps= 24 q=29.0 size=    5701kB time=00:00:26.49 bitrate=1762.9kbits/
    frame=  859 fps= 24 q=29.0 size=    5830kB time=00:00:27.02 bitrate=1767.0kbits/
    frame=  872 fps= 24 q=29.0 size=    5926kB time=00:00:27.46 bitrate=1767.7kbits/
    frame=  888 fps= 24 q=29.0 size=    6014kB time=00:00:27.99 bitrate=1759.7kbits/
    frame=  900 fps= 24 q=29.0 size=    6332kB time=00:00:28.39 bitrate=1826.9kbits/
    frame=  901 fps= 24 q=-1.0 Lsize=    6717kB time=00:00:30.10 bitrate=1828.0kbits
    /s
    video:6211kB audio:472kB subtitle:0 global headers:0kB muxing overhead 0.513217%
    
    [libx264 @ 00000000002e6980] frame I:8     Avg QP:21.77  size: 39744
    [libx264 @ 00000000002e6980] frame P:433   Avg QP:25.69  size: 11490
    [libx264 @ 00000000002e6980] frame B:460   Avg QP:29.25  size:  2319
    [libx264 @ 00000000002e6980] consecutive B-frames:  5.4% 78.6%  2.7% 13.3%
    [libx264 @ 00000000002e6980] mb I  I16..4: 21.8% 48.8% 29.5%
    [libx264 @ 00000000002e6980] mb P  I16..4:  0.7%  4.0%  1.3%  P16..4: 37.1% 22.2
    % 15.5%  0.0%  0.0%    skip:19.2%
    [libx264 @ 00000000002e6980] mb B  I16..4:  0.1%  0.5%  0.2%  B16..8: 43.5%  7.0
    %  2.1%  direct: 2.2%  skip:44.5%  L0:36.4% L1:52.7% BI:10.9%
    [libx264 @ 00000000002e6980] 8x8 transform intra:62.8% inter:56.2%
    [libx264 @ 00000000002e6980] coded y,uvDC,uvAC intra: 74.2% 78.8% 44.0% inter: 2
    3.6% 14.5% 1.0%
    [libx264 @ 00000000002e6980] i16 v,h,dc,p: 48% 24%  9% 20%
    [libx264 @ 00000000002e6980] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 17% 15%  7%  8%
    11%  8% 10%  8%
    [libx264 @ 00000000002e6980] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 17% 15%  7% 10%
    11%  8%  7%  7%
    [libx264 @ 00000000002e6980] i8c dc,h,v,p: 53% 21% 18%  7%
    [libx264 @ 00000000002e6980] Weighted P-Frames: Y:0.7% UV:0.0%
    [libx264 @ 00000000002e6980] ref P L0: 62.4% 19.0% 12.0%  6.6%  0.0%
    [libx264 @ 00000000002e6980] ref B L0: 90.5%  8.9%  0.7%
    [libx264 @ 00000000002e6980] ref B L1: 97.9%  2.1%
    [libx264 @ 00000000002e6980] kb/s:1692.37
    

    AND THE –MOVFLAGS COMMAND:

    ffmpeg -i C:\vidtests\Wildlife.mp4 -movflags faststart C:\vidtests\Wildlife_fs.mp4
    

    AND THE –MOVFLAGS OUTPUT

    ffmpeg version N-54207-ge59fb3f Copyright (c) 2000-2013 the FFmpeg developers
      built on Jun 25 2013 21:55:00 with gcc 4.7.3 (GCC)
      configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
    isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
    le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
    e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
    ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
    ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
    eex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-
    amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --
    enable-libxvid --enable-zlib
      libavutil      52. 37.101 / 52. 37.101
      libavcodec     55. 17.100 / 55. 17.100
      libavformat    55. 10.100 / 55. 10.100
      libavdevice    55.  2.100 / 55.  2.100
      libavfilter     3. 77.101 /  3. 77.101
      libswscale      2.  3.100 /  2.  3.100
      libswresample   0. 17.102 /  0. 17.102
      libpostproc    52.  3.100 / 52.  3.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\vidtests\Wildlife.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        title           : Wildlife in HD
        encoder         : Lavf55.10.100
        comment         : Footage: Small World Productions, Inc; Tourism New Zealand
     | Producer: Gary F. Spradling | Music: Steve Ball
        copyright       : © 2008 Microsoft Corporation
      Duration: 00:00:30.13, start: 0.036281, bitrate: 1826 kb/s
        Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x480,
    1692 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc
        Metadata:
          handler_name    : VideoHandler
        Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 12
    8 kb/s
        Metadata:
          handler_name    : SoundHandler
    [libx264 @ 0000000004360620] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
    
    [libx264 @ 0000000004360620] profile High, level 3.0
    [libx264 @ 0000000004360620] 264 - core 133 r2334 a3ac64b - H.264/MPEG-4 AVC cod
    ec - Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 r
    ef=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_pski
    p=1 chroma_qp_offset=-2 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 deci
    mate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_
    adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=2
    5 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.6
    0 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to 'C:\vidtests\Wildlife_fs.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        title           : Wildlife in HD
        copyright       : © 2008 Microsoft Corporation
        comment         : Footage: Small World Productions, Inc; Tourism New Zealand
     | Producer: Gary F. Spradling | Music: Steve Ball
        encoder         : Lavf55.10.100
        Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 6
    40x480, q=-1--1, 30k tbn, 29.97 tbc
        Metadata:
          handler_name    : VideoHandler
        Stream #0:1(eng): Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 44100
    Hz, stereo, s16, 128 kb/s
        Metadata:
          handler_name    : SoundHandler
    Stream mapping:
      Stream #0:0 -> #0:0 (h264 -> libx264)
      Stream #0:1 -> #0:1 (aac -> libvo_aacenc)
    Press [q] to stop, [?] for help
    frame=   52 fps=0.0 q=29.0 size=      29kB time=00:00:01.76 bitrate= 133.9kbits/
    frame=   63 fps= 60 q=29.0 size=     104kB time=00:00:02.14 bitrate= 397.2kbits/
    frame=   74 fps= 47 q=29.0 size=     176kB time=00:00:02.51 bitrate= 573.2kbits/
    frame=   87 fps= 41 q=29.0 size=     265kB time=00:00:02.93 bitrate= 741.2kbits/
    frame=  101 fps= 37 q=29.0 size=     358kB time=00:00:03.39 bitrate= 862.8kbits/
    frame=  113 fps= 34 q=29.0 size=     437kB time=00:00:03.79 bitrate= 943.7kbits/
    frame=  125 fps= 33 q=29.0 size=     520kB time=00:00:04.20 bitrate=1012.2kbits/
    frame=  138 fps= 32 q=29.0 size=     606kB time=00:00:04.64 bitrate=1069.8kbits/
    frame=  151 fps= 31 q=29.0 size=     696kB time=00:00:05.06 bitrate=1124.3kbits/
    frame=  163 fps= 30 q=29.0 size=     780kB time=00:00:05.47 bitrate=1166.4kbits/
    frame=  176 fps= 30 q=29.0 size=     919kB time=00:00:05.90 bitrate=1273.9kbits/
    frame=  196 fps= 31 q=29.0 size=     994kB time=00:00:06.57 bitrate=1237.4kbits/
    frame=  213 fps= 31 q=29.0 size=    1097kB time=00:00:07.13 bitrate=1258.8kbits/
    frame=  225 fps= 30 q=29.0 size=    1204kB time=00:00:07.53 bitrate=1309.8kbits/
    frame=  236 fps= 30 q=29.0 size=    1323kB time=00:00:07.91 bitrate=1369.4kbits/
    frame=  249 fps= 29 q=29.0 size=    1451kB time=00:00:08.34 bitrate=1424.6kbits/
    frame=  263 fps= 29 q=29.0 size=    1574kB time=00:00:08.82 bitrate=1461.3kbits/
    frame=  278 fps= 29 q=29.0 size=    1610kB time=00:00:09.30 bitrate=1416.9kbits/
    frame=  296 fps= 30 q=29.0 size=    1655kB time=00:00:09.91 bitrate=1368.0kbits/
    frame=  313 fps= 30 q=29.0 size=    1697kB time=00:00:10.48 bitrate=1326.4kbits/
    frame=  330 fps= 30 q=29.0 size=    1737kB time=00:00:11.05 bitrate=1286.5kbits/
    frame=  345 fps= 30 q=29.0 size=    1776kB time=00:00:11.54 bitrate=1260.4kbits/
    frame=  361 fps= 30 q=29.0 size=    1813kB time=00:00:12.07 bitrate=1230.3kbits/
    frame=  377 fps= 30 q=29.0 size=    1847kB time=00:00:12.59 bitrate=1201.4kbits/
    frame=  395 fps= 30 q=29.0 size=    1880kB time=00:00:13.22 bitrate=1165.0kbits/
    frame=  410 fps= 30 q=29.0 size=    1993kB time=00:00:13.72 bitrate=1190.2kbits/
    frame=  424 fps= 30 q=29.0 size=    2080kB time=00:00:14.18 bitrate=1201.4kbits/
    frame=  439 fps= 30 q=29.0 size=    2166kB time=00:00:14.67 bitrate=1209.4kbits/
    frame=  455 fps= 30 q=29.0 size=    2262kB time=00:00:15.21 bitrate=1217.5kbits/
    frame=  469 fps= 30 q=29.0 size=    2341kB time=00:00:15.68 bitrate=1223.0kbits/
    frame=  484 fps= 30 q=29.0 size=    2430kB time=00:00:16.19 bitrate=1229.1kbits/
    frame=  500 fps= 30 q=29.0 size=    2523kB time=00:00:16.71 bitrate=1236.3kbits/
    frame=  515 fps= 30 q=29.0 size=    2607kB time=00:00:17.21 bitrate=1240.4kbits/
    frame=  531 fps= 30 q=29.0 size=    2681kB time=00:00:17.73 bitrate=1238.2kbits/
    frame=  546 fps= 30 q=29.0 size=    2758kB time=00:00:18.24 bitrate=1238.2kbits/
    frame=  561 fps= 30 q=29.0 size=    2824kB time=00:00:18.75 bitrate=1233.4kbits/
    frame=  576 fps= 30 q=29.0 size=    2955kB time=00:00:19.25 bitrate=1256.8kbits/
    frame=  586 fps= 29 q=29.0 size=    3061kB time=00:00:19.59 bitrate=1279.6kbits/
    frame=  598 fps= 29 q=29.0 size=    3217kB time=00:00:19.99 bitrate=1318.4kbits/
    frame=  610 fps= 29 q=29.0 size=    3354kB time=00:00:20.39 bitrate=1347.2kbits/
    frame=  622 fps= 29 q=29.0 size=    3483kB time=00:00:20.78 bitrate=1372.6kbits/
    frame=  634 fps= 29 q=29.0 size=    3593kB time=00:00:21.19 bitrate=1388.6kbits/
    frame=  648 fps= 29 q=29.0 size=    3708kB time=00:00:21.66 bitrate=1402.3kbits/
    frame=  661 fps= 29 q=29.0 size=    3811kB time=00:00:22.08 bitrate=1413.5kbits/
    frame=  674 fps= 29 q=29.0 size=    3978kB time=00:00:22.53 bitrate=1446.3kbits/
    frame=  690 fps= 29 q=29.0 size=    4133kB time=00:00:23.05 bitrate=1468.4kbits/
    frame=  706 fps= 29 q=29.0 size=    4263kB time=00:00:23.58 bitrate=1480.4kbits/
    frame=  721 fps= 29 q=29.0 size=    4391kB time=00:00:24.08 bitrate=1493.8kbits/
    frame=  735 fps= 29 q=29.0 size=    4524kB time=00:00:24.55 bitrate=1509.4kbits/
    frame=  748 fps= 29 q=29.0 size=    4661kB time=00:00:24.98 bitrate=1528.2kbits/
    frame=  763 fps= 29 q=29.0 size=    4835kB time=00:00:25.50 bitrate=1553.1kbits/
    frame=  778 fps= 29 q=29.0 size=    4993kB time=00:00:25.99 bitrate=1573.6kbits/
    frame=  795 fps= 29 q=29.0 size=    5149kB time=00:00:26.56 bitrate=1588.1kbits/
    frame=  814 fps= 29 q=29.0 size=    5258kB time=00:00:27.18 bitrate=1584.4kbits/
    frame=  833 fps= 29 q=29.0 size=    5368kB time=00:00:27.82 bitrate=1580.2kbits/
    frame=  851 fps= 29 q=29.0 size=    5469kB time=00:00:28.43 bitrate=1575.9kbits/
    frame=  870 fps= 29 q=29.0 size=    5567kB time=00:00:29.05 bitrate=1569.5kbits/
    frame=  889 fps= 29 q=29.0 size=    5688kB time=00:00:29.70 bitrate=1568.4kbits/
    Starting second pass: moving header on top of the file
    frame=  902 fps= 28 q=-1.0 Lsize=    6109kB time=00:00:30.14 bitrate=1659.8kbits
    /s dup=1 drop=0
    video:5602kB audio:472kB subtitle:0 global headers:0kB muxing overhead 0.566600%
    
    [libx264 @ 0000000004360620] frame I:8     Avg QP:20.52  size: 39667
    [libx264 @ 0000000004360620] frame P:419   Avg QP:25.06  size: 10524
    [libx264 @ 0000000004360620] frame B:475   Avg QP:29.03  size:  2123
    [libx264 @ 0000000004360620] consecutive B-frames:  3.2% 79.6%  0.3% 16.9%
    [libx264 @ 0000000004360620] mb I  I16..4: 20.7% 52.3% 26.9%
    [libx264 @ 0000000004360620] mb P  I16..4:  0.7%  4.2%  1.1%  P16..4: 39.4% 21.4
    % 13.8%  0.0%  0.0%    skip:19.3%
    [libx264 @ 0000000004360620] mb B  I16..4:  0.1%  0.9%  0.3%  B16..8: 41.8%  6.4
    %  1.7%  direct: 1.7%  skip:47.1%  L0:36.4% L1:53.3% BI:10.3%
    [libx264 @ 0000000004360620] 8x8 transform intra:65.7% inter:58.8%
    [libx264 @ 0000000004360620] coded y,uvDC,uvAC intra: 71.2% 76.6% 35.7% inter: 2
    0.7% 13.0% 0.5%
    [libx264 @ 0000000004360620] i16 v,h,dc,p: 48% 24%  8% 20%
    [libx264 @ 0000000004360620] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 18% 15%  6%  8%
    11%  8% 10%  8%
    [libx264 @ 0000000004360620] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 16% 15%  7% 10%
    11%  8%  8%  7%
    [libx264 @ 0000000004360620] i8c dc,h,v,p: 51% 22% 19%  9%
    [libx264 @ 0000000004360620] Weighted P-Frames: Y:0.7% UV:0.0%
    [libx264 @ 0000000004360620] ref P L0: 63.4% 19.7% 11.0%  5.9%  0.0%
    [libx264 @ 0000000004360620] ref B L0: 90.7%  8.7%  0.7%
    [libx264 @ 0000000004360620] ref B L1: 98.4%  1.6%
    [libx264 @ 0000000004360620] kb/s:1524.54
    
  • Unable to find a suitable output format for 'ffmpeg' - ffmpeg : Invalid argument

    19 août, par Alvydas Juodikis

    I am trying to work through a tutorial I found online that converts an RTSP URL to a HSL stream. Upon executing the command on ubuntu 20.04, I get the following error:

    "[NULL @ 0x55985b9bab80] Unable to find a suitable output format for 'ffmpeg' ffmpeg: Invalid argument"

    These were my commands:

    ffmpeg -v info \
    -i  \
    -c:v copy -c:a copy -bufsize 1835k -pix_fmt yuv420p \
    -flags -global_header \
    ffmpeg -hls_time 10 -hls_list_size 6 -hls_wrap 10 \
    ffmpeg -start_number 1 Home/Documents/ffmpegsolution/video.m3u8
    

    (The example said that I needed to provide my path to output, so I listed the directories that I wanted the file to go to - ffmpegsolution being the folder)

    The tutorial I'm using is found on: https://www.thewebblinders.in/programming/article/rtsp-streaming-on-a-web-browser-6069

    It essentially shows that you can convert an rtsp url to a HSL file and stream it using html templates, however I can't get passed the conversion stage.

    Any help would be appreciated. My thinking is that maybe one of my formats like "m3u8" isn't recognised; however I'm not sure.

    Thank you for your time,

  • OpenCV VideoWriter using ffmpeg with "Could not open codec 'libx264'" Error

    19 août, par user2262504

    I am new to OpenCV, and I want write Mat images into video using VideoWriter on Ubuntu 12.04. But when constructing VideoWriter, errors came out.

    It seems that OpenCV invoke ffmpeg API using default parameters and ffmpeg invoke x264 using its default parameters. Then these setting is broken for libx264. Thus the "Could not open codec 'libx264'" error.

    Anyone has ideas to solve this problem?

    More specifically:

    1. anyone knows where and how OpenCV invoke ffmpeg API?
    2. how to change ffmpeg default settings using code, hopefull, can be easily embeded into OpenCV?
    3. will changes of default in ffmpeg be carried to libx264?

    Errors:

    1. Uising CV_FOURCC('H', '2', '6', '4')
    [libx264 @ 0x255de40] broken ffmpeg default settings detected
    [libx264 @ 0x255de40] use an encoding preset (e.g. -vpre medium)
    [libx264 @ 0x255de40] preset usage: -vpre  -vpre 
    [libx264 @ 0x255de40] speed presets are listed in x264 --help
    [libx264 @ 0x255de40] profile is optional; x264 defaults to high
    Could not open codec 'libx264': Unspecified error
    
    2. Using FOURCC = -1 to invoke user customized codec
    OpenCV Error: Unsupported format or combination of formats (Gstreamer Opencv 
    backend doesn't support this codec acutally.) in CvVideoWriter_GStreamer::open, 
    file /home/XXX/Downloads/opencv-2.4.8/modules/highgui/src/cap_gstreamer.cpp, 
    line 505 terminate called after throwing an instance of 'cv::Exception'
    what():  /home/XXX/Downloads/opencv-2.4.8/modules/highgui/src/cap_gstreamer.cpp:
    505: error: (-210) Gstreamer Opencv backend doesn't support this codec acutally.
    in function CvVideoWriter_GStreamer::open
    

    Codes:

    int main(int argc, char *argv[])
    {
        VideoWriter outputVideo;
        bool fourcc_on = true; //switch on / off different error
        if (fourcc_on)
            outputVideo.open("outVideo.avi", CV_FOURCC('H', '2', '6', '4'), 25, Size(100, 100), true);
        else
            outputVideo.open("outVideo.avi", -1, 25, Size(100, 100), true);
    
        if (!outputVideo.isOpened())
        {
            cout  << "Could not open the output video for write" << endl;
            return -1;
        }
        return 0;
    }
    

    OpenCV Configuration:

    -- Detected version of GNU GCC: 46 (406)
    -- Found OpenEXR: /usr/lib/libIlmImf.so
    -- Looking for linux/videodev.h
    -- Looking for linux/videodev.h - not found
    -- Looking for linux/videodev2.h
    -- Looking for linux/videodev2.h - found
    -- Looking for sys/videoio.h
    -- Looking for sys/videoio.h - not found
    -- Looking for libavformat/avformat.h
    -- Looking for libavformat/avformat.h - found
    -- Looking for ffmpeg/avformat.h
    -- Looking for ffmpeg/avformat.h - not found
    -- Could NOT find JNI (missing:  JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH) 
    -- 
    -- General configuration for OpenCV 2.4.8 =====================================
    --   Version control:               unknown
    -- 
    --   Platform:
    --     Host:                        Linux 3.8.0-38-generic x86_64
    --     CMake:                       2.8.7
    --     CMake generator:             Unix Makefiles
    --     CMake build tool:            /usr/bin/make
    --     Configuration:               RELEASE
    -- 
    --   C/C++:
    --     Built as dynamic libs?:      YES
    --     C++ Compiler:                /usr/bin/c++  (ver 4.6)
    --     C++ flags (Release):         -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -O3 -DNDEBUG  -DNDEBUG
    --     C++ flags (Debug):           -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -g  -O0 -DDEBUG -D_DEBUG
    --     C Compiler:                  /usr/bin/gcc
    --     C flags (Release):           -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -O3 -DNDEBUG  -DNDEBUG
    --     C flags (Debug):             -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -g  -O0 -DDEBUG -D_DEBUG
    --     Linker flags (Release):      
    --     Linker flags (Debug):        
    --     Precompiled headers:         YES
    -- 
    --   OpenCV modules:
    --     To be built:                 core flann imgproc highgui features2d calib3d ml video legacy objdetect photo gpu ocl nonfree contrib python stitching superres ts videostab
    --     Disabled:                    world
    --     Disabled by dependency:      -
    --     Unavailable:                 androidcamera dynamicuda java
    -- 
    --   GUI: 
    --     QT:                          NO
    --     GTK+ 2.x:                    YES (ver 2.24.10)
    --     GThread :                    YES (ver 2.32.4)
    --     GtkGlExt:                    NO
    --     OpenGL support:              NO
    -- 
    --   Media I/O: 
    --     ZLib:                        /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.3.4)
    --     JPEG:                        /usr/lib/x86_64-linux-gnu/libjpeg.so (ver )
    --     PNG:                         /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.2.46)
    --     TIFF:                        /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 - 3.9.5)
    --     JPEG 2000:                   /usr/lib/x86_64-linux-gnu/libjasper.so (ver 1.900.1)
    --     OpenEXR:                     /usr/lib/libImath.so /usr/lib/libIlmImf.so /usr/lib/libIex.so /usr/lib/libHalf.so /usr/lib/libIlmThread.so (ver 1.6.1)
    -- 
    --   Video I/O:
    --     DC1394 1.x:                  NO
    --     DC1394 2.x:                  YES (ver 2.2.0)
    --     FFMPEG:                      YES
    --       codec:                     YES (ver 55.58.105)
    --       format:                    YES (ver 55.37.101)
    --       util:                      YES (ver 52.78.100)
    --       swscale:                   YES (ver 2.6.100)
    --       gentoo-style:              YES
    --     GStreamer:                   
    --       base:                      YES (ver 0.10.36)
    --       app:                       YES (ver 0.10.36)
    --       video:                     YES (ver 0.10.36)
    --     OpenNI:                      NO
    --     OpenNI PrimeSensor Modules:  NO
    --     PvAPI:                       NO
    --     GigEVisionSDK:               NO
    --     UniCap:                      NO
    --     UniCap ucil:                 NO
    --     V4L/V4L2:                    Using libv4l (ver 1.0.1)
    --     XIMEA:                       NO
    --     Xine:                        NO
    -- 
    --   Other third-party libraries:
    --     Use IPP:                     NO
    --     Use Eigen:                   NO
    --     Use TBB:                     NO
    --     Use OpenMP:                  NO
    --     Use GCD                      NO
    --     Use Concurrency              NO
    --     Use C=:                      NO
    --     Use Cuda:                    NO
    --     Use OpenCL:                  YES
    -- 
    --   OpenCL:
    --     Version:                     dynamic
    --     Include path:                /home/shixudongleo/Downloads/opencv-2.4.8/3rdparty/include/opencl/1.2
    --     Use AMD FFT:                 NO
    --     Use AMD BLAS:                NO
    -- 
    --   Python:
    --     Interpreter:                 /usr/bin/python (ver 2.7.3)
    --     Libraries:                   /usr/lib/libpython2.7.so
    --     numpy:                       /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.6.1)
    --     packages path:               lib/python2.7/dist-packages
    -- 
    --   Java:
    --     ant:                         NO
    --     JNI:                         NO
    --     Java tests:                  NO
    -- 
    --   Documentation:
    --     Build Documentation:         NO
    --     Sphinx:                      NO
    --     PdfLaTeX compiler:           /usr/bin/pdflatex
    -- 
    --   Tests and samples:
    --     Tests:                       YES
    --     Performance tests:           YES
    --     C/C++ Examples:              NO
    -- 
    --   Install path:                  /usr/local
    -- 
    --   cvconfig.h is in:              /home/shixudongleo/Downloads/opencv-2.4.8/build
    -- -----------------------------------------------------------------
    -- 
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/XXX/Downloads/opencv-2.4.8/build
    

    FFMPEG

    ffmpeg is enable to support OpenCV and libx264 is enabled when compiling ffmpeg. By using ffmpeg command line, libx264 is running normally.

    $ ffmpeg -i test.avi -vcodec libx264 test.mp4
    ffmpeg -i test.avi -vcodec libx264 test.mp4 > ~/Downloads/ffmpeg_log.txt
    ffmpeg version 2.2.git Copyright (c) 2000-2014 the FFmpeg developers
      built on Apr 24 2014 16:39:51 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
      configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab --enable-shared --enable-pic
      libavutil      52. 78.100 / 52. 78.100
      libavcodec     55. 58.105 / 55. 58.105
      libavformat    55. 37.101 / 55. 37.101
      libavdevice    55. 13.100 / 55. 13.100
      libavfilter     4.  4.100 /  4.  4.100
      libswscale      2.  6.100 /  2.  6.100
      libswresample   0. 18.100 /  0. 18.100
      libpostproc    52.  3.100 / 52.  3.100
    Input #0, avi, from 'test.avi':
      Duration: 00:00:03.73, start: 0.000000, bitrate: 1757 kb/s
        Stream #0:0: Video: msvideo1 (CRAM / 0x4D415243), rgb555le, 320x240, 1781 kb/s, 15 tbr, 15 tbn, 15 tbc
        Metadata:
          title           : julius.avi Video #1
    File 'test.mp4' already exists. Overwrite ? [y/N] y
    No pixel format specified, yuv444p for H.264 encoding chosen.
    Use -pix_fmt yuv420p for compatibility with outdated media players.
    [libx264 @ 0x25d08e0] using cpu capabilities: none!
    [libx264 @ 0x25d08e0] profile High 4:4:4 Predictive, level 1.2, 4:4:4 8-bit
    [libx264 @ 0x25d08e0] 264 - core 142 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - 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=4 threads=12 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=15 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, mp4, to 'test.mp4':
      Metadata:
        encoder         : Lavf55.37.101
        Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv444p, 320x240, q=-1--1, 15360 tbn, 15 tbc
        Metadata:
          title           : julius.avi Video #1
    Stream mapping:
      Stream #0:0 -> #0:0 (msvideo1 -> libx264)
    Press [q] to stop, [?] for help
    frame=   56 fps=0.0 q=-1.0 Lsize=     321kB time=00:00:03.60 bitrate= 731.0kbits/s    
    video:320kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.409949%
    [libx264 @ 0x25d08e0] frame I:3     Avg QP:15.36  size:  7975
    [libx264 @ 0x25d08e0] frame P:38    Avg QP:26.05  size:  6230
    [libx264 @ 0x25d08e0] frame B:15    Avg QP:28.25  size:  4418
    [libx264 @ 0x25d08e0] consecutive B-frames: 46.4% 53.6%  0.0%  0.0%
    [libx264 @ 0x25d08e0] mb I  I16..4:  1.4% 72.8% 25.8%
    [libx264 @ 0x25d08e0] mb P  I16..4:  1.6%  5.7% 15.1%  P16..4:  7.6%  6.3%  7.4%  0.0%  0.0%    skip:56.3%
    [libx264 @ 0x25d08e0] mb B  I16..4:  0.2%  1.0%  2.0%  B16..8: 13.3%  7.8%  8.7%  direct: 8.3%  skip:58.8%  L0:34.9% L1:36.6% BI:28.5%
    [libx264 @ 0x25d08e0] 8x8 transform intra:37.7% inter:2.3%
    [libx264 @ 0x25d08e0] coded y,u,v intra: 52.1% 42.1% 30.1% inter: 19.6% 9.2% 5.2%
    [libx264 @ 0x25d08e0] i16 v,h,dc,p: 56% 17% 24%  2%
    [libx264 @ 0x25d08e0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10% 16% 68%  1%  1%  1%  1%  1%  1%
    [libx264 @ 0x25d08e0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 18% 28%  5%  6%  5%  7%  5%  6%
    [libx264 @ 0x25d08e0] Weighted P-Frames: Y:31.6% UV:21.1%
    [libx264 @ 0x25d08e0] ref P L0: 70.5%  9.0% 12.1%  6.5%  2.0%
    [libx264 @ 0x25d08e0] ref B L0: 91.3%  8.7%
    [libx264 @ 0x25d08e0] kb/s:700.56
    
  • Trouble saving matplotlib animation with ffmpeg

    18 août, par kevinkayaks

    I installed ffmpeg and would like to save an animation.

    My code is

    #evo is the dataset composed of sequence of images
    
    evo = np.load('bed_evolution_3000iter_2.npy')
    fig = plt.figure(figsize=(15,15*2*width/length))
    # make axesimage object
    # the vmin and vmax here are very important to get the color map correct
    im = plt.imshow(np.transpose(evo[0]), cmap=plt.get_cmap('jet'), vmin=0, vmax=1300)
    cbar_ax = fig.add_axes([0.85, 0.15, 0.05, 0.7])
    fig.colorbar(im, cax=cbar_ax)
    fig.subplots_adjust(right=0.8)
    
    def updatefig(j):    
        # set the data in the axesimage object
        im.set_array(np.transpose(evo[j]))
        # return the artists set
        return im,
    # kick off the animation
    ani = animation.FuncAnimation(fig, updatefig, frames=range(len(evo)), 
                              interval=100, blit=True)
    
    #now just need to get the ability to save... this uses 
    
    FFwriter = animation.FFMpegWriter()
    ani.save('basic_animation.mp4', writer = FFwriter, fps=30, extra_args =([vcodec', 'libx264'])
    

    The animation runs and it looks good, but I just can't get it to save. The error message (at this stage) is

    error

    I am not sure what's going wrong. Any help is appreciated.

    EDIT: Following Can't save matplotlib animation I added

    plt.rcParams['animation.ffmpeg_path'] ='C:\\Program Files\\ffmpeg  \\bin\\ffmpeg.exe'
    

    Which returns Warning: Cannot change to a different GUI toolkit: qt. Using qt4 instead. ERROR: execution aborted

  • FFMPEG : recode all audio streams while keeping originals

    16 août, par Olirav

    I am trying to add an additional set of audio tracks into some video files, as part of an automated process. I would like to keep all the original audio tracks and have a second re-coded copy.

    What I have been using is:

    ffmpeg -i file
    -map 0:v -codec:v copy
    -map 0:a -codec:a copy
    -map 0:a:0 -codec:a:0 aac -strict experimental ...(Bitrate, filters etc all with :a:0)
    -map 0:s -codec:s copy
    output file
    

    However, I can't work out how to change this to handle input files that have multiple audio tracks as it will only convert the first.

    If I change :a:0 to :a on the 4th line it produces the extra copy I need but overrides the copy codec for the original copy.