Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FFmpeg on aws lambda - Invalid NAL unit size

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!
like image 686
Lina Sharifi Moghaddam Avatar asked Oct 09 '18 15:10

Lina Sharifi Moghaddam


1 Answers

I know that it's been quite some time since this question was asked but maybe it will help somebody anyway. I faced the same problem today with everything working on my mac and this kind of error on Lambda:

Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x61bd180] Invalid NAL unit size (2517825 > 9835).
[h264 @ 0x61bd180] Error splitting the input into NAL units

I added stdin=subprocess.DEVNULL to the subprocess call and videos encode properly now (as suggested by this answer)

like image 173
Franciszek Szombara Avatar answered Sep 21 '22 03:09

Franciszek Szombara