Quit VLC on loss of stream

For questions and discussion that is NOT (I repeat NOT) specific to a certain Operating System.
troykelly
Blank Cone
Blank Cone
Posts: 11
Joined: 10 Nov 2020 05:27
VLC version: 3.0.11.1
Operating System: Linux
Location: Sydney, Australia
Contact:

Quit VLC on loss of stream

Postby troykelly » 15 Jan 2021 07:34

Using VLC to transcode via a VLM and I can not work out how to get VLC to quit if it stops transcoding the stream.

VLC is being started with

Code: Select all

/usr/bin/vlc -I telnet --telnet-password=${PASSWORD} --telnet-port=${PORT} --drop-late-frames --skip-frames --play-and-exit --no-daemon --adaptive-logic=${VLC_ADAPTIVE_LOGIC} --adaptive-maxwidth=${VLC_ADAPTIVE_WIDTH} --adaptive-maxheight=${VLC_ADAPTIVE_HEIGHT} --adaptive-bw=${VLC_ADAPTIVE_BITRATE} --vlm-conf=/vlc/stream.vlm
Where the VLM is simply

Code: Select all

del all new stream broadcast enabled setup stream option network-caching=1000 setup stream input "http://example.com/stream/abcnews24" loop setup stream output #transcode{venc=x264{preset=ultrafast},vcodec=h264,threads=4,vb=1000}:duplicate{dst='rtp{access=udp,mux=ts,ttl=15,dst=234.0.1.1,port=1234,sdp=sap://,group="News",name="ABC News 24"}'} control stream play
If VLC stops streaming for some reason VLC logs this (but does not quit)

Code: Select all

2x3_1 | [00007f33b3b8e5b0] stream_out_transcode stream out: aspect-ratio changed, reiniting. 1 -> 0 : 1 -> 1. 2x3_1 | [00007f33b27bd500] x264 encoder error: Input picture width (720) is greater than stride (0)
And so I am stuck.

