question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Streaming and recording with different quality Camera2 API

See original GitHub issue

Hi! I need to stream and record with different video quality using Camera2 API. I read this issue (https://github.com/pedroSG94/rtmp-rtsp-stream-client-java/issues/228), but it is for Camera1. As i understand, i need to duplicate VideoEncoder in Camera2Base.java, add this new VideoEncoder to listSurfaces in Camera2ApiManager.java’s startPreview and set useOpengl to false in RtmpCamera2 init: rtmpCamera2 = new RtmpCamera2(App.getContext(), false, connectCheckerRtmp); Am i right? But after setting useOpengl to false (without any other modifications) i got errors: 2019-01-14 11:47:53.612 13103-13493/ru.altatec.server I/Camera2ApiManager: Camera opened 2019-01-14 11:47:53.613 13103-13493/ru.altatec.server E/Camera2ApiManager: Configuration failed Device is Sony Xperia XZ1 Compact Android 9 and camera working at background.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
pedroSG94commented, Dec 6, 2019

Yes, you are right. You need modify library code. You have an example posted above but maybe you need fix something. I’m not doing this implementation because you need create 2 videoencoders to do it and this result in worse performance and it is more difficult to maintain

0reactions
pedroSG94commented, Nov 25, 2020

@pedroSG94 I was trying the proposed examples, and streaming was breaking. Is there a way to achieve this with the openglview? Creating two encoders and so on.

I have an idea to copy the surface in the meantime, but needs too much modification on the current base code and it can be really slow that way.

No, because openglview only support 2 surfaces (preview and encoder). You need modify SurfaceManager to make it work and create a way to scale image correctly to both encoders.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use multiple camera streams simultaneously
Both CameraX and Camera2 support Android 5.0 (API level 21) and higher. ... In some cases, different streams even require a different frame ......
Read more >
Android 13 adds HDR video and "stream ... - XDA Developers
Android 13 adds some new features to the Camera2 API including HDR ... capture for generating high quality photo capture, video record for ......
Read more >
How to Use the Camera2 API to Take Photos and Videos
The Camera2 API introduces several new interfaces and classes. ... is a UI component that you use to display a content stream (think...
Read more >
Getting the most from the new multi-camera API (Android Dev ...
This talk helps camera developers build apps that harnesses Android P's multi-camera API. We will show live demos and a code walkthrough on ......
Read more >
Android Camera2 : How to access every single frames while ...
I'm using Camera2 API. What I want is to take every single frame while recording, and the frames should be exactly equal to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found