[mythtv-users] Debugging problem with ExternalRecorder and streamlink

Peter Bennett pb.mythtv at gmail.com
Sun Jun 27 17:22:33 UTC 2021

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
> # 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 
- 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.

# If your recordings have audio sync problems, fix them during
# recording by specifying audio offset in seconds

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 -


More information about the mythtv-users mailing list