danielpetri1 / bbb-recording-exporter

A client- and server side script to generate BigBlueButton MP4 recordings.
MIT License
103 stars 50 forks source link

Excessive Ram Usage #68

Open gpallaris opened 2 years ago

gpallaris commented 2 years ago

For short recordings it works fine, but for sessions that have a duration more than 30 minutes the system (Ubuntu 18.04) use excessive amount of ram until it crashes.

Any suggestion?

Best G

hostbbb commented 2 years ago

@gpallaris do you have a public html5 playback link to one of the recordings that gives you issues.... we convert 5hr meetings all the time with no issues.. and our 24core ryzen converts 6 concurrently with 32gb ram.

If you provide the link, i will try here is see if we can replicate the error.

gpallaris commented 2 years ago

@hostbbb Stephen thanks for your prompt reply. I restarted the server and Memory usage is normal now during conversion! The cpu usage is a high 60%-65% during a single conversion. Is there a way to lower it down without modifying the ffmpeg?

Current Settings/Logs During Conversion:

/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated /usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:29: warning: constant Gem::ConfigMap is deprecated /usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:30: warning: constant Gem::ConfigMap is deprecated /usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:10: warning: constant Gem::ConfigMap is deprecated ffmpeg version 4.2.4-1ubuntu0.1bbb2~18.04 Copyright (c) 2000-2020 the FFmpeg developers built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04) configuration: --prefix=/usr --extra-version='1ubuntu0.1bbb2~18.04' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-libopus --enable-librsvg --enable-librubberband --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libxml2 --enable-sdl2 --disable-decoders --enable-decoder='aac,ass,bmp,ffv1,ffvhuff,flac,flashsv,flashsv2,flv,gif,h264,huffyuv,libopus,librsvg,libspeex,mjpeg,mp3float,mpeg2video,opus,pcm_f32le,pcm_s16le,pcm_s16le_planar,png,rawvideo,srt,ssa,subrip,vorbis,vp6,vp6a,vp6f,vp8,vp9,webp,webvtt' --disable-encoders --enable-encoder='aac,ass,bmp,ffv1,ffvhuff,flac,flashsv,flashsv2,flv,gif,h264_vaapi,huffyuv,libmp3lame,libopus,libspeex,libvorbis,libvpx_vp8,libvpx_vp9,libx264,libx264rgb,mjpeg,mjpeg_vaapi,mpeg2_vaapi,mpeg2video,pcm_f32le,pcm_s16le,pcm_s16le_planar,png,rawvideo,srt,ssa,subrip,vp8_vaapi,vp9_vaapi,webvtt' --disable-hwaccels --enable-hwaccel='h264_vaapi,h264_vdpau,mjpeg_vaapi,mpeg2_vaapi,mpeg2_vdpau,vp8_vaapi,vp9_vaapi' --disable-parsers --enable-parser='aac,bmp,flac,gif,h264,mjpeg,mpegaudio,mpegvideo,opus,png,vorbis,vp8,vp9' --disable-demuxers --enable-demuxer='aac,alsa,ass,avi,bmp_pipe,caf,concat,dash,ffmetadata,flac,flv,gif,gif_pipe,h264,hls,image2,image2pipe,ivf,jpeg_pipe,kmsgrab,lavfi,matroska,mjpeg,mov,mp3,mpegts,mpegtsraw,nut,ogg,pcm_f32le,pcm_s16le,png_pipe,pulse,rawvideo,rtp,rtsp,srt,swf,w64,wav,webvtt,yuv4mpegpipe' --disable-muxers --enable-muxer='adts,ass,avi,caf,dash,ffmetadata,flac,flv,framecrc,framehash,framemd5,gif,h264,hash,hls,image2,image2pipe,ipod,ivf,matroska,matroska_audio,md5,mjpeg,mkvtimestamp_v2,mov,mp3,mp4,mpeg2video,mpegts,nut,oga,ogg,ogv,opus,pcm_f32le,pcm_s16le,rawvideo,rtp,rtp_mpegts,rtsp,segment,singlejpeg,srt,stream_segment,swf,tee,uncodedframecrc,w64,wav,webm,webm_chunk,webm_dash_manifest,webvtt,yuv4mpegpipe' --disable-protocols --enable-protocol='async,cache,concat,data,file,hls,http,httpproxy,https,icecast,md5,pipe,rtmp,rtmps,rtmpt,rtmpts,rtp,subfile,tcp,tee,tls,udp,unix' --disable-bsfs --enable-bsf='aac_adtstoasc,chomp,filter_units,h264_metadata,h264_mp4toannexb,h264_redundant_pps,mjpeg2jpeg,mpeg2_metadata,noise,null,vp9_metadata,vp9_raw_reorder,vp9_superframe,vp9_superframe_split' --disable-indevs --enable-indev='alsa,lavfi,v4l2,fbdev,xcbgrab,kmsgrab' --disable-outdevs --enable-outdev='alsa,sdl2,xv,fbdev,v4l2' --disable-libdc1394 --enable-libdrm --disable-libiec61883 --disable-chromaprint --disable-frei0r --enable-libx264 --enable-shared libavutil 56. 31.100 / 56. 31.100 libavcodec 58. 54.100 / 58. 54.100 libavformat 58. 29.100 / 58. 29.100 libavdevice 58. 8.100 / 58. 8.100 libavfilter 7. 57.100 / 7. 57.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 5.100 / 5. 5.100 libswresample 3. 5.100 / 3. 5.100 libpostproc 55. 5.100 / 55. 5.100 Input #0, lavfi, from 'color=c=white:s=1920x1080': Duration: N/A, start: 0.000000, bitrate: N/A Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 25 tbr, 25 tbn, 25 tbc Input #1, concat, from '/var/bigbluebutton/published/presentation/1bc38eb4080e0cbdc43a1f1162f3b882e46562d9-1642086003824/timestamps/whiteboard_timestamps': Duration: N/A, start: 0.000000, bitrate: N/A Stream #1:0: Video: svg, bgra, 1600x1080, 25 tbr, 25 tbn, 25 tbc Input #2, image2, from '/var/bigbluebutton/published/presentation/1bc38eb4080e0cbdc43a1f1162f3b882e46562d9-1642086003824/cursor/cursor.svg': Duration: 00:00:00.10, start: 0.000000, bitrate: 5 kb/s Stream #2:0: Video: svg, bgra, 16x16, 10 fps, 10 tbr, 10 tbn, 10 tbc Input #3, image2, from '/var/bigbluebutton/published/presentation/1bc38eb4080e0cbdc43a1f1162f3b882e46562d9-1642086003824/chats/chat.svg': Duration: 00:00:01.00, start: 0.000000, bitrate: 33 kb/s Stream #3:0: Video: svg, bgra, 320x2340, 1 fps, 1 tbr, 1 tbn, 1 tbc Input #4, mov,mp4,m4a,3gp,3g2,mj2, from '/var/bigbluebutton/published/presentation/1bc38eb4080e0cbdc43a1f1162f3b882e46562d9-1642086003824/video/webcams.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf58.29.100 Duration: 03:50:03.14, start: 0.000000, bitrate: 120 kb/s Stream #4:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 50 kb/s, 15 fps, 15 tbr, 15360 tbn, 30 tbc (default) Metadata: handler_name : VideoHandler Stream #4:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 65 kb/s (default) Metadata: handler_name : SoundHandler Input #5, mov,mp4,m4a,3gp,3g2,mj2, from '/var/bigbluebutton/published/presentation/1bc38eb4080e0cbdc43a1f1162f3b882e46562d9-1642086003824/deskshare/deskshare.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf58.29.100 Duration: 03:50:03.20, start: 0.000000, bitrate: 42 kb/s Stream #5:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 41 kb/s, 5 fps, 5 tbr, 10240 tbn, 10 tbc (default) Metadata: handler_name : VideoHandler Stream mapping: Stream #0:0 (rawvideo) -> overlay:main (graph 0) Stream #1:0 (librsvg) -> overlay:overlay (graph 0) Stream #2:0 (librsvg) -> sendcmd (graph 0) Stream #3:0 (librsvg) -> sendcmd (graph 0) Stream #4:0 (h264) -> scale (graph 0) Stream #5:0 (h264) -> scale (graph 0) overlay (graph 0) -> Stream #0:0 (libx264) Stream #4:1 -> #0:1 (aac (native) -> aac (native)) Press [q] to stop, [?] for help [libx264 @ 0x56428d7b7000] using SAR=1/1 [libx264 @ 0x56428d7b7000] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 [libx264 @ 0x56428d7b7000] profile High, level 4.0 [libx264 @ 0x56428d7b7000] 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=4 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 '/var/bigbluebutton/published/presentation/1bc38eb4080e0cbdc43a1f1162f3b882e46562d9-1642086003824/meeting-tmp.mp4': Metadata: title : Meeting 13/01/2022 encoder : Lavf58.29.100 Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 12800 tbn, 25 tbc (default) Metadata: encoder : Lavc58.54.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), 48000 Hz, stereo, fltp, 128 kb/s (default) Metadata: handler_name : SoundHandler encoder : Lavc58.54.100 aac frame=89654 fps=129 q=28.0 size= 138496kB time=00:59:46.70 bitrate= 316.3kbits/s speed=5.17x

hostbbb commented 2 years ago

I have a dedicated record pipeline and set this to use all the cores on all the conversion servers.

THREADS = 24

you can look at yours and set it to 1, will take much longer to process.. as i have set... conversions happen 6-10x of duration. so 1hr recording takes about just a few minutes.