Comments (5)
First of all, you need a compatible device. Many devices with Snapdragon SoC are capable, see https://www.qualcomm.com/news/onq/2015/10/30/snapdragon-dual-cameras-capture-photos-first-adjust-focus-later.
Then, camera2 API lets you open the two devices.
Finally, you can encode the video as a single combined stream (e.g. Picture in Picture), or as separate video streams.
There is nothing special that you must do to produce RTMP.
from grafika.
First of all, you need a compatible device. Many devices with Snapdragon SoC are capable, see https://www.qualcomm.com/news/onq/2015/10/30/snapdragon-dual-cameras-capture-photos-first-adjust-focus-later.
Then, camera2 API lets you open the two devices.
Finally, you can encode the video as a single combined stream (e.g. Picture in Picture), or as separate video streams.
There is nothing special that you must do to produce RTMP.
@alexcohn thanks for the reply. Can you tell me how can i encode both stream into single stream so that i can stream through rtmp.
from grafika.
how can i encode both stream into single stream
First, you configure the two streams to be of the same width. Then, you create a stream of this width, and the height that is a sum of the two, and a pixel buffer that is enough to hold this. You copy the frame pixels of the back camera to the upper half, the pixels of the front camera to the lower part. When both parts are ready, you send the frame to the encoder (using MediaCodec). The encoded frame is sent to RTMP same as if you had a single camera.
from grafika.
how can i encode both stream into single stream
First, you configure the two streams to be of the same width. Then, you create a stream of this width, and the height that is a sum of the two, and a pixel buffer that is enough to hold this. You copy the frame pixels of the back camera to the upper half, the pixels of the front camera to the lower part. When both parts are ready, you send the frame to the encoder (using MediaCodec). The encoded frame is sent to RTMP same as if you had a single camera.
I have did exact same but the problem is that i want back camera should be full width and front camera should be overlap on it so that it look like picture in picture.
from grafika.
So, you have no choice but to copy one frame over the other (Y plane separate from UV plane, line by line).
from grafika.
Related Issues (20)
- Extend encode/decode test example with asynchronous API
- Sound not available in Video using CameraCaptureActivity HOT 1
- how can i remove shape HOT 1
- how can i add shapes in texture view using open gl
- glReadPixels returns a blank image on disabling blend
- Decoding four video streams simultaneous on Google Pixel 2 phone
- seconds of video in Continuous Capture mode becomes double after keeping it on for a while. HOT 3
- If you want to record mp4 with sound, use this one https://github.com/moo611/OpenCamera
- Memory leak of Texture2dProgram
- Continuous capture bug(Android5.1.1) HOT 1
- Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x38 in tid 9379, pid 9379
- Some OpenGL stuff doesn't work on some devices: eglMakeCurrent failed and glDrawArrays: glError 0x505 HOT 4
- Can we play scene.json in grafika?
- Test HOT 1
- Doesn't build on Flamingo and Giraffe HOT 2
- fun fact HOT 1
- Camera2 Pass Images from ImageReader to MediaRecorder HOT 2
- Camera2 pipeline; synchronously get PRIVATE/YUV/RGB Image data from a Frame HOT 4
- Website
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grafika.