Recherche avancée

Médias (0)

Mot : - Tags -/tags

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

Autres articles (70)

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

  • Les formats acceptés

    28 janvier 2010, par

    Les commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
    ffmpeg -codecs ffmpeg -formats
    Les format videos acceptés en entrée
    Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
    Les formats vidéos de sortie possibles
    Dans un premier temps on (...)

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

Sur d’autres sites (9398)

  • FFmpeg on aws lambda - Invalid NAL unit size

    28 juin 2020, par Lina Sharifi Moghaddam

    I am trying to run below :

    



    1- generate mp4 from one png image and a mp3 file

    



    2- overlay another png image on top of the previous video

    



    A-On my local environment (mac) things work perfect :

    



    1A-

    



    ffmpeg -loop 1 -i images/01.png -i audio_123e4567-e89b-12d3-a456-426655440000.mp3 -c:v libx264 -pix_fmt yuv420p -shortest 01.mp4 -y
ffmpeg version 4.0.2 Copyright (c) 2000-2018 the FFmpeg developers
  built with Apple LLVM version 9.0.0 (clang-900.0.39.2)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.0.2 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
[png_pipe @ 0x7ff1ba000000] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, png_pipe, from 'images/01.png':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: png, rgba(pc), 3360x2100 [SAR 5669:5669 DAR 8:5], 25 tbr, 25 tbn, 25 tbc
[mp3 @ 0x7ff1ba00fa00] Estimating duration from bitrate, this may be inaccurate
Input #1, mp3, from 'audio_123e4567-e89b-12d3-a456-426655440000.mp3':
  Metadata:
    encoder         : Lavf57.71.100
  Duration: 00:00:05.38, start: 0.000000, bitrate: 48 kb/s
    Stream #1:0: Audio: mp3, 22050 Hz, mono, fltp, 48 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))
  Stream #1:0 -> #0:1 (mp3 (mp3float) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x7ff1ba021400] using SAR=1/1
[libx264 @ 0x7ff1ba021400] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x7ff1ba021400] profile High, level 5.1
[libx264 @ 0x7ff1ba021400] 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=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 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=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 '01.mp4':
  Metadata:
    encoder         : Lavf58.12.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p(progressive), 3360x2100 [SAR 1:1 DAR 8:5], q=-1--1, 25 fps, 12800 tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.18.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), 22050 Hz, mono, fltp, 69 kb/s
    Metadata:
      encoder         : Lavc58.18.100 aac
frame=  191 fps= 19 q=-1.0 Lsize=     798kB time=00:00:07.52 bitrate= 868.8kbits/s speed=0.75x     
video:744kB audio:49kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.685866%
[libx264 @ 0x7ff1ba021400] frame I:1     Avg QP:13.38  size:706076
[libx264 @ 0x7ff1ba021400] frame P:48    Avg QP:13.63  size:   516
[libx264 @ 0x7ff1ba021400] frame B:142   Avg QP:23.33  size:   210
[libx264 @ 0x7ff1ba021400] consecutive B-frames:  0.5%  1.0%  0.0% 98.4%
[libx264 @ 0x7ff1ba021400] mb I  I16..4:  5.4% 81.4% 13.2%
[libx264 @ 0x7ff1ba021400] mb P  I16..4:  0.0%  0.0%  0.0%  P16..4:  0.8%  0.0%  0.0%  0.0%  0.0%    skip:99.2%
[libx264 @ 0x7ff1ba021400] 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:10.7% L1:89.3% BI: 0.0%
[libx264 @ 0x7ff1ba021400] 8x8 transform intra:81.3% inter:99.4%
[libx264 @ 0x7ff1ba021400] coded y,uvDC,uvAC intra: 97.1% 1.7% 1.4% inter: 0.1% 0.0% 0.0%
[libx264 @ 0x7ff1ba021400] i16 v,h,dc,p:  1% 21% 66% 11%
[libx264 @ 0x7ff1ba021400] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  9%  9% 45%  5%  7%  5%  5%  6%  8%
[libx264 @ 0x7ff1ba021400] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 14% 18% 10% 11%  8%  7%  6%  8%
[libx264 @ 0x7ff1ba021400] i8c dc,h,v,p: 97%  3%  1%  0%
[libx264 @ 0x7ff1ba021400] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x7ff1ba021400] ref P L0: 98.3%  0.1%  1.3%  0.3%
[libx264 @ 0x7ff1ba021400] ref B L0: 35.0% 65.0%
[libx264 @ 0x7ff1ba021400] ref B L1: 94.6%  5.4%
[libx264 @ 0x7ff1ba021400] kb/s:796.51
[aac @ 0x7ff1ba022c00] Qavg: 2267.321


    



    2A-

    



    ffmpeg -i 01.mp4 -i square.png  -filter_complex "[0:v][1:v] overlay=12:12:enable='between(t,1,3)' "  -c:a copy -y temp.mp4
ffmpeg version 4.0.2 Copyright (c) 2000-2018 the FFmpeg developers
  built with Apple LLVM version 9.0.0 (clang-900.0.39.2)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.0.2 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '01.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.12.100
  Duration: 00:00:07.64, start: 0.000000, bitrate: 855 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 3360x2100 [SAR 1:1 DAR 8:5], 797 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, mono, fltp, 73 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Input #1, png_pipe, from 'square.png':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Video: png, rgba(pc), 90x90 [SAR 1:1 DAR 1:1], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 (h264) -> overlay:main
  Stream #1:0 (png) -> overlay:overlay
  overlay -> Stream #0:0 (libx264)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[libx264 @ 0x7f8e22006e00] using SAR=1/1
[libx264 @ 0x7f8e22006e00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x7f8e22006e00] profile High, level 5.1
[libx264 @ 0x7f8e22006e00] 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=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 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=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 'temp.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.12.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 3360x2100 [SAR 1:1 DAR 8:5], q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
    Metadata:
      encoder         : Lavc58.18.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, mono, fltp, 73 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
