xbelanch / OBS4Pi

Compiling and building ffmpeg and OBS for Raspberry Pi 4
MIT License
34 stars 7 forks source link

Debian 11 / Raspbian OS, are custom builds & scripts required anymore? #16

Open arrowgent opened 2 years ago

arrowgent commented 2 years ago

obs-studio from debian 11's repo works out of the box

obs 26.1.2 (although v x.x.2 is a mac only fix...)

https://packages.debian.org/bullseye/libobs0 https://packages.debian.org/bullseye/obs-plugins https://packages.debian.org/bullseye/obs-studio

this makes the old debian 10/raspbian10 requirements to build for basic x264 streaming & recording obsolete ? omx is a different thing, in my own testing setting to the h264_omx encoder was worse quality visually with no cpu/hardware benefit

although possibly newer versions -master- branch or the hopeful upcomming 27.2 will have CEF v95 support, may be possible to build obs-browser on raspberrypi then again my own testing of using an extremely lightweight luakit web browser still very heavy on CPU for a RPI4 overclocked; fancy browser sources might not be reliable for this generation RPI.

a raspberry pi 4b 4gb 32bit review: 25FPS at 720p is possible, depending what you are using CPU for in the background (gaming) high frame motion will rekt the encoder and suffer with buffering, latency, (render time) encoder overload. 1080p30 is possible, very low expectations to maintain a solid 30fps, it will dip often below 20fps. i did several full gaming streams and encoder tests along with custom ffmpeg settings. currently i set the monitor to 50hz and lock the video to 25fps in obs. this is the best way i can figure to maintain 20-25fps for example: preset=ultrafast profile=main tune=fastdecode

othernote: i dont use wayland or pipewire.

arrowgent commented 2 years ago

some extended testing with the supplied packages from debian 11

im considering if compiling your own build results in better performance

i know i had better performance with raspbian 10/debian 10 on my own builds

some tests on things i had used to record/stream previously are now having major frames missed due to rendering lag: 22.5% last test

i was able to play simple dosbox games without encountering major FPS drops reported by obs

this could be the new debian11 and mesa/graphics libraries having issues. although most of obs is CPU bound. watching htop and a graph monitor, obs is very heavy when live recording.

sorry, i will need to recompile obs the way i have been and report back for some further testing

arrowgent commented 2 years ago

going through the whole build script doing custom install

no pipewire no gstreamer, no obs-gstreamer x264-20210814.tar.xz (newer) ffmpeg 4.3.3 (not n4.5) obs 26.1.1

very minor performance gain it is ~2fps gain minimum stable 23-25fps in my example scene which is very heavy on cpu transitions and transforms and filters.

very minor gain but every tiny amount helps here

i use GALLIUM_HUD=fps+cpu (mesa) for stats obs preview is disabled, it uses a lot of cpu

1280x720p25 2880Kbps

x264 options: preset=ultrafast profile=main tune=fastdecode+zerolatency x264-params=threads=6:preset=ultrafast:profile=main:tune=fastdecode+zerolatency:bframes=0:trellis=0:subme=0:scenecut=0:keyint=50:min-keyint:25:nal-hrd=cbr:crf=26:crf-max=32:bitrate=2416k:maxrate=2880k:vbv-maxrate=2880k:vbv-bufsize=3264k:fps=25

Previously: Debian 11 obs-studio 26.1.2+dfsg1-2 armhf dosbox doom lagged badly (example)

self compile: build script obs 26.1.1 dosbox doom performed and recorded correctly

result: yes i would say building your own OBS is the better option depending what software you are running or recording if the game/video is using 90-100% of a pthread (cpu core) you will need better hardware!!!

xbelanch commented 2 years ago

@arrowgent thanks for spent your spare time for doing this set of benchmarks. As you know, the Pi 4 is still having a limited hardware for OBS but imo would be great using it for some kind of streamings (I found on Twitch some of them related to streets, farms or whatever similar) that Pi would fit better than a PC gig. I hope the release in a future of version 5 of the Raspberry will carry a better graphics hardware support.

arrowgent commented 2 years ago

yeah its actually amazing that compiling your own from source gains a small performance boost i was not expecting that

true the rpi4b/400 is not a powerhorse for gaming and streaming simultaneously, very limited CPU but testing and examples shows us exactly what its capable of and what to expect