project-management-only/home-tv-station#5: RTMP players do not always seamlessly transition between episodes



Issue Information

Issue Type: issue
Status: closed
Reported By: btasker
Assigned To: btasker

Milestone: v0.2
Created: 03-Aug-24 14:53



Description

When playing back with RTMP, players get a bit upset around episode change time.

HLS is unaffected



Toggle State Changes

Activity


assigned to @btasker

mentioned in issue #1

The settings do seem to be correct (I've added some explicit settings to be sure).

It occurred to me, though, that maybe it's an issue with VLC instead. I've got ffplay going at the moment to see what happens.

ffplay handles it just fine (it's done several transitions now)

On the basis that it may be a VLC oddity (and I am running an old version: 3.0.16 Vetinari (revision 3.0.13-8-g41878ff4f2)) - I'm going to close this as Invalid for now.

Can always re-open if I run into issues with other players later.

verified

mentioned in commit github-mirror/Home-TV-Station@eb77852a797a062d3f88ca4b9e6a22052f5659bb

Commit: github-mirror/Home-TV-Station@eb77852a797a062d3f88ca4b9e6a22052f5659bb 
Author: B Tasker                            
                            
Date: 2024-08-03T16:30:10.000+01:00 

Message

chore: be explicit about rtmp config (helps with project-management-only/home-tv-station#5)

+9 -0 (9 lines changed)

Re-opening - something similar happens on Kodi too.

The video sticks, but the audio does not. So you get stuck with the last frame of the previous video whilst the audio of the next one plays.

Yeah, so as I suspected, this has to do with changes in the video being fed in (see here).

We need to ensure consistency of resolution + framerate etc.

verified

mentioned in commit github-mirror/Home-TV-Station@ccbc2db3f657c2984c8a319e21837c3177f04202

Commit: github-mirror/Home-TV-Station@ccbc2db3f657c2984c8a319e21837c3177f04202 
Author: B Tasker                            
                            
Date: 2024-08-04T13:07:43.000+01:00 

Message

feat: normalise video parameters to allow seamless changeovers (project-management-only/home-tv-station#5)

+16 -0 (16 lines changed)

The commit above ensure consistency - I've tested it by running and then stopping the testcard.

It does come at a CPU cost though, because we're now doing much more than simply mirroring video.

Streams have the following characteristics:

  Stream [[#0](/issue/project-management-only/home-tv-station/0.html)](/issue/project-management-only/home-tv-station/0.html):0: Audio: aac (LC), 48000 Hz, stereo, fltp, 128 kb/s
  Stream [[#0](/issue/project-management-only/home-tv-station/0.html)](/issue/project-management-only/home-tv-station/0.html):1: Video: h264 (High), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], 1499 kb/s, 25 fps, 25 tbr, 1k tbn, 50 tbc

changed title from {-Allow-} seamless transition {- -}between episodes{- via RTMP-} to {+RTMP players do not always+} seamless{+ly+} transition between episodes

This seems OK so far.

If it does start playing up again, though, one option would be enable rtmp_control. We could then have the publish script make a call to redirect all clients to a new stream (realistically, probably back to the same one) - the idea being that it should result in a disconnect + reconnect.

In the meantime, I've implemented a switch (RTMP_FORCE_REDIRECT) to send clients a redirect away from the stream (and then back again) at a change in presentation.

It needs to be set to true to activate (it's off by default).

It doesn't work with VLC - there may well be other players that don't handle it either, RTMP being the vague spec that it is (I'm starting to get flashbacks...)

Just tested against Kodi's player, seems to work fairly seamlessly with the redirect enabled - I've been using the next API to skip ahead. Occasionally the image will stick, presumably because we've got to wait for the next keyframe in the new stream.

verified

mentioned in commit github-mirror/Home-TV-Station@9f277e706e983b9038b3bf75b3aa45a077ae3511

Commit: github-mirror/Home-TV-Station@9f277e706e983b9038b3bf75b3aa45a077ae3511 
Author: B Tasker                            
                            
Date: 2024-08-04T17:53:33.000+01:00 

Message

feat: implement ability to force redirect players (project-management-only/home-tv-station#5)

+19 -0 (19 lines changed)