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 776 forks source link

NoSupport [codec.profileLevel, avc1.4D401F, video/avc] [OMX.google.h264.decoder, video/avc] #1638

Closed longuto closed 1 week ago

longuto commented 1 week ago

i use a old machine in Android 5.1.1 , It ok when I use hight machine. the error is NoSupport [codec.profileLevel, avc1.4D401F, video/avc] [OMX.google.h264.decoder, video/avc]

pedroSG94 commented 1 week ago

Hello,

Are you using from file streaming? Can you tell me more info about it? Show me the log of this code:

for (String s: CodecUtil.showAllCodecsInfo()) {
      Log.e("Pedro", s);
}

And tell me the video info about the file used (resolution, codec, profile, etc. You can get all info using ffmpeg or similar). You can share the file if you want. Also, try with other video file created with the device that fail.

longuto commented 1 week ago

genericStream = GenericStream(baseContext, this, NoVideoSource(), MicrophoneSource()).apply { getGlInterface().setForceRender(true, 15) } prepared = try { genericStream.prepareVideo(width, height, vBitrate, rotation = rotation) && genericStream.prepareAudio(sampleRate, isStereo, aBitrate, echoCanceler = true, noiseSuppressor = true ) } catch (e: IllegalArgumentException) { false }

fun prepareStream(resultCode: Int, data: Intent): Boolean { keepAliveTrick() stopStream() mediaProjection?.stop() val mediaProjection = mediaProjectionManager.getMediaProjection(resultCode, data) this.mediaProjection = mediaProjection val screenSource = ScreenSource(applicationContext, mediaProjection) return try { //ScreenSource need use always setCameraOrientation(0) because the MediaProjection handle orientation. //You also need remove autoHandleOrientation if you are using it. //You need to call it after prepareVideo to override the default value. genericStream.getGlInterface().setCameraOrientation(0) genericStream.changeVideoSource(screenSource) // toggleAudioSource(selectedAudioSource) genericStream.changeAudioSource(MicrophoneSource()) true } catch (ignored: IllegalArgumentException) { false } }

no use file streaming, use ScreenSource. I think the issue is related to my machine, as I'm using an old ARM machine. It works fine on higher version machines, and now I just want to know if there's a way to make it compatible with mine.

pedroSG94 commented 1 week ago

If you are using ScreenSource i don't understand this:

[OMX.google.h264.decoder, video/avc]

Only from file source use decoders. Can you share me a full logcat to get more info about it?

longuto commented 1 week ago

test.txt this is CodecUtil.showAllCodecsInfo logcat

longuto commented 1 week ago

full.txt this is full logcat

pedroSG94 commented 1 week ago

Ok, you only have 1 encoder:

Name: OMX.rk.video_encoder.avc
                                                                                                    Type: video/avc
                                                                                                    ----- Encoder info -----
                                                                                                    Complexity range: 0 - 0
                                                                                                    CBR supported: false
                                                                                                    VBR supported: true
                                                                                                    CQ supported: false
                                                                                                    ----- -----
                                                                                                    ----- Video info -----
                                                                                                    Supported colors: 
                                                                                                    2135033992
                                                                                                    19
                                                                                                    21
                                                                                                    2130708361
                                                                                                    Profile: 1, level: 1
                                                                                                    Profile: 1, level: 2
                                                                                                    Profile: 1, level: 4
                                                                                                    Profile: 1, level: 8
                                                                                                    Profile: 1, level: 16
                                                                                                    Profile: 1, level: 32
                                                                                                    Profile: 1, level: 64
                                                                                                    Profile: 1, level: 128
                                                                                                    Profile: 1, level: 256
                                                                                                    Profile: 1, level: 512
                                                                                                    Profile: 1, level: 1024
                                                                                                    Profile: 1, level: 2048
                                                                                                    Profile: 1, level: 4096
                                                                                                    Profile: 1, level: 8192
                                                                                                    Profile: 1, level: 16384
                                                                                                    Profile: 1, level: 32768
                                                                                                    Profile: 2, level: 1
                                                                                                    Profile: 2, level: 2
                                                                                                    Profile: 2, level: 4
                                                                                                    Profile: 2, level: 8
                                                                                                    Profile: 2, level: 16
                                                                                                    Profile: 2, level: 32
                                                                                                    Profile: 2, level: 64
                                                                                                    Profile: 2, level: 128
                                                                                                    Profile: 2, level: 256
                                                                                                    Profile: 2, level: 512
                                                                                                    Profile: 2, level: 1024
                                                                                                    Profile: 2, level: 2048
                                                                                                    Profile: 2, level: 4096
                                                                                                    Profile: 2, level: 8192
                                                                                                    Profile: 2, level: 16384
                                                                                                    Profile: 2, level: 32768
                                                                                                    Profile: 8, level: 1
                                                                                                    Profile: 8, level: 2
                                                                                                    Profile: 8, level: 4
                                                                                                    Profile: 8, level: 8
                                                                                                    Profile: 8, level: 16
                                                                                                    Profile: 8, level: 32
                                                                                                    Profile: 8, level: 64
                                                                                                    Profile: 8, level: 128
                                                                                                    Profile: 8, level: 256
                                                                                                    Profile: 8, level: 512
                                                                                                    Profile: 8, level: 1024
                                                                                                    Profile: 8, level: 2048
                                                                                                    Profile: 8, level: 4096
                                                                                                    Profile: 8, level: 8192
                                                                                                    Profile: 8, level: 16384
                                                                                                    Profile: 8, level: 32768
                                                                                                    Bitrate range: 1 - 40000000
                                                                                                    Frame rate range: 0 - 960
                                                                                                    Width range: 176 - 1920
                                                                                                    Height range: 144 - 1088

As you can see the max resolution supported is 1920x1080. I assume that the problem is that you receive an error or return false in prepareVideo. Can you share a logcat of all from you create the stream class to you call start stream or get the error? Also share me the parameters used in prepareVideo method.

pedroSG94 commented 1 week ago

full.txt this is full logcat

Ok, the problem is not related with the video, it is related with the audio. Your audio encoder is not working properly and you are not producing audio frames. For that reason the server close connection with you.

First of all try reset the device. Also try use a different configuration in prepareAudio method.

longuto commented 1 week ago

I am using the example code. How should I modify it? if i not use audio,how should i do [Uploading code.txt…]()

pedroSG94 commented 1 week ago

I tried to do a fix for it. Try to compile the example in this branch: https://github.com/pedroSG94/RootEncoder/pull/1640 Or use this gradle:

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

Let me know if this solve the error.

longuto commented 1 week ago

it is error , logcat.txt if i not use audio,how should i do

pedroSG94 commented 1 week ago

This error:

java.net.ConnectException: failed to connect to rtmp.teachain.net/47.96.248.18 (port 1935): isConnected failed: EHOSTUNREACH (No route to host)

Should be received in onConnectionFailed. It is not a crash, this only notify you the reason about the connection failed that is because the server is not available from your network (No route to host).

pedroSG94 commented 1 week ago

This case:

it is error , logcat.txt if i not use audio,how should i do

And this case:

full.txt this is full logcat

Are not related. The second case could be a bug, the the first case is a connection problem so the library is working as expected for this first case.

longuto commented 1 week ago

There should be an error causing the RTMP push to fail. It works fine when I push from the emulator, but the error only occurs on this device.

longuto commented 1 week ago

Thank you, it's resolved now. It was my own mistake.