-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Add RTSP support #3854
Add RTSP support #3854
Conversation
Thanks for the contribution. I haven't looked in detail yet, but one thing that would definitively need to be changed is that RTSP should be implemented in its own extension similar to VP9 or Opus. Please see @ojw28 comment about it here. Can you move the implementation as far as possible to its own extension? |
We could move the RTSP implementation to an extension but we will like to maintain the RTP an SDP parts in the core library to reuse it in our RTP datasource. |
It's probably even better to put it in library and not extensions (similar to Dash and HLS) because it doesn't use any external third-party dependencies. And it's probably alright to keep certain parts in the core library if they can be reused at different places. |
Regarding controlling the player and listening to player events in the media source: depending on the requirements, you may be able to use the |
Another problem we have is that there is no concept of VCR like FF and RW in exoplayer (only seekTo is supported). In RTSP FF and RW is done at the server level, the player keeps decoding the frames that it receives and the server is in charge of select the I-frames (in forward or reverse order) and send them to the player, so we will need to keep these states (and their multipliers) in the library. |
5ccfa2e
to
2cc2b73
Compare
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. |
5df740d
to
754375b
Compare
CLAs look good, thanks! |
754375b
to
62800d2
Compare
Is there a possibility that this doesn´t work on the emulator. It worked great on all physical devices i have testet with, but not on the emulator. No x86 support? |
@FabianTerhorst it doesn't work with the emulator because of a bug in android. Issue#207602: Emulator does not redirect UDP packets |
Hello there ! |
@anhth58 at the moment we are working to support trick modes and improve the design of the solution and solve the bugs that are detected. Generate thumb video rtsp isn't something we plan to support any time soon; sorry. Anyway, could you give us more detail about what you really need? Generate a tumbail from the video keeping the rtsp live connection paused until you decide to continue playing or stopping the video? |
@portizb Thanks for reply. I need to play serveral video in a screen (paging) without controller, just thumb. Then click to each of them to view full screen. I have tried Exoplayer but it does not work and even without error log. Could you please tell me some guideline ? Thank you so much. |
I have testet this with some cameras now. For the one where it doesn´t work im getting an 200 Ok first and then an 500 Internal Server Error.
Edit: some more logs
|
@FabianTerhorst The exchange of rtsp messages between the client and the server is correct, therefore the behavior of the rtsp client is correct too. The client requests the setup for audio and video, and the server responds with error only in the audio. That is why, the client sends the teardown request. What is the reason the server responds with error? I do not know. Maybe the server is not properly configured or the server only supports RTSP over HTTP. Could you do the same test using a VLC client with verbose enabled (vlc -vvv)? |
Hi. |
@floschu You can reduce the size of buffering when you create the exoplayer instance by adjusting the DefaultLoadControl parameters (bufferForPlaybackMs and bufferForPlaybackAfterRebufferMs). |
I took a quick look at this. Some initial comments that might assist in getting it into something closer to what we'd be happy with:
Let me know what you think. Thanks! |
@ojw28 thanks for your review, I will try to give an answer to all your remarks. First of all, we are already rewriting/refactoring parts of the RTSP/RTP code in response to the feedback received from the testers, due to that we are introducing a reordering buffer to cope with out of order packets that seem to be a problem in some wifi scenarios, we are also improving the compatibility with a larger amount of ip webcams and adding trick modes support We are trying to share code with our RTP extractor so we try to put common code in the util package, if that´s a problem we will move all the RTP code to an RTP extractor and make the RTSP mediasource depend on it. The SDP will become a new library that will be used by the RTSP and RTP packages. We will fix the visibility of the classes outside the library and provide as much info as possible over the library design. |
Is it possible to implement RTSP over HTTP? |
If I could make one feature request.. it would be compatability with being able to play rtsp streams produced by the libstreaming library. on Android: on Windows desktop: Since libstreaming is such a popular library for running rtsp servers on Android, (imho) compatability should be a priority. The library itself is incredibly compact and simple to grok.. so it's possible that it just needs a few minor tweaks (on its end) to be more standards compliant.. dunno. |
@googlebot I consent. |
Hello guys! How is everything? I feel my silence... have been hard times, but I am back! Working in this PR is already a problem, because the code is very outdated, and also I am not the owner of the branch, although I do own the code. So, I need to work on my own branch. My idea is to create either two new PRs, one for RTP, and one for RTSP, or just a new one with all the code. Likewise, i am open to your suggestions. The first PR provides the RTP library and the necessary tools to play audio or video or mux (only with mp2ts over RTP). This version is an extension and improves the one used by RTSP. The second PR provides the RTSP library (RTSP and SDP), and use the new RTP library. Currently, I am working in two branches: https://github.com/portizb/ExoPlayer/tree/dev-v2-rtp (The RTP code is not uploaded) https://github.com/portizb/ExoPlayer/tree/dev-v2-rtsp Anyway, and before doing anything, I have to take a look at the code. Thanks for your patience and understanding. |
@portizb Welcome back and thanks for the message! @lcf87 has been working on RTSP support on our side using the latest sources as a starting point, so you may want to hold off working on this pull request further until we start publishing pieces of that (likely early next year). Our implementation is probably going to be quite minimal at first (e.g., lacking support for various media formats) so contributions will be welcome. |
@andrewlewis Excellent! So, I will wait until that day and then, I will take your implementation as a starting point to continue contributing. |
@googlebot I consent |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
Hi @tresvecesseis , I only want to ask if this RTSP support will be included at some point inside the master branch of the ExoPlayer. Thank you for your effort. |
@lars18th My previous comment still applies. We expect to have a minimal, official implementation to share in the near future. Thanks for your patience! |
Any news on this PR? |
Can you also add support for RTSPS (RTSP over SSL). Nest cameras uses it. Or is there some trick to make it work out of the box? |
Hi, I suggest to add simple SAT>IP compatibility to this source. One relevant change is the requirement to understand the "com.ses.streamID" parameter of the SETUP command as the session ID. See this inside the VideoLAN source: |
ExoPlayer release 2.14 included our RTSP support implementations! It supports playback with RTSP/1.0 (RFC2326) with RTP/AVP (RFC1889). Please reference our more in-depth info here. Format support:
Network support:
We support streaming unicast RTP with UDP and TCP (also known as RTP-over-RTSP). In the current implementation, if no RTP packet is received on UDP, ExoPlayer will retry playback using TCP. To try it out Simply add an entry to the demo app's media list here For instance:
Debugging tip |
Is it possible to play streams that require authentication? If so, could you give an example? |
I think the easiest way it is
|
Hi, It's possible that someone address the compatibility with SAT>IP servers, please? |
@sproctor @notjulian Basic Auth works with this MR's source. But it doesn't work with the preliminary RTSP support in 2.14.0. See #8941. |
@Pitel Thanks. My source uses digest authentication, which is supported on https://github.com/portizb/ExoPlayer/tree/dev-v2-rtsp . I hope it gets support here too. |
Has anyone else tried playing RTSP with r2.14.0 and experienced this issue? Unless I'm completely missing a step, that is what I see when I try to play: |
RTSP announcements: =================== https://exoplayer.dev/rtsp.html https://github.com/google/ExoPlayer/blob/release-v2/RELEASENOTES.md#2140-2021-05-13 google/ExoPlayer#3854 (comment) references: =========== https://github.com/google/ExoPlayer/blob/r2.14.0/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsMediaSource.java#L368 https://github.com/google/ExoPlayer/blob/r2.14.0/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DashMediaSource.java#L371 https://github.com/google/ExoPlayer/blob/r2.14.0/library/smoothstreaming/src/main/java/com/google/android/exoplayer2/source/smoothstreaming/SsMediaSource.java#L316 https://github.com/google/ExoPlayer/blob/r2.14.0/library/rtsp/src/main/java/com/google/android/exoplayer2/source/rtsp/RtspMediaSource.java#L123 https://github.com/google/ExoPlayer/blob/r2.14.0/library/core/src/main/java/com/google/android/exoplayer2/source/ProgressiveMediaSource.java#L221 https://github.com/google/ExoPlayer/blob/r2.14.0/library/core/src/main/java/com/google/android/exoplayer2/source/SingleSampleMediaSource.java#L122 https://github.com/google/ExoPlayer/blob/r2.14.0/library/core/src/main/java/com/google/android/exoplayer2/upstream/RawResourceDataSource.java#L75 https://github.com/google/ExoPlayer/blob/r2.14.0/library/common/src/main/java/com/google/android/exoplayer2/MediaItem.java#L58 https://github.com/google/ExoPlayer/blob/r2.14.0/library/common/src/main/java/com/google/android/exoplayer2/util/MimeTypes.java#L115 https://github.com/google/ExoPlayer/blob/r2.14.0/library/core/src/main/java/com/google/android/exoplayer2/util/EventLogger.java#L79 https://github.com/google/ExoPlayer/blob/r2.14.0/library/core/src/main/java/com/google/android/exoplayer2/SimpleExoPlayer.java#L215 https://github.com/google/ExoPlayer/blob/r2.14.0/library/core/src/main/java/com/google/android/exoplayer2/analytics/AnalyticsCollector.java#L91 https://github.com/google/ExoPlayer/blob/r2.14.0/library/core/src/main/java/com/google/android/exoplayer2/DefaultLoadControl.java#L112 https://github.com/google/ExoPlayer/blob/r2.14.0/library/core/src/main/java/com/google/android/exoplayer2/text/TextRenderer.java https://github.com/google/ExoPlayer/blob/r2.14.0/demos/main/src/main/java/com/google/android/exoplayer2/demo/TrackSelectionDialog.java#L356 issue: ====== google/ExoPlayer#8994 - there appears to be a minor problem with RTSP support in r2.14.0 - attempting to play an RTSP stream causes the app to crash - this should be resolved by updating ExoPlayer after a fix is released * TBD
This is our first public release of our in-house RTSP Mediasource, we have to rewrite it several
times to make it useful for a wider audience and more easily maintainable and extensible.
It currently supports:
devices use URL parameters to encode user/password info)
(interleaved not implemented)
We are working to integrate Server Trick Modes and asynchronous notifications, but we have to
clarify the best way to control a push media source (we need to modify explayerImpInternal to
communicate the player state to the media source - pause - and the media source to inform that
some events had ocurred - end of stream reached, begin of stream reached, ...) with
the Exoplayer lead developers in the meantime the trick modes have to be implemented outside the library.