apivideo / api.video-flutter-live-stream

Flutter RTMP live stream client. Made with ♥ by api.video
MIT License
62 stars 37 forks source link

[Bug]: RTMP_ReadPacket, failed to read RTMP packet header #30

Closed Keval-11 closed 8 months ago

Keval-11 commented 1 year ago

Version

v1.1.1

Which operating systems have you used?

Environment that reproduces the issue

Pixel 4 (API 30) emulator Mi A1 (API 28) real device

Is it reproducible in the example application?

Yes

RTMP Server

rtmp://global-live.mux.com:5222/app/

Reproduction steps

  1. Configure video to 720p
  2. Start streming

Expected result

RTMP stream should work.

Actual result

Nothing happen, while start sreaming.

Given me below log

E/rtmpdroid(11700): RTMP_ReadPacket, failed to read RTMP packet header E/rtmpdroid(11700): Can't connect stream

Error: PlatformException(failed_to_start_stream, java.net.ConnectException: Failed to connectStream, null, null)

Additional context

3.0.0

Relevant logs output

[log] Camera Permission: GRANTED
I/CameraManagerGlobal(11700): Connecting to camera service
I/VideoCapabilities(11700): Unsupported profile 4 for video/mp4v-es

I/VideoMediaCodecEncoder(11700): Selected encoder OMX.google.h264.encoder
I/OMXClient(11700): IOmx service obtained
I/MediaCodec(11700): MediaCodec will operate in async mode
W/OMXUtils(11700): do not know color format 0x7f000789 = 2130708361
I/ACodec  (11700): setupAVCEncoderParameters with [profile: Main] [level: Level41]
I/ACodec  (11700): [OMX.google.h264.encoder] cannot encode color aspects. Ignoring.
I/ACodec  (11700): [OMX.google.h264.encoder] cannot encode HDR static metadata. Ignoring.
I/ACodec  (11700): setupVideoEncoder succeeded
W/OMXUtils(11700): do not know color format 0x7f000789 = 2130708361
D/HostConnection(11700): HostConnection::get() New Host Connection established 0xeec4b530, tid 11765
D/HostConnection(11700): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_sync_buffer_data GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_async_frame_commands ANDROID_EMU_gles_max_version_3_0 
D/EGL_emulation(11700): eglCreateContext: 0xeec4e9b0: maj 3 min 0 rcv 3
D/EGL_emulation(11700): eglMakeCurrent: 0xeec4e9b0: ver 3 0 (tinfo 0xb3b39d90) (first time)
E/EGL_emulation(11700): eglQueryContext 32c0  EGL_BAD_ATTRIBUTE
E/EGL_emulation(11700): tid 11765: eglQueryContext(2019): error 0x3004 (EGL_BAD_ATTRIBUTE)
I/NDOP    (11700): listening using window listener

E/AudioCapture(11700): Acoustic echo canceler is not available
E/AudioCapture(11700): Noise suppressor is not available
I/AudioMediaCodecEncoder(11700): Selected encoder c2.android.aac.encoder

