Jump to content

RTSP Stream on Roku will connect but drop after a few seconds.


Recommended Posts

SumpnFishy
Posted

Issue: On the Roku connection it connects, and looks great for a few seconds but then goes blurry and drops the connection.

Playing around with a new home security camera from ReoLink. I found an old topic from 2019 on connections using IPTV that works, except on Roku. Just wondering if anyone had any ideas on how to make that work or is it just a limitation of what the Roku app can do on the Roku hardware? I've tried to find info on using http but don't seem to find anything describing the stream requirements. Everything I've tried just gives me error on the http. So neither RTSP or Http seems to work for Roku. Has anyone found anything that works on Roku? (most my TV's are Roku thus the hope I can get something that works).

Also played with m3u files with no luck but maybe I'm just doing that wrong. Any detailed documentation would be great.

Old topic: 

 

Thanks!

Dennis

Posted
23 minutes ago, SumpnFishy said:

Nothing shows 'send files' at the bottom of the home page

It is "Send Logs" and it is under the user menu at the top.

SumpnFishy
Posted

Sorry, that was the instructions that came up in my search. Just sent the file.

SumpnFishy
Posted

Further testing on my MX Linux server. In this case I used a new program called Reostream to setup an http link in IPTV. It did the exact same thing as the RTSP, it connects for a few seconds, pixilates and then drops the connection without errors. Not sure if this helps but attached logs and send debug from Roku client.

Let me know if you need me to do anything else.

Thanks!

Dennis

embyserver MX Linux.txt ffmpeg-transcode-2d6a5af7-7bdc-42d4-9974-d8c7b0a3f0d2_1MX Linux.txt

Posted

hi, rtsp is always difficult so this isn't a guarantee, but are you able to update to the latest version of emby server?

SumpnFishy
Posted

Will do and let you know.

Thanks

Dennis

Posted
3 hours ago, SumpnFishy said:

send debug from Roku client

If I found your log (you didn't provide the identifying info), there were no errors on the player side.

SumpnFishy
Posted

Upgraded the MX Linux system with same results.

At this point I'm going to say Roku is the problem here. Both HTTP (via Reostream) and RTSP exabit the same behaviors. Seems to initially connect fine but then something goes wrong in the processing and drops the connection in about a second or two. I recently have been playing with Gnome Network Displays with pretty much the same results, initial connections fine, then suddenly drops. Apparently Roku is just picky about these things... 🤨

Posted
2 hours ago, SumpnFishy said:

Upgraded the MX Linux system with same results.

At this point I'm going to say Roku is the problem here. Both HTTP (via Reostream) and RTSP exabit the same behaviors. Seems to initially connect fine but then something goes wrong in the processing and drops the connection in about a second or two. I recently have been playing with Gnome Network Displays with pretty much the same results, initial connections fine, then suddenly drops. Apparently Roku is just picky about these things... 🤨

can you please attach new log file examples? Thanks.

Posted

as a test, if you turn off hardware transcoding in server transcoding settings, does that help ?

SumpnFishy
Posted

Tried it, same results.

SumpnFishy
Posted

Just sent.

User Jack

Time 9:23

Attempting to play RTSP Sub in IPTV. Plays for one second then drops.

Posted

Looks like the player goes into a buffering state and then you back out of it.  No errors on the player side.

SumpnFishy
Posted

So maybe more on server side? I originally was trying to use m3u files to created a live tv channel. Is that a better approach in this case? If so what file configuration would help address buffering?

Posted

How long did you wait before backing out?

SumpnFishy
Posted

I don't back out, it drops the connection after a few seconds and I'm back at the playback screen. Originally it would get blurry and then drop the connection but now it's clear until it drops. Not sure what would change that.

Posted (edited)

"AverageFrameRate":10,"RealFrameRate":25.166666,

 

Can you get your stream to use constant frame rate instead of variable? The Roku uses audio timing to sync video. This is impossible to do with variable frame rates. It is also in a TS format with a short duration which is why it ends abruptly. It desyncs cannot find more video frames and exits.

image.png.2b7f08cb3eb553075078e9276dbd1f12.png

To fix RTSP variable frame rate (VFR) streams freezing or stopping on Roku, you need to transcode the stream into a Constant Frame Rate (CFR) HLS format with proper PTS (Presentation Time Stamp) re-generation. Roku's media player engine is notoriously strict about timestamp gaps and erratic frame timing, which are common hallmarks of IP camera RTSP streams.
The Recommended FFmpeg Command
Run the following background command to ingest your RTSP stream, force a constant frame rate, align the audio/video timestamps, and segment it into a Roku-compliant HLS stream:
bash
ffmpeg -rtsp_transport tcp -i "rtsp://YOUR_CAMERA_IP:554/stream" \
  -c:v libx264 -preset superfast -tune zerolatency \
  -vsync cfr -r 30 -g 60 -sc_threshold 0 \
  -c:a aac -b:a 128k -ar 44100 -async 1 \
  -f hls -hls_time 2 -hls_list_size 5 -hls_flags delete_segments \
  -hls_segment_type mpegts /path/to/www/stream.m3u8
Use code with caution.
 
The AI (SI in the USA..lol) shows this which might be useful since the protocol is known prior to Emby launch ffmpeg. It likely can be fixed via ffmpeg. But all this would need to exist in the Emby ffmpeg version.
 
Not sure if it does. @softworkzwould know better than I.
 
Edited by speechles
Posted
1 hour ago, SumpnFishy said:

I don't back out, it drops the connection after a few seconds and I'm back at the playback screen

That is odd as I do not see the player getting a stream end notification nor an error.

Posted (edited)
2 minutes ago, ebr said:

That is odd as I do not see the player getting a stream end notification nor an error.

It is the variable frame rate. It might jump right to the end and bail. It may not give us an error. It sees this as an unrecoverable problem and might just skip frames until it can find one that matches the timestamp. When it cannot find any matching timestamps in the data it has it just ends the stream. It is being fed via m3u8 with ts slices. Those play horrible with variable frame rates. If the player has to skip frames to sync to audio timestamps it might skip out of bounds and see that as the end.

Edited by speechles
Posted
8 hours ago, speechles said:
ffmpeg -rtsp_transport tcp -i "rtsp://YOUR_CAMERA_IP:554/stream" \
  -c:v libx264 -preset superfast -tune zerolatency \
  -vsync cfr -r 30 -g 60 -sc_threshold 0 \
  -c:a aac -b:a 128k -ar 44100 -async 1 \
  -f hls -hls_time 2 -hls_list_size 5 -hls_flags delete_segments \
  -hls_segment_type mpegts /path/to/www/stream.m3u8
Use code with caution.
 
The AI (SI in the USA..lol) shows this which might be useful since the protocol is known prior to Emby launch ffmpeg. It likely can be fixed via ffmpeg. But all this would need to exist in the Emby ffmpeg version.
 
Not sure if it does. @softworkzwould know better than I.

We're actually transcoding to a constant framerate already, it could only reach the client as vfr when just remuxing. 

I'm not sure whether the command is meant for the user to execute, but if yes, then they should not encode anything to hls but rather to mp4 or mkv.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...