frame=  191 fps= 40 q=-1.0 Lsize=     780kB time=00:00:07.52 bitrate= 849.4kbits/s speed=1.56x    
video:726kB audio:49kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.701603%
[libx264 @ 0x7f8e22006e00] frame I:1     Avg QP:13.38  size:697836
[libx264 @ 0x7f8e22006e00] frame P:48    Avg QP:15.44  size:   284
[libx264 @ 0x7f8e22006e00] frame B:142   Avg QP:23.34  size:   218
[libx264 @ 0x7f8e22006e00] consecutive B-frames:  0.5%  1.0%  0.0% 98.4%
[libx264 @ 0x7f8e22006e00] mb I  I16..4:  6.1% 81.0% 13.0%
[libx264 @ 0x7f8e22006e00] 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 @ 0x7f8e22006e00] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.1%  0.0%  0.0%  direct: 0.0%  skip:99.9%  L0:49.9% L1:49.8% BI: 0.3%
[libx264 @ 0x7f8e22006e00] 8x8 transform intra:80.9% inter:78.2%
[libx264 @ 0x7f8e22006e00] coded y,uvDC,uvAC intra: 96.5% 1.7% 1.4% inter: 0.0% 0.0% 0.0%
[libx264 @ 0x7f8e22006e00] i16 v,h,dc,p:  2% 28% 63%  8%
[libx264 @ 0x7f8e22006e00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  9%  9% 43%  6%  7%  6%  6%  6%  8%
[libx264 @ 0x7f8e22006e00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 13% 19% 10% 10%  8%  7%  6%  8%
[libx264 @ 0x7f8e22006e00] i8c dc,h,v,p: 96%  3%  1%  0%
[libx264 @ 0x7f8e22006e00] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x7f8e22006e00] ref P L0: 64.8%  0.3% 13.8% 21.1%
[libx264 @ 0x7f8e22006e00] ref B L0: 34.0% 64.9%  1.0%
[libx264 @ 0x7f8e22006e00] ref B L1: 99.0%  1.0%
[libx264 @ 0x7f8e22006e00] kb/s:777.46


    



    B- When I try the same on aws lambda , I get encoding erros and the overlay command fails. (Tried two different ffmpeg build on lambda, local build and official static 64bit build )

    



    1B-

    



    ffmpeg version N-92107-g4901fa1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-23)