D/CCodec  (11700): allocate(c2.android.aac.encoder)
I/Codec2Client(11700): Available Codec2 services: "software"
I/CCodec  (11700): Created component [c2.android.aac.encoder]
D/CCodecConfig(11700): read media type: audio/mp4a-latm
D/ReflectedParamUpdater(11700): extent() != 1 for single value type: algo.buffers.max-count.values
D/ReflectedParamUpdater(11700): extent() != 1 for single value type: output.subscribed-indices.values
D/ReflectedParamUpdater(11700): extent() != 1 for single value type: input.buffers.allocator-ids.values
D/ReflectedParamUpdater(11700): extent() != 1 for single value type: output.buffers.allocator-ids.values
D/ReflectedParamUpdater(11700): extent() != 1 for single value type: algo.buffers.allocator-ids.values
D/ReflectedParamUpdater(11700): extent() != 1 for single value type: output.buffers.pool-ids.values
D/ReflectedParamUpdater(11700): extent() != 1 for single value type: algo.buffers.pool-ids.values
I/CCodecConfig(11700): query failed after returning 9 values (BAD_INDEX)
D/CCodecConfig(11700): c2 config diff is Dict {
D/CCodecConfig(11700):   c2::u32 coded.bitrate.value = 64000
D/CCodecConfig(11700):   c2::u32 coded.pl.level = 0
D/CCodecConfig(11700):   c2::u32 coded.pl.profile = 8192
D/CCodecConfig(11700):   c2::u32 coding.aac-sbr-mode.value = 3
D/CCodecConfig(11700):   c2::u32 input.buffers.max-size.value = 2048
D/CCodecConfig(11700):   c2::u32 input.delay.value = 0
D/CCodecConfig(11700):   string input.media-type.value = "audio/raw"
D/CCodecConfig(11700):   string output.media-type.value = "audio/mp4a-latm"
D/CCodecConfig(11700):   c2::u32 raw.channel-count.value = 1
D/CCodecConfig(11700):   c2::u32 raw.sample-rate.value = 44100
D/CCodecConfig(11700): }
I/MediaCodec(11700): MediaCodec will operate in async mode
D/CCodec  (11700): [c2.android.aac.encoder] buffers are bound to CCodec for this session
D/CCodecConfig(11700): no c2 equivalents for aac-profile
D/CCodecConfig(11700): no c2 equivalents for flags
D/CCodecConfig(11700): no c2 equivalents for encoder
D/CCodecConfig(11700): c2 config diff is   c2::u32 coded.bitrate.value = 128000
D/CCodecConfig(11700):   c2::u32 input.buffers.max-size.value = 4096
D/CCodecConfig(11700):   c2::u32 raw.channel-count.value = 2
W/Codec2Client(11700): query -- param skipped: index = 1107298332.
D/CCodec  (11700): setup formats input: AMessage(what = 0x00000000) = {
D/CCodec  (11700):   int32_t aac-sbr-mode = 3
D/CCodec  (11700):   int32_t channel-count = 2
D/CCodec  (11700):   int32_t max-input-size = 4096
D/CCodec  (11700):   string mime = "audio/raw"
D/CCodec  (11700):   int32_t sample-rate = 44100
D/CCodec  (11700): } and output: AMessage(what = 0x00000000) = {
D/CCodec  (11700):   int32_t aac-sbr-mode = 3
D/CCodec  (11700):   int32_t bitrate = 128000
D/CCodec  (11700):   int32_t channel-count = 2
D/CCodec  (11700):   int32_t level = 0
D/CCodec  (11700):   int32_t max-bitrate = 128000
D/CCodec  (11700):   string mime = "audio/mp4a-latm"
D/CCodec  (11700):   int32_t profile = 2
D/CCodec  (11700):   int32_t sample-rate = 44100
D/CCodec  (11700): }
I/NDOP    (11700): listening using window listener

I/CameraController(11700): Supported FPS range list: [[5, 30], [15, 30], [15, 15], [30, 30]]
D/CameraController(11700): Selected Fps range [30, 30]

