Mailing List Archive

Debugging problem with ExternalRecorder and streamlink
Hello,

I have previously written about these problems but I wonder if the
ExternalRecorder can be run independently without the involvement
of the mythtv backend?

I have a problem getting ExternalRecorder to work with streamlink,
which has worked in the past.

Standalone streamlink works but unfortunately not together with
ExternalRecorder and I would like to debug the problem.

/Peter
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Debugging problem with ExternalRecorder and streamlink [ In reply to ]
On Sat, May 15, 2021 at 3:45 PM Peter Carlsson
<peter.jm.carlsson@gmail.com> wrote:

> I have previously written about these problems but I wonder if the
> ExternalRecorder can be run independently without the involvement
> of the mythtv backend?

Yes (at least on a system with the required MythTV
support libraries, such as your backend). On the
recent development branch, something like (add
additional options as configured in your capturecard):

/usr/bin/mythexternalrecorder --logpath /tmp --verbose all
--loglevel debug --conf XXXXX >/dev/null

and then you will need to enter commands that
are appropriate/understood to the external recorder.

Such as:

0:HasTuner?
0:TuneChannel:1234
0:HasLock?
0:HasLock?
0:StartStreaming
0:CloseRecorder

The 0 is a serial number (previous versions may
not use API version 2, with a serial number, so
if the recorder complains, eliminate the '0:'), and
would normally increment for serialization
purposes, but for manual testing you can just
use zero.

The redirect of stdout to /dev/null just throws
away the transport stream, so if you want to
keep that, redirect it to someplace useful.
As it is a raw binary stream, you will not want
it sent to your terminal.

The external recorder will respond as it would to
the backend, and also produce additional
information in the logfile which will be in the
logpath directory (named something like
mythexternalrecorder.DATETIME.PID.log).

The commands are documented in the wiki at:

https://www.mythtv.org/wiki/ExternalRecorder

and you may be able to use a previous
BE log to suggest the commands you
want to issue for your testing.
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Debugging problem with ExternalRecorder and streamlink [ In reply to ]
On Sat, May 15, 2021 at 04:50:51PM +0000, Gary Buhrmaster wrote:
> On Sat, May 15, 2021 at 3:45 PM Peter Carlsson
> <peter.jm.carlsson@gmail.com> wrote:
>
> > I have previously written about these problems but I wonder if the
> > ExternalRecorder can be run independently without the involvement
> > of the mythtv backend?
>
> Yes (at least on a system with the required MythTV
> support libraries, such as your backend). On the
> recent development branch, something like (add
> additional options as configured in your capturecard):
>
> /usr/bin/mythexternalrecorder --logpath /tmp --verbose all
> --loglevel debug --conf XXXXX >/dev/null
>
> and then you will need to enter commands that
> are appropriate/understood to the external recorder.
>
> Such as:
>
> 0:HasTuner?
> 0:TuneChannel:1234
> 0:HasLock?
> 0:HasLock?
> 0:StartStreaming
> 0:CloseRecorder
>
> The 0 is a serial number (previous versions may
> not use API version 2, with a serial number, so
> if the recorder complains, eliminate the '0:'), and
> would normally increment for serialization
> purposes, but for manual testing you can just
> use zero.
>
> The redirect of stdout to /dev/null just throws
> away the transport stream, so if you want to
> keep that, redirect it to someplace useful.
> As it is a raw binary stream, you will not want
> it sent to your terminal.
>
> The external recorder will respond as it would to
> the backend, and also produce additional
> information in the logfile which will be in the
> logpath directory (named something like
> mythexternalrecorder.DATETIME.PID.log).
>
> The commands are documented in the wiki at:
>
> https://www.mythtv.org/wiki/ExternalRecorder
>
> and you may be able to use a previous
> BE log to suggest the commands you
> want to issue for your testing.

Hello and thanks for the help. I have done this previously but did not
know how much the backend was involved.

Here is the output from a debug session. From what I can tell HasLock
never returns Yes. Is it possible to debug this part even further?

Since it works directly with streamlink there seems to be a difference
in how it locks to the stream?

