Recherche avancée

Médias (0)

Mot : - Tags -/optimisation

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

Autres articles (82)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

Sur d’autres sites (6300)

  • | NGINX | FFMPEG not creating DASH manifests or chunks in the designated DIR |

    7 avril 2020, par Mathew Knight

    Hopefully someone can help here, I have a setup that takes two input RTMP streams from two separate machines into my server. From here I am trying to serve some MPEG DASH manifests and chunks to an experimental spatial audio/360 web (.js) player.

    



    My issue is that while i can see the FFMPEG processes running and creating the Chunks the files themselves are not appearing in the specified folder and so the media player will not read the content.

    



    Is there something obvious that i am not doing that is preventing these files being written ?

    



    Any help with this would be amazing !!!

    



    Here is my config :

    



    #user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
    worker_connections 768;
    # multi_accept on;
}

http {

    ##
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    # server_tokens off;

    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ##
    # SSL Settings
    ##

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;


    ##
    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;

}

rtmp {
        server {
            listen 1935;
            chunk_size 4096;

            application live {
            live on;
            record off;
            interleave off;
            wait_key on;
            meta on;
            wait_video off;
            idle_streams off;
            sync 300ms;
            session_relay on;
            #allow publish 127.0.0.1;
            #allow publish 192.168.2.0/24;
            allow publish all;
            #deny publish all;
            allow play all;    

         dash on;
            dash_nested on;
            dash_path /tmp/dash;
            dash_fragment 3;
            dash_playlist_length 120;
            dash_cleanup on;

            #dash_clock_compensation http_head;
            #dash_clock_helper_uri https://localhost/time;

    #dash_variant _low   bandwidth="500000"  width="640"  height="360";
            #dash_variant _med  bandwidth="1500000" width="1280"  height="720";
            #dash_variant _high bandwidth="5000000" width="1920" height="1080" max;

            # EDIT THESE SO THE LIVESTREAM_KEY IS REPLACED BY YOUR PERSONAL KEY THAT YOU CAN LOOK UP ON THE SITE OF THE PLATFORM
            # push rtmp://live-ams.twitch.tv/app/LIVESTREAM_KEY;
            # push rtmp://a.rtmp.youtube.com/live2/LIVESTREAM_KEY;
            # push rtmp://ingest-ams.mixer.com:1935/beam/LIVESTREAM_KEY;

         exec_push ffmpeg -re -an -i 'rtmp://localhost:1935/live/stream' -c:v libx264 -preset veryfast -s 1920x1080 -bufsize 15000k -b:v 15000k -keyint_min 150 -g 150 -tile-columns 4 -frame-parallel 1 -an -f dash -init_seg_name 'init-stream$RepresentationID$_video.webm' -media_seg_name 'chunk-stream$RepresentationID$_video-$Number%05d$.webm' 'http://localhost:1935/dash/video.mpd' 2>>/var/log/nginx/ffmpegvideo.log;




            }



    application dash {
        #TRANSCODED VIDEO/AUDIO FROM FFMPEG COMES HERE?????
        live on;
        meta copy;

        record all;
        record_path /rec;
        }

        }


    server {
            listen 1936;
            chunk_size 4096;

            application live {
            live on;
            record off;
            interleave off;
            wait_key on;
            meta on;
            wait_video off;
            idle_streams off;
            sync 300ms;
            session_relay on;
            #allow publish 127.0.0.1;
            #allow publish 192.168.2.0/24;
            allow publish all;
            #deny publish all;
            allow play all;    


            # EDIT THESE SO THE LIVESTREAM_KEY IS REPLACED BY YOUR PERSONAL KEY THAT YOU CAN LOOK UP ON THE SITE OF THE PLATFORM
            # push rtmp://live-ams.twitch.tv/app/LIVESTREAM_KEY;
            # push rtmp://a.rtmp.youtube.com/live2/LIVESTREAM_KEY;
            # push rtmp://ingest-ams.mixer.com:1935/beam/LIVESTREAM_KEY;

    exec_push ffmpeg -re -i 'rtmp://localhost:1936/live/stream' -filter 'channelmap=0|1|2|3|4|5|6|7:' -c:a libopus -b:a 512k -vn -f dash -init_seg_name 'init-stream$RepresentationID$_audio_01-08ch.webm' -media_seg_name 'chunk-stream$RepresentationID$_audio_01-08ch-$Number%05d$.webm' 'http://localhost:1936/dash/audio_01-08ch.mpd' -filter 'channelmap=8|9|10|11|12|13|14|15:' -c:a libopus -b:a 512k -vn -f dash -init_seg_name 'init-stream$RepresentationID$_audio_09-16ch.webm' -media_seg_name 'chunk-stream$RepresentationID$_audio_09-16ch-$Number%05d$.webm' 'http://localhost:1936/dash/audio_09-16ch.mpd' 2>>/var/log/nginx/ffmpegaudio.log;
            }





    application dash {
        #TRANSCODED AUDIO FROM FFMPEG COMES HERE?????
        live on;
        meta copy;
        }


}
}


    



    and here is the output from my FFMPEG logs :

    



    AUDIO :

    



    ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
  configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
[aac @ 0x55bfeaaafc60] Channel layout 'stereo' with 2 channels does not match specified number of channels 16: ignoring specified channel layout
Guessed Channel Layout for Input Stream #0.0 : hexadecagonal
Input #0, flv, from 'rtmp://localhost:1936/live/stream':
  Metadata:
    Server          : NGINX RTMP (github.com/arut/nginx-rtmp-module)
    displayWidth    : 0
    displayHeight   : 0
    fps             : 0
    profile         : 
    level           : 
  Duration: 00:00:00.00, start: 0.042000, bitrate: N/A
    Stream #0:0: Audio: aac (LC), 48000 Hz, hexadecagonal, fltp, 512 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (aac (native) -> opus (libopus))
  Stream #0:0 -> #1:0 (aac (native) -> opus (libopus))
