[mythtv-users] workaround if external recorder is buggy for you

Brian J. Murrell brian at interlinx.bc.ca
Wed Nov 21 12:27:38 UTC 2018


I have been trying to use the external recorder functionality to record
from an HLS stream on the Internet but have found the interaction with
the recorder to be buggy[1].

So I found an interesting and pretty straightforward workaround using
the "started writing" system event hook.

If you write a shell script something along the lines of:

    if [ "$chanid" =  "2006" ]; then
        now=$(date "+%s")
        endtime_e=$(date -d "$endtime" "+%s")
        duration=$((endtime_e-now))
	ffmpeg -i "<HLS stream URL>" \
	       -acodec copy -vcodec copy -f mpegts -to "$duration" \
	       /var/lib/mythtv/recordings/$file.new &
        while [ ! -f /var/lib/mythtv/recordings/$file.new ]; do
            :
	done
	pushd /var/lib/mythtv/recordings/
	rm -f $file
	mv $file{.new,}
    fi

And then add that shell script as a "started writing" system event,
where you pass the $chanid, $file, and $endtime values to the script
when you add the system event you will get your HLS recording in place
of the standard recording from whatever source (i.e. crappy analog SD
cable box) it would have otherwise come from.

I use this in the case where my cable subscription gives me a channel,
but in usual-proprietary-cable-system fashion I only get a crappy SD
version of the channel.  However the television station provides a
"live stream" of their channel using an HLS URL which I prefer due to
it's superior quality.

Anyway, just wanted to pass that along in case it was useful to anyone.

Cheers,
b.

[1] http://lists.mythtv.org/pipermail/mythtv-users/2018-November/398177.html
    but cannot try latest 29/fixes (or 30 I am sure) as it has stopped
    being buildable on Ubuntu Trusty LTS.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <http://lists.mythtv.org/pipermail/mythtv-users/attachments/20181121/dcff00b4/attachment.sig>


More information about the mythtv-users mailing list