peter@server:~$ mythexternrecorder --logpath /tmp --verbose all --loglevel debug --conf /home/peter/delat/script/mythtv-svtplay-external-recorder.conf
2021-05-18 16:17:34.556339 C mythexternrecorder version: [v31.0] www.mythtv.org
2021-05-18 16:17:34.556354 C Qt version: compile: 5.11.3, runtime: 5.11.3
2021-05-18 16:17:34.556374 I Debian GNU/Linux 10 (buster) (x86_64)
2021-05-18 16:17:34.556379 N Enabled verbose msgs: all
2021-05-18 16:17:34.556456 N Setting Log Level to LOG_DEBUG
2021-05-18 16:17:34.566832 I Added logging to the console
2021-05-18 16:17:34.567035 D New Logging Client: ID: (#1)
2021-05-18 16:17:34.567068 I Added logging to /tmp/mythexternrecorder.20210518141734.22509.log
2021-05-18 16:17:34.567081 I : Command parser ready.
2021-05-18 16:17:34.567157 I : Buffer: Ready for data.
2021-05-18 16:17:34.567404 I Channels in '/home/peter/delat/script/mythtv-svtplay-external-recorder-channels.conf', Tuner: '', Scanner: ''
0:HasTuner?
0:OK:Yes
0:HasTuner?'6:17:46.205687 D : Processing '
0:OK:Yes'8 16:17:46.205888 I : Processing 'HasTuner' --> '
0:TuneChannel:1
2021-05-18 16:17:57.283790 D : Processing '0:TuneChannel:1'
0:OK:Tuned to 1
2021-05-18 16:17:57.290625 D streamlink "%URL%" "%CHANNUM%" "%CHANNAME%" "%CALLSIGN%" : '%URL%' replaced with 'https://www.svtplay.se/kanaler/svt1?start=auto' in cmd: '/usr/bin/streamlink --player=vlc --stdout "https://www.svtplay.se/kanaler/svt1?start=auto" best'
2021-05-18 16:17:57.290671 I streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Processing 'TuneChannel' --> '0:OK:Tuned to 1'
0:HasLock?
0:OK:No
2021-05-18 16:18:34.847504 D streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Processing '0:HasLock?'
2021-05-18 16:18:34.847520 I streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Processing '0:HasLock?' --> '0:OK:No'
0:HasLock?
0:OK:No
2021-05-18 16:18:44.517351 D streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Processing '0:HasLock?'
2021-05-18 16:18:44.517369 I streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Processing '0:HasLock?' --> '0:OK:No'
0:HasLock?
0:OK:No
2021-05-18 16:18:51.663488 D streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Processing '0:HasLock?'
2021-05-18 16:18:51.663504 I streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Processing '0:HasLock?' --> '0:OK:No'
0:HasLock?
0:OK:No
2021-05-18 16:18:58.295381 D streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Processing '0:HasLock?'
2021-05-18 16:18:58.295398 I streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Processing '0:HasLock?' --> '0:OK:No'
0:StartStreaming
0:OK:Streaming Started
2021-05-18 16:19:06.487610 D streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Processing '0:StartStreaming'
2021-05-18 16:19:06.490527 I (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Starting process '/usr/bin/streamlink' args: '--player=vlc --stdout https://www.svtplay.se/kanaler/svt1?start=auto best'
2021-05-18 16:19:06.541807 I (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Started process '/usr/bin/streamlink' PID 22644
2021-05-18 16:19:06.541859 I (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Processing 'StartStreaming' --> '0:OK:Streaming Started'
2021-05-18 16:19:07.455385 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Adding 65536 bytes
2021-05-18 16:19:07.465725 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Adding 90112 bytes
2021-05-18 16:19:07.475982 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Adding 73728 bytes
2021-05-18 16:19:07.486180 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Adding 65536 bytes
2021-05-18 16:19:07.496488 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Adding 131072 bytes
2021-05-18 16:19:07.506757 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Adding 131072 bytes
2021-05-18 16:19:07.516955 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Adding 73728 bytes
2021-05-18 16:19:10.535648 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Adding 65536 bytes
2021-05-18 16:19:10.545940 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Adding 131072 bytes
2021-05-18 16:19:10.556175 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Adding 81920 bytes
2021-05-18 16:19:10.566454 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Adding 131072 bytes
2021-05-18 16:19:10.576627 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Adding 57344 bytes
2021-05-18 16:19:10.586881 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Adding 32768 bytes
2021-05-18 16:19:10.597117 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Adding 65536 bytes
2021-05-18 16:19:10.607417 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Adding 114688 bytes
0:CloseRecorder
0:OK:Terminating
2021-05-18 16:19:13.117330 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Processing '0:CloseRecorder'
2021-05-18 16:19:13.117357 I (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Processing '0:CloseRecorder' --> '0:OK:Terminating'
2021-05-18 16:19:13.134619 I (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" Sending SIGINT to App(22644)

0:0:ERR:Version 2 API expects serial_no:msg format. Saw '' instead
2021-05-18 16:19:13.827020 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Processing ''
0:STATUS:Streaming Stopped
2021-05-18 16:19:16.906314 I streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : External application terminated.
2021-05-18 16:19:16.906334 I (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Processing 'StopStreaming' --> '0:STATUS:Streaming Stopped'
2021-05-18 16:19:16.906359 I streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Closing application.
2021-05-18 16:19:16.906487 I streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Buffer: shutting down
2021-05-18 16:19:17.080015 I streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Command parser: shutting down
2021-05-18 16:19:17.080055 C streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Terminated.
2021-05-18 16:19:17.170509 I Removed logging to /tmp/mythexternrecorder.20210518141734.22509.log
peter@server:~$

_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Debugging problem with ExternalRecorder and streamlink [ In reply to ]
On Tue, May 18, 2021 at 04:26:56PM +0200, Peter Carlsson wrote:
> On Sat, May 15, 2021 at 04:50:51PM +0000, Gary Buhrmaster wrote:
> > On Sat, May 15, 2021 at 3:45 PM Peter Carlsson
> > <peter.jm.carlsson@gmail.com> wrote:
> >
> > > I have previously written about these problems but I wonder if the
> > > ExternalRecorder can be run independently without the involvement
> > > of the mythtv backend?
> >
> > Yes (at least on a system with the required MythTV
> > support libraries, such as your backend). On the
> > recent development branch, something like (add
> > additional options as configured in your capturecard):
> >
> > /usr/bin/mythexternalrecorder --logpath /tmp --verbose all
> > --loglevel debug --conf XXXXX >/dev/null
> >
> > and then you will need to enter commands that
> > are appropriate/understood to the external recorder.
> >
> > Such as:
> >
> > 0:HasTuner?
> > 0:TuneChannel:1234
> > 0:HasLock?
> > 0:HasLock?
> > 0:StartStreaming
> > 0:CloseRecorder
> >
> > The 0 is a serial number (previous versions may
> > not use API version 2, with a serial number, so
> > if the recorder complains, eliminate the '0:'), and
> > would normally increment for serialization
> > purposes, but for manual testing you can just
> > use zero.
> >
> > The redirect of stdout to /dev/null just throws
> > away the transport stream, so if you want to
> > keep that, redirect it to someplace useful.
> > As it is a raw binary stream, you will not want
> > it sent to your terminal.
> >
> > The external recorder will respond as it would to
> > the backend, and also produce additional
> > information in the logfile which will be in the
> > logpath directory (named something like
> > mythexternalrecorder.DATETIME.PID.log).
> >
> > The commands are documented in the wiki at:
> >
> > https://www.mythtv.org/wiki/ExternalRecorder
> >
> > and you may be able to use a previous
> > BE log to suggest the commands you
> > want to issue for your testing.
>
> Hello and thanks for the help. I have done this previously but did not
> know how much the backend was involved.
>
> Here is the output from a debug session. From what I can tell HasLock
> never returns Yes. Is it possible to debug this part even further?
>
> Since it works directly with streamlink there seems to be a difference
> in how it locks to the stream?
>
> peter@server:~$ mythexternrecorder --logpath /tmp --verbose all --loglevel debug --conf /home/peter/delat/script/mythtv-svtplay-external-recorder.conf
> 2021-05-18 16:17:34.556339 C mythexternrecorder version: [v31.0] www.mythtv.org
> 2021-05-18 16:17:34.556354 C Qt version: compile: 5.11.3, runtime: 5.11.3
> 2021-05-18 16:17:34.556374 I Debian GNU/Linux 10 (buster) (x86_64)
> 2021-05-18 16:17:34.556379 N Enabled verbose msgs: all
> 2021-05-18 16:17:34.556456 N Setting Log Level to LOG_DEBUG
> 2021-05-18 16:17:34.566832 I Added logging to the console
> 2021-05-18 16:17:34.567035 D New Logging Client: ID: (#1)
> 2021-05-18 16:17:34.567068 I Added logging to /tmp/mythexternrecorder.20210518141734.22509.log
> 2021-05-18 16:17:34.567081 I : Command parser ready.
> 2021-05-18 16:17:34.567157 I : Buffer: Ready for data.
> 2021-05-18 16:17:34.567404 I Channels in '/home/peter/delat/script/mythtv-svtplay-external-recorder-channels.conf', Tuner: '', Scanner: ''
> 0:HasTuner?
> 0:OK:Yes
> 0:HasTuner?'6:17:46.205687 D : Processing '
> 0:OK:Yes'8 16:17:46.205888 I : Processing 'HasTuner' --> '
> 0:TuneChannel:1
> 2021-05-18 16:17:57.283790 D : Processing '0:TuneChannel:1'
> 0:OK:Tuned to 1
> 2021-05-18 16:17:57.290625 D streamlink "%URL%" "%CHANNUM%" "%CHANNAME%" "%CALLSIGN%" : '%URL%' replaced with 'https://www.svtplay.se/kanaler/svt1?start=auto' in cmd: '/usr/bin/streamlink --player=vlc --stdout "https://www.svtplay.se/kanaler/svt1?start=auto" best'
> 2021-05-18 16:17:57.290671 I streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Processing 'TuneChannel' --> '0:OK:Tuned to 1'
> 0:HasLock?
> 0:OK:No
> 2021-05-18 16:18:34.847504 D streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Processing '0:HasLock?'
> 2021-05-18 16:18:34.847520 I streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Processing '0:HasLock?' --> '0:OK:No'
> 0:HasLock?
> 0:OK:No
> 2021-05-18 16:18:44.517351 D streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Processing '0:HasLock?'
> 2021-05-18 16:18:44.517369 I streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Processing '0:HasLock?' --> '0:OK:No'
> 0:HasLock?
> 0:OK:No
> 2021-05-18 16:18:51.663488 D streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Processing '0:HasLock?'
> 2021-05-18 16:18:51.663504 I streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Processing '0:HasLock?' --> '0:OK:No'
> 0:HasLock?
> 0:OK:No
> 2021-05-18 16:18:58.295381 D streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Processing '0:HasLock?'
> 2021-05-18 16:18:58.295398 I streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Processing '0:HasLock?' --> '0:OK:No'
> 0:StartStreaming
> 0:OK:Streaming Started
> 2021-05-18 16:19:06.487610 D streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Processing '0:StartStreaming'
> 2021-05-18 16:19:06.490527 I (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Starting process '/usr/bin/streamlink' args: '--player=vlc --stdout https://www.svtplay.se/kanaler/svt1?start=auto best'
> 2021-05-18 16:19:06.541807 I (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Started process '/usr/bin/streamlink' PID 22644
> 2021-05-18 16:19:06.541859 I (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Processing 'StartStreaming' --> '0:OK:Streaming Started'
> 2021-05-18 16:19:07.455385 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Adding 65536 bytes
> 2021-05-18 16:19:07.465725 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Adding 90112 bytes
> 2021-05-18 16:19:07.475982 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Adding 73728 bytes
> 2021-05-18 16:19:07.486180 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Adding 65536 bytes
> 2021-05-18 16:19:07.496488 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Adding 131072 bytes
> 2021-05-18 16:19:07.506757 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Adding 131072 bytes
> 2021-05-18 16:19:07.516955 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Adding 73728 bytes
> 2021-05-18 16:19:10.535648 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Adding 65536 bytes
> 2021-05-18 16:19:10.545940 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Adding 131072 bytes
> 2021-05-18 16:19:10.556175 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Adding 81920 bytes
> 2021-05-18 16:19:10.566454 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Adding 131072 bytes
> 2021-05-18 16:19:10.576627 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Adding 57344 bytes
> 2021-05-18 16:19:10.586881 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Adding 32768 bytes
> 2021-05-18 16:19:10.597117 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Adding 65536 bytes
> 2021-05-18 16:19:10.607417 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Adding 114688 bytes
> 0:CloseRecorder
> 0:OK:Terminating
> 2021-05-18 16:19:13.117330 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Processing '0:CloseRecorder'
> 2021-05-18 16:19:13.117357 I (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Processing '0:CloseRecorder' --> '0:OK:Terminating'
> 2021-05-18 16:19:13.134619 I (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" Sending SIGINT to App(22644)
>
> 0:0:ERR:Version 2 API expects serial_no:msg format. Saw '' instead
> 2021-05-18 16:19:13.827020 D (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Processing ''
> 0:STATUS:Streaming Stopped
> 2021-05-18 16:19:16.906314 I streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : External application terminated.
> 2021-05-18 16:19:16.906334 I (pid 22644) streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Processing 'StopStreaming' --> '0:STATUS:Streaming Stopped'
> 2021-05-18 16:19:16.906359 I streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Closing application.
> 2021-05-18 16:19:16.906487 I streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Buffer: shutting down
> 2021-05-18 16:19:17.080015 I streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Command parser: shutting down
> 2021-05-18 16:19:17.080055 C streamlink "https://www.svtplay.se/kanaler/svt1?start=auto" "1" "SVT1 HD" "SVT1HD" : Terminated.
> 2021-05-18 16:19:17.170509 I Removed logging to /tmp/mythexternrecorder.20210518141734.22509.log
> peter@server:~$

According to the log above it receive data from streamlink but fails to
find the start of the stream to sync/lock on.

I have no knowledge about how this is working but it feels that MythTV
and VLC have different ways of finding the start of a stream.

Could someone explain how this works in MythTV?

I can build MythTV and add more logging but am not sure where to put it
and what I should log to best find out what is failing.

Best regards,
Peter Carlsson
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Debugging problem with ExternalRecorder and streamlink [ In reply to ]
On 6/24/21 5:32 PM, Peter Carlsson wrote:
> According to the log above it receive data from streamlink but fails to
> find the start of the stream to sync/lock on.
>
> I have no knowledge about how this is working but it feels that MythTV
> and VLC have different ways of finding the start of a stream.
>
> Could someone explain how this works in MythTV?
>
> I can build MythTV and add more logging but am not sure where to put it
> and what I should log to best find out what is failing.
>
> Best regards,
> Peter Carlsson

I don't know what streamlink is. I am working on a system using the
external recorder to record from Xfinity stream, and it is working
reasonably well.

Can you explain your setup.

I am using capturecard External Black Box. In mythtv-setup I give it the
name and location of a bash script. That script does a few things and
then calls mythexternrecorder passing the name of a configuration file.
The configuration file contains the names of scripts that are executed
to tune, to record, to end recordings and to signal a new episode.

Is this similar to your setup?

The script that is executed to record must output a transport stream to
stdout and not output anything else (no messages, etc.). Since the
capture device I have does not output a transport stream I execute
ffmpeg to convert to a transport stream. I can share the details.

Peter


_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Debugging problem with ExternalRecorder and streamlink [ In reply to ]
On Fri, Jun 25, 2021 at 11:33:46AM -0400, Peter Bennett wrote:
>
> On 6/24/21 5:32 PM, Peter Carlsson wrote:
> > According to the log above it receive data from streamlink but fails to
> > find the start of the stream to sync/lock on.
> >
> > I have no knowledge about how this is working but it feels that MythTV
> > and VLC have different ways of finding the start of a stream.
> >
> > Could someone explain how this works in MythTV?
> >
> > I can build MythTV and add more logging but am not sure where to put it
> > and what I should log to best find out what is failing.
> >
> > Best regards,
> > Peter Carlsson
>
> I don't know what streamlink is. I am working on a system using the external
> recorder to record from Xfinity stream, and it is working reasonably well.
>
> Can you explain your setup.
>
> I am using capturecard External Black Box. In mythtv-setup I give it the
> name and location of a bash script. That script does a few things and then
> calls mythexternrecorder passing the name of a configuration file. The
> configuration file contains the names of scripts that are executed to tune,
> to record, to end recordings and to signal a new episode.
>
> Is this similar to your setup?
>
> The script that is executed to record must output a transport stream to
> stdout and not output anything else (no messages, etc.). Since the capture
> device I have does not output a transport stream I execute ffmpeg to convert
> to a transport stream. I can share the details.

Thanks for sharing!

https://streamlink.github.io

I had it working perfectly until the plugin for SVTPlay in Streamlink
stopped working. It did not take long before Ian Cameron fixed/rewrote
the plugin and it start work in Streamlink again but after that I never
got it working in MythTV.

If I remember correctly I followed the examples on https://www.mythtv.org/wiki/Example_Configuration_files
when I first set it up.

As I wrote in my previous email it feels that MythTV is receiving a
stream from Streamlink but never find the start of the stream to
sync/lock on.

It never crossed my mind to try ffmpeg until I read that you use it. I
should probably give that a try.

Please let me know if you want some further explanation.

Here are my config files.

# cat /home/peter/script/mythtv-svtplay-external-recorder.conf
[RECORDER]
# The recorder command to execute. %URL% is optional, and
# will be replaced with the channel's "URL" as defined in the
# [TUNER/channels] (channel conf) configuration file
#command="cvlc \"%URL%\" --sout \"#std{mux=ts,access=file,dst=-}\""
command="/usr/bin/streamlink --player=vlc --stdout \"%URL%\" best"

# Used in logging events, %ARG% are replaced from the channel info
desc=streamlink \"%URL%\" \"%CHANNUM%\" \"%CHANNAME%\" \"%CALLSIGN%\"

[TUNER]
# An optional CONF file which provides channel details. If it does not
# exist, then channel changes are not supported.
channels=mythtv-svtplay-external-recorder-channels.conf

# If [TUNER/command] is provided, it will be executed to "tune" the
# channel. A %URL% parameter will be substituted with the "URL" as
# defined in the [TUNER/channels] configuration file
#command=

# Timeout for changing channels in msecs
#timeout=


[SCANNER]
# When MythTV scans for channels, The contents of the [TUNER/channels]
# config file are used to populate MythTV's channel information.
# If a command is provided here, it will be executed first, so it can
# populate the [TUNER/channels] config file
#command=/home/myth/bin/scan.sh "%CHANCONF%"

# Timeout for scan command in msecs
#timeout=60000

# cat /home/peter/script/mythtv-svtplay-external-recorder-channels.conf
[1]
NAME=SVT1 HD
CALLSIGN=SVT1HD
XMLTVID=svt1.svt.se
URL="https://www.svtplay.se/kanaler/svt1?start=auto"
ICON=/home/mythtv/.mythtv/channels/svt1.svt.se.png

[2]
NAME=SVT2 HD
CALLSIGN=SVT2HD
XMLTVID=svt2.svt.se
URL="https://www.svtplay.se/kanaler/svt2?start=auto"
ICON=/home/mythtv/.mythtv/channels/svt2.svt.se.png

[3]
NAME=Kunskapskanalen
CALLSIGN=Kunskapskanalen
XMLTVID=kunskapskanalen.svt.se
URL="https://www.svtplay.se/kanaler/kunskapskanalen?start=auto"
ICON=/home/mythtv/.mythtv/channels/kunskapskanalen.svt.se.png

[4]
NAME=Barnkanalen
CALLSIGN=Barnkanalen
XMLTVID=barnkanalen.svt.se
URL="https://www.svtplay.se/kanaler/svtbarn?start=auto"
ICON=/home/mythtv/.mythtv/channels/barnkanalen.svt.se.png

[5]
NAME=SVT24
CALLSIGN=SVT24
XMLTVID=svt24.svt.se
URL="https://www.svtplay.se/kanaler/svt24?start=auto"
ICON=/home/mythtv/.mythtv/channels/svt24.svt.se.png

_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Debugging problem with ExternalRecorder and streamlink [ In reply to ]
On 6/26/21 5:30 PM, Peter Carlsson wrote:
> On Fri, Jun 25, 2021 at 11:33:46AM -0400, Peter Bennett wrote:
>> On 6/24/21 5:32 PM, Peter Carlsson wrote:
>>> According to the log above it receive data from streamlink but fails to
>>> find the start of the stream to sync/lock on.
>>>
>>> I have no knowledge about how this is working but it feels that MythTV
>>> and VLC have different ways of finding the start of a stream.
>>>
>>> Could someone explain how this works in MythTV?
>>>
>>> I can build MythTV and add more logging but am not sure where to put it
>>> and what I should log to best find out what is failing.
>>>
>>> Best regards,
>>> Peter Carlsson
>> I don't know what streamlink is. I am working on a system using the external
>> recorder to record from Xfinity stream, and it is working reasonably well.
>>
>> Can you explain your setup.
>>
>> I am using capturecard External Black Box. In mythtv-setup I give it the
>> name and location of a bash script. That script does a few things and then
>> calls mythexternrecorder passing the name of a configuration file. The
>> configuration file contains the names of scripts that are executed to tune,
>> to record, to end recordings and to signal a new episode.
>>
>> Is this similar to your setup?
>>
>> The script that is executed to record must output a transport stream to
>> stdout and not output anything else (no messages, etc.). Since the capture
>> device I have does not output a transport stream I execute ffmpeg to convert
>> to a transport stream. I can share the details.
> Thanks for sharing!
>
> https://streamlink.github.io
>
> I had it working perfectly until the plugin for SVTPlay in Streamlink
> stopped working. It did not take long before Ian Cameron fixed/rewrote
> the plugin and it start work in Streamlink again but after that I never
> got it working in MythTV.
>
> If I remember correctly I followed the examples on https://www.mythtv.org/wiki/Example_Configuration_files
> when I first set it up.
>
> As I wrote in my previous email it feels that MythTV is receiving a
> stream from Streamlink but never find the start of the stream to
> sync/lock on.
>
> It never crossed my mind to try ffmpeg until I read that you use it. I
> should probably give that a try.
>
> Please let me know if you want some further explanation.
>
> Here are my config files.
>
> # cat /home/peter/script/mythtv-svtplay-external-recorder.conf
> [RECORDER]
> # The recorder command to execute. %URL% is optional, and
> # will be replaced with the channel's "URL" as defined in the
> # [TUNER/channels] (channel conf) configuration file
> #command="cvlc \"%URL%\" --sout \"#std{mux=ts,access=file,dst=-}\""
> command="/usr/bin/streamlink --player=vlc --stdout \"%URL%\" best"
>
> # Used in logging events, %ARG% are replaced from the channel info
> desc=streamlink \"%URL%\" \"%CHANNUM%\" \"%CHANNAME%\" \"%CALLSIGN%\"
>
I use bash shell scripts. This is the command that is executed in my
RECORDER script.  If you want to see the full scripts they are in github
https://github.com/bennettpeter/mythscripts/tree/master/install/opt/mythtv/bin
- scripts with names that start with hdmi. These are still a work in
progress. The recording part works fine, my problems now are mainly with
tuning the correct channel.

VIDEO_IN=/dev/video2
AUDIO_IN=hw:2,0
RESOLUTION=1280x720
FRAMERATE=60
INPUT_FORMAT=mjpeg
# If your recordings have audio sync problems, fix them during
# recording by specifying audio offset in seconds
AUDIO_OFFSET=0.150

ffmpeg -hide_banner -loglevel error -f v4l2 -thread_queue_size 256
-input_format $INPUT_FORMAT \
  -framerate $FRAMERATE -video_size $RESOLUTION \
  -use_wallclock_as_timestamps 1 \
  -i $VIDEO_IN -f alsa -ac 2 -ar 48000 -thread_queue_size 1024 \
  -itsoffset $AUDIO_OFFSET -i $AUDIO_IN \
  -c:v libx264 -vf format=yuv420p -preset faster -crf 23 -c:a aac \
  -f mpegts -

Peter


_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Debugging problem with ExternalRecorder and streamlink [ In reply to ]
On Sun, Jun 27, 2021 at 01:22:33PM -0400, Peter Bennett wrote:
>
> On 6/26/21 5:30 PM, Peter Carlsson wrote:
> > On Fri, Jun 25, 2021 at 11:33:46AM -0400, Peter Bennett wrote:
> > > On 6/24/21 5:32 PM, Peter Carlsson wrote:
> > > > According to the log above it receive data from streamlink but fails to
> > > > find the start of the stream to sync/lock on.
> > > >
> > > > I have no knowledge about how this is working but it feels that MythTV
> > > > and VLC have different ways of finding the start of a stream.
> > > >
> > > > Could someone explain how this works in MythTV?
> > > >
> > > > I can build MythTV and add more logging but am not sure where to put it
> > > > and what I should log to best find out what is failing.
> > > >
> > > > Best regards,
> > > > Peter Carlsson
> > > I don't know what streamlink is. I am working on a system using the external
> > > recorder to record from Xfinity stream, and it is working reasonably well.
> > >
> > > Can you explain your setup.
> > >
> > > I am using capturecard External Black Box. In mythtv-setup I give it the
> > > name and location of a bash script. That script does a few things and then
> > > calls mythexternrecorder passing the name of a configuration file. The
> > > configuration file contains the names of scripts that are executed to tune,
> > > to record, to end recordings and to signal a new episode.
> > >
> > > Is this similar to your setup?
> > >
> > > The script that is executed to record must output a transport stream to
> > > stdout and not output anything else (no messages, etc.). Since the capture
> > > device I have does not output a transport stream I execute ffmpeg to convert
> > > to a transport stream. I can share the details.
> > Thanks for sharing!
> >
> > https://streamlink.github.io
> >
> > I had it working perfectly until the plugin for SVTPlay in Streamlink
> > stopped working. It did not take long before Ian Cameron fixed/rewrote
> > the plugin and it start work in Streamlink again but after that I never
> > got it working in MythTV.
> >
> > If I remember correctly I followed the examples on https://www.mythtv.org/wiki/Example_Configuration_files
> > when I first set it up.
> >
> > As I wrote in my previous email it feels that MythTV is receiving a
> > stream from Streamlink but never find the start of the stream to
> > sync/lock on.
> >
> > It never crossed my mind to try ffmpeg until I read that you use it. I
> > should probably give that a try.
> >
> > Please let me know if you want some further explanation.
> >
> > Here are my config files.
> >
> > # cat /home/peter/script/mythtv-svtplay-external-recorder.conf
> > [RECORDER]
> > # The recorder command to execute. %URL% is optional, and
> > # will be replaced with the channel's "URL" as defined in the
> > # [TUNER/channels] (channel conf) configuration file
> > #command="cvlc \"%URL%\" --sout \"#std{mux=ts,access=file,dst=-}\""
> > command="/usr/bin/streamlink --player=vlc --stdout \"%URL%\" best"
> >
> > # Used in logging events, %ARG% are replaced from the channel info
> > desc=streamlink \"%URL%\" \"%CHANNUM%\" \"%CHANNAME%\" \"%CALLSIGN%\"
> >
> I use bash shell scripts. This is the command that is executed in my
> RECORDER script.  If you want to see the full scripts they are in github https://github.com/bennettpeter/mythscripts/tree/master/install/opt/mythtv/bin
> - scripts with names that start with hdmi. These are still a work in
> progress. The recording part works fine, my problems now are mainly with
> tuning the correct channel.
>
> VIDEO_IN=/dev/video2
> AUDIO_IN=hw:2,0
> RESOLUTION=1280x720
> FRAMERATE=60
> INPUT_FORMAT=mjpeg
> # If your recordings have audio sync problems, fix them during
> # recording by specifying audio offset in seconds
> AUDIO_OFFSET=0.150
>
> ffmpeg -hide_banner -loglevel error -f v4l2 -thread_queue_size 256
> -input_format $INPUT_FORMAT \
>   -framerate $FRAMERATE -video_size $RESOLUTION \
>   -use_wallclock_as_timestamps 1 \
>   -i $VIDEO_IN -f alsa -ac 2 -ar 48000 -thread_queue_size 1024 \
>   -itsoffset $AUDIO_OFFSET -i $AUDIO_IN \
>   -c:v libx264 -vf format=yuv420p -preset faster -crf 23 -c:a aac \
>   -f mpegts -

I followed the wiki on www.mythtv.org and was so happy that it worked
immediately without any troubles. When it suddenly stopped working after
an update I had almost no clue how to debug. And that is basically where
I am right now.

Since it worked so well before it does feel like there is just a small
change I have to figure out to get it work again. Introducing bash shell
scripts might be a solution but to get that to work I need to
understand how MythTV expect it to work. And currently I do not have
that knowledge.

A flow chart or similar might help me understand if that is available.

When I had it working I fed the streamlink stream to vlc but do you
think I could feed it to ffmpeg instead? Or directly to MythTV?

How could I tell if the streamlink stream is of the correct format?

You said you could share the details and I would be happy if that could
bring me some information on how things work.

/Peter
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org