I've been told to build a whole tool using the telnet interface to interrogate VLC - but that doesn't help - because the stream shows as playing (it's not) and `is_playing` always returns `0` even when it _is_ working.

Code: Select all

workstation:~ troy$ telnet streaming.server.example.com 9999 Trying 10.0.0.1... Connected to streaming.server.example.com. Escape character is '^]'. VLC media player 3.0.11.1 Vetinari Password: Welcome, Master > show stream show stream type : broadcast enabled : yes loop : yes inputs 1 : http://example.com/stream/abcnews24 output : #transcode{venc=x264{preset=ultrafast},vcodec=h264,threads=4,vb=1000}:duplicate{dst='rtp{access=udp,mux=ts,ttl=15,dst=234.0.0.1,port=1234,sdp=sap://,group="News",name="ABC News 24"}'} options network-caching=1000 instances instance name : default state : playing position : 0.000000 time : 0 length : 0 rate : 1.000000 title : 0 chapter : 0 can-seek : 0 playlistindex : 1 >
Surely... there must be a way to know if VLC is actually outputting something... somehow?

Rémi Denis-Courmont
Developer
Developer
Posts: 15272
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Quit VLC on loss of stream

Postby Rémi Denis-Courmont » 15 Jan 2021 16:49

The whole point of VLM was to handle multiple streams. Of course it won't quit because of any given single stream.

Just don't use VLM.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

troykelly
Blank Cone
Blank Cone
Posts: 11
Joined: 10 Nov 2020 05:27
VLC version: 3.0.11.1
Operating System: Linux
Location: Sydney, Australia
Contact:

Re: Quit VLC on loss of stream

Postby troykelly » 17 Jan 2021 10:54

Thank you @Rémi Denis-Courmont

Changing to the below. How should I get VLC to quit when not using a VLM?

Code: Select all

/usr/bin/vlc -I telnet --no-repeat --no-loop "${VLC_SOURCE_URL}" --network-caching=${VLC_CACHE} --telnet-password="${PASSWORD}" --telnet-port=${PORT} --drop-late-frames --skip-frames --play-and-exit --no-daemon --adaptive-logic="${VLC_ADAPTIVE_LOGIC}" --adaptive-maxwidth=${VLC_ADAPTIVE_WIDTH} --adaptive-maxheight=${VLC_ADAPTIVE_HEIGHT} --adaptive-bw=${VLC_ADAPTIVE_BITRATE} --sout="${SOUT}" vlc://quit

troykelly
Blank Cone
Blank Cone
Posts: 11
Joined: 10 Nov 2020 05:27
VLC version: 3.0.11.1
Operating System: Linux
Location: Sydney, Australia
Contact:

Re: Quit VLC on loss of stream

Postby troykelly » 18 Jan 2021 22:10

Per Remi's suggestion - I've stopped using a VLM, but VLC does exactly the same thing.

Surely it's not impossible to get VLC to quit when it has given up streaming?

I still can't write an expect script either - because VLC still shows streaming via the telnet interface.

*Stream Dead*

Code: Select all

> is_playing 1 > show show media : ( 0 broadcast - 0 vod ) schedule > status ( new input: rtsp://user:password@rtsp.example.com/ ) ( audio volume: 256 ) ( state playing )
*Stream Alive*

Code: Select all

> is_playing 1 > show show media : ( 0 broadcast - 0 vod ) schedule > status ( new input: http://hls.example.com/stream/1234 ) ( audio volume: 256 ) ( state playing )

EduardoP
New Cone
New Cone
Posts: 5
Joined: 19 Jan 2021 18:50

Re: Quit VLC on loss of stream

Postby EduardoP » 19 Jan 2021 21:15

urely it's not impossible to get VLC to quit when it has given up streaming. Thanks for your help

troykelly
Blank Cone
Blank Cone
Posts: 11
Joined: 10 Nov 2020 05:27
VLC version: 3.0.11.1
Operating System: Linux
Location: Sydney, Australia
Contact:

Re: Quit VLC on loss of stream

Postby troykelly » 20 Jan 2021 03:30

You have a solution @EduardoP ?

Rémi Denis-Courmont
Developer
Developer
Posts: 15272
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: Quit VLC on loss of stream

Postby Rémi Denis-Courmont » 20 Jan 2021 18:08

The simplest way is to add vlc://quit at the end of the playlist.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

troykelly
Blank Cone
Blank Cone
Posts: 11
Joined: 10 Nov 2020 05:27
VLC version: 3.0.11.1
Operating System: Linux
Location: Sydney, Australia
Contact:

Re: Quit VLC on loss of stream

Postby troykelly » 20 Jan 2021 22:58

Per my example above @Remi - it is, and it doesn't quit.
Am I formatting it incorrectly?

troykelly
Blank Cone
Blank Cone
Posts: 11
Joined: 10 Nov 2020 05:27
VLC version: 3.0.11.1
Operating System: Linux
Location: Sydney, Australia
Contact:

Re: Quit VLC on loss of stream

Postby troykelly » 28 Jan 2021 21:36

So, there is no way to quit VLC when a stream ends?

troykelly
Blank Cone
Blank Cone
Posts: 11
Joined: 10 Nov 2020 05:27
VLC version: 3.0.11.1
Operating System: Linux
Location: Sydney, Australia
Contact:

Re: Quit VLC on loss of stream

Postby troykelly » 06 Feb 2021 00:53

Is there any way at all to get VLC to either automatically restart the stream/transcode or quit so it can be restarted as a service?
If there isn't - is there a way to test if VLC is transcoding, and if it isn't, kill it somehow?
I've tried VLM, Command like with vlc://quit at the end, telnet - I'm not sure what else to do?


Return to “General VLC media player Troubleshooting”

Who is online

Users browsing this forum: No registered users and 18 guests