[mythtv-users] Debugging problem with ExternalRecorder and streamlink

Peter Carlsson peter.jm.carlsson at gmail.com
Mon Jun 28 20:32:48 UTC 2021


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


More information about the mythtv-users mailing list