E/rtmpdroid(11700): RTMP_ReadPacket, failed to read RTMP packet header
E/rtmpdroid(11700): Can't connect stream
D/VideoMediaCodecEncoder(11700): Not running
D/AudioMediaCodecEncoder(11700): Not running
D/AudioCapture(11700): Not running
I/AudioMediaCodecEncoder(11700): Selected encoder c2.android.aac.encoder
D/CCodec  (11700): allocate(c2.android.aac.encoder)
I/CCodec  (11700): Created component [c2.android.aac.encoder]
D/CCodecConfig(11700): read media type: audio/mp4a-latm
I/hw-BpHwBinder(11700): onLastStrongRef automatically unlinking death recipients
D/ReflectedParamUpdater(11700): extent() != 1 for single value type: algo.buffers.max-count.values
D/ReflectedParamUpdater(11700): extent() != 1 for single value type: output.subscribed-indices.values
D/ReflectedParamUpdater(11700): extent() != 1 for single value type: input.buffers.allocator-ids.values
D/ReflectedParamUpdater(11700): extent() != 1 for single value type: output.buffers.allocator-ids.values
D/ReflectedParamUpdater(11700): extent() != 1 for single value type: algo.buffers.allocator-ids.values
D/ReflectedParamUpdater(11700): extent() != 1 for single value type: output.buffers.pool-ids.values
D/ReflectedParamUpdater(11700): extent() != 1 for single value type: algo.buffers.pool-ids.values
I/CCodecConfig(11700): query failed after returning 9 values (BAD_INDEX)
D/CCodecConfig(11700): c2 config diff is Dict {
D/CCodecConfig(11700):   c2::u32 coded.bitrate.value = 64000
D/CCodecConfig(11700):   c2::u32 coded.pl.level = 0
D/CCodecConfig(11700):   c2::u32 coded.pl.profile = 8192
D/CCodecConfig(11700):   c2::u32 coding.aac-sbr-mode.value = 3
D/CCodecConfig(11700):   c2::u32 input.buffers.max-size.value = 2048
D/CCodecConfig(11700):   c2::u32 input.delay.value = 0
D/CCodecConfig(11700):   string input.media-type.value = "audio/raw"
D/CCodecConfig(11700):   string output.media-type.value = "audio/mp4a-latm"
D/CCodecConfig(11700):   c2::u32 raw.channel-count.value = 1
D/CCodecConfig(11700):   c2::u32 raw.sample-rate.value = 44100
D/CCodecConfig(11700): }
I/MediaCodec(11700): MediaCodec will operate in async mode
D/CCodec  (11700): [c2.android.aac.encoder] buffers are bound to CCodec for this session
D/CCodecConfig(11700): no c2 equivalents for aac-profile
D/CCodecConfig(11700): no c2 equivalents for flags
D/CCodecConfig(11700): no c2 equivalents for encoder
D/CCodecConfig(11700): c2 config diff is   c2::u32 coded.bitrate.value = 128000
D/CCodecConfig(11700):   c2::u32 input.buffers.max-size.value = 4096
D/CCodecConfig(11700):   c2::u32 raw.channel-count.value = 2
W/Codec2Client(11700): query -- param skipped: index = 1107298332.
D/CCodec  (11700): setup formats input: AMessage(what = 0x00000000) = {
D/CCodec  (11700):   int32_t aac-sbr-mode = 3
D/CCodec  (11700):   int32_t channel-count = 2
D/CCodec  (11700):   int32_t max-input-size = 4096
D/CCodec  (11700):   string mime = "audio/raw"
D/CCodec  (11700):   int32_t sample-rate = 44100
D/CCodec  (11700): } and output: AMessage(what = 0x00000000) = {
D/CCodec  (11700):   int32_t aac-sbr-mode = 3
D/CCodec  (11700):   int32_t bitrate = 128000
D/CCodec  (11700):   int32_t channel-count = 2
D/CCodec  (11700):   int32_t level = 0
D/CCodec  (11700):   int32_t max-bitrate = 128000
D/CCodec  (11700):   string mime = "audio/mp4a-latm"
D/CCodec  (11700):   int32_t profile = 2
D/CCodec  (11700):   int32_t sample-rate = 44100
D/CCodec  (11700): }
I/VideoMediaCodecEncoder(11700): Selected encoder OMX.google.h264.encoder
I/OMXClient(11700): IOmx service obtained
I/MediaCodec(11700): MediaCodec will operate in async mode
W/OMXUtils(11700): do not know color format 0x7f000789 = 2130708361
I/ACodec  (11700): setupAVCEncoderParameters with [profile: Main] [level: Level41]
I/ACodec  (11700): [OMX.google.h264.encoder] cannot encode color aspects. Ignoring.
I/ACodec  (11700): [OMX.google.h264.encoder] cannot encode HDR static metadata. Ignoring.
I/ACodec  (11700): setupVideoEncoder succeeded
W/OMXUtils(11700): do not know color format 0x7f000789 = 2130708361
D/HostConnection(11700): HostConnection::get() New Host Connection established 0xeec4d2f0, tid 11765
D/HostConnection(11700): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_sync_buffer_data GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_async_frame_commands ANDROID_EMU_gles_max_version_3_0 
D/EGL_emulation(11700): eglCreateContext: 0xeec4d910: maj 3 min 0 rcv 3
D/EGL_emulation(11700): eglMakeCurrent: 0xeec4d910: ver 3 0 (tinfo 0xb3b39d90) (first time)
[log] Error: code:1063638632
[log] Error: PlatformException(failed_to_start_stream, java.net.ConnectException: Failed to connectStream, null, null)
D/VideoMediaCodecEncoder(11700): Not running
D/AudioMediaCodecEncoder(11700): Not running
D/AudioCapture(11700): Not running
I/AudioMediaCodecEncoder(11700): Selected encoder c2.android.aac.encoder
D/CCodec  (11700): allocate(c2.android.aac.encoder)
I/hw-BpHwBinder(11700): onLastStrongRef automatically unlinking death recipients
I/CCodec  (11700): Created component [c2.android.aac.encoder]
D/CCodecConfig(11700): read media type: audio/mp4a-latm
ThibaultBee commented 1 year ago

Hi,

According to your logs, the issue:

E/rtmpdroid(11700): RTMP_ReadPacket, failed to read RTMP packet header
E/rtmpdroid(11700): Can't connect stream

connectStream is a RTMP message that is exchanged between the client and the server once they are connected. The issue is often because the streamKey is not correctly set. Could you double check it?

If your stream key is okay, could you please contact your server to check what is wrong with the connectStream message?

Keval-11 commented 1 year ago

Hi,

According to your logs, the issue:

E/rtmpdroid(11700): RTMP_ReadPacket, failed to read RTMP packet header
E/rtmpdroid(11700): Can't connect stream

connectStream is a RTMP message that is exchanged between the client and the server once they are connected. The issue is often because the streamKey is not correctly set. Could you double check it?

If your stream key is okay, could you please contact your server to check what is wrong with the connectStream message?

Yes, I have double check of streamKey it is Ok, I am using "rtmp://global-live.mux.com:5222/app/" server which is provided by MUX which is mention on MUX official site (https://docs.mux.com/guides/video/start-live-streaming#3-start-broadcasting)

ThibaultBee commented 1 year ago

Just tested it. I have no issue with it. We can't help you on this. Please contact your server provider directly.

ThibaultBee commented 1 year ago

Did you contact your server provider? Have you fixed your issue?

ThibaultBee commented 8 months ago

Stalled issue -> Closing. Feel free to repoen the issue if you still need support.