androidx / media

Jetpack Media3 support libraries for media use cases, including ExoPlayer, an extensible media player for Android
https://developer.android.com/media/media3
Apache License 2.0
1.75k stars 422 forks source link

How to modify sdp when using RTSP as an ExoPlayer #1463

Open Oscar-World opened 5 months ago

Oscar-World commented 5 months ago

The IP Camera I have doesn't send me the fmtp attribute, so I face the missing attribute fmtp error. Also, must send digest authentication information in sdp from the client to the RTSP server. How do I use ExoPlayer to add the fmtp and digest properties on the client side? By any chance, doesn't ExoPlayer offer the ability to modify sdp?

microkatz commented 4 months ago

Hello @Oscar-World,

Are you looking to create specific static fmtp attributes for your stream and parse those in RtspMediaTrack::generatePayloadFormat?

ExoPlayer does support rtsp streaming using digest authentication. If you provide the username and password in the url string as rtsp://username:password@{IP.ADDRESS}/ then the parsing logic should handle the digest challenge correctly.

If you wanted to modify the sdp for requests, then you might need to fork the repository and provide your own logic in the RtspMessageUtil::serializeRequest static method.

Oscar-World commented 4 months ago

Thank you for your reply. I understood the digest authentication method you explained and how to modify the sdp. But other than how I modify the sdp myself, isn't there a way to use RTSP communication without fmtp properties?

microkatz commented 1 month ago

@Oscar-World

For some encodings, decoders require some initialization data from the stream(ex: H264 and H265). Currently, ExoPlayer parses this data from the fmtp attributes provided in the transport layer and does not support parsing them from the nal units in the stream. There have been requests for this. To note, it would help us support this feature if we were provided example rtsp sources that model this behavior for testing.

Were you able to modify the sdp yourself? Did that fix your scenario?