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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Recording video with multiple part, screen stuck

nirmala-ncompass opened this issue · comments

  1. I am recording the video into multiple parts using stoprecord and start record. Without rtmp streaming connection I am doing. I am recording the video every 10sec. When I stoprecord and start record immediately few milliseconds screen will stuck in mobile. How could I resolve that?
  2. When I am recording 10 delay duration, i am getting 9 sec duration of the video. For example first video ends with the timer 01:30. The next video starts with timer 01:31. I could see the frame is missing 1sec in between of 01:30 to 01:31. How could I get the video without frame missing?
  3. We are getting bitrate every second in the method of OnNewBitrate() when we are connecting with rtmp url. In my case, I am not connecting with url. When recording how could I get the bitrate every second ?? Is there any way to get the current bitrate ?

HI @pedroSG94 We are getting bitrate every second in the method of OnNewBitrate() when we are connecting with rtmp url. In my case, I am not connecting with url. When recording how could I get the bitrate every second ?? Is there any way to get the current bitrate while recording only?

HI @pedroSG94 We are getting bitrate every second in the method of OnNewBitrate() when we are connecting with rtmp url. In my case, I am not connecting with url. When recording how could I get the bitrate every second ?? Is there any way to get the current bitrate while recording only?

Hello,

Currently I haven't a way to get bitrate of the file record. This is because the bitrate should be always the same (you are recording in local disk) because you haven't external problems involved like internet connection so you haven't a reason to reduce or increase the bitrate depend of your current bitrate.

I can implement it. Do you have any reason to need it? It should be constant

Hi @pedroSG94 Thanks!. I record the video every 10sec and upload it into s3 bucket. So the video takes more time to upload, in my case i need to reduce the video quality of next chunk of video based on upload time. If we have better internet connection again needs to restore the bitrate into high quality. Is there any way to improve the video Quality using AB logic??
And what about my first 2 questions??

Bitrate callback for record was added here:
5c6e67d
You can use this gradle:

  implementation 'com.github.pedroSG94.RootEncoder:library:b3e3675511'
  1. I am recording the video into multiple parts using stoprecord and start record. Without rtmp streaming connection I am doing. I am recording the video every 10sec. When I stopRecord and start record immediately few milliseconds screen will stuck in mobile. How could I resolve that?

Did you test using threading or coroutines? For example:

    CoroutineScope(Dispatchers.IO).launch {
        genericStream.stopRecord()
        //if you are using Camera1Base or Camera2Base you will need call prepare methods here
        genericStream.startRecord(path)
    }

2. When I am recording 10 delay duration, i am getting 9 sec duration of the video. For example first video ends with the timer 01:30. The next video starts with timer 01:31. I could see the frame is missing 1sec in between of 01:30 to 01:31. How could I get the video without frame missing?

I think it is not totally possible because you are stopping and starting the record again. This produce that you lose a bit of frames in the time you start again and a keyframe is detected (you need a keyframe to start recording a video).

The best way you have is create a large video and after finish chunk this video in multiple videos and then upload it but i'm not sure if this is useful for you.

If we have better internet connection again needs to restore the bitrate into high quality. Is there any way to improve the video Quality using AB logic??

This is a question that you need to solve for your case. Maybe you can try check your current bandwidth and modify the bitrate on fly depend of the current bandwith.
To calculate the bandwidth you can check the bytes uploaded in x seconds while you are uploading it to know it. Of course, this is only an idea

Thanks @pedroSG94 I will look into it.

Hi @pedroSG94 When I am starting the record without connecting with RTMP URL. OnNewBitrate is not worked in my activity class. Only I am connecting with RTMP URL this method working fine. May I know the reason, why OnNewBitrate is not working while recording? Do I need to change anything?

Hello,

Did you try using the callback provided in RecordController.Listener used in startRecord method?
You should have 3 methods in that interface:
https://github.com/pedroSG94/RootEncoder/blob/master/library/src/main/java/com/pedro/library/base/recording/RecordController.java#L45

Yes @pedroSG94 I am using Recordcontroller.Listener in startRecord method. Also tried with implements callback also. It is not working.

Can you share me the code used in startRecord using RecordController.Listener?

Here is the code: @pedroSG94

  rtmpCamera2.startRecord(FILE_PATH, new RecordController.Listener() {
                    @Override
                    public void onStatusChange(RecordController.Status status) {
                        System.out.println("record state: " + status.name());
                    }
                });

That is the problem. Replace with this:

 rtmpCamera2.startRecord(FILE_PATH, new RecordController.Listener() {
                    @Override
                    public void onStatusChange(RecordController.Status status) {
                        System.out.println("record state: " + status.name());
                    }
                    @Override
                    public void onNewBitrate(long bitrate) {

                    }
                });

Remember use the gradle shared:

 implementation 'com.github.pedroSG94.RootEncoder:library:b3e3675511'

Thanks @pedroSG94 It's working fine now.

Closing as completed.