configuration: --prefix=/home/centos/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/centos/ffmpeg_build/include --extra-ldflags=-L/home/centos/ffmpeg_build/lib --extra-libs=-lpthread --extra-libs=-lm --bindir=/home/centos/bin --enable-gpl --enable-libfdk_aac --enable-libfreetype --enable-libmp3lame --enable-libvpx --enable-libx264 --enable-nonfree
libavutil 56. 19.101 / 56. 19.101
libavcodec 58. 32.100 / 58. 32.100
libavformat 58. 18.104 / 58. 18.104
libavdevice 58. 4.105 / 58. 4.105
libavfilter 7. 33.100 / 7. 33.100
libswscale 5. 2.100 / 5. 2.100
libswresample 3. 2.100 / 3. 2.100
libpostproc 55. 2.100 / 55. 2.100
[png_pipe @ 0x7f85a5b6c740] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, png_pipe, from '/tmp/01.png':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: png, rgba(pc), 3360x2100 [SAR 5669:5669 DAR 8:5], 25 tbr, 25 tbn, 25 tbc
[mp3 @ 0x7f85a5b6f300] Estimating duration from bitrate, this may be inaccurate
Input #1, mp3, from '/tmp/audio_123e4567-e89b-12d3-a456-426655440000.mp3':
Metadata:
encoder : Lavf57.71.100
Duration: 00:00:05.38, start: 0.000000, bitrate: 48 kb/s
Stream #1:0: Audio: mp3, 22050 Hz, mono, fltp, 48 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (mp3 (mp3float) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x7f85a5b84880] using SAR=1/1
[libx264 @ 0x7f85a5b84880] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x7f85a5b84880] profile High, level 5.1, 4:2:0, 8-bit
[libx264 @ 0x7f85a5b84880] 264 - core 157 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:-3:-3 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=2.00:0.70 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=3 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=18.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.20
Output #0, mp4, to '/tmp/01.mp4':
Metadata:
encoder : Lavf58.18.104
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p(progressive), 3360x2100 [SAR 1:1 DAR 8:5], q=-1--1, 25 fps, 12800 tbn, 25 tbc
Metadata:
encoder : Lavc58.32.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), 22050 Hz, mono, fltp, 69 kb/s
Metadata:
encoder : Lavc58.32.100 aac
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= 24 fps= 11 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x 
frame= 30 fps= 11 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x 
frame= 36 fps= 11 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x 
frame= 42 fps= 11 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x 
frame= 47 fps=9.6 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x 
frame= 48 fps=7.9 q=23.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x 
frame= 51 fps=7.7 q=23.0 size= 1536kB time=00:00:00.04 bitrate=270958.1kbits/s speed=0.00697x 
frame= 51 fps=7.1 q=23.0 size= 1536kB time=00:00:00.04 bitrate=270958.1kbits/s speed=0.00645x 
frame= 53 fps=6.7 q=23.0 size= 1536kB time=00:00:00.13 bitrate=90319.4kbits/s speed=0.0176x 
frame= 55 fps=6.5 q=23.0 size= 1536kB time=00:00:00.23 bitrate=54191.6kbits/s speed=0.0273x 
frame= 57 fps=6.0 q=23.0 size= 1536kB time=00:00:00.32 bitrate=38708.4kbits/s speed=0.0344x 
frame= 60 fps=5.7 q=23.0 size= 1792kB time=00:00:00.41 bitrate=35124.1kbits/s speed=0.0397x 
frame= 62 fps=5.6 q=23.0 size= 1792kB time=00:00:00.55 bitrate=26343.1kbits/s speed=0.0505x 
frame= 64 fps=5.5 q=23.0 size= 1792kB time=00:00:00.60 bitrate=24316.7kbits/s speed=0.0522x 
frame= 66 fps=5.4 q=23.0 size= 1792kB time=00:00:00.65 bitrate=22579.8kbits/s speed=0.0532x 
frame= 67 fps=5.2 q=23.0 size= 1792kB time=00:00:00.74 bitrate=19757.3kbits/s speed=0.0582x 
frame= 69 fps=5.1 q=23.0 size= 1792kB time=00:00:00.78 bitrate=18595.1kbits/s speed=0.0579x 
frame= 71 fps=5.0 q=23.0 size= 1792kB time=00:00:00.88 bitrate=16637.7kbits/s speed=0.0616x 
frame= 73 fps=4.9 q=23.0 size= 1792kB time=00:00:00.92 bitrate=15805.9kbits/s speed=0.0627x 
frame= 75 fps=4.8 q=23.0 size= 2048kB time=00:00:01.02 bitrate=16421.6kbits/s speed=0.0654x 
frame= 77 fps=4.7 q=23.0 size= 2048kB time=00:00:01.16 bitrate=14451.0kbits/s speed=0.0709x 
frame= 80 fps=4.7 q=23.0 size= 2048kB time=00:00:01.20 bitrate=13895.2kbits/s speed=0.0713x 
frame= 81 fps=4.6 q=23.0 size= 2048kB time=00:00:01.25 bitrate=13380.6kbits/s speed=0.0707x 
frame= 83 fps=4.5 q=23.0 size= 2048kB time=00:00:01.39 bitrate=12042.5kbits/s speed=0.0757x 
frame= 85 fps=4.4 q=23.0 size= 2048kB time=00:00:01.43 bitrate=11654.0kbits/s speed=0.0748x 
frame= 88 fps=4.4 q=23.0 size= 2048kB time=00:00:01.53 bitrate=10947.7kbits/s speed=0.0771x 
frame= 89 fps=4.3 q=23.0 size= 2048kB time=00:00:01.57 bitrate=10625.7kbits/s speed=0.0764x 
frame= 92 fps=4.2 q=23.0 size= 2048kB time=00:00:01.71 bitrate=9764.2kbits/s speed=0.0789x 
frame= 95 fps=4.3 q=23.0 size= 2048kB time=00:00:01.81 bitrate=9263.5kbits/s speed=0.0811x 
frame= 96 fps=4.2 q=23.0 size= 2048kB time=00:00:01.85 bitrate=9031.9kbits/s speed=0.0809x 
frame= 97 fps=4.1 q=23.0 size= 2048kB time=00:00:01.90 bitrate=8811.6kbits/s speed=0.0811x 
frame= 99 fps=4.1 q=23.0 size= 2304kB time=00:00:01.99 bitrate=9452.0kbits/s speed=0.0831x 
frame= 102 fps=4.1 q=23.0 size= 2304kB time=00:00:02.08 bitrate=9031.9kbits/s speed=0.0849x 
frame= 102 fps=4.1 q=23.0 size= 2304kB time=00:00:02.08 bitrate=9031.9kbits/s speed=0.0831x 
frame= 104 fps=4.1 q=23.0 size= 2304kB time=00:00:02.22 bitrate=8467.4kbits/s speed=0.0868x 
frame= 106 fps=4.0 q=23.0 size= 2304kB time=00:00:02.27 bitrate=8294.6kbits/s speed=0.0859x 
frame= 109 fps=4.0 q=23.0 size= 2304kB time=00:00:02.36 bitrate=7969.3kbits/s speed=0.0873x 
frame= 109 fps=3.9 q=23.0 size= 2304kB time=00:00:02.41 bitrate=7816.0kbits/s speed=0.0872x 
frame= 112 fps=3.9 q=23.0 size= 2304kB time=00:00:02.50 bitrate=7526.6kbits/s speed=0.0877x 
frame= 114 fps=3.9 q=23.0 size= 2304kB time=00:00:02.64 bitrate=7130.4kbits/s speed=0.0904x 
frame= 117 fps=3.8 q=23.0 size= 2304kB time=00:00:02.69 bitrate=7007.5kbits/s speed=0.0884x 
frame= 119 fps=3.8 q=23.0 size= 2560kB time=00:00:02.83 bitrate=7403.2kbits/s speed=0.0913x 
frame= 120 fps=3.8 q=23.0 size= 2560kB time=00:00:02.83 bitrate=7403.2kbits/s speed=0.0898x 
frame= 122 fps=3.8 q=23.0 size= 2560kB time=00:00:02.92 bitrate=7168.1kbits/s speed=0.0913x 
frame= 124 fps=3.8 q=23.0 size= 2560kB time=00:00:02.97 bitrate=7056.1kbits/s speed=0.0911x 
frame= 125 fps=3.8 q=23.0 size= 2560kB time=00:00:03.06 bitrate=6842.3kbits/s speed=0.0924x 
frame= 127 fps=3.8 q=23.0 size= 2560kB time=00:00:03.11 bitrate=6740.2kbits/s speed=0.0923x 
frame= 128 fps=3.7 q=23.0 size= 2560kB time=00:00:03.15 bitrate=6641.1kbits/s speed=0.0919x 
frame= 131 fps=3.7 q=23.0 size= 2560kB time=00:00:03.25 bitrate=6451.3kbits/s speed=0.0923x 
frame= 133 fps=3.7 q=23.0 size= 2560kB time=00:00:03.34 bitrate=6272.1kbits/s speed=0.0929x 
frame= 135 fps=3.7 q=23.0 size= 2560kB time=00:00:03.48 bitrate=6021.2kbits/s speed=0.0954x 
frame= 138 fps=3.7 q=23.0 size= 2560kB time=00:00:03.52 bitrate=5942.0kbits/s speed=0.0945x 
frame= 139 fps=3.6 q=23.0 size= 2816kB time=00:00:03.57 bitrate=6451.3kbits/s speed=0.0937x 
frame= 142 fps=3.6 q=23.0 size= 2816kB time=00:00:03.71 bitrate=6209.4kbits/s speed=0.0951x 
frame= 145 fps=3.7 q=23.0 size= 2816kB time=00:00:03.80 bitrate=6057.9kbits/s speed=0.096x 
frame= 145 fps=3.6 q=23.0 size= 2816kB time=00:00:03.80 bitrate=6057.9kbits/s speed=0.0948x 
frame= 148 fps=3.6 q=23.0 size= 2816kB time=00:00:03.94 bitrate=5844.1kbits/s speed=0.0957x 
frame= 152 fps=3.6 q=23.0 size= 2816kB time=00:00:04.08 bitrate=5644.9kbits/s speed=0.0967x 
frame= 153 fps=3.6 q=23.0 size= 2816kB time=00:00:04.13 bitrate=5581.5kbits/s speed=0.0961x 
frame= 156 fps=3.5 q=23.0 size= 2816kB time=00:00:04.31 bitrate=5341.4kbits/s speed=0.0979x 
frame= 160 fps=3.6 q=23.0 size= 2816kB time=00:00:04.41 bitrate=5229.0kbits/s speed=0.0983x 
frame= 161 fps=3.5 q=23.0 size= 3072kB time=00:00:04.50 bitrate=5586.7kbits/s speed=0.0987x 
frame= 163 fps=3.5 q=23.0 size= 3072kB time=00:00:04.55 bitrate=5529.7kbits/s speed=0.0983x 
frame= 165 fps=3.5 q=23.0 size= 3072kB time=00:00:04.64 bitrate=5419.1kbits/s speed=0.0984x 
frame= 168 fps=3.5 q=23.0 size= 3072kB time=00:00:04.73 bitrate=5312.8kbits/s speed=0.0982x 
frame= 170 fps=3.5 q=23.0 size= 3072kB time=00:00:04.82 bitrate=5210.7kbits/s speed=0.0989x 
frame= 172 fps=3.5 q=23.0 size= 3072kB time=00:00:04.92 bitrate=5112.4kbits/s speed=0.0995x 
frame= 174 fps=3.5 q=23.0 size= 3072kB time=00:00:04.96 bitrate=5064.6kbits/s speed=0.0991x 
frame= 176 fps=3.5 q=23.0 size= 3072kB time=00:00:05.06 bitrate=4971.6kbits/s speed=0.0993x 
frame= 178 fps=3.4 q=23.0 size= 3072kB time=00:00:05.15 bitrate=4882.1kbits/s speed=0.0998x 
frame= 181 fps=3.4 q=23.0 size= 3072kB time=00:00:05.24 bitrate=4795.7kbits/s speed=0.0995x 
frame= 182 fps=2.9 q=-1.0 Lsize= 3597kB time=00:00:07.16 bitrate=4115.3kbits/s speed=0.113x 
video:3543kB audio:49kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.148349%
[libx264 @ 0x7f85a5b84880] frame I:1 Avg QP: 7.45 size:1298948
[libx264 @ 0x7f85a5b84880] frame P:46 Avg QP: 8.09 size: 44457
[libx264 @ 0x7f85a5b84880] frame B:135 Avg QP:17.27 size: 2100
[libx264 @ 0x7f85a5b84880] consecutive B-frames: 1.1% 0.0% 0.0% 98.9%
[libx264 @ 0x7f85a5b84880] mb I I16..4: 24.5% 22.8% 52.6%
[libx264 @ 0x7f85a5b84880] mb P I16..4: 0.0% 0.0% 0.0% P16..4: 15.2% 0.1% 0.7% 0.0% 0.0% skip:84.0%
[libx264 @ 0x7f85a5b84880] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 11.9% 0.0% 0.0% direct: 0.0% skip:88.1% L0:69.1% L1:30.8% BI: 0.0%
[libx264 @ 0x7f85a5b84880] 8x8 transform intra:23.0% inter:72.2%
[libx264 @ 0x7f85a5b84880] coded y,uvDC,uvAC intra: 97.3% 2.2% 1.9% inter: 2.9% 0.0% 0.0%
[libx264 @ 0x7f85a5b84880] i16 v,h,dc,p: 1% 5% 83% 11%
[libx264 @ 0x7f85a5b84880] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 11% 12% 39% 7% 6% 6% 4% 6% 9%
[libx264 @ 0x7f85a5b84880] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 14% 12% 21% 10% 10% 8% 7% 7% 9%
[libx264 @ 0x7f85a5b84880] i8c dc,h,v,p: 96% 3% 0% 0%
[libx264 @ 0x7f85a5b84880] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x7f85a5b84880] ref P L0: 47.1% 0.0% 52.2% 0.7%
[libx264 @ 0x7f85a5b84880] ref B L0: 55.4% 44.4% 0.2%
[libx264 @ 0x7f85a5b84880] ref B L1: 98.6% 1.4%
[libx264 @ 0x7f85a5b84880] kb/s:3986.16
[aac @ 0x7f85a5b95f40] Qavg: 2267.321


    



    2B-

    



        ffmpeg version N-92107-g4901fa1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-23)
