Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recording video with multiple part, screen stuck #1479

Closed
nirmala-ncompass opened this issue May 10, 2024 · 13 comments
Closed

Recording video with multiple part, screen stuck #1479

nirmala-ncompass opened this issue May 10, 2024 · 13 comments

Comments

@nirmala-ncompass
Copy link

  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 ?
@nirmala-ncompass
Copy link
Author

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?

@pedroSG94
Copy link
Owner

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

@nirmala-ncompass
Copy link
Author

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??

@pedroSG94
Copy link
Owner

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

@nirmala-ncompass
Copy link
Author

Thanks @pedroSG94 I will look into it.

@nirmala-ncompass
Copy link
Author

nirmala-ncompass commented May 31, 2024

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?

@pedroSG94
Copy link
Owner

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

@nirmala-ncompass
Copy link
Author

nirmala-ncompass commented Jun 3, 2024

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

@pedroSG94
Copy link
Owner

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

@nirmala-ncompass
Copy link
Author

nirmala-ncompass commented Jun 3, 2024

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());
                    }
                });

@pedroSG94
Copy link
Owner

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'

@nirmala-ncompass
Copy link
Author

Thanks @pedroSG94 It's working fine now.

@pedroSG94
Copy link
Owner

Closing as completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants