ant-media / LibRtmp-Client-for-Android

It is probably the smallest(~60KB, fat version ~300KB) rtmp client for android. It calls librtmp functions over JNI interface
http://antmedia.io
Apache License 2.0
672 stars 230 forks source link

RtmpClient unable to properly read stream #70

Closed ojw28 closed 4 years ago

ojw28 commented 6 years ago

This issue was originally reported here: https://github.com/google/ExoPlayer/issues/4319

It appears RtmpClient is unable to read rtmp://76.81.29.11:1935/live/Cam2 correctly. To verify the issue is in RtmpClient I did the following:

Srinu-try commented 6 years ago

Hi,

I am facing the above issue with librtmp library used in ExoPlayer.

Request your help in this regard.

woehrl commented 4 years ago

Hi,

seems like this problem is still not fixed, right? I have a HD video stream (rtmp) without any audio stream and it just does not play back. If I add a nullsrc audio then it works, but that adds more processing power and time that I don't have available. The stream looks like this: https://a.uguu.se/Oj8rdrFDO7v3_rtmp_h264_noaudio.flv

Requesting help! Best regards...

ojw28 commented 4 years ago

The link you've provided above plays fine for me. It's also an https link rather than rtmp? I'm not sure how it's related to LibRtmp?

woehrl commented 4 years ago

Thank you for your swift reply! yes, the file plays perfectly in media players (MPC, VLC). I stored the rtmp stream to a file (raw conversion in VLC) for you to have a look at the stream - what might be wrong with it. I'm using librtmp within ExoPlayer on Android, already using latest release 3.1.0. I could provide you a direct link to the stream source via PN.

umangsaini commented 4 years ago

Few FLV files signal that both A and V tracks are available, when in fact only Video is available. This creates A/V tracks which will not play if Audio samples are not present.

Can you check in Exoplayer FlvExtractor.java -> readFlvHeader() if boolean hasAudio = (flags & 0x04) != 0;

If hasAudio flag is set true for your FLV file, then Video only playback will be an issue. FFMPEG is able to play such content over RTMP.

woehrl commented 4 years ago

Ok, I managed to clone the repo and included it in my project. That way I could perfectly detect if the flv headers set an audio track.

I found out that my gstreamer pipeline including the flvmux element did NOT add an audio stream, but the receiving nginx-rtmp module by default sets an audio track as given even if there is none in the input stream: url

So I just had to set meta copy; in my nginx server configuration. Now it works!

Thank you very much for your input! Best regards, Florian

ojw28 commented 4 years ago

Glad you were able to resolve this! I'm going to close this issue because I think it was fixed by https://github.com/ant-media/LibRtmp-Client-for-Android/pull/75, and was left open by accident :).