Allow alternate player app from DVR web UI

To stop remuxing or transcoding for live TV, end stream with .mpg:

 http://x.x.x.x:8089/devices/ANY/channels/6032/stream.mpg

I use VLC to watch on my desktop. I created a separate m3u file for each type of channel (News, Network, Movie, etc). You can double click on them and launch VLC with the playlist open and "surf". No guide, but hey.

News.m3u:

#EXTM3U

#EXTINF:-1 tvg-name="MSNBC",MSNBC
http://x.x.x.x:8089/devices/ANY/channels/6050/stream.mpg

#EXTINF:-1 tvg-name="CNN",CNN
http://x.x.x.x:8089/devices/ANY/channels/6030/stream.mpg

#EXTINF:-1 tvg-name="CNNI",CNNI
http://x.x.x.x:8089/devices/ANY/channels/6032/stream.mpg

#EXTINF:-1 tvg-name="FNC",FNC
http://x.x.x.x:8089/devices/ANY/channels/6073/stream.mpg

#EXTINF:-1 tvg-name="FBN",FBN
http://x.x.x.x:8089/devices/ANY/channels/6074/stream.mpg
1 Like

Thanks, had tried that and it works, BUT...
It grabs the live stream with no buffering or trick play.
So you can't skip back, skip forward.
With a recording you can pause and skip.

I was playing with this, adding parameters
http://x.x.x.x:8089/devices/ANY/channels/CHANNEL#/hls/master.m3u8?abr=false&acodec=copy&vcodec=copy&bitrate=10000

Can't seem to find a combination for TVE and PRIME sources that VLC will play that eliminates transcoding.

Try stream.m3u8 instead of master.m3u8

1 Like

That wont play in VLC.

Did some experimenting with VLC, TVE and HDHR Prime channels.

TVE Discovery channel

http://192.168.1.3:8089/devices/ANY/channels/6101/hls
Channels shows Remux running
VLC plays and skips but cannot pause

http://192.168.1.3:8089/devices/ANY/channels/6101/hls/master.m3u8
Channels shows Remux running
VLC plays and skips but cannot pause

http://192.168.1.3:8089/devices/ANY/channels/6101/hls/stream.m3u8
Channels shows Remux running but times out
VLC doesn't play

http://192.168.1.3:8089/devices/ANY/channels/6101/stream.mpg
Channels shows Watching
VLC plays and pauses but cannot skip

http://192.168.1.3:8089/devices/ANY/channels/6101/stream.mpg?format=ts
Channels shows Watching
VLC plays and pauses but cannot skip

Prime TV Land SD mpeg2 channel

http://192.168.1.4:8089/devices/ANY/channels/52/hls
Channels shows Remux running
VLC plays and skips but cannot pause

http://192.168.1.4:8089/devices/ANY/channels/52/hls/master.m3u8
Channels shows Transcoder running but times out
VLC doesn't play

http://192.168.1.4:8089/devices/ANY/channels/52/hls/stream.m3u8
Channels shows Remux running but times out
VLC doesn't play

http://192.168.1.4:8089/devices/ANY/channels/52/stream.mpg
Channels shows Watching
VLC plays and pauses but cannot skip

http://192.168.1.3:8089/devices/ANY/channels/52/stream.mpg?format=ts
Channels shows Watching
VLC plays and pauses but cannot skip

2 Likes

Updated my results for adding '?format=ts'

Can you find me an example of a html link which opens VLC when clicked?

Not sure such a monster exists without using a browser plugin however if a download option was provided so the save or open dialog is shown in the browser then the user could choose to open it in vlc.

1 Like

I haven't looked into that, but a web search indicates need for a browser extension along with a local client app.

Just tried something that works.
If you could pass an m3u containing just the channel selected it should work.
Created a small html file

<html>
<head>
<title>Channels DVR m3u</title>
</head>
<body>
<a href="http://192.168.1.4:8089/devices/ANY/channels.m3u?format=ts" type="application/vnd.apple.mpegurl">Channels DVR m3u</a><br>
</body>
</html>

Opened the html file in Firefox and clicked the link to the m3u and was able to open with VLC
Capture

1 Like

