sblantipodi / firefly_luciferin

Very fast Java screen capture PC software designed for the Glow Worm Luciferin firmware, the combination of these software create the perfect Bias Lighting and Ambient Light system for PC.
GNU General Public License v3.0
307 stars 29 forks source link

[Bug]: Ubuntu Scaling not applied correctly (Wrong recording dimensions) #129

Open jkowalk opened 1 year ago

jkowalk commented 1 year ago

Firefly Luciferin version

2.11.7

Glow Worm Luciferin version

5.10.6

Firmware type

FULL

What is the stream method?

WiFi Stream

Fiefly Luciferin config file

---
hueMap: ...
topLed: 36
leftLed: 20
rightLed: 20
bottomLeftLed: 13
bottomRightLed: 13
bottomRowLed: 37
orientation: "Clockwise"
numberOfCPUThreads: 1
captureMethod: "XIMAGESRC"
baudRate: "500000"
defaultLedMatrix: "FullScreen"
autoDetectBlackBars: true
timeout: 100
screenResX: 3840
screenResY: 2160
osScaling: 150
gamma: 2.2
whiteTemperature: 65
colorMode: 1
mqttServer: "tcp://192.168.1.3:1883"
mqttTopic: "glowwormluciferin"
mqttUsername: ""
mqttPwd: ""
mqttDiscoveryTopic: "homeassistant"
mqttEnable: false
streamType: "UDP stream"
checkForUpdates: true
eyeCare: false
nightModeFrom: "22:00"
nightModeTo: "08:00"
nightModeBrightness: "0%"
toggleLed: true
desiredFramerate: "30"
frameInsertion: "No smoothing"
colorChooser: "51,51,51,255"
brightness: 255
ledStartOffset: 76
splitBottomMargin: "0%"
grabberAreaTopBottom: "8%"
grabberSide: "8%"
gapTypeTopBottom: "8%"
gapTypeSide: "0%"
startWithSystem: true
multiMonitor: 1
monitorNumber: 0
syncCheck: true
effect: "Bias light"
audioLoopbackGain: 0.0
audioDevice: "Default audio output (Native)"
audioChannels: "2 channels"
multiScreenSingleDevice: false
powerSaving: "Disabled"
theme: "Classic theme"
language: "English"
groupBy: 1
defaultProfile: "tray.icon.default"
enableLDR: false
ldrTurnOff: false
ldrInterval: 0
ldrMin: 0
brightnessLimiter: 1.0
sampleRate: 0
ledMatrix: ...
splitBottomRow: true
configVersion: "2.11.7"
serialPort: "GlowWorm"
wifiEnable: true
mqttStream: true
extendedLog: "INFO"

Relevant log output