Press [q] to stop, [?] for help
[dash @ 0x55bfeaab43e0] Opening 'http://localhost:1936/dash/init-stream_audio_01-08ch.webm' for writing
Output #0, dash, to 'http://localhost:1936/dash/audio_01-08ch.mpd':
  Metadata:
    Server          : NGINX RTMP (github.com/arut/nginx-rtmp-module)
    displayWidth    : 0
    displayHeight   : 0
    fps             : 0
    profile         : 
    level           : 
    encoder         : Lavf57.83.100
    Stream #0:0: Audio: opus (libopus), 48000 Hz, 7.1, flt, 512 kb/s
    Metadata:
      encoder         : Lavc57.107.100 libopus
[dash @ 0x55bfeaab43e0] Cannot use rename on non file protocol, this may lead to races and temporary partial files
[dash @ 0x55bfeaaecb00] Opening 'http://localhost:1936/dash/init-stream_audio_09-16ch.webm' for writing
Output #1, dash, to 'http://localhost:1936/dash/audio_09-16ch.mpd':
  Metadata:
    Server          : NGINX RTMP (github.com/arut/nginx-rtmp-module)
    displayWidth    : 0
    displayHeight   : 0
    fps             : 0
    profile         : 
    level           : 
    encoder         : Lavf57.83.100
    Stream #1:0: Audio: opus (libopus), 48000 Hz, 7.1, flt, 512 kb/s
    Metadata:
      encoder         : Lavc57.107.100 libopus
size=N/A time=00:00:00.49 bitrate=N/A speed=0.986x    
size=N/A time=00:00:01.01 bitrate=N/A speed=1.01x    
size=N/A time=00:00:01.49 bitrate=N/A speed=0.993x    
size=N/A time=00:00:02.01 bitrate=N/A speed=   1x    
size=N/A time=00:00:02.49 bitrate=N/A speed=0.995x    
size=N/A time=00:00:03.01 bitrate=N/A speed=   1x    
size=N/A time=00:00:03.53 bitrate=N/A speed=   1x    
size=N/A time=00:00:04.01 bitrate=N/A speed=0.998x    
size=N/A time=00:00:04.53 bitrate=N/A speed=   1x    
[dash @ 0x55bfeaab43e0] Opening 'http://localhost:1936/dash/chunk-stream_audio_01-08ch-%05d.webm' for writing
[dash @ 0x55bfeaaecb00] Opening 'http://localhost:1936/dash/chunk-stream_audio_09-16ch-%05d.webm' for writing
size=N/A time=00:00:05.01 bitrate=N/A speed=0.997x    
size=N/A time=00:00:05.53 bitrate=N/A speed=   1x    
size=N/A time=00:00:06.03 bitrate=N/A speed=0.999x    
size=N/A time=00:00:06.55 bitrate=N/A speed=   1x    
size=N/A time=00:00:07.05 bitrate=N/A speed=0.999x    
size=N/A time=00:00:07.55 bitrate=N/A speed=0.999x    
size=N/A time=00:00:08.07 bitrate=N/A speed=   1x    
size=N/A time=00:00:08.57 bitrate=N/A speed=   1x    
size=N/A time=00:00:09.09 bitrate=N/A speed=   1x    
size=N/A time=00:00:09.59 bitrate=N/A speed=   1x    
[dash @ 0x55bfeaab43e0] Opening 'http://localhost:1936/dash/chunk-stream_audio_01-08ch-%05d.webm' for writing
[dash @ 0x55bfeaaecb00] Opening 'http://localhost:1936/dash/chunk-stream_audio_09-16ch-%05d.webm' for writing
size=N/A time=00:00:10.09 bitrate=N/A speed=0.999x    
size=N/A time=00:00:10.61 bitrate=N/A speed=   1x    
size=N/A time=00:00:11.09 bitrate=N/A speed=0.999x    
size=N/A time=00:00:11.61 bitrate=N/A speed=   1x    
size=N/A time=00:00:12.11 bitrate=N/A speed=0.999x    
size=N/A time=00:00:12.63 bitrate=N/A speed=   1x    
size=N/A time=00:00:13.13 bitrate=N/A speed=   1x    
size=N/A time=00:00:13.63 bitrate=N/A speed=0.999x    
size=N/A time=00:00:14.15 bitrate=N/A speed=   1x    
size=N/A time=00:00:14.63 bitrate=N/A speed=0.999x    
[dash @ 0x55bfeaab43e0] Opening 'http://localhost:1936/dash/chunk-stream_audio_01-08ch-%05d.webm' for writing
[dash @ 0x55bfeaaecb00] Opening 'http://localhost:1936/dash/chunk-stream_audio_09-16ch-%05d.webm' for writing
size=N/A time=00:00:15.15 bitrate=N/A speed=   1x    
size=N/A time=00:00:15.67 bitrate=N/A speed=   1x    
size=N/A time=00:00:16.15 bitrate=N/A speed=0.999x    
size=N/A time=00:00:16.67 bitrate=N/A speed=   1x    
size=N/A time=00:00:17.15 bitrate=N/A speed=0.999x    
size=N/A time=00:00:17.67 bitrate=N/A speed=   1x    
size=N/A time=00:00:18.17 bitrate=N/A speed=   1x    
size=N/A time=00:00:18.67 bitrate=N/A speed=0.999x    
size=N/A time=00:00:19.19 bitrate=N/A speed=   1x    
size=N/A time=00:00:19.69 bitrate=N/A speed=   1x    
[dash @ 0x55bfeaab43e0] Opening 'http://localhost:1936/dash/chunk-stream_audio_01-08ch-%05d.webm' for writing
[dash @ 0x55bfeaaecb00] Opening 'http://localhost:1936/dash/chunk-stream_audio_09-16ch-%05d.webm' for writing



    



    VIDEO :

    



    ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
  configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, flv, from 'rtmp://localhost:1935/live/stream':
  Metadata:
    Server          : NGINX RTMP (github.com/arut/nginx-rtmp-module)
    displayWidth    : 3840
    displayHeight   : 1920
    fps             : 30
    profile         : 
    level           : 
  Duration: 00:00:00.00, start: 0.033000, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuv420p(tv, bt470bg/bt709/bt709, progressive), 3840x1920 [SAR 1:1 DAR 2:1], 15360 kb/s, 30 fps, 30 tbr, 1k tbn, 60 tbc
    Stream #0:1: Audio: aac (LC), 48000 Hz, 7.1, fltp, 327 kb/s
