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

How to play rtmp stream without audio in Exoplayer? #6719

Closed
khyatiChitroda opened this issue Dec 3, 2019 · 11 comments
Closed

How to play rtmp stream without audio in Exoplayer? #6719

khyatiChitroda opened this issue Dec 3, 2019 · 11 comments
Assignees
Labels

Comments

@khyatiChitroda
Copy link

khyatiChitroda commented Dec 3, 2019

I am integrating Exoplayer into my application and into this I am getting problem when I am trying to play video without audio it can not play, but if I am enabling the audio it will play the video properly, my code :

player = ExoPlayerFactory.newSimpleInstance(this, trackSelector)

val playerView = findViewById<PlayerView>(R.id.simple_player)
playerView.player = player
val rtmpDataSourceFactory = RtmpDataSourceFactory()
val url = mVideoPath
val videoSource = ExtractorMediaSource.Factory(rtmpDataSourceFactory)
  .createMediaSource(Uri.parse(url))

player.prepare(videoSource)

player.playWhenReady = true
@kim-vde
Copy link
Contributor

kim-vde commented Dec 3, 2019

Please provide the video path (with and without audio) as described here.

@khyatiChitroda
Copy link
Author

khyatiChitroda commented Dec 3, 2019

PLease check mail, I had sent you url, once you check let me know I will add audio into that

@kim-vde
Copy link
Contributor

kim-vde commented Dec 3, 2019

ExoPlayer fails with the following stack trace when trying to open the rtmp url:

net.butterflytv.rtmp_client.RtmpClient$RtmpIOException: RTMP error: -3
        at net.butterflytv.rtmp_client.RtmpClient.open(RtmpClient.java:222)
        at com.google.android.exoplayer2.ext.rtmp.RtmpDataSource.open(RtmpDataSource.java:49)
        at com.google.android.exoplayer2.upstream.DefaultDataSource.open(DefaultDataSource.java:177)
        at com.google.android.exoplayer2.upstream.cache.CacheDataSource.openNextSource(CacheDataSource.java:462)
        at com.google.android.exoplayer2.upstream.cache.CacheDataSource.open(CacheDataSource.java:286)
        at com.google.android.exoplayer2.upstream.StatsDataSource.open(StatsDataSource.java:83)
        at com.google.android.exoplayer2.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:961)
        at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:394)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)

There is probably something wrong with the url or with the file because it also fails to play with ffplay.

@khyatiChitroda
Copy link
Author

if you will try with VLC it will work properly, and even if I will add audio into this url then also it will working properly, you just try now I had enabled audio.

@kim-vde
Copy link
Contributor

kim-vde commented Dec 4, 2019

I still get the same error with ExoPlayer and with ffplay.

Note that, when trying to play the file with ExoPlayer, the error is not thrown by ExoPlayer but by net.butterflytv.rtmp_client.RtmpClient, which indicates that there is probably something wrong with the url.

I also tried with VLC (version 3.0.8) and got the following error: "Your input can't be opened:
VLC is unable to open the MRL ''. Check the log for details."
And in the logs "avio error: Failed to open : Operation not permitted".

What version of VLC are you using? Do you use Media > Open Network Stream to play the file?

@khyatiChitroda
Copy link
Author

khyatiChitroda commented Dec 4, 2019 via email

@kim-vde
Copy link
Contributor

kim-vde commented Dec 4, 2019

I can play this URL with ExoPlayer without problem.

Can you do it as well? Did you build you app with the ExoPlayer RTMP extension?

@umangsaini
Copy link

Multiple RTMP issues were resolved with the release of v2.10.5. Older versions may have the issue described. Latest ExoPlayer uses the fixed version of RTMP library - net.butterflytv.utils:rtmp-client:3.1.0.

Regarding audio, in the Demo application, I am able to disable audio track from the "Select Tracks" menu, and video-only playback continues as expected.

Which version of Exoplayer are you working with, and have you tried disabling audio in the Demo Application?

ExoPlayer_Rtmp_Video_Only

@khyatiChitroda
Copy link
Author

khyatiChitroda commented Dec 5, 2019 via email

@umangsaini
Copy link

The RTMP content URL your demo app is trying to play is not video-only. It's FLV header is advertising both audio and video tracks, which is why ExoPlayer will not play the same.

Refer to this link and its solution.

Your FLV header should say only video track present for Exoplayer to play the same. Below is a screenshot of FLVExtractor showing hasAudio flag is true, even when audio track is not present.

RTMP_Video_Only

@khyatiChitroda
Copy link
Author

khyatiChitroda commented Dec 5, 2019

okay Thank you for your response, I need to talk with my team member for this, as we have to done changes into our URL side.

@ojw28 ojw28 closed this as completed Dec 9, 2019
@google google locked and limited conversation to collaborators Feb 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants