shogo4405 / HaishinKit.swift

Camera and Microphone streaming library via RTMP and SRT for iOS, macOS, tvOS and visionOS.
BSD 3-Clause "New" or "Revised" License
2.74k stars 609 forks source link

Low quality camera image #1508

Closed AntonReality closed 1 month ago

AntonReality commented 1 month ago

Describe the bug

After updating to the latest version we experience a deficient quality of the camera output (it's very pixelated) even though we're using the same settings as before (resolution is 1080p 60 fps).

To Reproduce

  1. Update to the latest version.
  2. Attach a camera to stream.
  3. See that the output is pixelated.

All the options are set as in the examples for the stream.screen as well: stream.screen.frameRate = 60 stream.screen.size = .init(width: 720, height: 1280)

We're using a multicamera option so stream.isMultiCamSessionEnabled = true.

See videos attached: The first video is before the update (1.8.1) and can be seen that it is seen as 1080p and 60fps, and the second video is after the update (1.9.1) you can see a significant drop in the fps.

https://github.com/shogo4405/HaishinKit.swift/assets/9284579/acdede33-6d1d-4b32-a529-9cbe5e0e940c

https://github.com/shogo4405/HaishinKit.swift/assets/9284579/e88d1e1d-c18b-47c3-acff-cca1e3cf2731

Expected behavior

After the update, we should have the same output fps as we had before.

Version

1.9.1

Smartphone info.

Additional context

We see an output: 2024-11-07 11:44:55.847 [Warn] [com.haishinkit.HaishinKit] [IOVideoCaptureUnit.swift:44] output > device doesn't support this color format 32. Can this be related?

Screenshots

No response

Relevant log output

No response

Asfand-Hafeez commented 1 month ago

Hi @AntonReality
this answer not for your issue but i have question for live streaming i need to get url if you have worked on it i am getting this url rtmp://192.168.1.6/live but its not showing live streaming in server

shogo4405 commented 1 month ago

@Asfand-Hafeez Hey. Please refrain from asking unrelated questions to third parties in this issue. Next time, I will block you.

shogo4405 commented 1 month ago

You can now set the output frame rate and camera capture input frame rate separately. stream.screen.frameRate is used to set the output frame rate. Setting stream.frameRate = 60 and stream.screen.frameRate = 60 should achieve the expected result, shouldn't it?"

If there's anything more you'd like to know or clarify, feel free to ask!

AntonReality commented 1 month ago

@shogo4405 As I’ve originally mentioned in my report, both values are set. Also, it worked perfectly before the update.

AntonReality commented 1 month ago

Hey @shogo4405. I’ve double checked and both values are set to 60.

shogo4405 commented 1 month ago

In the 1.8.x series, the preview used data captured from the camera. On the iPhone 15 Pro Max, it would be 1080 x 1920.

If you set the screen size as follows, downsampling will occur, which might result in lower quality. Please consider increasing the screen size from the following value: stream.screen.size = .init(width: 720, height: 1280)

Regarding the FPS issue, I have an iPhone 15 Pro Max, but I cannot reproduce the problem. Is it the same with the Examples project?

https://github.com/shogo4405/HaishinKit.swift?tab=readme-ov-file#-examples