<div dir="ltr"><div dir="ltr">On Wed, Feb 10, 2021 at 2:30 PM Peter Carlsson <<a href="mailto:maillist.peter@home.se">maillist.peter@home.se</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>On Tue, Feb 02, 2021 at 01:13:23PM -0700, John P Poet wrote:<br>
> On Sun, Jan 31, 2021 at 3:10 PM Peter Carlsson <<a href="mailto:maillist.peter@home.se" target="_blank">maillist.peter@home.se</a>><br>
> wrote:<br>
> <br>
> > On Sat, Jan 30, 2021 at 03:01:02PM -0700, John P Poet wrote:<br>
> > > On Tue, Jan 26, 2021 at 3:11 PM Peter Carlsson <<a href="mailto:maillist.peter@home.se" target="_blank">maillist.peter@home.se</a>><br>
> > > wrote:<br>
> > ><br>
> > > > Hello!<br>
> > > ><br>
> > > > I had MythTV setup using the ExternalRecorder together with streamlink.<br>
> > > ><br>
> > > > Last summer the svtplay plugin for streamlink stopped working and I<br>
> > > > temporarily stopped using it by changing the recording priority to use<br>
> > > > another recorder.<br>
> > > ><br>
> > > > In streamlink version 1.6.0 (2020-09-22) it was fixed (by Ian Cameron)<br>
> > > > and I verified in streamlink that it worked but I never took the time<br>
> > to<br>
> > > > change back the recording priority until recently.<br>
> > > ><br>
> > > > But I can not get it to work again. I don't remember to have done<br>
> > > > anything else specific to the original problem but much has changed<br>
> > > > since then.<br>
> > > ><br>
> > > > MythTV has been upgraded to version 31 and streamlink to version 2.0.0<br>
> > > > where streamlink has dropped support for Python 2 and Python 3.5 and<br>
> > > > MythTV added support for Python 3.<br>
> > > ><br>
> > > > I use Debian Buster and have both Python 2.7 and 3.7 installed.<br>
> > > ><br>
> > > > I tried he following but it just stops at the last line below.<br>
> > > ><br>
> > > > mythexternrecorder --conf<br>
> > > > /home/peter/delat/script/mythtv-svtplay-external-recorder.conf<br>
> > --loglevel<br>
> > > > debug --verbose all<br>
> > > > 2021-01-26 22:55:35.201299 C  mythexternrecorder version:  [v31.0]<br>
> > > > <a href="http://www.mythtv.org" rel="noreferrer" target="_blank">www.mythtv.org</a><br>
> > > > 2021-01-26 22:55:35.201337 C  Qt version: compile: 5.11.3, runtime:<br>
> > 5.11.3<br>
> > > > 2021-01-26 22:55:35.201391 I  Debian GNU/Linux 10 (buster) (i386)<br>
> > > > 2021-01-26 22:55:35.201394 N  Enabled verbose msgs: all<br>
> > > > 2021-01-26 22:55:35.201415 N  Setting Log Level to LOG_DEBUG<br>
> > > > 2021-01-26 22:55:35.212913 I  : Buffer: Ready for data.<br>
> > > > 2021-01-26 22:55:35.212956 I  Added logging to the console<br>
> > > > 2021-01-26 22:55:35.212986 I  : Command parser ready.<br>
> > > > 2021-01-26 22:55:35.213774 D  New Logging Client: ID:  (#1)<br>
> > > > 2021-01-26 22:55:35.231943 I   Channels in<br>
> > > ><br>
> > '/home/peter/delat/script/mythtv-svtplay-external-recorder-channels.conf',<br>
> > > > Tuner: '', Scanner: ''<br>
> > > > ^C<br>
> > > ><br>
> > > > What can I do to debug this problem?<br>
> > > ><br>
> > > > Please let me know if I should provide additional information.<br>
> > > ><br>
> > > > cat /home/peter/delat/script/mythtv-svtplay-external-recorder.conf<br>
> > > ><br>
> > > > [RECORDER]<br>
> > > > # The recorder command to execute.  %URL% is optional, and<br>
> > > > # will be replaced with the channel's "URL" as defined in the<br>
> > > > # [TUNER/channels] (channel conf) configuration file<br>
> > > > #command="cvlc \"%URL%\" --sout \"#std{mux=ts,access=file,dst=-}\""<br>
> > > > command="streamlink --player=vlc --stdout \"%URL%\" best"<br>
> > > ><br>
> > > > # Used in logging events, %ARG% are replaced from the channel info<br>
> > > > desc=streamlink \"%URL%\" \"%CHANNUM%\" \"%CHANNAME%\" \"%CALLSIGN%\"<br>
> > > ><br>
> > > > [TUNER]<br>
> > > > # An optional CONF file which provides channel details.  If it does not<br>
> > > > # exist, then channel changes are not supported.<br>
> > > > channels=mythtv-svtplay-external-recorder-channels.conf<br>
> > > ><br>
> > > > # If [TUNER/command] is provided, it will be executed to "tune" the<br>
> > > > # channel. A %URL% parameter will be substituted with the "URL" as<br>
> > > > # defined in the [TUNER/channels] configuration file<br>
> > > > #command=<br>
> > > ><br>
> > > > # Timeout for changing channels in msecs<br>
> > > > #timeout=<br>
> > > ><br>
> > > > [SCANNER]<br>
> > > > # When MythTV scans for channels, The contents of the [TUNER/channels]<br>
> > > > # config file are used to populate MythTV's channel information.<br>
> > > > # If a command is provided here, it will be executed first, so it can<br>
> > > > # populate the [TUNER/channels] config file<br>
> > > > #command=/home/myth/bin/scan.sh "%CHANCONF%"<br>
> > > ><br>
> > > > # Timeout for scan command in msecs<br>
> > > > #timeout=60000<br>
> > > ><br>
> > > ><br>
> > > > cat<br>
> > > > /home/peter/delat/script/mythtv-svtplay-external-recorder-channels.conf<br>
> > > ><br>
> > > > [1]<br>
> > > > NAME=SVT1 HD<br>
> > > > CALLSIGN=SVT1HD<br>
> > > > XMLTVID=<a href="http://svt1.svt.se" rel="noreferrer" target="_blank">svt1.svt.se</a><br>
> > > > URL="<a href="https://www.svtplay.se/kanaler/svt1?start=auto" rel="noreferrer" target="_blank">https://www.svtplay.se/kanaler/svt1?start=auto</a>"<br>
> > > > ICON=/home/mythtv/.mythtv/channels/svt1.svt.se.png<br>
> > > ><br>
> > > > [2]<br>
> > > > NAME=SVT2 HD<br>
> > > > CALLSIGN=SVT2HD<br>
> > > > XMLTVID=<a href="http://svt2.svt.se" rel="noreferrer" target="_blank">svt2.svt.se</a><br>
> > > > URL="<a href="https://www.svtplay.se/kanaler/svt2?start=auto" rel="noreferrer" target="_blank">https://www.svtplay.se/kanaler/svt2?start=auto</a>"<br>
> > > > ICON=/home/mythtv/.mythtv/channels/svt2.svt.se.png<br>
> > > ><br>
> > > > [3]<br>
> > > > NAME=Kunskapskanalen<br>
> > > > CALLSIGN=Kunskapskanalen<br>
> > > > XMLTVID=<a href="http://kunskapskanalen.svt.se" rel="noreferrer" target="_blank">kunskapskanalen.svt.se</a><br>
> > > > URL="<a href="https://www.svtplay.se/kanaler/kunskapskanalen?start=auto" rel="noreferrer" target="_blank">https://www.svtplay.se/kanaler/kunskapskanalen?start=auto</a>"<br>
> > > > ICON=/home/mythtv/.mythtv/channels/kunskapskanalen.svt.se.png<br>
> > > ><br>
> > > > [4]<br>
> > > > NAME=Barnkanalen<br>
> > > > CALLSIGN=Barnkanalen<br>
> > > > XMLTVID=<a href="http://barnkanalen.svt.se" rel="noreferrer" target="_blank">barnkanalen.svt.se</a><br>
> > > > URL="<a href="https://www.svtplay.se/kanaler/svtbarn?start=auto" rel="noreferrer" target="_blank">https://www.svtplay.se/kanaler/svtbarn?start=auto</a>"<br>
> > > > ICON=/home/mythtv/.mythtv/channels/<a href="http://barnkanalen.svt.se" target="_blank">barnkanalen.svt.se</a>.png<br>
> > > ><br>
> > > > [5]<br>
> > > > NAME=SVT24<br>
> > > > CALLSIGN=SVT24<br>
> > > > XMLTVID=<a href="http://svt24.svt.se" rel="noreferrer" target="_blank">svt24.svt.se</a><br>
> > > > URL="<a href="https://www.svtplay.se/kanaler/svt24?start=auto" rel="noreferrer" target="_blank">https://www.svtplay.se/kanaler/svt24?start=auto</a>"<br>
> > > > ICON=/home/mythtv/.mythtv/channels/svt24.svt.se.png<br>
> > > ><br>
> > > ><br>
> > > Hi Peter,<br>
> > ><br>
> > > The behavior you describe is correct. At that point mythexternrecorder is<br>
> > > expecting to be given commands from mythackend. For example, instead of<br>
> > > hitting CTRL-C where you did, you could type:<br>
> > > APIVersion?<br>
> > > and it should spit out something like<br>
> > > OK:2<br>
> > ><br>
> > > If you look at <a href="https://www.mythtv.org/wiki/ExternalRecorder" rel="noreferrer" target="_blank">https://www.mythtv.org/wiki/ExternalRecorder</a> you can see<br>
> > the<br>
> > > commands that are allowed. With APIVersion2, the serial number at the<br>
> > > beginning of each command should be incremented.<br>
> ><br>
> > Hello John,<br>
> ><br>
> > Thanks for you answer. I tried to send some commands and they all seems<br>
> > to work until I try to send TuneStatus? where I would have expected<br>
> > '9:OK:Tuned to 1' or similar. Am I on the right track and is this<br>
> > indicating that something is wrong?<br>
> ><br>
> > It seems that although I add arguments '--loglevel debug --verbose' I<br>
> > don't get that much help of the output.<br>
> ><br>
> > I can call streamlink directly and get a stream that I can watch in VLC.<br>
> ><br>
> > mythexternrecorder --conf<br>
> > /home/peter/delat/script/mythtv-svtplay-external-recorder.conf --loglevel<br>
> > debug --verbose<br>
> > 2021-01-31 22:58:06.872700 C  mythexternrecorder version:  [v31.0]<br>
> > <a href="http://www.mythtv.org" rel="noreferrer" target="_blank">www.mythtv.org</a><br>
> > 2021-01-31 22:58:06.872720 C  Qt version: compile: 5.11.3, runtime: 5.11.3<br>
> > 2021-01-31 22:58:06.872748 I  Debian GNU/Linux 10 (buster) (x86_64)<br>
> > 2021-01-31 22:58:06.872750 N  Enabled verbose msgs:  general<br>
> > 2021-01-31 22:58:06.872760 N  Setting Log Level to LOG_DEBUG<br>
> > 2021-01-31 22:58:06.883132 I  Added logging to the console<br>
> > 1::HasTuner?<br>
> > 1:OK:Yes<br>
> > 2::LoadChannels<br>
> > 2:OK:5<br>
> > 3::FirstChannel<br>
> > 3:OK:1,SVT1 HD,SVT1HD,<a href="http://svt1.svt.se" rel="noreferrer" target="_blank">svt1.svt.se</a><br>
> > ,/home/mythtv/.mythtv/channels/svt1.svt.se.png<br>
> > 4:NextChannel<br>
> > 4:OK:2,SVT2 HD,SVT2HD,<a href="http://svt2.svt.se" rel="noreferrer" target="_blank">svt2.svt.se</a><br>
> > ,/home/mythtv/.mythtv/channels/svt2.svt.se.png<br>
> > 5:NextChannel<br>
> > 5:OK:3,Kunskapskanalen,Kunskapskanalen,<a href="http://kunskapskanalen.svt.se" rel="noreferrer" target="_blank">kunskapskanalen.svt.se</a><br>
> > ,/home/mythtv/.mythtv/channels/kunskapskanalen.svt.se.png<br>
> > 6:NextChannel<br>
> > 6:OK:4,Barnkanalen,Barnkanalen,<a href="http://barnkanalen.svt.se" rel="noreferrer" target="_blank">barnkanalen.svt.se</a><br>
> > ,/home/mythtv/.mythtv/channels/<a href="http://barnkanalen.svt.se" target="_blank">barnkanalen.svt.se</a>.png<br>
> > 7:NextChannel<br>
> > 7:OK:5,SVT24,SVT24,<a href="http://svt24.svt.se" rel="noreferrer" target="_blank">svt24.svt.se</a><br>
> > ,/home/mythtv/.mythtv/channels/svt24.svt.se.png<br>
> > 8:TuneChannel:1<br>
> > 8:OK:Tuned to 1<br>
> > 9:TuneStatus?<br>
> > 9:OK:Tuned to<br>
> ><br>
> > /Peter<br>
> ><br>
> <br>
> Hi Peter,<br>
> <br>
> Sorry for the slow responses. I have some other things going on.<br>
> <br>
> As far as the TuneStatus? response, that could be a minor bug. mythbackend<br>
> will only issue that command if TuneChannel: returns "OK:InProgress". In<br>
> your example it returned "OK:Tuned to 1" so mythbackend would never have<br>
> issued "TuneStatus?", therefore I never noticed that the response was poor.<br>
> I will take a look at that.<br>
> <br>
> mythbackend will normally send the following commands after the channel is<br>
> tuned:<br>
> Description?<br>
> SignalStrengthPercent?<br>
> HasLock?<br>
> IsOpen?<br>
> Those are just to gather information. It will then do:<br>
> StartStreaming<br>
> XON<br>
> Which tells mythexternrecorder to actually start processing data. The<br>
> transport stream will be parsed so mythtv can verify that it is valid. Then<br>
> the stream will be shut down:<br>
> XOFF<br>
> Version?<br>
> StopStreaming<br>
> ..<br>
> Then mythbackend is finally ready to start recording, so it will start the<br>
> stream back up:<br>
> ..<br>
> StartStreaming<br>
> XON<br>
> and mythexternrecorder will pass the transport stream to mythbackend for it<br>
> to record.<br>
> <br>
> When mythbackend invokes mythexternrecorder it passes arguments such as<br>
> --logpath to it. Wherever the mythbackend logs are stored (e.g.<br>
> /var/log/mythtv) you should also find mythexternrecorder log files. If<br>
> mythbackend is started up with "--logpath /var/log/mythtv -v<br>
> channel,record" then mythexternrecorder will as well. When debugging<br>
> recording issues make sure you have told mythbackend to run with "-v<br>
> channel,record".<br>
<br>
Hello John,<br>
<br>
I very much appreciate your help!<br>
<br>
I added more logging as you suggested. Don't know why it is truncated in<br>
the log messages.<br>
<br>
Do you make anything out of the log messages?<br>
<br>
What would be my next step?<br>
<br>
Best regards,<br>
Peter Carlsson<br>
<br>
Feb 10 22:09:06 htpc mythbackend[1097]: 2021-02-10 22:09:06.285294 I  ExternChan[21](/usr/bin/mythexternrecorder --conf /home/peter/delat/script/mythtv-svtplay-external-recorder.conf --loglevel debug --verbose cha): Open()<br>
Feb 10 22:09:06 htpc mythbackend[1097]: 2021-02-10 22:09:06.286900 I  ChannelBase[21]: Input #21: 'MPEG2TS' schan(1) sourceid(4)<br>
Feb 10 22:09:06 htpc mythbackend[1097]: 2021-02-10 22:09:06.287222 I  ExternSH[21](/usr/bin/mythexternrecorder --conf /home/peter/delat/script/mythtv-svtplay-external-recorder.conf --loglevel debug --verbose cha): args "--conf /home/peter/delat/script/mythtv-svtplay-external-recorder.conf --loglevel debug --verbose cha --verbose general,channel,record --logpath<br>
 /var/log/mythtv --loglevel info --quiet --inputid 21"<br>
Feb 10 22:09:06 htpc mythbackend[1097]: 2021-02-10 22:09:06.287275 I  ExternSH[21](/usr/bin/mythexternrecorder --conf /home/peter/delat/script/mythtv-svtplay-external-recorder.conf --loglevel debug --verbose cha): Spawn '/usr/bin/mythexternrecorder --conf /home/peter/delat/script/mythtv-svtplay-external-recorder.conf --loglevel debug --verbose cha'<br>
Feb 10 22:09:06 htpc mythbackend[1097]: 2021-02-10 22:09:06.287281 I  ExternIO::Run()<br>
Feb 10 22:09:06 htpc mythbackend[1097]: 2021-02-10 22:09:06.308616 I  ExternIO::Fork 'mythexternrecorder --conf /home/peter/delat/script/mythtv-svtplay-external-recorder.conf --loglevel debug --verbose cha --verbose general,channel,record --logpath /var/log/mythtv --loglevel info --quiet --inputid 21'<br>
Feb 10 22:09:06 htpc mythbackend[1097]: 2021-02-10 22:09:06.314137 I  Spawned<br>
Feb 10 22:09:06 htpc mythbackend[1097]: 2021-02-10 22:09:06.567769 I  ExternSH[21](/usr/bin/mythexternrecorder --conf /home/peter/delat/script/mythtv-svtplay-external-recorder.conf --loglevel debug --verbose cha): ProcessCommand('APIVersion?') = 'OK:2' took 243ms<br>
Feb 10 22:09:06 htpc mythbackend[1097]: 2021-02-10 22:09:06.567940 I  ExternSH[21](/usr/bin/mythexternrecorder --conf /home/peter/delat/script/mythtv-svtplay-external-recorder.conf --loglevel debug --verbose cha): ProcessV2('1:APIVersion:2') = 'OK:2' took 0ms<br>
Feb 10 22:09:06 htpc mythbackend[1097]: 2021-02-10 22:09:06.568051 I  ExternSH[21](/usr/bin/mythexternrecorder --conf /home/peter/delat/script/mythtv-svtplay-external-recorder.conf --loglevel debug --verbose cha): ProcessV2('2:Version?') = 'OK:0.6' took 0ms<br>
Feb 10 22:09:06 htpc mythbackend[1097]: 2021-02-10 22:09:06.568173 W  ExternSH[21](/usr/bin/mythexternrecorder --conf /home/peter/delat/script/mythtv-svtplay-external-recorder.conf --loglevel debug --verbose cha): ProcessV2('3:Description?') = 'WARN:Not set' took 0ms <-- NOTE<br>
Feb 10 22:09:10 htpc mythbackend[1097]: 2021-02-10 22:09:10.570731 E  ExternSH[21](/usr/bin/mythexternrecorder --conf /home/peter/delat/script/mythtv-svtplay-external-recorder.conf --loglevel debug --verbose cha): ProcessVer2: Giving up waiting for response for command '4:HasTuner?'<br></div><snip><br></blockquote><div><br></div><div>Is it possible that there is a wedged copy of mythexternrecorder running which is interfering?</div><div>What does the mythexternrecorder log file have in it?</div><div><br></div><div>John<br></div></div></div>