androidx / androidx/media

RTSP not working

Open
#2,841 5 comments 0 reactions 1 assignee View on GitHub

@microkatz is already working on this.

Since Oct 13, 2025.

question
Dominant language
Java
Stars
3k
Forks
955
Avg merge
12d 14h
Merged PRs (30d)
2

Description

Hello, I'm trying to play an RTSP link in exoPlayer. But I'm getting an error.
The same link plays correctly in VLC.

Here's how I try to play in exoPlayer:

RtspMediaSource videoSource = new RtspMediaSource.Factory()
.setDebugLoggingEnabled(true)
.createMediaSource(MediaItem.fromUri(url));
exoPlayer.setMediaSource(videoSource);
exoPlayer.prepare();
exoPlayer.setPlayWhenReady(true);

I get an error in the logs:
androidx.media3.exoplayer.ExoPlaybackException: Source error
Caused by: java.io.IOException: java.lang.IllegalArgumentException: bad base-64
Caused by: androidx.media3.exoplayer.rtsp.RtspMediaSource$RtspPlaybackException: java.lang.IllegalArgumentException: bad base-64
at androidx.media3.exoplayer.rtsp.RtspClient$MessageListener.handleRtspResponse(RtspClient.java:701) 
at androidx.media3.exoplayer.rtsp.RtspClient$MessageListener.handleRtspMessage(RtspClient.java:531) 
at androidx.media3.exoplayer.rtsp.RtspClient$MessageListener.lambda$onRtspMessageReceived$0$androidx-media3-exoplayer-rtsp-RtspClient$MessageListener(RtspClient.java:524)

Stream parameters:
"rtsp://171.25.235.253/9ba7c5c359614d9394bace7c7947cea1"
ffprobe version 7.0.1 Copyright (c) 2007-2024 the FFmpeg developers
built with Apple clang version 15.0.0 (clang-1500.3.9.4)
configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/7.0.1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags='-Wl,-ld_classic' --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox --enable-neon
libavutil 59. 8.100 / 59. 8.100
libavcodec 61. 3.100 / 61. 3.100
libavformat 61. 1.100 / 61. 1.100
libavdevice 61. 1.100 / 61. 1.100
libavfilter 10. 1.100 / 10. 1.100
libswscale 8. 1.100 / 8. 1.100
libswresample 5. 1.100 / 5. 1.100
libpostproc 58. 1.100 / 58. 1.100
[tcp @ 0x600003f0da70] No default whitelist set
[tcp @ 0x600003f0da70] Original list of addresses:
[tcp @ 0x600003f0da70] Address 171.25.235.253 port 554
[tcp @ 0x600003f0da70] Interleaved list of addresses:
[tcp @ 0x600003f0da70] Address 171.25.235.253 port 554
[tcp @ 0x600003f0da70] Starting connection attempt to 171.25.235.253 port 554
[tcp @ 0x600003f0da70] Successfully connected to 171.25.235.253 port 554
[rtsp @ 0x13f605a70] SDP:
v=0
o=- 1760166502488591 1 IN IP4 127.0.0.1
s=mpeg4
i=mpeg4
t=0 0
a=tool:Hankvision Server Media v2017.03.21
a=type:broadcast
a=control:*
a=range:npt=0-
a=x-qt-text-nam:mpeg4
a=x-qt-text-inf:mpeg4
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
b=AS:2097
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;profile-level-id=4d002a;sprop-parameter-sets=Z00AKpY1QPAET8s3BQEFQAAAAwBAAAAMoQ==,aO4xsg==config=0000000167640028ad84054562b8ac5474202a2b15c562a3a1015158ae2b151d080a8ac57158a8e84054562b8ac5474202a2b15c562a3a10248521393c9f27e4fe4fc9f279b9b34d081242909c9e4f93f27f27e4f93cdcd9a6b403c0113f2ca9000003007800001c206040001312d000055d4bbdef85e1108d400000000168ee0000
a=x-dimensions: 1920, 1080
a=x-framerate: 25
a=control:track0

Failed to parse interval end specification ''
[rtsp @ 0x13f605a70] video codec set to: h264
[rtsp @ 0x13f605a70] RTP Packetization Mode: 1
[rtsp @ 0x13f605a70] RTP Profile IDC: 4d Profile IOP: 0 Level: 2a
[rtsp @ 0x13f605a70] Extradata set to 0x6000026040e0 (size: 37)
[rtsp @ 0x13f605a70] setting jitter buffer size to 0
[rtsp @ 0x13f605a70] hello state=0
[h264 @ 0x1408046e0] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0x1408046e0] nal_unit_type: 8(PPS), nal_ref_idc: 3
[h264 @ 0x1408046e0] Decoding VUI
[h264 @ 0x1408046e0] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0x1408046e0] nal_unit_type: 8(PPS), nal_ref_idc: 3
[h264 @ 0x1408046e0] Decoding VUI
[h264 @ 0x1408046e0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 3
[h264 @ 0x1408046e0] Format yuvj420p chosen by get_format().
[h264 @ 0x1408046e0] Reinit context to 1920x1088, pix_fmt: yuvj420p
[h264 @ 0x1408046e0] Frame num gap 22 20
[h264 @ 0x1408046e0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 3
Last message repeated 1 times
[h264 @ 0x1408046e0] Decoding VUI
[h264 @ 0x1408046e0] unknown SEI type 229
[h264 @ 0x1408046e0] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0x1408046e0] nal_unit_type: 8(PPS), nal_ref_idc: 3
[h264 @ 0x1408046e0] nal_unit_type: 6(SEI), nal_ref_idc: 0
[h264 @ 0x1408046e0] nal_unit_type: 5(IDR), nal_ref_idc: 3
[h264 @ 0x1408046e0] Decoding VUI
[h264 @ 0x1408046e0] unknown SEI type 229
[h264 @ 0x1408046e0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 3
Last message repeated 5 times
[rtsp @ 0x13f605a70] first_dts 36000 not matching first dts NOPTS (pts NOPTS, duration 3600) in the queue
[h264 @ 0x1408046e0] Decoding VUI
[h264 @ 0x1408046e0] unknown SEI type 229
[rtsp @ 0x13f605a70] All info found
Input #0, rtsp, from 'rtsp://171.25.235.253/9ba7c5c359614d9394bace7c7947cea1':
Metadata:
title : mpeg4
comment : mpeg4
Duration: N/A, start: 0.040000, bitrate: N/A
Stream #0:0, 31, 1/90000: Video: h264 (Main), 1 reference frame, yuvj420p(pc, bt470bg/bt470bg/bt709, progressive, left), 1920x1080, 0/1, 25 fps, 25 tbr, 90k tbn
[h264 @ 0x1408046e0] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0x1408046e0] nal_unit_type: 8(PPS), nal_ref_idc: 3
[h264 @ 0x1408046e0] Decoding VUI

What could be the problem? Thank you.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.