Codec AVOption tile-columns (Number of tile columns to use, log2) specified for output file #0 (http://localhost:1935/dash/video.mpd) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Codec AVOption frame-parallel (Enable frame parallel decodability features) specified for output file #0 (http://localhost:1935/dash/video.mpd) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0x55e24ea47f40] VBV maxrate unspecified, assuming CBR
[libx264 @ 0x55e24ea47f40] using SAR=9/8
[libx264 @ 0x55e24ea47f40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x55e24ea47f40] profile High, level 4.0
[libx264 @ 0x55e24ea47f40] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6 lookahead_threads=2 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=1 keyint=150 keyint_min=76 scenecut=40 intra_refresh=0 rc_lookahead=10 rc=cbr mbtree=1 bitrate=15000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=15000 vbv_bufsize=15000 nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00
[dash @ 0x55e24ea4b640] Opening 'http://localhost:1935/dash/init-stream_video.webm' for writing
Output #0, dash, to 'http://localhost:1935/dash/video.mpd':
  Metadata:
    Server          : NGINX RTMP (github.com/arut/nginx-rtmp-module)
    displayWidth    : 3840
    displayHeight   : 1920
    fps             : 30
    profile         : 
    level           : 
    encoder         : Lavf57.83.100
    Stream #0:0: Video: h264 (libx264), yuv420p, 1920x1080 [SAR 9:8 DAR 2:1], q=-1--1, 15000 kb/s, 30 fps, 15360 tbn, 30 tbc
    Metadata:
      encoder         : Lavc57.107.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/15000000 buffer size: 15000000 vbv_delay: -1
frame=   11 fps=0.0 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A speed=   0x    
[dash @ 0x55e24ea4b640] Cannot use rename on non file protocol, this may lead to races and temporary partial files
frame=   26 fps= 26 q=19.0 size=N/A time=00:00:00.10 bitrate=N/A speed=0.0997x    
frame=   42 fps= 28 q=17.0 size=N/A time=00:00:00.63 bitrate=N/A speed=0.421x    
frame=   57 fps= 28 q=14.0 size=N/A time=00:00:01.13 bitrate=N/A speed=0.565x    
frame=   72 fps= 29 q=15.0 size=N/A time=00:00:01.63 bitrate=N/A speed=0.65x    
frame=   87 fps= 29 q=14.0 size=N/A time=00:00:02.13 bitrate=N/A speed=0.706x    
frame=  102 fps= 29 q=16.0 size=N/A time=00:00:02.63 bitrate=N/A speed=0.746x    
frame=  118 fps= 29 q=16.0 size=N/A time=00:00:03.16 bitrate=N/A speed=0.785x    
frame=  133 fps= 29 q=17.0 size=N/A time=00:00:03.66 bitrate=N/A speed=0.807x    
frame=  148 fps= 29 q=15.0 size=N/A time=00:00:04.16 bitrate=N/A speed=0.826x    
frame=  163 fps= 29 q=18.0 size=N/A time=00:00:04.66 bitrate=N/A speed=0.841x    
[dash @ 0x55e24ea4b640] Opening 'http://localhost:1935/dash/chunk-stream_video-%05d.webm' for writing
frame=  178 fps= 29 q=17.0 size=N/A time=00:00:05.16 bitrate=N/A speed=0.854x    
frame=  193 fps= 29 q=18.0 size=N/A time=00:00:05.66 bitrate=N/A speed=0.864x    
frame=  208 fps= 29 q=15.0 size=N/A time=00:00:06.16 bitrate=N/A speed=0.873x    
frame=  224 fps= 30 q=15.0 size=N/A time=00:00:06.70 bitrate=N/A speed=0.885x    
frame=  239 fps= 30 q=16.0 size=N/A time=00:00:07.20 bitrate=N/A speed=0.892x    
frame=  254 fps= 30 q=15.0 size=N/A time=00:00:07.70 bitrate=N/A speed=0.898x    
frame=  269 fps= 30 q=17.0 size=N/A time=00:00:08.20 bitrate=N/A speed=0.903x    
frame=  284 fps= 30 q=16.0 size=N/A time=00:00:08.70 bitrate=N/A speed=0.908x    
frame=  299 fps= 30 q=16.0 size=N/A time=00:00:09.20 bitrate=N/A speed=0.912x    
frame=  314 fps= 30 q=18.0 size=N/A time=00:00:09.70 bitrate=N/A speed=0.916x    
[dash @ 0x55e24ea4b640] Opening 'http://localhost:1935/dash/chunk-stream_video-%05d.webm' for writing
frame=  330 fps= 30 q=17.0 size=N/A time=00:00:10.23 bitrate=N/A speed=0.922x    
frame=  345 fps= 30 q=17.0 size=N/A time=00:00:10.73 bitrate=N/A speed=0.925x    
frame=  360 fps= 30 q=15.0 size=N/A time=00:00:11.23 bitrate=N/A speed=0.928x    
frame=  375 fps= 30 q=15.0 size=N/A time=00:00:11.73 bitrate=N/A speed=0.931x    
frame=  390 fps= 30 q=16.0 size=N/A time=00:00:12.23 bitrate=N/A speed=0.933x    
frame=  405 fps= 30 q=17.0 size=N/A time=00:00:12.73 bitrate=N/A speed=0.935x    
frame=  420 fps= 30 q=14.0 size=N/A time=00:00:13.23 bitrate=N/A speed=0.937x    
frame=  435 fps= 30 q=16.0 size=N/A time=00:00:13.73 bitrate=N/A speed=0.94x    
frame=  450 fps= 30 q=16.0 size=N/A time=00:00:14.23 bitrate=N/A speed=0.941x    
frame=  465 fps= 30 q=18.0 size=N/A time=00:00:14.73 bitrate=N/A speed=0.943x    
[dash @ 0x55e24ea4b640] Opening 'http://localhost:1935/dash/chunk-stream_video-%05d.webm' for writing
frame=  481 fps= 30 q=16.0 size=N/A time=00:00:15.26 bitrate=N/A speed=0.946x    
frame=  496 fps= 30 q=17.0 size=N/A time=00:00:15.76 bitrate=N/A speed=0.947x    
frame=  511 fps= 30 q=16.0 size=N/A time=00:00:16.26 bitrate=N/A speed=0.949x    
frame=  526 fps= 30 q=16.0 size=N/A time=00:00:16.76 bitrate=N/A speed=0.95x    
frame=  541 fps= 30 q=16.0 size=N/A time=00:00:17.26 bitrate=N/A speed=0.951x    
frame=  557 fps= 30 q=16.0 size=N/A time=00:00:17.80 bitrate=N/A speed=0.953x    
frame=  572 fps= 30 q=15.0 size=N/A time=00:00:18.30 bitrate=N/A speed=0.954x    
frame=  587 fps= 30 q=16.0 size=N/A time=00:00:18.80 bitrate=N/A speed=0.955x    
frame=  602 fps= 30 q=16.0 size=N/A time=00:00:19.30 bitrate=N/A speed=0.956x    
frame=  618 fps= 30 q=18.0 size=N/A time=00:00:19.83 bitrate=N/A speed=0.958x    
[dash @ 0x55e24ea4b640] Opening 'http://localhost:1935/dash/chunk-stream_video-%05d.webm' for writing
frame=  633 fps= 30 q=17.0 size=N/A time=00:00:20.33 bitrate=N/A speed=0.959x    
frame=  648 fps= 30 q=16.0 size=N/A time=00:00:20.83 bitrate=N/A speed=0.96x    
frame=  663 fps= 30 q=16.0 size=N/A time=00:00:21.33 bitrate=N/A speed=0.961x    
frame=  678 fps= 30 q=16.0 size=N/A time=00:00:21.83 bitrate=N/A speed=0.961x    
frame=  693 fps= 30 q=16.0 size=N/A time=00:00:22.33 bitrate=N/A speed=0.962x    
frame=  708 fps= 30 q=16.0 size=N/A time=00:00:22.83 bitrate=N/A speed=0.962x    
frame=  723 fps= 30 q=17.0 size=N/A time=00:00:23.33 bitrate=N/A speed=0.963x    
frame=  739 fps= 30 q=17.0 size=N/A time=00:00:23.86 bitrate=N/A speed=0.965x    
frame=  754 fps= 30 q=16.0 size=N/A time=00:00:24.36 bitrate=N/A speed=0.965x    
frame=  769 fps= 30 q=18.0 size=N/A time=00:00:24.86 bitrate=N/A speed=0.966x    
[dash @ 0x55e24ea4b640] Opening 'http://localhost:1935/dash/chunk-stream_video-%05d.webm' for writing
frame=  784 fps= 30 q=15.0 size=N/A time=00:00:25.36 bitrate=N/A speed=0.966x    
frame=  799 fps= 30 q=15.0 size=N/A time=00:00:25.86 bitrate=N/A speed=0.967x    
frame=  814 fps= 30 q=15.0 size=N/A time=00:00:26.36 bitrate=N/A speed=0.967x    
frame=  829 fps= 30 q=16.0 size=N/A time=00:00:26.86 bitrate=N/A speed=0.968x    
frame=  844 fps= 30 q=15.0 size=N/A time=00:00:27.36 bitrate=N/A speed=0.968x    
frame=  860 fps= 30 q=15.0 size=N/A time=00:00:27.90 bitrate=N/A speed=0.97x    
frame=  875 fps= 30 q=15.0 size=N/A time=00:00:28.40 bitrate=N/A speed=0.97x    
frame=  890 fps= 30 q=15.0 size=N/A time=00:00:28.90 bitrate=N/A speed=0.971x    
frame=  905 fps= 30 q=16.0 size=N/A time=00:00:29.40 bitrate=N/A speed=0.971x    
frame=  920 fps= 30 q=18.0 size=N/A time=00:00:29.90 bitrate=N/A speed=0.971x    
[dash @ 0x55e24ea4b640] Opening 'http://localhost:1935/dash/chunk-stream_video-%05d.webm' for writing
frame=  935 fps= 30 q=16.0 size=N/A time=00:00:30.40 bitrate=N/A speed=0.971x    
frame=  950 fps= 30 q=16.0 size=N/A time=00:00:30.90 bitrate=N/A speed=0.972x    
frame=  966 fps= 30 q=15.0 size=N/A time=00:00:31.43 bitrate=N/A speed=0.973x    
frame=  981 fps= 30 q=15.0 size=N/A time=00:00:31.93 bitrate=N/A speed=0.973x    
frame=  996 fps= 30 q=16.0 size=N/A time=00:00:32.43 bitrate=N/A speed=0.974x    
frame= 1011 fps= 30 q=15.0 size=N/A time=00:00:32.93 bitrate=N/A speed=0.974x    
frame= 1026 fps= 30 q=16.0 size=N/A time=00:00:33.43 bitrate=N/A speed=0.974x    
frame= 1041 fps= 30 q=16.0 size=N/A time=00:00:33.93 bitrate=N/A speed=0.974x    
frame= 1057 fps= 30 q=16.0 size=N/A time=00:00:34.46 bitrate=N/A speed=0.975x    
[dash @ 0x55e24ea4b640] Opening 'http://localhost:1935/dash/chunk-stream_video-%05d.webm' for writing
frame= 1072 fps= 30 q=18.0 size=N/A time=00:00:34.96 bitrate=N/A speed=0.976x    
frame= 1087 fps= 30 q=18.0 size=N/A time=00:00:35.46 bitrate=N/A speed=0.976x    
frame= 1102 fps= 30 q=15.0 size=N/A time=00:00:35.96 bitrate=N/A speed=0.976x    
frame= 1117 fps= 30 q=15.0 size=N/A time=00:00:36.46 bitrate=N/A speed=0.976x    
frame= 1132 fps= 30 q=16.0 size=N/A time=00:00:36.96 bitrate=N/A speed=0.976x    
frame= 1148 fps= 30 q=16.0 size=N/A time=00:00:37.50 bitrate=N/A speed=0.977x    
frame= 1163 fps= 30 q=17.0 size=N/A time=00:00:38.00 bitrate=N/A speed=0.978x    
frame= 1178 fps= 30 q=15.0 size=N/A time=00:00:38.50 bitrate=N/A speed=0.978x    
frame= 1193 fps= 30 q=15.0 size=N/A time=00:00:39.00 bitrate=N/A speed=0.978x    
frame= 1208 fps= 30 q=18.0 size=N/A time=00:00:39.50 bitrate=N/A speed=0.978x    
[dash @ 0x55e24ea4b640] Opening 'http://localhost:1935/dash/chunk-stream_video-%05d.webm' for writing  


    


  • MP4 Created Using FFmpeg API Can't Be Played in Media Players

    11 avril 2020, par RandyCroucher

    I've been struggling with this issue for days. There are similar issues posted here and around the web, but none of the solutions seem to work for me. They are possibly outdated ?

    



    Here is the current iteration of code I'm using to generate the MP4 file.

    



    It generates a simple 2 second .mp4 file that fails to play in any player I've tried. If I run that mp4 file back through the FFmpeg command line, it will generate a perfectly playable movie out of it. So the data is there.

    



    Also, if you modify the output file name in this code from .mp4 to .avi, this code generates a playable avi file too. So whatever it is, it is tied to the H.264 format.

    



    I'm sure I'm missing something simple, but for the life of me, I can't figure out what that is.

    



    Any help would be greatly appreciated !

    



    Here is a link to the VC++ project. MovieMaker.zip

    



    MovieMaker.h

    



    #pragma once&#xA;&#xA;extern "C"&#xA;{&#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libavformat></libavformat>avformat.h>&#xA;#include <libswscale></libswscale>swscale.h>&#xA;#include <libavutil></libavutil>opt.h>&#xA;}&#xA;&#xA;class FMovieMaker&#xA;{&#xA;public:&#xA;    ~FMovieMaker();&#xA;&#xA;    bool Initialize(const char* FileName, int Width = 1920, int Height = 1080, int FPS = 30, int BitRate = 2000);&#xA;    bool RecordFrame(uint8_t* BGRAData);&#xA;    bool Finalize();&#xA;&#xA;    bool IsInitialized() const { return bInitialized; }&#xA;    int GetWidth() const { return CodecContext ? CodecContext->width : 0; }&#xA;    int GetHeight() const { return CodecContext ? CodecContext->height : 0; }&#xA;&#xA;private:&#xA;    bool EncodeFrame(bool bFinalize);&#xA;    void Log(const char* fmt, ...);&#xA;&#xA;    AVOutputFormat* OutputFormat = nullptr;&#xA;    AVFormatContext* FormatContext = nullptr;&#xA;    AVCodecContext* CodecContext = nullptr;&#xA;    AVFrame* Frame = nullptr;&#xA;    SwsContext* ColorConverter = nullptr;&#xA;    int64_t RecordedFrames = 0;&#xA;    bool bInitialized = false;&#xA;};&#xA;

    &#xA;&#xA;

    MovieMaker.cpp

    &#xA;&#xA;

    #include "MovieMaker.h"&#xA;&#xA;FMovieMaker::~FMovieMaker()&#xA;{&#xA;    if (IsInitialized())&#xA;        Finalize();&#xA;}&#xA;&#xA;bool FMovieMaker::Initialize(const char* FileName, int Width /*= 1920*/, int Height /*= 1080*/, int FPS /*= 30*/, int BitRate /*= 2000*/)&#xA;{&#xA;    OutputFormat = av_guess_format(nullptr, FileName, nullptr);&#xA;    if (!OutputFormat)&#xA;    {&#xA;        Log("Couldn&#x27;t guess the output format from the filename: %s", FileName);&#xA;        return false;&#xA;    }&#xA;&#xA;    AVCodecID CodecID = OutputFormat->video_codec;&#xA;    if (CodecID == AV_CODEC_ID_NONE)&#xA;    {&#xA;        Log("Could not determine a codec to use");&#xA;        return false;&#xA;    }&#xA;&#xA;    /* allocate the output media context */&#xA;    int ErrorCode = avformat_alloc_output_context2(&amp;FormatContext, OutputFormat, nullptr, FileName);&#xA;    if (ErrorCode &lt; 0)&#xA;    {&#xA;        char Error[AV_ERROR_MAX_STRING_SIZE];&#xA;        av_make_error_string(Error, AV_ERROR_MAX_STRING_SIZE, ErrorCode);&#xA;        Log("Failed to allocate format context: %s", Error);&#xA;        return false;&#xA;    }&#xA;    else if (!FormatContext)&#xA;    {&#xA;        Log("Failed to get format from filename: %s", FileName);&#xA;        return false;&#xA;    }&#xA;&#xA;    /* find the video encoder */&#xA;    const AVCodec* Codec = avcodec_find_encoder(CodecID);&#xA;    if (!Codec)&#xA;    {&#xA;        Log("Codec &#x27;%d&#x27; not found", CodecID);&#xA;        return false;&#xA;    }&#xA;&#xA;    /* create the video stream */&#xA;    AVStream* Stream = avformat_new_stream(FormatContext, Codec);&#xA;    if (!Stream)&#xA;    {&#xA;        Log("Failed to allocate stream");&#xA;        return false;&#xA;    }&#xA;&#xA;    /* create the codec context */&#xA;    CodecContext = avcodec_alloc_context3(Codec);&#xA;    if (!CodecContext)&#xA;    {&#xA;        Log("Could not allocate video codec context");&#xA;        return false;&#xA;    }&#xA;&#xA;    Stream->codecpar->codec_id = OutputFormat->video_codec;&#xA;    Stream->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;&#xA;    Stream->codecpar->width = Width;&#xA;    Stream->codecpar->height = Height;&#xA;    Stream->codecpar->format = AV_PIX_FMT_YUV420P;&#xA;    Stream->codecpar->bit_rate = (int64_t)BitRate * 1000;&#xA;    avcodec_parameters_to_context(CodecContext, Stream->codecpar);&#xA;&#xA;    CodecContext->time_base = { 1, FPS };&#xA;    CodecContext->max_b_frames = 2;&#xA;    CodecContext->gop_size = 12;&#xA;    CodecContext->framerate = { FPS, 1 };&#xA;&#xA;    if (Stream->codecpar->codec_id == AV_CODEC_ID_H264)&#xA;        av_opt_set(CodecContext, "preset", "medium", 0);&#xA;    else if (Stream->codecpar->codec_id == AV_CODEC_ID_H265)&#xA;        av_opt_set(CodecContext, "preset", "medium", 0);&#xA;&#xA;    avcodec_parameters_from_context(Stream->codecpar, CodecContext);&#xA;&#xA;    if (FormatContext->oformat->flags &amp; AVFMT_GLOBALHEADER)&#xA;        CodecContext->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;&#xA;&#xA;    if ((ErrorCode = avcodec_open2(CodecContext, Codec, NULL)) &lt; 0)&#xA;    {&#xA;        char Error[AV_ERROR_MAX_STRING_SIZE];&#xA;        av_make_error_string(Error, AV_ERROR_MAX_STRING_SIZE, ErrorCode);&#xA;        Log("Failed to open codec: %s", Error);&#xA;        return false;&#xA;    }&#xA;&#xA;    if (!(OutputFormat->flags &amp; AVFMT_NOFILE))&#xA;    {&#xA;        if ((ErrorCode = avio_open(&amp;FormatContext->pb, FileName, AVIO_FLAG_WRITE)) &lt; 0)&#xA;        {&#xA;            char Error[AV_ERROR_MAX_STRING_SIZE];&#xA;            av_make_error_string(Error, AV_ERROR_MAX_STRING_SIZE, ErrorCode);&#xA;            Log("Failed to open file: %s", Error);&#xA;            return false;&#xA;        }&#xA;    }&#xA;&#xA;    Stream->time_base = CodecContext->time_base;&#xA;    if ((ErrorCode = avformat_write_header(FormatContext, NULL)) &lt; 0)&#xA;    {&#xA;        char Error[AV_ERROR_MAX_STRING_SIZE];&#xA;        av_make_error_string(Error, AV_ERROR_MAX_STRING_SIZE, ErrorCode);&#xA;        Log("Failed to write header: %s", Error);&#xA;        return false;&#xA;    }&#xA;&#xA;    CodecContext->time_base = Stream->time_base;&#xA;&#xA;    av_dump_format(FormatContext, 0, FileName, 1);&#xA;&#xA;    // create the frame&#xA;    {&#xA;        Frame = av_frame_alloc();&#xA;        if (!Frame)&#xA;        {&#xA;            Log("Could not allocate video frame");&#xA;            return false;&#xA;        }&#xA;        Frame->format = CodecContext->pix_fmt;&#xA;        Frame->width = CodecContext->width;&#xA;        Frame->height = CodecContext->height;&#xA;&#xA;        ErrorCode = av_frame_get_buffer(Frame, 32);&#xA;        if (ErrorCode &lt; 0)&#xA;        {&#xA;            char Error[AV_ERROR_MAX_STRING_SIZE];&#xA;            av_make_error_string(Error, AV_ERROR_MAX_STRING_SIZE, ErrorCode);&#xA;            Log("Could not allocate the video frame data: %s", Error);&#xA;            return false;&#xA;        }&#xA;    }&#xA;&#xA;    // create a color converter&#xA;    {&#xA;        ColorConverter = sws_getContext(CodecContext->width, CodecContext->height, AV_PIX_FMT_BGRA,&#xA;                                        CodecContext->width, CodecContext->height, AV_PIX_FMT_YUV420P, 0, 0, 0, 0);&#xA;        if (!ColorConverter)&#xA;        {&#xA;            Log("Could not allocate color converter");&#xA;            return false;&#xA;        }&#xA;    }&#xA;&#xA;    bInitialized = true;&#xA;    return true;&#xA;}&#xA;&#xA;bool FMovieMaker::RecordFrame(uint8_t* BGRAData)&#xA;{&#xA;    if (!bInitialized)&#xA;    {&#xA;        Log("Cannot record frames on an uninitialized Video Recorder");&#xA;        return false;&#xA;    }&#xA;&#xA;    /*make sure the frame data is writable */&#xA;    int ErrorCode = av_frame_make_writable(Frame);&#xA;    if (ErrorCode &lt; 0)&#xA;    {&#xA;        char Error[AV_ERROR_MAX_STRING_SIZE];&#xA;        av_make_error_string(Error, AV_ERROR_MAX_STRING_SIZE, ErrorCode);&#xA;        Log("Could not make the frame writable: %s", Error);&#xA;        return false;&#xA;    }&#xA;&#xA;    /* convert the bgra bitmap data into yuv frame data */&#xA;    int inLinesize[1] = { 4 * CodecContext->width }; // RGB stride&#xA;    sws_scale(ColorConverter, &amp;BGRAData, inLinesize, 0, CodecContext->height, Frame->data, Frame->linesize);&#xA;&#xA;    //Frame->pts = RecordedFrames&#x2B;&#x2B;;&#xA;    Frame->pts = CodecContext->time_base.den / CodecContext->time_base.num * CodecContext->framerate.den / CodecContext->framerate.num * (RecordedFrames&#x2B;&#x2B;);&#xA;    //The following assumes that codecContext->time_base = (AVRational){1, 1};&#xA;    //Frame->pts = frameduration * (RecordedFrames&#x2B;&#x2B;) * Stream->time_base.den / (Stream->time_base.num * fps);&#xA;    //Frame->pts &#x2B;= av_rescale_q(1, CodecContext->time_base, Stream->time_base);&#xA;&#xA;    return EncodeFrame(false);&#xA;}&#xA;&#xA;bool FMovieMaker::EncodeFrame(bool bFinalize)&#xA;{&#xA;    /* send the frame to the encoder */&#xA;    int ErrorCode = avcodec_send_frame(CodecContext, bFinalize ? nullptr : Frame);&#xA;    if (ErrorCode &lt; 0)&#xA;    {&#xA;        char Error[AV_ERROR_MAX_STRING_SIZE];&#xA;        av_make_error_string(Error, AV_ERROR_MAX_STRING_SIZE, ErrorCode);&#xA;        Log("Error sending a frame for encoding: %s", Error);&#xA;        return false;&#xA;    }&#xA;&#xA;    AVPacket Packet;&#xA;    av_init_packet(&amp;Packet);&#xA;    Packet.data = NULL;&#xA;    Packet.size = 0;&#xA;    Packet.flags |= AV_PKT_FLAG_KEY;&#xA;    Packet.pts = Frame->pts;&#xA;&#xA;    if (avcodec_receive_packet(CodecContext, &amp;Packet) == 0)&#xA;    {&#xA;        //std::cout &lt;&lt; "pkt key: " &lt;&lt; (Packet.flags &amp; AV_PKT_FLAG_KEY) &lt;&lt; " " &lt;&lt; Packet.size &lt;&lt; " " &lt;&lt; (counter&#x2B;&#x2B;) &lt;&lt; std::endl;&#xA;        uint8_t* size = ((uint8_t*)Packet.data);&#xA;        //std::cout &lt;&lt; "first: " &lt;&lt; (int)size[0] &lt;&lt; " " &lt;&lt; (int)size[1] &lt;&lt; " " &lt;&lt; (int)size[2] &lt;&lt; " " &lt;&lt; (int)size[3] &lt;&lt; " " &lt;&lt; (int)size[4] &lt;&lt; " " &lt;&lt; (int)size[5] &lt;&lt; " " &lt;&lt; (int)size[6] &lt;&lt; " " &lt;&lt; (int)size[7] &lt;&lt; std::endl;&#xA;&#xA;        av_interleaved_write_frame(FormatContext, &amp;Packet);&#xA;        av_packet_unref(&amp;Packet);&#xA;    }&#xA;&#xA;    return true;&#xA;}&#xA;&#xA;bool FMovieMaker::Finalize()&#xA;{&#xA;    if (!bInitialized)&#xA;    {&#xA;        Log("Cannot finalize uninitialized Video Recorder");&#xA;        return false;&#xA;    }&#xA;&#xA;    //DELAYED FRAMES&#xA;    AVPacket Packet;&#xA;    av_init_packet(&amp;Packet);&#xA;    Packet.data = NULL;&#xA;    Packet.size = 0;&#xA;&#xA;    for (;;)&#xA;    {&#xA;        avcodec_send_frame(CodecContext, NULL);&#xA;        if (avcodec_receive_packet(CodecContext, &amp;Packet) == 0)&#xA;        {&#xA;            av_interleaved_write_frame(FormatContext, &amp;Packet);&#xA;            av_packet_unref(&amp;Packet);&#xA;        }&#xA;        else&#xA;            break;&#xA;    }&#xA;&#xA;    av_write_trailer(FormatContext);&#xA;    if (!(OutputFormat->flags &amp; AVFMT_NOFILE))&#xA;    {&#xA;        int ErrorCode = avio_close(FormatContext->pb);&#xA;        if (ErrorCode &lt; 0)&#xA;        {&#xA;            char Error[AV_ERROR_MAX_STRING_SIZE];&#xA;            av_make_error_string(Error, AV_ERROR_MAX_STRING_SIZE, ErrorCode);&#xA;            Log("Failed to close file: %s", Error);&#xA;        }&#xA;    }&#xA;&#xA;    if (Frame)&#xA;    {&#xA;        av_frame_free(&amp;Frame);&#xA;        Frame = nullptr;&#xA;    }&#xA;&#xA;    if (CodecContext)&#xA;    {&#xA;        avcodec_free_context(&amp;CodecContext);&#xA;        CodecContext = nullptr;&#xA;    }&#xA;&#xA;    if (FormatContext)&#xA;    {&#xA;        avformat_free_context(FormatContext);&#xA;        FormatContext = nullptr;&#xA;    }&#xA;&#xA;    if (ColorConverter)&#xA;    {&#xA;        sws_freeContext(ColorConverter);&#xA;        ColorConverter = nullptr;&#xA;    }&#xA;&#xA;    bInitialized = false;&#xA;    return true;&#xA;}&#xA;&#xA;void FMovieMaker::Log(const char* fmt, ...)&#xA;{&#xA;    va_list args;&#xA;    fprintf(stderr, "LOG: ");&#xA;    va_start(args, fmt);&#xA;    vfprintf(stderr, fmt, args);&#xA;    va_end(args);&#xA;    fprintf(stderr, "\n");&#xA;}&#xA;

    &#xA;&#xA;

    Main.cpp

    &#xA;&#xA;

    #include "MovieMaker.h"&#xA;&#xA;uint8_t FtoB(float x)&#xA;{&#xA;    if (x &lt;= 0.0f)&#xA;        return 0;&#xA;    if (x >= 1.0f)&#xA;        return 255;&#xA;    else&#xA;        return (uint8_t)(x * 255.0f);&#xA;}&#xA;&#xA;void SetPixelColor(float X, float Y, float Width, float Height, float t, uint8_t* BGRA)&#xA;{&#xA;    t &#x2B;= 12.0f; // more interesting colors at this time&#xA;&#xA;    float P[2] = { 0.1f * X - 25.0f, 0.1f * Y - 25.0f };&#xA;    float V = sqrtf(P[0] * P[0] &#x2B; P[1] * P[1]);&#xA;    BGRA[0] = FtoB(sinf(V &#x2B; t / 0.78f));&#xA;    BGRA[1] = FtoB(sinf(V &#x2B; t / 10.0f));&#xA;    BGRA[2] = FtoB(sinf(V &#x2B; t / 36e2f));&#xA;    BGRA[3] = 255;&#xA;}&#xA;&#xA;int main()&#xA;{&#xA;    FMovieMaker MovieMaker;&#xA;&#xA;    const char* FileName = "C:\\ffmpeg\\MyMovieMakerMovie.mp4";&#xA;    int Width = 640;&#xA;    int Height = 480;&#xA;    int FPS = 30;&#xA;    int BitRateKBS = 2000;&#xA;&#xA;    if (MovieMaker.Initialize(FileName, Width, Height, FPS, BitRateKBS))&#xA;    {&#xA;        int Size = Width * 4 * Height;&#xA;        uint8_t* BGRAData = new uint8_t[Size];&#xA;        memset(BGRAData, 255, Size);&#xA;&#xA;        for (float Frame = 0; Frame &lt; 60; Frame&#x2B;&#x2B;)&#xA;        {&#xA;            // fill the image data with something interesting&#xA;            for (float Y = 0; Y &lt; Height; Y&#x2B;&#x2B;)&#xA;            {&#xA;                for (float X = 0; X &lt; Width; X&#x2B;&#x2B;)&#xA;                {&#xA;                    SetPixelColor(X, Y, (float)Width, (float)Height, Frame / (float)FPS, &amp;BGRAData[(int)(Y * Width &#x2B; X) * 4]);&#xA;                }&#xA;            }&#xA;&#xA;            if (!MovieMaker.RecordFrame(BGRAData))&#xA;                break;&#xA;        }&#xA;&#xA;        delete[] BGRAData;&#xA;&#xA;        MovieMaker.Finalize();&#xA;    }&#xA;}&#xA;

    &#xA;&#xA;

    If I have the lines that add the AV_CODEC_FLAG_GLOBAL_HEADER flag like shown above, I get all sorts of issues in the output from ffprobe MyMovieMakerMovie.mp4.

    &#xA;&#xA;

    C:\ffmpeg>ffprobe MyMovieMakerMovie.mp4&#xA;ffprobe version 4.2.2 Copyright (c) 2007-2019 the FFmpeg developers&#xA;  built with gcc 9.2.1 (GCC) 20200122&#xA;  configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt&#xA;  libavutil      56. 31.100 / 56. 31.100&#xA;  libavcodec     58. 54.100 / 58. 54.100&#xA;  libavformat    58. 29.100 / 58. 29.100&#xA;  libavdevice    58.  8.100 / 58.  8.100&#xA;  libavfilter     7. 57.100 /  7. 57.100&#xA;  libswscale      5.  5.100 /  5.  5.100&#xA;  libswresample   3.  5.100 /  3.  5.100&#xA;  libpostproc    55.  5.100 / 55.  5.100&#xA;[h264 @ 000001d44b795b00] non-existing PPS 0 referenced&#xA;[h264 @ 000001d44b795b00] decode_slice_header error&#xA;[h264 @ 000001d44b795b00] no frame!&#xA;...&#xA;[h264 @ 000001d44b795b00] non-existing PPS 0 referenced&#xA;[h264 @ 000001d44b795b00] decode_slice_header error&#xA;[h264 @ 000001d44b795b00] no frame!&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 000001d44b783880] decoding for stream 0 failed&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 000001d44b783880] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 640x480, 20528 kb/s): unspecified pixel format&#xA;Consider increasing the value for the &#x27;analyzeduration&#x27; and &#x27;probesize&#x27; options&#xA;Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;MyMovieMakerMovie.mp4&#x27;:&#xA;  Metadata:&#xA;    major_brand     : isom&#xA;    minor_version   : 512&#xA;    compatible_brands: isomiso2avc1mp41&#xA;    encoder         : Lavf58.29.100&#xA;  Duration: 00:00:01.97, start: 0.000000, bitrate: 20529 kb/s&#xA;    Stream #0:0(und): Video: h264 (avc1 / 0x31637661), none, 640x480, 20528 kb/s, 30.51 fps, 30 tbr, 15360 tbn, 30720 tbc (default)&#xA;    Metadata:&#xA;      handler_name    : VideoHandler&#xA;

    &#xA;&#xA;

    Without adding the AV_CODEC_FLAG_GLOBAL_HEADER flag, I get a clean output from ffprobe, but the video still doesn't play. Notice it thinks the frame rate is 30.51, I'm not sure why.

    &#xA;&#xA;

    C:\ffmpeg>ffprobe MyMovieMakerMovie.mp4&#xA;ffprobe version 4.2.2 Copyright (c) 2007-2019 the FFmpeg developers&#xA;  built with gcc 9.2.1 (GCC) 20200122&#xA;  configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt&#xA;  libavutil      56. 31.100 / 56. 31.100&#xA;  libavcodec     58. 54.100 / 58. 54.100&#xA;  libavformat    58. 29.100 / 58. 29.100&#xA;  libavdevice    58.  8.100 / 58.  8.100&#xA;  libavfilter     7. 57.100 /  7. 57.100&#xA;  libswscale      5.  5.100 /  5.  5.100&#xA;  libswresample   3.  5.100 /  3.  5.100&#xA;  libpostproc    55.  5.100 / 55.  5.100&#xA;Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;MyMovieMakerMovie.mp4&#x27;:&#xA;  Metadata:&#xA;    major_brand     : isom&#xA;    minor_version   : 512&#xA;    compatible_brands: isomiso2avc1mp41&#xA;    encoder         : Lavf58.29.100&#xA;  Duration: 00:00:01.97, start: 0.000000, bitrate: 20530 kb/s&#xA;    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x480, 20528 kb/s, 30.51 fps, 30 tbr, 15360 tbn, 60 tbc (default)&#xA;    Metadata:&#xA;      handler_name    : VideoHandler&#xA;

    &#xA;

  • ffmpeg : How to speed up (and keep only) a specified portion of an input video

    17 avril 2020, par shrimpwidget

    In my input video is a 48 second range that I wish to speed up. I wish to save only that sped up portion to a new video.

    &#xA;&#xA;

    Solution :

    &#xA;&#xA;

    ffmpeg -y -ss 00:00:03 -t 00:00:48 -i input.mp4 -an -crf 20 -pix_fmt yuv420p -vf "scale=1080:-1, setpts=PTS/10.0" "output.mp4"&#xA;

    &#xA;