Currently if I right click on the Watch Now button for a currently airing program in the guide on channel 52 (TVLand mpeg2 SD) I can choose to open in a new tab of the browser which allows me to open it in VLC.
What VLC gets is this

master.m3u8

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=10000000,RESOLUTION=528x480
stream.m3u8?abitrate=256&acodec=aac&bitrate=10000&deinterlacer=hardware&indexed=true&resolution=480&ssize=1&vcodec=h264

VLC doesn't play it and Channels DVR times out after 30 seconds.

2021/01/15 18:42:11.232711 [TNR] Opened connection to 1323AADB/0 for ch52 TVLANDP
2021/01/15 18:42:11.233592 [HLS] Starting transcoder for channel 52 from 192.168.1.2 (encoder=remux, resolution=, deinterlacer=, bitrate=0)
2021/01/15 18:42:12.766439 [HLS] Probed live stream in 1.532629223s: mpeg2video 528x480 tt 1410755bps
2021/01/15 18:42:15.284604 [HLS] Session ch52-dANY-ip192.168.1.2 started in 4.612906139s
2021/01/15 18:42:15.285945 [ENC] Starting encoder for ch52 in /volume1/arkives/ChannelsDVR/Streaming/ch52-dANY-ip192.168.1.2-312959462/encoder-1-868992525 at 1 (1.750211) (encoder=h264_vaapi, resolution=480, deinterlacer=hardware, bitrate=10000 segment_size=0.01)
2021/01/15 18:42:45.235092 [HLS] Stopping inactive session ch52-dANY-ip192.168.1.2
2021/01/15 18:42:45.235160 [HLS] Stopping transcoder session ch52-dANY-ip192.168.1.2 (out: 34.149256s, finished: false)
2021/01/15 18:42:45.239322 [ENC] Stopped encoder for ch52 in /volume1/arkives/ChannelsDVR/Streaming/ch52-dANY-ip192.168.1.2-312959462/encoder-1-868992525 after encoding 1 to 25
2021/01/15 18:42:45.239521 [TNR] Closed connection to 1323AADB/0 for ch52 TVLANDP
2021/01/15 18:42:45.241520 [SNR] Statistics for ch52 TVLANDP: ss=97% snq=100% seq=100% bps=2037477,42112-2353760 pps=208,1-237

If I pass this to VLC. it plays just fine.

channels.m3u

#EXTM3U
#EXTINF:-1 channel-id="52" tvg-chno="52" tvg-logo="https://tmsimg.fancybits.co/assets/s16123_ll_h3_aa.png" tvg-name="TVLANDP" group-title="SD",TVLANDP
http://192.168.1.4:8089/devices/ANY/channels/52/stream.mpg?format=ts
2021/01/15 19:19:55.229235 [TNR] Opened connection to 1323AADB/0 for ch52 TVLANDP
2021/01/15 19:21:44.100719 [SNR] Statistics for ch52 TVLANDP: ss=97% snq=100% seq=98%,0%-100% bps=2133034,0-2451520 pps=219,0-248 sigerr=1%
2021/01/15 19:21:44.100875 [TNR] Closed connection to 1323AADB/0 for ch52 TVLANDP```

Nice find. I will try to add a button based on this technique.

The timeouts you're seeing are also unexpected. Does that happen only with live tv, or recordings too?

1 Like

Can you submit a diagnostic log after these fail?

I'm trying to reproduce the behavior on my local system and trying to play the master.m3u8 and stream.m3u8 in my VLC all work great.

Just tried with a recording.
Right clicked Watch Now, open in new tab which allows me to Open with VLC.
VLC doesn't play it.
This is what was passed to VLC.

master.m3u8

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=3776000,RESOLUTION=1280x720
stream.m3u8?abitrate=192&acodec=aac&bitrate=3776&deinterlacer=hardware&indexed=true&resolution=720&ssize=1&vcodec=copy

dvr log

2021/01/16 08:18:05.235078 [HLS] Stopping inactive session file2758-ip192.168.1.2

But, if I open this url in VLC it plays the recording.
http://192.168.1.4:8089/dvr/files/2758/stream.mpg

If I'm using VLC as a client there is no need to transcode/remux since VLC can handle mpeg2/H.264 video and AC-3/AAC audio.

VLC isn't playing the master.m3u8 because it thinks the stream.m3u8 is a local file. VLC error is "filesystem error: cannot open file C:\Users\chDVRuser\AppData\Local\Temp\stream.m3u8 (No such file or directory)". I'm sure the reason this happens is that Firefox downloads the master.m3u8 from Channels DVR, saves it to a temp directory and launches VLC pointing it to the playlist file, so any references in the playlist, like stream.m3u8, are considered relative file paths.

I really don't want my NAS transcoding/remuxing either Live TV or recordings when using VLC to play them. That's why I use stream.mpg with VLC.

When Firefox opens an m3u with VLC on Windows, according to Windows process monitor, this is how Firefox launches VLC.
"absoulte path to\vlc.exe" --started-from-file "C:\Users\chDVRuser\AppData\Local\Temp\master.m3u8"
VLC option --started-from-file means VLC is started from file association (default disabled). Tell VLC that it is being launched due to a file association in the OS.
Edge does the same, just using a different temp directory.

Not sure how it works on other OS's.

1 Like

Watching this with great interest.

image

If at all possible, can this functionality be added to the Watch Now button for the Recordings Web UI as well? Using VLC to bypass transcoding on recorded content would be a nice feature.

1 Like

The failure of VLC to autoplay the above example is due to master.m3u returning relative URIs. This is certainly a gray area (or maybe a violation) of RFC 8216. The use of relative URIs in playlist M3Us is explicitly permitted and addressed:

4.1
...
A URI in a Playlist, whether it is a URI line or part of a tag, MAY
be relative.  Any relative URI is considered to be relative to the
URI of the Playlist that contains it.

The use of relative URIs in a master playlist is not mentioned, but this thread illustrates some of the issues it can cause. Because a master.m3u may be passed a player in some proprietary fashion, a relative URI may be undefined for the player.

To verify this, I used VLC MacOS:

curl -sL "http://dvr.lxc.lan:8089/devices/ANY/channels/9077/hls/master.m3u8?" >/tmp/master.m3u
/Applications/VLC.app/Contents/MacOS/VLC /tmp/master.m3u
(lots of 404 errors since it cannot resolve the URI)
vi /tmp/master.m3u
change: stream.m3u8?acodec=copy&bitrate=3063&indexed=true&resolution=720&ssize=1&vcodec=copy
to: http://dvr.lxc.lan/devices/ANY/channels/9077/hls/stream.m3u8?acodec=copy&bitrate=3063&indexed=true&resolution=720&ssize=1&vcodec=copy
/Applications/VLC.app/Contents/MacOS/VLC /tmp/master.m3u
VLC now plays without issue.

I added a VLC button in the latest prerelease. Please try it out and lmk if it works

2 Likes

Hmm, I couldn't get this working on macOS. I tried with Safari and Chrome. I do have VLC as well as my preferred IINA installed on this Mac but I'm not sure if macOS is able to handle "vlc://" links in that way. I also tried manually pasting the URL into VLC's File -> Open Network dialog (both with the VLC:// prefix as well as it removed, and the https// part fixed to be https://) but those attempts failed too.

Doesn’t work for me either. It does work in iOS.

Ditto not working on Windows 10 in Firefox and Chrome, as well as pasting the link directly in VLC.

image

If it helps at all in troubleshooting, I have a desktop shortcut like this that does work:

"C:\Program Files\VideoLAN\VLC\vlc.exe" "https://dvr-nexus-media-01.local:8089/devices/ANY/channels.m3u?format=ts"

Not working on Windows 10 in Firefox, Brave or Edge.
Firefox gives this error, other browsers do nothing.

The address wasn’t understood
Firefox doesn’t know how to open this address, because one of the following protocols (vlc) isn’t associated with any program or is not allowed in this context.
    You might need to install other software to open this address.

Appears the URI Scheme vlc has to have a protocol handler registered with the browser?
It's not an officially recognized scheme Uniform Resource Identifier (URI) Schemes

Okay I found out it only works on iOS. For Mac/Windows, you have to install a helper: https://github.com/stefansundin/vlc-protocol

I'm not sure why this isn't built into VLC already.

1 Like