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.57k stars 778 forks source link

Choose encoder with CBR priority #1632

Closed isaacchiang-kkstream closed 1 week ago

isaacchiang-kkstream commented 3 weeks ago

Is your feature request related to a problem? Please describe. We need to ensure the setting of CBR during the streaming. But i only notice that there have 3 settings in RootEncoder

  1. HARDWARE
  2. SOFTWARE
  3. FIRST_COMPATIBLE_FOUND

Describe the solution you'd like Can you provide the 4th setting which in below priority? hardware CBR > software CBR > hardware > software

Describe alternatives you've considered If solution available, please release it in a official version will very helpful to me. Thank you.

Additional context N/A

pedroSG94 commented 3 weeks ago

Hello,

Currently the library follow this rule (using FIRST_COMPATIBLE_FOUND that is used by default): hardware CBR > hardware > software CBR > software

This is because in the streaming CBR is always recommended. You can find the logic here: https://github.com/pedroSG94/RootEncoder/blob/master/encoder/src/main/java/com/pedro/encoder/video/VideoEncoder.java#L359 https://github.com/pedroSG94/RootEncoder/blob/master/encoder/src/main/java/com/pedro/encoder/utils/CodecUtil.java#L293

pedroSG94 commented 3 weeks ago

I could add it for the next release

isaacchiang-kkstream commented 3 weeks ago

hardware CBR > hardware > software CBR > software

Yes, i found it.

I could add it for the next release

This is very helpful for my use case. Thank you so much. Another question, when is the next release expected?

pedroSG94 commented 3 weeks ago

No date for now. I want finish a new feature related to support custom Extractors to use in FromFile streaming and maybe others fixs.

I can provide you a compilation of the commit with this change meanwhile (I think I could have a compilation this week).

isaacchiang-kkstream commented 2 weeks ago

No date for now. I want finish a new feature related to support custom Extractors to use in FromFile streaming and maybe others fixs.

Sure, It's ok.

I can provide you a compilation of the commit with this change meanwhile (I think I could have a compilation this week).

You mean might provide as below import way this week?

implementation 'com.github.pedroSG94.RootEncoder:library:{COMMIT_NUM}'

That will be great! Thank you.

pedroSG94 commented 2 weeks ago

I did a PR for this: https://github.com/pedroSG94/RootEncoder/pull/1633 I want test it a bit and then merge into master

isaacchiang-kkstream commented 2 weeks ago

Thanks for the PR, it looks perfect! But instead of directly using the source code to enter my project, I use Gradle import your released version to enter my project. Since the release(official) version still under developing, could you please provide the snapshot version that i can import to my project? Such as below:

implementation 'com.github.pedroSG94.RootEncoder:library:35c550b3bb'
pedroSG94 commented 2 weeks ago

Hello,

Try with this gradle:

implementation 'com.github.pedroSG94.RootEncoder:library:35c550b3bb'
isaacchiang-kkstream commented 2 weeks ago

Thanks a lot, very helpful.

isaacchiang-kkstream commented 1 week ago

Hi, I notice that might be some typo in this line? https://github.com/pedroSG94/RootEncoder/pull/1633/files Can you please help to check it if you available?

pedroSG94 commented 1 week ago

Which line?

isaacchiang-kkstream commented 1 week ago
List<MediaCodecInfo> softwareEncoders = getAllHardwareEncoders(mime);
pedroSG94 commented 1 week ago

True, fixed: https://github.com/pedroSG94/RootEncoder/commit/204efe020e484abbb7f0d998a3ac5f86146ed641 I'm compiling a new gradle

pedroSG94 commented 1 week ago

Gradle:

implementation 'com.github.pedroSG94.RootEncoder:library:8b428e5d4e'
isaacchiang-kkstream commented 1 week ago

This 8b428e5d4e version worked fine, thank you very much. 👍

pedroSG94 commented 1 week ago

Ok, Closing as solved. You can use that gradle until the new release is uploaded