Recherche avancée

Médias (0)

Mot : - Tags -/serveur

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

Autres articles (89)

  • L’espace de configuration de MediaSPIP

    29 novembre 2010, par

    L’espace de configuration de MediaSPIP est réservé aux administrateurs. Un lien de menu "administrer" est généralement affiché en haut de la page [1].
    Il permet de configurer finement votre site.
    La navigation de cet espace de configuration est divisé en trois parties : la configuration générale du site qui permet notamment de modifier : les informations principales concernant le site (...)

  • 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 ) (...)

  • Formulaire personnalisable

    21 juin 2013, par

    Cette page présente les champs disponibles dans le formulaire de publication d’un média et il indique les différents champs qu’on peut ajouter. Formulaire de création d’un Media
    Dans le cas d’un document de type média, les champs proposés par défaut sont : Texte Activer/Désactiver le forum ( on peut désactiver l’invite au commentaire pour chaque article ) Licence Ajout/suppression d’auteurs Tags
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire. (...)

Sur d’autres sites (5579)

  • FFMPEG does not produce output a valid mp4 when called from Java

    13 décembre 2019, par VincBreaker

    I am merging an image with an audio file into a mp4-video using the ffmpeg-command :

    ffmpeg -y -r 30 -loop 1 -i <path></path>to/image.png> -i <path></path>to/audio.aac> -shortest -acodec copy -vcodec libx264 <path></path>to/output.mp4>

    To call this command from Java I’m using this code :

    ProcessBuilder builder = new ProcessBuilder("ffmpeg", "-y", "-r",
                       String.valueOf(generalConfig.getOutputFPS()), "-loop", "1", "-i", pictureFile,
                       "-i", transspoken.getVoiceFile(), "-shortest", "-acodec", "copy", "-vcodec", "libx264",
                       snippetOut);
    builder.redirectOutput(new File(getTMPName() + ".txt"));
    builder.redirectError(new File(getTMPName() + ".txt"));
    builder.redirectErrorStream(true);

    LogUtils.debug("FFMPEG-Render", String.join(" ", builder.command()));
    try {
       Process p = builder.start();
       p.waitFor();
    } catch (IOException | InterruptedException e) {
       e.printStackTrace();
    }

    This code runs without problem on my local machine running Ubuntu 18.04 Desktop and OpenJDK 11.0.4. However, when run on a Ubuntu 18.04 Server droplet, running the same OpenJDK-Version, the code results in a corrupted output. Strangely, there is absolutely no problem when I ssh into the server and call exactly the same command to generate the mp4 file. So I am in a the really strange situation where :

    1. The command works fine when called automatically on my local machine.
    2. The command works fine when called manually on the server.
    3. The command does not work when called automatically on the server.

    Output of the automated FFMPEG call on the server :

    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
    [png_pipe @ 0x560225784a60] Stream #0: not enough frames to estimate rate; consider increasing probesize
    Input #0, png_pipe, from 'tmp/render_1.png':
     Duration: N/A, bitrate: N/A
       Stream #0:0: Video: png, rgb24(pc), 1920x1080, 25 tbr, 25 tbn, 25 tbc
    [aac @ 0x560225789940] Estimating duration from bitrate, this may be inaccurate
    Input #1, aac, from 'tmp/marytts_1.aac':
     Duration: 00:00:04.80, bitrate: 25 kb/s
       Stream #1:0: Audio: aac (LC), 16000 Hz, mono, fltp, 25 kb/s
    Stream mapping:
     Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))
     Stream #1:0 -> #0:1 (copy)
    Press [q] to stop, [?] for help
    [libx264 @ 0x56022578c2e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 AVX512
    [libx264 @ 0x56022578c2e0] profile High 4:4:4 Predictive, level 4.0, 4:4:4 8-bit
    [libx264 @ 0x56022578c2e0] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=4 threads=1 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to 'tmp/render_2.mp4':
     Metadata:
       encoder         : Lavf57.83.100
       Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv444p, 1920x1080, q=-1--1, 30 fps, 15360 tbn, 30 tbc
       Metadata:
         encoder         : Lavc57.107.100 libx264
       Side data:
         cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
       Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 16000 Hz, mono, fltp, 25 kb/s
    frame=    6 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
    frame=   12 fps= 11 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
    frame=   18 fps= 11 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
    frame=   23 fps= 10 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
    frame=   27 fps=9.8 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
    frame=   30 fps=9.2 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
    frame=   32 fps=7.9 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
    frame=   33 fps=7.1 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
    frame=   34 fps=6.4 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
    frame=   35 fps=5.4 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
    frame=   38 fps=5.4 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
    frame=   42 fps=5.0 q=29.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    

    The error output is empty. FFProbe on the corrupted file :

    $ ffprobe tmp/render_2.mp4
       ffprobe version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2007-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
       [mov,mp4,m4a,3gp,3g2,mj2 @ 0x558b07498080] moov atom not found
       tmp/render_2.mp4: Invalid data found when processing input

    At first I thought that the java program is not properly waiting for FFMpeg to finish thereby causing the corrupted output but some time measurements made me somewhat confident that that is not the cause of this bug.

    EDIT :

    Output of the ffmpeg command on the server when called via ssh :

    $ ffmpeg -y -r 30 -loop 1 -i tmp/render_1.png -i tmp/marytts_1.aac -shortest -acodec copy -vcodec libx264 tmp/render_2.mp4
    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
    [png_pipe @ 0x562e37a77a60] Stream #0: not enough frames to estimate rate; consider increasing probesize
    Input #0, png_pipe, from 'tmp/render_1.png':
     Duration: N/A, bitrate: N/A
       Stream #0:0: Video: png, rgb24(pc), 1920x1080, 25 tbr, 25 tbn, 25 tbc
    [aac @ 0x562e37a7c940] Estimating duration from bitrate, this may be inaccurate
    Input #1, aac, from 'tmp/marytts_1.aac':
     Duration: 00:00:04.80, bitrate: 25 kb/s
       Stream #1:0: Audio: aac (LC), 16000 Hz, mono, fltp, 25 kb/s
    Stream mapping:
     Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))
     Stream #1:0 -> #0:1 (copy)
    Press [q] to stop, [?] for help
    [libx264 @ 0x562e37a7f2e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 AVX512
    [libx264 @ 0x562e37a7f2e0] profile High 4:4:4 Predictive, level 4.0, 4:4:4 8-bit
    [libx264 @ 0x562e37a7f2e0] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=4 threads=1 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to 'tmp/render_2.mp4':
     Metadata:
       encoder         : Lavf57.83.100
       Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv444p, 1920x1080, q=-1--1, 30 fps, 15360 tbn, 30 tbc
       Metadata:
         encoder         : Lavc57.107.100 libx264
       Side data:
         cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
       Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 16000 Hz, mono, fltp, 25 kb/s
    frame=  194 fps= 10 q=29.0 Lsize=     280kB time=00:00:05.00 bitrate= 458.3kbits/s speed=0.261x    
    video:261kB audio:15kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.337588%
    [libx264 @ 0x562e37a7f2e0] frame I:1     Avg QP:16.02  size:255181
    [libx264 @ 0x562e37a7f2e0] frame P:49    Avg QP:10.58  size:    93
    [libx264 @ 0x562e37a7f2e0] frame B:144   Avg QP:13.67  size:    69
    [libx264 @ 0x562e37a7f2e0] consecutive B-frames:  1.0%  0.0%  0.0% 99.0%
    [libx264 @ 0x562e37a7f2e0] mb I  I16..4: 49.3%  0.0% 50.7%
    [libx264 @ 0x562e37a7f2e0] mb P  I16..4:  0.0%  0.0%  0.0%  P16..4:  0.1%  0.0%  0.0%  0.0%  0.0%    skip:99.9%
    [libx264 @ 0x562e37a7f2e0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.0%  0.0%  0.0%  direct: 0.0%  skip:100.0%  L0: 0.0% L1:100.0% BI: 0.0%
    [libx264 @ 0x562e37a7f2e0] coded y,u,v intra: 49.6% 41.1% 42.4% inter: 0.0% 0.0% 0.0%
    [libx264 @ 0x562e37a7f2e0] i16 v,h,dc,p: 97%  0%  2%  1%
    [libx264 @ 0x562e37a7f2e0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 15%  7%  7%  9% 10%  9%  9% 11%
    [libx264 @ 0x562e37a7f2e0] Weighted P-Frames: Y:0.0% UV:0.0%
    [libx264 @ 0x562e37a7f2e0] ref P L0: 72.6% 13.6% 11.6%  2.3%
    [libx264 @ 0x562e37a7f2e0] kb/s:333.64

    Output of local automated call :

    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
     WARNING: library configuration mismatch
     avcodec     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 --enable-version3 --disable-doc --disable-programs --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc
     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
    [png_pipe @ 0x558d89df15c0] Stream #0: not enough frames to estimate rate; consider increasing probesize
    Input #0, png_pipe, from 'tmp/render_1.png':
     Duration: N/A, bitrate: N/A
       Stream #0:0: Video: png, rgb24(pc), 1920x1080, 25 tbr, 25 tbn, 25 tbc
    [aac @ 0x558d89df64a0] Estimating duration from bitrate, this may be inaccurate
    Input #1, aac, from 'tmp/marytts_1.aac':
     Duration: 00:00:04.80, bitrate: 25 kb/s
       Stream #1:0: Audio: aac (LC), 16000 Hz, mono, fltp, 25 kb/s
    Stream mapping:
     Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))
     Stream #1:0 -> #0:1 (copy)
    Press [q] to stop, [?] for help
    [libx264 @ 0x558d89df8e40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
    [libx264 @ 0x558d89df8e40] profile High 4:4:4 Predictive, level 4.0, 4:4:4 8-bit
    [libx264 @ 0x558d89df8e40] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=4 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to 'tmp/render_2.mp4':
     Metadata:
       encoder         : Lavf57.83.100
       Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv444p, 1920x1080, q=-1--1, 30 fps, 15360 tbn, 30 tbc
       Metadata:
         encoder         : Lavc57.107.100 libx264
       Side data:
         cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
       Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 16000 Hz, mono, fltp, 25 kb/s
    frame=   29 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
    frame=   51 fps= 51 q=29.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
    frame=   67 fps= 44 q=29.0 size=       0kB time=00:00:00.51 bitrate=   0.8kbits/s speed=0.335x    
    frame=   88 fps= 43 q=29.0 size=     256kB time=00:00:01.21 bitrate=1724.9kbits/s speed=0.595x    
    frame=  111 fps= 43 q=29.0 size=     256kB time=00:00:01.93 bitrate=1084.9kbits/s speed=0.756x    
    frame=  132 fps= 43 q=29.0 size=     256kB time=00:00:02.68 bitrate= 780.3kbits/s speed=0.877x    
    frame=  153 fps= 43 q=29.0 size=     256kB time=00:00:03.39 bitrate= 618.4kbits/s speed=0.949x    
    frame=  176 fps= 43 q=29.0 size=     256kB time=00:00:04.16 bitrate= 504.2kbits/s speed=1.02x    
    frame=  196 fps= 43 q=29.0 size=     256kB time=00:00:04.80 bitrate= 437.0kbits/s speed=1.04x    
    frame=  203 fps= 38 q=29.0 Lsize=     280kB time=00:00:05.00 bitrate= 458.0kbits/s speed=0.946x    
    video:261kB audio:15kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.338639%
    [libx264 @ 0x558d89df8e40] frame I:1     Avg QP:16.02  size:255033
    [libx264 @ 0x558d89df8e40] frame P:51    Avg QP:10.50  size:    91
    [libx264 @ 0x558d89df8e40] frame B:151   Avg QP:13.67  size:    69
    [libx264 @ 0x558d89df8e40] consecutive B-frames:  0.5%  1.0%  0.0% 98.5%
    [libx264 @ 0x558d89df8e40] mb I  I16..4: 49.4%  0.0% 50.6%
    [libx264 @ 0x558d89df8e40] mb P  I16..4:  0.0%  0.0%  0.0%  P16..4:  0.1%  0.0%  0.0%  0.0%  0.0%    skip:99.9%
    [libx264 @ 0x558d89df8e40] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.0%  0.0%  0.0%  direct: 0.0%  skip:100.0%  L0: 0.0% L1:100.0% BI: 0.0%
    [libx264 @ 0x558d89df8e40] coded y,u,v intra: 49.6% 41.1% 42.2% inter: 0.0% 0.0% 0.0%
    [libx264 @ 0x558d89df8e40] i16 v,h,dc,p: 97%  0%  2%  1%
    [libx264 @ 0x558d89df8e40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 15%  7%  7%  9% 10%  9% 10% 11%
    [libx264 @ 0x558d89df8e40] Weighted P-Frames: Y:0.0% UV:0.0%
    [libx264 @ 0x558d89df8e40] ref P L0: 80.5% 10.5%  8.7%  0.3%
    [libx264 @ 0x558d89df8e40] kb/s:319.34

    Output of local manual call :

    $ ffmpeg -y -r 30 -loop 1 -i tmp/render_1.png -i tmp/marytts_1.aac -shortest -acodec copy -vcodec libx264 tmp/render_2.mp4
    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
     WARNING: library configuration mismatch
     avcodec     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 --enable-version3 --disable-doc --disable-programs --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc
     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
    [png_pipe @ 0x558ddf2165c0] Stream #0: not enough frames to estimate rate; consider increasing probesize
    Input #0, png_pipe, from 'tmp/render_1.png':
     Duration: N/A, bitrate: N/A
       Stream #0:0: Video: png, rgb24(pc), 1920x1080, 25 tbr, 25 tbn, 25 tbc
    [aac @ 0x558ddf21b4a0] Estimating duration from bitrate, this may be inaccurate
    Input #1, aac, from 'tmp/marytts_1.aac':
     Duration: 00:00:04.80, bitrate: 25 kb/s
       Stream #1:0: Audio: aac (LC), 16000 Hz, mono, fltp, 25 kb/s
    Stream mapping:
     Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))
     Stream #1:0 -> #0:1 (copy)
    Press [q] to stop, [?] for help
    [libx264 @ 0x558ddf21de40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
    [libx264 @ 0x558ddf21de40] profile High 4:4:4 Predictive, level 4.0, 4:4:4 8-bit
    [libx264 @ 0x558ddf21de40] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=4 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to 'tmp/render_2.mp4':
     Metadata:
       encoder         : Lavf57.83.100
       Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv444p, 1920x1080, q=-1--1, 30 fps, 15360 tbn, 30 tbc
       Metadata:
         encoder         : Lavc57.107.100 libx264
       Side data:
         cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
       Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 16000 Hz, mono, fltp, 25 kb/s
    frame=  203 fps= 40 q=29.0 Lsize=     280kB time=00:00:05.00 bitrate= 458.0kbits/s speed=0.986x    
    video:261kB audio:15kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.338639%
    [libx264 @ 0x558ddf21de40] frame I:1     Avg QP:16.02  size:255033
    [libx264 @ 0x558ddf21de40] frame P:51    Avg QP:10.50  size:    91
    [libx264 @ 0x558ddf21de40] frame B:151   Avg QP:13.67  size:    69
    [libx264 @ 0x558ddf21de40] consecutive B-frames:  0.5%  1.0%  0.0% 98.5%
    [libx264 @ 0x558ddf21de40] mb I  I16..4: 49.4%  0.0% 50.6%
    [libx264 @ 0x558ddf21de40] mb P  I16..4:  0.0%  0.0%  0.0%  P16..4:  0.1%  0.0%  0.0%  0.0%  0.0%    skip:99.9%
    [libx264 @ 0x558ddf21de40] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.0%  0.0%  0.0%  direct: 0.0%  skip:100.0%  L0: 0.0% L1:100.0% BI: 0.0%
    [libx264 @ 0x558ddf21de40] coded y,u,v intra: 49.6% 41.1% 42.2% inter: 0.0% 0.0% 0.0%
    [libx264 @ 0x558ddf21de40] i16 v,h,dc,p: 97%  0%  2%  1%
    [libx264 @ 0x558ddf21de40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 15%  7%  7%  9% 10%  9% 10% 11%
    [libx264 @ 0x558ddf21de40] Weighted P-Frames: Y:0.0% UV:0.0%
    [libx264 @ 0x558ddf21de40] ref P L0: 80.5% 10.5%  8.7%  0.3%
    [libx264 @ 0x558ddf21de40] kb/s:319.34
  • Statically built FFMPEG binary segmentation fault

    12 février 2020, par stevendesu

    I want to create a custom build of FFMPEG which rips out everything except for the ability to transmux HLS videos to MP4, and I need this build to be 100% static with no external dependencies

    I tried using the following configuration :

    ./configure \
       --extra-cflags='-static -static-libstdc++ -static-libgcc' \
       --extra-cxxflags='-static -static-libstdc++ -static-libgcc' \
       --extra-ldflags='-static -static-libstdc++ -static-libgcc' \
       --pkg-config-flags='--static' \
       --enable-static \
       --disable-shared \
       --disable-runtime-cpudetect \
       --disable-autodetect \
       --disable-ffplay \
       --disable-ffprobe \
       --disable-doc \
       --disable-avdevice \
       --disable-swresample \
       --disable-swscale \
       --disable-postproc \
       --disable-pthreads \
       --disable-w32threads \
       --disable-os2threads \
       --enable-network \
       --disable-dct \
       --disable-dwt \
       --disable-error-resilience \
       --disable-lsp \
       --disable-lzo \
       --disable-mdct \
       --disable-rdft \
       --disable-fft \
       --disable-faan \
       --disable-pixelutils \
       --disable-encoders \
       --disable-decoders \
       --disable-hwaccels \
       --disable-muxers \
       --enable-muxer=mov \
       --enable-muxer=mp4 \
       --disable-demuxers \
       --enable-demuxer=hls \
       --enable-demuxer=mpegts \
       --enable-demuxer=h264 \
       --enable-demuxer=aac \
       --disable-parsers \
       --enable-parser=h264 \
       --enable-parser=aac \
       --disable-bsfs \
       --disable-protocols \
       --enable-protocol=tcp \
       --enable-protocol=tls \
       --enable-protocol=http \
       --enable-protocol=https \
       --enable-protocol=hls \
       --disable-indevs \
       --disable-outdevs \
       --disable-devices \
       --disable-filters \
       --disable-alsa \
       --disable-appkit \
       --disable-avfoundation \
       --disable-bzlib \
       --disable-coreimage \
       --disable-iconv \
       --disable-lzma \
       --enable-openssl \
       --disable-sndio \
       --disable-sdl2 \
       --disable-securetransport \
       --disable-xlib \
       --disable-zlib \
       --disable-amf \
       --disable-audiotoolbox \
       --disable-cuda-llvm \
       --disable-cuvid \
       --disable-d3d11va \
       --disable-dxva2 \
       --disable-ffnvcodec \
       --disable-nvdec \
       --disable-nvenc \
       --disable-v4l2-m2m \
       --disable-vaapi \
       --disable-vdpau \
       --disable-videotoolbox \
       --disable-debug

    This looked about like what I wanted :

    install prefix            /usr/local
    source path               .
    C compiler                gcc
    C library                 glibc
    ARCH                      x86 (generic)
    big-endian                no
    runtime cpu detection     no
    standalone assembly       yes
    x86 assembler             nasm
    MMX enabled               yes
    MMXEXT enabled            yes
    3DNow! enabled            yes
    3DNow! extended enabled   yes
    SSE enabled               yes
    SSSE3 enabled             yes
    AESNI enabled             yes
    AVX enabled               yes
    AVX2 enabled              yes
    AVX-512 enabled           yes
    XOP enabled               yes
    FMA3 enabled              yes
    FMA4 enabled              yes
    i686 features enabled     yes
    CMOV is fast              yes
    EBX available             yes
    EBP available             yes
    debug symbols             no
    strip symbols             yes
    optimize for size         no
    optimizations             yes
    static                    yes
    shared                    no
    postprocessing support    no
    network support           yes
    threading support         no
    safe bitstream reader     yes
    texi2html enabled         no
    perl enabled              yes
    pod2man enabled           yes
    makeinfo enabled          no
    makeinfo supports HTML    no

    External libraries:
    openssl

    External libraries providing hardware acceleration:

    Libraries:
    avcodec                 avfilter                avformat                avutil

    Programs:
    ffmpeg

    Enabled decoders:

    Enabled encoders:

    Enabled hwaccels:

    Enabled parsers:
    aac                     h264

    Enabled demuxers:
    aac                     h264                    hls                     mpegts

    Enabled muxers:
    mov                     mp4

    Enabled protocols:
    hls                     http                    https                   tcp                     tls

    Enabled filters:
    aformat                 anull                   atrim                   format                  hflip                   null                    transpose               trim                    vflip

    Enabled bsfs:
    null

    Enabled indevs:

    Enabled outdevs:

    License: LGPL version 2.1 or later

    It included several filters which I won’t ever need or use, but these filters are pulled in automatically if you don’t specify --disable-avfilter, and specifying --disable-avfilter prevents the ffmpeg binary from being produced. So I’m stuck with those.

    Using these parameters and then running make, I received a binary that was about 5.9 MB in size and looked right :

    $> ldd ffmpeg
           not a dynamic executable

    But when I try to run it :

    $> ./ffmpeg -version
    Segmentation fault

    Using valgrind to try and inspect the cause of the segmentation fault :

    $> valgrind ./ffmpeg -version
    .... lots of stuff ...
    ==61362== Jump to the invalid address stated on the next line
    ==61362==    at 0x0: ???
    ==61362==    by 0x70BB1B: ??? (in /src/FFmpeg/ffmpeg)
    ==61362==    by 0x70B2E6: ??? (in /src/FFmpeg/ffmpeg)
    ==61362==    by 0x4033F9: ??? (in /src/FFmpeg/ffmpeg)
    ==61362==    by 0x1FFF000677: ???
    ==61362==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
    ==61362==
    ==61362==
    ==61362== Process terminating with default action of signal 11 (SIGSEGV)
    ==61362==  Bad permissions for mapped region at address 0x0
    ==61362==    at 0x0: ???
    ==61362==    by 0x70BB1B: ??? (in /src/FFmpeg/ffmpeg)
    ==61362==    by 0x70B2E6: ??? (in /src/FFmpeg/ffmpeg)
    ==61362==    by 0x4033F9: ??? (in /src/FFmpeg/ffmpeg)
    ==61362==    by 0x1FFF000677: ???
    ==61362==
    ==61362== HEAP SUMMARY:
    ==61362==     in use at exit: 0 bytes in 0 blocks
    ==61362==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
    ==61362==
    ==61362== All heap blocks were freed -- no leaks are possible
    ==61362==
    ==61362== For counts of detected and suppressed errors, rerun with: -v
    ==61362== Use --track-origins=yes to see where uninitialised values come from
    ==61362== ERROR SUMMARY: 93 errors from 90 contexts (suppressed: 0 from 0)
    Segmentation fault

    Attempting to access memory at location 0x0 sounds like trying to follow a null pointer. But I’m not sure how to fix this.

    gdb backtrace

    When I first ran gdb ./ffmpeg gdb immediately gave me a segmentation fault and I wasn’t kicked into the gdb REPL, so I couldn’t investigate

    After rebuilding ffmpeg I was able to get in this time :

    $> gdb ./ffmpeg

    GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git
    Copyright (C) 2018 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later /gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "x86_64-linux-gnu".
    Type "show configuration" for configuration details.
    For bug reporting instructions, please see:
    /www.gnu.org/software/gdb/bugs/>.
    Find the GDB manual and other documentation resources online at:
    /www.gnu.org/software/gdb/documentation/>.
    For help, type "help".
    Type "apropos word" to search for commands related to "word"...
    Reading symbols from ffmpeg...done.
    (gdb) r
    Starting program: /src/FFmpeg/ffmpeg
    warning: Error disabling address space randomization: Operation not permitted

    Program received signal SIGSEGV, Segmentation fault.
    0x0000000000000000 in ?? ()
    (gdb) bt
    #0  0x0000000000000000 in ?? ()
    #1  0x0000000000f9a8d5 in __register_frame_info_bases.part.6 ()
    #2  0x00000000004445fd in frame_dummy ()
    #3  0x0000000000000001 in ?? ()
    #4  0x0000000000ebd20c in __libc_csu_init ()
    #5  0x0000000000ebc9d7 in __libc_start_main ()
    #6  0x000000000044451a in _start ()
    (gdb)

    I tried grep’ing the code base for __register_frame_info_bases and found nothing. So I’m not really sure where to go from here

    A fix, but not an explanation

    By randomly removing configuration parameters and rebuilding I discovered that --disable-pthreads was causing the segmentation fault. When I remove this, ffmpeg runs just fine

    I don’t know why this is the case, though. Why would they make it possible to remove something that you need to run ?

  • lavfi/vf_drawtext : fix memory management when destroying font face

    31 octobre 2024, par Leandro Santiago
    lavfi/vf_drawtext : fix memory management when destroying font face
    

    Ref https://trac.ffmpeg.org/ticket/11152

    According to harfbuzz docs, hb_ft_font_set_funcs() does not need to be
    called, as, quoted :

    ```
    An #hb_font_t object created with hb_ft_font_create()
    is preconfigured for FreeType font functions and does not
    require this function to be used.
    ```

    Using this function seems to cause memory management issues between
    harfbuzz and freetype, and could be eliminated.

    This commit also call hb_ft_font_changed() when the underlying FC_Face
    changes size, as stated on hardbuzz :

    ```
    HarfBuzz also provides a utility function called hb_ft_font_changed() that you should call
    whenever you have altered the properties of your underlying FT_Face, as well as a hb_ft_get_face()
    that you can call on an hb_font_t font object to fetch its underlying FT_Face.
    ```

    Finally, the execution order between hb_font_destroy() and
    hb_buffer_destroy() is flipped to match the order of creation of
    the respective objects.

    Signed-off-by : Leandro Santiago <leandrosansilva@gmail.com>
    Signed-off-by : Marton Balint <cus@passwd.hu>

    • [DH] libavfilter/vf_drawtext.c