configuration: --prefix=/home/centos/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/centos/ffmpeg_build/include --extra-ldflags=-L/home/centos/ffmpeg_build/lib --extra-libs=-lpthread --extra-libs=-lm --bindir=/home/centos/bin --enable-gpl --enable-libfdk_aac --enable-libfreetype --enable-libmp3lame --enable-libvpx --enable-libx264 --enable-nonfree
libavutil 56. 19.101 / 56. 19.101
libavcodec 58. 32.100 / 58. 32.100
libavformat 58. 18.104 / 58. 18.104
libavdevice 58. 4.105 / 58. 4.105
libavfilter 7. 33.100 / 7. 33.100
libswscale 5. 2.100 / 5. 2.100
libswresample 3. 2.100 / 3. 2.100
libpostproc 55. 2.100 / 55. 2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/01.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.18.104
Duration: 00:00:07.28, start: 0.000000, bitrate: 4047 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 3360x2100 [SAR 1:1 DAR 8:5], 3986 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, mono, fltp, 73 kb/s (default)
Metadata:
handler_name : SoundHandler
Input #1, png_pipe, from '/tmp/square.png':
Duration: N/A, bitrate: N/A
Stream #1:0: Video: png, rgba(pc), 90x90 [SAR 1:1 DAR 1:1], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
Stream #0:0 (h264) -> overlay:main
Stream #1:0 (png) -> overlay:overlay
overlay -> Stream #0:0 (libx264)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[h264 @ 0x7f39d841d7c0] Invalid NAL unit size (2944577 > 11502).
[h264 @ 0x7f39d841d7c0] Error splitting the input into NAL units.
[h264 @ 0x7f39d8379a00] concealing 24601 DC, 24601 AC, 24601 MV errors in P frame
[h264 @ 0x7f39d839eec0] Invalid NAL unit size (1049345 > 4099).
[h264 @ 0x7f39d839eec0] Error splitting the input into NAL units.
Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x7f39d8379a00] Invalid NAL unit size (127861151 > 1951).
[h264 @ 0x7f39d8379a00] Error splitting the input into NAL units.
Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x7f39d841d7c0] Invalid NAL unit size (-1415429733 > 43938).
[h264 @ 0x7f39d841d7c0] Error splitting the input into NAL units.
Error while decoding stream #0:0: Invalid data found when processing input
Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x7f39d8379a00] Invalid NAL unit size (-1582612070 > 41387).
[h264 @ 0x7f39d8379a00] Error splitting the input into NAL units.
Error while decoding stream #0:0: Invalid data found when processing input
**** lots of the same NAL issue ****
Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x7f39d839eec0] Invalid NAL unit size (128188831 > 1956).
[h264 @ 0x7f39d839eec0] Error splitting the input into NAL units.
Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x7f39d8379a00] Invalid NAL unit size (13779355 > 210).
[h264 @ 0x7f39d8379a00] Error splitting the input into NAL units.
Error while decoding stream #0:0: Invalid data found when processing input
Last message repeated 1 times
[libx264 @ 0x7f39d838df00] using SAR=1/1
[libx264 @ 0x7f39d838df00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x7f39d838df00] profile High, level 5.1, 4:2:0, 8-bit
[libx264 @ 0x7f39d838df00] 264 - core 157 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=3 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/temp.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.18.104
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 3360x2100 [SAR 1:1 DAR 8:5], q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
Metadata:
encoder : Lavc58.32.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, mono, fltp, 73 kb/s (default)
Metadata:
handler_name : SoundHandler
frame= 5 fps=3.2 q=-1.0 Lsize= 360kB time=00:00:05.34 bitrate= 552.0kbits/s dup=3 drop=0 speed=3.44x 
video:309kB audio:49kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.543219%
[libx264 @ 0x7f39d838df00] frame I:1 Avg QP:19.79 size:301308
[libx264 @ 0x7f39d838df00] frame P:1 Avg QP:27.65 size: 4760
[libx264 @ 0x7f39d838df00] frame B:3 Avg QP:23.24 size: 3347
[libx264 @ 0x7f39d838df00] consecutive B-frames: 20.0% 0.0% 0.0% 80.0%
[libx264 @ 0x7f39d838df00] mb I I16..4: 2.3% 82.9% 14.8%
[libx264 @ 0x7f39d838df00] mb P I16..4: 0.1% 0.0% 0.0% P16..4: 5.6% 0.2% 4.5% 0.0% 0.0% skip:89.4%
[libx264 @ 0x7f39d838df00] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 16.0% 0.0% 0.0% direct: 0.0% skip:84.0% L0:13.4% L1:86.6% BI: 0.0%
[libx264 @ 0x7f39d838df00] 8x8 transform intra:82.8% inter:92.8%
[libx264 @ 0x7f39d838df00] coded y,uvDC,uvAC intra: 92.0% 1.6% 1.2% inter: 0.6% 0.0% 0.0%
[libx264 @ 0x7f39d838df00] i16 v,h,dc,p: 18% 72% 4% 6%
[libx264 @ 0x7f39d838df00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10% 9% 49% 6% 6% 5% 4% 5% 6%
[libx264 @ 0x7f39d838df00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 14% 26% 9% 10% 7% 6% 5% 5%
[libx264 @ 0x7f39d838df00] i8c dc,h,v,p: 96% 3% 1% 0%
[libx264 @ 0x7f39d838df00] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x7f39d838df00] ref B L0: 99.8% 0.2%
[libx264 @ 0x7f39d838df00] ref B L1: 91.7% 8.3%
[libx264 @ 0x7f39d838df00] kb/s:12644.32
Conversion failed!


    


  • Wrong video duration when recording with ffmpeg

    4 octobre 2018, par lulas

    I am trying to record a H264 video using ffmpeg.

    In order to do this, I am grabbing frames from a video source and pushing them into a pipe that FFmpeg reads from and afterwards writes to a file.

    My problem is that when I record a 10 second video, the file contains the full video sped up, being the final duration 3 seconds...

    I believe the problem I am having might be related with the frame rate, since I am saying to record with 30 FPS, but I can only provide 10 FPS.

    These are the options I use with FFmpeg :

    -thread_queue_size 512 -framerate 30 -f rawvideo -pix_fmt rgb32 -video_size 1920x1080 -i \.\pipe\pipe_name -vcodec libx264 -crf 23 -pix_fmt yuv420p -preset ultrafast -r 30 "output.mp4"

    And these are the FFmpeg logs :

    2018-10-04 15:56:11.9342 | INFO  | ffmpeg version N-91715-gd71dfc087b Copyright (c) 2000-2018 the FFmpeg developers
    2018-10-04 15:56:11.9402 | INFO  |   built with gcc 8.2.1 (GCC) 20180813
    2018-10-04 15:56:11.9402 | INFO  |   configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --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
    2018-10-04 15:56:11.9402 | INFO  |   libavutil      56. 19.100 / 56. 19.100
    2018-10-04 15:56:11.9542 | INFO  |   libavcodec     58. 27.100 / 58. 27.100
    2018-10-04 15:56:11.9542 | INFO  |   libavformat    58. 17.103 / 58. 17.103
    2018-10-04 15:56:11.9728 | INFO  |   libavdevice    58.  4.101 / 58.  4.101
    2018-10-04 15:56:11.9728 | INFO  |   libavfilter     7. 26.100 /  7. 26.100
    2018-10-04 15:56:11.9999 | INFO  |   libswscale      5.  2.100 /  5.  2.100
    2018-10-04 15:56:12.0239 | INFO  |   libswresample   3.  2.100 /  3.  2.100
    2018-10-04 15:56:12.0239 | INFO  |   libpostproc    55.  2.100 / 55.  2.100
    2018-10-04 15:56:12.0350 | INFO  | Input #0, rawvideo, from '\\.\pipe\pipe_name':
    2018-10-04 15:56:12.0350 | INFO  |   Duration: N/A, start: 0.000000, bitrate: 1990656 kb/s
    2018-10-04 15:56:12.0350 | INFO  |     Stream #0:0: Video: rawvideo (BGRA / 0x41524742), bgra, 1920x1080, 1990656 kb/s, 30 tbr, 30 tbn, 30 tbc
    2018-10-04 15:56:12.0481 | INFO  | Stream mapping:
    2018-10-04 15:56:12.0481 | INFO  |   Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
    2018-10-04 15:56:12.0691 | INFO  | Press [q] to stop, [?] for help
    2018-10-04 15:56:12.0881 | INFO  | [libx264 @ 000001bceea618c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
    2018-10-04 15:56:12.0881 | INFO  | [libx264 @ 000001bceea618c0] profile Constrained Baseline, level 4.0, 4:2:0, 8-bit
    2018-10-04 15:56:12.0951 | INFO  | [libx264 @ 000001bceea618c0] 264 - core 157 r2932 303c484 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=30.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0
    2018-10-04 15:56:12.0951 | INFO  | Output #0, mp4, to 'output.mp4':
    2018-10-04 15:56:12.0951 | INFO  |   Metadata:
    2018-10-04 15:56:12.0951 | INFO  |     encoder         : Lavf58.17.103
    2018-10-04 15:56:12.0951 | INFO  |     Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1920x1080, q=-1--1, 30 fps, 15360 tbn, 30 tbc
    2018-10-04 15:56:12.1171 | INFO  |     Metadata:
    2018-10-04 15:56:12.1171 | INFO  |       encoder         : Lavc58.27.100 libx264
    2018-10-04 15:56:12.1531 | INFO  |     Side data:
    2018-10-04 15:56:12.1691 | INFO  |       cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    2018-10-04 15:56:12.8750 | INFO  | frame=    8 fps=0.0 q=31.0 size=       0kB time=00:00:00.00 bitrate=5907.7kbits/s speed=0.000121x    
    2018-10-04 15:56:13.3238 | INFO  | frame=   11 fps=9.9 q=31.0 size=       0kB time=00:00:00.10 bitrate=   3.8kbits/s speed=0.0904x    
    2018-10-04 15:56:13.7782 | INFO  | frame=   16 fps=9.5 q=31.0 size=       0kB time=00:00:00.26 bitrate=   1.4kbits/s speed=0.159x    
    2018-10-04 15:56:14.2346 | INFO  | frame=   21 fps=9.5 q=31.0 size=       0kB time=00:00:00.43 bitrate=   0.9kbits/s speed=0.197x    
    2018-10-04 15:56:14.8011 | INFO  | frame=   27 fps=9.7 q=31.0 size=       0kB time=00:00:00.63 bitrate=   0.6kbits/s speed=0.229x    
    2018-10-04 15:56:15.4266 | INFO  | frame=   33 fps=9.7 q=32.0 size=       0kB time=00:00:00.83 bitrate=   0.5kbits/s speed=0.246x    
    2018-10-04 15:56:16.0827 | INFO  | frame=   39 fps=9.6 q=31.0 size=     256kB time=00:00:01.03 bitrate=2029.7kbits/s speed=0.255x    
    2018-10-04 15:56:16.7291 | INFO  | frame=   47 fps= 10 q=31.0 size=     256kB time=00:00:01.30 bitrate=1613.4kbits/s speed=0.277x    
    2018-10-04 15:56:17.4279 | INFO  | frame=   54 fps= 10 q=31.0 size=     256kB time=00:00:01.53 bitrate=1367.9kbits/s speed=0.284x    
    2018-10-04 15:56:18.0562 | INFO  | frame=   61 fps= 10 q=31.0 size=     512kB time=00:00:01.76 bitrate=2374.3kbits/s speed=0.298x    
    2018-10-04 15:56:18.5401 | INFO  | frame=   64 fps=9.9 q=31.0 size=     512kB time=00:00:01.86 bitrate=2247.1kbits/s speed=0.287x    
    2018-10-04 15:56:19.2106 | INFO  | frame=   70 fps=9.9 q=32.0 size=     512kB time=00:00:02.06 bitrate=2029.6kbits/s speed=0.293x    
    2018-10-04 15:56:19.6653 | INFO  | frame=   75 fps=9.9 q=31.0 size=     512kB time=00:00:02.23 bitrate=1878.2kbits/s speed=0.294x    
    2018-10-04 15:56:20.1512 | INFO  | frame=   78 fps=9.6 q=31.0 size=     512kB time=00:00:02.33 bitrate=1797.7kbits/s speed=0.287x    
    2018-10-04 15:56:21.0577 | INFO  | frame=   84 fps=9.3 q=31.0 size=     768kB time=00:00:02.53 bitrate=2483.6kbits/s speed=0.281x    
    2018-10-04 15:56:21.6416 | INFO  | frame=   91 fps=9.5 q=31.0 size=     768kB time=00:00:02.76 bitrate=2274.1kbits/s speed=0.29x    
    2018-10-04 15:56:22.1779 | INFO  | frame=   97 fps=9.6 q=31.0 size=     768kB time=00:00:02.96 bitrate=2120.8kbits/s speed=0.295x    
    2018-10-04 15:56:22.6571 | INFO  | frame=  101 fps=9.5 q=-1.0 Lsize=    1015kB time=00:00:03.33 bitrate=2495.6kbits/s speed=0.313x    
    2018-10-04 15:56:22.6571 | INFO  | video:1014kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.117556%
    2018-10-04 15:56:22.6571 | INFO  | [libx264 @ 000001bceea618c0] frame I:1     Avg QP:27.00  size: 60682
    2018-10-04 15:56:22.6571 | INFO  | [libx264 @ 000001bceea618c0] frame P:100   Avg QP:31.09  size:  9774
    2018-10-04 15:56:22.6571 | INFO  | [libx264 @ 000001bceea618c0] mb I  I16..4: 100.0%  0.0%  0.0%
    2018-10-04 15:56:22.6736 | INFO  | [libx264 @ 000001bceea618c0] mb P  I16..4: 10.6%  0.0%  0.0%  P16..4: 15.2%  0.0%  0.0%  0.0%  0.0%    skip:74.3%
    2018-10-04 15:56:22.6736 | INFO  | [libx264 @ 000001bceea618c0] coded y,uvDC,uvAC intra: 15.8% 24.4% 1.4% inter: 4.8% 6.8% 0.0%
    2018-10-04 15:56:22.6736 | INFO  | [libx264 @ 000001bceea618c0] i16 v,h,dc,p: 39% 20% 15% 26%
    2018-10-04 15:56:22.6736 | INFO  | [libx264 @ 000001bceea618c0] i8c dc,h,v,p: 54% 19% 20%  7%
    2018-10-04 15:56:22.6896 | INFO  | [libx264 @ 000001bceea618c0] kb/s:2466.66

    So, through the logs I can see that I provided around 100 frames in 10 seconds, but FFmpeg wrote all those 100 frames in 3 seconds...

    What can I do to write the 100 frames spread in the 10 seconds ?

    I looked into a FFmpeg option called -vsync, but haven’t had any success with it.

  • Ruby on Rails - Paperclip - ffmpeg - throws error when adding style to "has_attached_file"

    4 octobre 2018, par TamerB

    I’m working on image and video upload in a rails app using paperclip and ffmpeg.

    The following code in models/image.rb is working fine :

    has_attached_file :image,
    processors: [:ffmpeg]
    validates_attachment_content_type :image, content_type: /.*/

    But, when I add styling to the code as follows, it throws an error on (page loading) :

    has_attached_file :image, styles: lambda {|a| if a.instance.is_image? then {original: {}, medium: "300x300>"} end},
    processors: [:ffmpeg]
    validates_attachment_content_type :image, content_type: /.*/

    def is_image?
     return false unless @attachment_image.content_type
     ['image/jpeg', 'image/pjpeg', 'image/gif', 'image/png', 'image/x-png', 'image/jpg'].include?(@attachment_image.content_type)
    end

    The error is as follows :

    F, [2018-10-04T15:04:47.381706 #9836] FATAL -- : [643e7428-d41e-4000-9a48-566d85e7b109]  
    F, [2018-10-04T15:04:47.381906 #9836] FATAL -- : [643e7428-d41e-4000-9a48-566d85e7b109] ActionView::Template::Error (undefined method `each_pair' for nil:NilClass):
    F, [2018-10-04T15:04:47.382186 #9836] FATAL -- : [643e7428-d41e-4000-9a48-566d85e7b109]     1: insert_tag renderer_for(:show)
    F, [2018-10-04T15:04:47.382345 #9836] FATAL -- : [643e7428-d41e-4000-9a48-566d85e7b109]  
    F, [2018-10-04T15:04:47.382441 #9836] FATAL -- : [643e7428-d41e-4000-9a48-566d85e7b109] app/admin/resorts.rb:46:in `block (5 levels) in <top>'
    </top>

    How can I solve this ?

    Update

    This error is displayed only when trying to upload a video or or trying to load a page containing a video.

    The code in pp/admin/resorts.rb mentioned in the error message is the following (I’m using activeadmin gem) :

    if im.itype == 'video-slider' then
       video_tag im.image, class: 'my_image_size' # line 46
    else
       image_tag im.image, class: 'my_image_size'
    end

    When trying to upload an image, the error changed to be as follows () :

    Input #0, image2, from '/tmp/dcdc7c452102ec2b9255973f59b40ee320181004-23173-fx7vzi.jpg':
    Duration: 00:00:00.04, start: 0.000000, bitrate: 35614 kb/s
    Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1920x1080, 25 tbr, 25 tbn, 25 tbc
    [NULL @ 0x564aeb7df580] Unable to find a suitable output format for '/tmp/dcdc7c452102ec2b9255973f59b40ee320181004-23173-fx7vzi20181004-23173-zurkvx'
    /tmp/dcdc7c452102ec2b9255973f59b40ee320181004-23173-fx7vzi20181004-23173-zurkvx: Invalid argument
    ):
    F, [2018-10-04T19:13:02.028565 #23173] FATAL -- : [c267e57b-7e06-4624-be1c-0d9aa4b71e00]  
    F, [2018-10-04T19:13:02.028730 #23173] FATAL -- : [c267e57b-7e06-4624-be1c-0d9aa4b71e00] paperclip-ffmpeg (1.2.0) lib/paperclip_processors/ffmpeg.rb:175:in `rescue in make'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] paperclip-ffmpeg (1.2.0) lib/paperclip_processors/ffmpeg.rb:171:in `make'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] paperclip (5.2.1) lib/paperclip/processor.rb:34:in `make'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] paperclip (5.2.1) lib/paperclip/attachment.rb:533:in `block in post_process_style'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] paperclip (5.2.1) lib/paperclip/attachment.rb:532:in `each'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] paperclip (5.2.1) lib/paperclip/attachment.rb:532:in `reduce'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] paperclip (5.2.1) lib/paperclip/attachment.rb:532:in `post_process_style'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] paperclip (5.2.1) lib/paperclip/attachment.rb:519:in `post_process_styles'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] paperclip (5.2.1) lib/paperclip/attachment.rb:512:in `block (2 levels) in post_process'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] activesupport (5.1.5) lib/active_support/callbacks.rb:131:in `run_callbacks'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] paperclip (5.2.1) lib/paperclip/callbacks.rb:38:in `run_paperclip_callbacks'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] paperclip (5.2.1) lib/paperclip/attachment.rb:510:in `block in post_process'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] activesupport (5.1.5) lib/active_support/callbacks.rb:97:in `run_callbacks'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] paperclip (5.2.1) lib/paperclip/callbacks.rb:38:in `run_paperclip_callbacks'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] paperclip (5.2.1) lib/paperclip/attachment.rb:509:in `post_process'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] paperclip (5.2.1) lib/paperclip/attachment.rb:465:in `post_process_file'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] paperclip (5.2.1) lib/paperclip/attachment.rb:113:in `assign'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] paperclip (5.2.1) lib/paperclip/has_attached_file.rb:66:in `block in define_setter'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] activemodel (5.1.5) lib/active_model/attribute_assignment.rb:46:in `public_send'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] activemodel (5.1.5) lib/active_model/attribute_assignment.rb:46:in `_assign_attribute'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] activemodel (5.1.5) lib/active_model/attribute_assignment.rb:40:in `block in _assign_attributes'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] activemodel (5.1.5) lib/active_model/attribute_assignment.rb:39:in `each'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] activemodel (5.1.5) lib/active_model/attribute_assignment.rb:39:in `_assign_attributes'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] activerecord (5.1.5) lib/active_record/attribute_assignment.rb:26:in `_assign_attributes'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] activemodel (5.1.5) lib/active_model/attribute_assignment.rb:33:in `assign_attributes'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] activerecord (5.1.5) lib/active_record/core.rb:337:in `initialize'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] activerecord (5.1.5) lib/active_record/inheritance.rb:66:in `new'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] activerecord (5.1.5) lib/active_record/inheritance.rb:66:in `new'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] activeadmin (1.1.0) lib/active_admin/resource_controller/data_access.rb:130:in `build_new_resource'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] activeadmin (1.1.0) lib/active_admin/resource_controller/data_access.rb:116:in `build_resource'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] inherited_resources (1.8.0) lib/inherited_resources/actions.rb:31:in `create'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] actionpack (5.1.5) lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] actionpack (5.1.5) lib/abstract_controller/base.rb:186:in `process_action'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] actionpack (5.1.5) lib/action_controller/metal/rendering.rb:30:in `process_action'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] actionpack (5.1.5) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] activesupport (5.1.5) lib/active_support/callbacks.rb:131:in `run_callbacks'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] actionpack (5.1.5) lib/abstract_controller/callbacks.rb:19:in `process_action'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] actionpack (5.1.5) lib/action_controller/metal/rescue.rb:20:in `process_action'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] actionpack (5.1.5) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] activesupport (5.1.5) lib/active_support/notifications.rb:166:in `block in instrument'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] activesupport (5.1.5) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] activesupport (5.1.5) lib/active_support/notifications.rb:166:in `instrument'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] actionpack (5.1.5) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] actionpack (5.1.5) lib/action_controller/metal/params_wrapper.rb:252:in `process_action'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] searchkick (3.0.0) lib/searchkick/logging.rb:209:in `process_action'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] activerecord (5.1.5) lib/active_record/railties/controller_runtime.rb:22:in `process_action'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] actionpack (5.1.5) lib/abstract_controller/base.rb:124:in `process'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] actionview (5.1.5) lib/action_view/rendering.rb:30:in `process'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] actionpack (5.1.5) lib/action_controller/metal.rb:189:in `dispatch'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] actionpack (5.1.5) lib/action_controller/metal.rb:253:in `dispatch'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] actionpack (5.1.5) lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] actionpack (5.1.5) lib/action_dispatch/routing/route_set.rb:31:in `serve'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] actionpack (5.1.5) lib/action_dispatch/journey/router.rb:50:in `block in serve'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] actionpack (5.1.5) lib/action_dispatch/journey/router.rb:33:in `each'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] actionpack (5.1.5) lib/action_dispatch/journey/router.rb:33:in `serve'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] actionpack (5.1.5) lib/action_dispatch/routing/route_set.rb:844:in `call'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] omniauth (1.8.1) lib/omniauth/strategy.rb:190:in `call!'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] omniauth (1.8.1) lib/omniauth/strategy.rb:168:in `call'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] omniauth (1.8.1) lib/omniauth/strategy.rb:190:in `call!'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] omniauth (1.8.1) lib/omniauth/strategy.rb:168:in `call'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] omniauth (1.8.1) lib/omniauth/strategy.rb:190:in `call!'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] omniauth (1.8.1) lib/omniauth/strategy.rb:168:in `call'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] warden (1.2.7) lib/warden/manager.rb:36:in `block in call'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] warden (1.2.7) lib/warden/manager.rb:35:in `catch'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] warden (1.2.7) lib/warden/manager.rb:35:in `call'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] rack (2.0.5) lib/rack/etag.rb:25:in `call'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] rack (2.0.5) lib/rack/conditional_get.rb:38:in `call'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] rack (2.0.5) lib/rack/head.rb:12:in `call'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] rack (2.0.5) lib/rack/session/abstract/id.rb:232:in `context'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] rack (2.0.5) lib/rack/session/abstract/id.rb:226:in `call'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] actionpack (5.1.5) lib/action_dispatch/middleware/cookies.rb:613:in `call'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] activerecord (5.1.5) lib/active_record/migration.rb:556:in `call'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] actionpack (5.1.5) lib/action_dispatch/middleware/callbacks.rb:26:in `block in call'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] activesupport (5.1.5) lib/active_support/callbacks.rb:97:in `run_callbacks'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] actionpack (5.1.5) lib/action_dispatch/middleware/callbacks.rb:24:in `call'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] actionpack (5.1.5) lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] web-console (3.5.1) lib/web_console/middleware.rb:135:in `call_app'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] web-console (3.5.1) lib/web_console/middleware.rb:28:in `block in call'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] web-console (3.5.1) lib/web_console/middleware.rb:18:in `catch'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] web-console (3.5.1) lib/web_console/middleware.rb:18:in `call'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] actionpack (5.1.5) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] railties (5.1.5) lib/rails/rack/logger.rb:36:in `call_app'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] railties (5.1.5) lib/rails/rack/logger.rb:24:in `block in call'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] activesupport (5.1.5) lib/active_support/tagged_logging.rb:69:in `block in tagged'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] activesupport (5.1.5) lib/active_support/tagged_logging.rb:26:in `tagged'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] activesupport (5.1.5) lib/active_support/tagged_logging.rb:69:in `tagged'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] railties (5.1.5) lib/rails/rack/logger.rb:24:in `call'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] sprockets-rails (3.2.1) lib/sprockets/rails/quiet_assets.rb:13:in `call'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] actionpack (5.1.5) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] request_store (1.4.0) lib/request_store/middleware.rb:19:in `call'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] actionpack (5.1.5) lib/action_dispatch/middleware/request_id.rb:25:in `call'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] rack (2.0.5) lib/rack/method_override.rb:22:in `call'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] rack (2.0.5) lib/rack/runtime.rb:22:in `call'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] activesupport (5.1.5) lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] actionpack (5.1.5) lib/action_dispatch/middleware/executor.rb:12:in `call'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] actionpack (5.1.5) lib/action_dispatch/middleware/static.rb:125:in `call'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] rack (2.0.5) lib/rack/sendfile.rb:111:in `call'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] railties (5.1.5) lib/rails/engine.rb:522:in `call'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] puma (3.11.2) lib/puma/configuration.rb:225:in `call'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] puma (3.11.2) lib/puma/server.rb:624:in `handle_request'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] puma (3.11.2) lib/puma/server.rb:438:in `process_client'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] puma (3.11.2) lib/puma/server.rb:302:in `block in run'
    [c267e57b-7e06-4624-be1c-0d9aa4b71e00] puma (3.11.2) lib/puma/thread_pool.rb:120:in `block in spawn_thread'