[Instance #1] 2023-06-24 13:23:41,894 INFO o.d.JavaFXStarter [main] Starting default instance
[Instance #1] 2023-06-24 13:23:42,349 INFO o.d.g.ImageProcessor [JavaFX Application Thread] GStreamer path in use=opt/fireflyluciferin/lib/app/classes
[Instance #1] 2023-06-24 13:23:42,455 INFO o.d.m.PipelineManager [JavaFX Application Thread] ximagesrc startx=1 endx=2559 starty=0 endy=1439 ! videoscale ! videoconvert
[Instance #1] 2023-06-24 13:23:42,500 INFO o.d.m.UpgradeManager [JavaFX Application Thread] Checking for Firefly Luciferin Update
[Instance #1] 2023-06-24 13:23:42,645 INFO o.d.FireflyLuciferin [JavaFX Application Thread] MQTT disabled.
[Instance #1] 2023-06-24 13:23:42,647 INFO o.d.n.t.UdpServer [JavaFX Application Thread] Local IP= 192.168.178.110
[Instance #1] 2023-06-24 13:23:42,648 INFO o.d.n.t.UdpServer [JavaFX Application Thread] Network adapter in use=enp5s0
[Instance #1] 2023-06-24 13:23:42,648 INFO o.d.n.t.UdpServer [JavaFX Application Thread] Broadcast address found=/192.168.178.255
[Instance #1] 2023-06-24 13:23:42,649 INFO o.d.m.PowerSavingManager [JavaFX Application Thread] Adding hook for power saving.
[Instance #1] 2023-06-24 13:23:43,659 INFO o.d.m.PipelineManager [pool-11-thread-1] Waiting device for my instance...
[Instance #1] 2023-06-24 13:23:44,337 INFO o.d.m.DisplayManager [JavaFX Application Thread] Width: 2560.0 Height: 1440.0 Scaling: 2.0 MinX: 0.0 MinY: 0.0
[Instance #1] 2023-06-24 13:23:44,651 INFO o.d.m.PipelineManager [pool-11-thread-1] Waiting device for my instance...
[Instance #1] 2023-06-24 13:23:45,651 INFO o.d.m.PipelineManager [pool-11-thread-1] Waiting device for my instance...
[Instance #1] 2023-06-24 13:23:47,456 INFO o.d.g.GrabberManager [gstreamer service thread 1] Starting a new pipeline
[Instance #1] 2023-06-24 13:23:57,645 INFO o.d.m.UpgradeManager [pool-4-thread-1] Checking for Glow Worm Luciferin Update

How to reproduce

I have a 3840x2160 4k Monitor set up with Firefly Luciferin. In the OS I have a scaling of 150%. Same Settings in the Firefly App. On Windows it works as expected, whole screen gets captured and so on. But on Ubuntu only the top left corner of the screen gets recorded. The log also states, that the scaling seems to be applied wrong: ximagesrc startx=1 endx=2559 starty=0 endy=1439 ! videoscale ! videoconvert (Width: 2560.0 Height: 1440.0 Scaling: 2.0 MinX: 0.0 MinY: 0.0)

I also tried 100%, which works correct: ximagesrc startx=1 endx=3839 starty=0 endy=2159 ! videoscale ! videoconvert (Width: 3840.0 Height: 2160.0 Scaling: 1.0 MinX: 0.0 MinY: 0.0)

And 200%, which again only records a forth of the screen: ximagesrc startx=1 endx=1919 starty=0 endy=1079 ! videoscale ! videoconvert (Width: 1920.0 Height: 1080.0 Scaling: 2.0 MinX: 0.0 MinY: 0.0)

I was able to verify this by running: gst-launch-1.0 ximagesrc startx=1 endx=2559 starty=0 endy=1439 ! video/x-raw,framerate=30/1 ! videoscale method=0 ! video/x-raw,width=1920,height=1080 ! ximagesink which resulted in only the top left corner showing up. The correct settings for 150% scaling would be: ximagesrc startx=1 endx=5759 starty=0 endy=3239 which is screen_resolution * 1.5 - 1

So I thought I'll just set the screen resolution to 5760 to 3240 and scaling to 100% in the app settings, which didn't work either. Log output was: ximagesrc startx=1 endx=2559 starty=0 endy=1439 ! videoscale ! videoconvert (Width: 2560.0 Height: 1440.0 Scaling: 2.0 MinX: 0.0 MinY: 0.0)

It seems to me that there is something wrong with the calculation of the dimensions, but maybe someone can help me out.

Thanks anyways for the great system and your work so far.

sblantipodi commented 1 year ago

Hi @jkowalk thank you for reporting this issue.

I was able to reproduce the issue... I sincerely don't know if it's a Luciferin problem or a GStreamer one, I'll investigate the problem and let you know if I find some news about it.

sblantipodi commented 7 months ago

just for reference, this problem does not affect Wayland.

gk1089 commented 4 weeks ago

I just want to add plus one to this issue. Looking forward to a solution or a workaround. I am using it on Debian 12.

Cheers!

sblantipodi commented 4 weeks ago

@gk1089 what is the version of GStreamer you are using? can you try to update it to 1.24.4? what GPU are you using? is drivers correctly installed? What version of GNOME are you using?