pedroSG94 / RootEncoder

RootEncoder for Android (rtmp-rtsp-stream-client-java) is a stream encoder to push video/audio to media servers using protocols RTMP, RTSP, SRT and UDP with all code written in Java/Kotlin
Apache License 2.0
2.55k stars 773 forks source link

Recording multiple videos without closing the encoders or the camera #867

Open tareqalbeesh opened 3 years ago

tareqalbeesh commented 3 years ago

is there a way so that I can record multiple videos without closing the encoders or the camera, I want to record 30 sec videos all the time, any recommended starting point ?

tareqalbeesh commented 3 years ago

I managed to do it, but I am afraid that I am not doing it "the right way", if you can provide me with suggestions it would be great, I am now getting this error E/StudioTransport: JVMTI error: 103(JVMTI_ERROR_ILLEGAL_ARGUMENT) but it's not effecting the recording and it's not causing the application to crash.

pedroSG94 commented 3 years ago

Hello,

Your error is not a library error. That is throw by your system I think you can ignore it. About tips, an idea if you are using api 19+ you can force a keyframe each time you init a record to get it soon and start record a bit fast (you need start recording a video with a keyframe). You can use this method: https://github.com/pedroSG94/rtmp-rtsp-stream-client-java/blob/master/encoder/src/main/java/com/pedro/encoder/video/VideoEncoder.java#L233