[mythtv-users] Recording from an IPTV source

Stephen Worthington stephen_agent at jsw.gen.nz
Wed Nov 23 03:12:41 UTC 2022

On Tue, 22 Nov 2022 19:41:42 +0100, you wrote:

>Dear list,
>At the moment I am using PVRUSB2 devices to record content that is only
>available through set-top boxes (whereas I use a HDHR to record content
>that is available unencrypted on the cable). I would like to migrate
>away from the PVRUSB2 devices, towards using HDMI-to-IPTV encoders.
>I have read the following article on the wiki:
>and consider it to be very convoluted (not to mention the fact that the
>HDMI capture devices I have at my disposal generate H.264 encapsulated
>in MPEG TS over UDP, which is different from the assumptions made in
>that article). For example it seems to me that the use of a .m3u file
>makes the data schema overly complex, since channel information
>unnecessarily lives in multiple places.
>So does anyone here have recommendations for how to do this more simply
>(or in fact at all, since my IPTV signal isn't transported over HTTP)? I
>would like the backend to either accept the video/audio stream straight
>from the network, or alternatively from a pipe. Probably the pipe is the
>more realistic option because I will probably need ffmpeg to first
>massage the signal into a form that the frontend can play back.
>I would also need a hook for a channel changing script so that I can
>tell the STB what channel to tune to.
>Many thanks, Jan

Your basic problem with using the advice on that page is that your
HDMI to IPTV capture devices do not do HTTP output.  Everything on
that page is based around using curl to do HTTP connections, so it
will not work at all for you.  Fortunately, MythTV does actually do
RTP/RTSP UDP protocol - it was originally used for some older network
tuners, which are still supported.  And now it is used for SAT>IP
connections, which use a specific subset of RTP/RTSP.  So it may be
possible to get MythTV to do the capture directly by just giving it a
URL in its IPTV channels.

MPEG TS with H.264 video is fully supported by MythTV as that is the
format used in many parts of the world for DVB-T(2) transmissions.  So
there should be no need to use ffmpeg to convert it - if you capture
the stream to disk as is it should just work.

The big problem with IPTV channels is setting them up using a .m3u
file.  The parts of that page that refer to .m3u creation may help
with that.  But for my use of RTP/RTSP protocol to do SAT>IP channels
from before MythTV actually supported SAT>IP fully, I originally
created a .m3u file from a channel scan output and after that just
manually edited the channels when changes happened.  Here is a sample
of my iptv_channel table:

MariaDB [mythconverg]> select * from iptv_channel limit 10;
| iptvid | chanid | url                                                                                                                                   | type | bitrate |
|     79 |  10008 | rtsp://satip.jsw.gen.nz:554/?src=1&freq=12608&msys=dvbs2&plts=off&fec=23&pol=h&ro=0.35&sr=22500&mtype=8psk&pids=0,303,1003,1103,8183  | data |       0 |
|     78 |  10007 | rtsp://satip.jsw.gen.nz:554/?src=1&freq=12358&msys=dvbs2&plts=off&fec=23&pol=h&ro=0.35&sr=22500&mtype=8psk&pids=0,307,1007,1107,1907  | data |       0 |
|     77 |  10006 | rtsp://satip.jsw.gen.nz:554/?src=1&freq=12581&msys=dvbs2&plts=off&fec=23&pol=h&ro=0.35&sr=22500&mtype=8psk&pids=0,304,1004,1104,8184  | data |       0 |
|     76 |  10005 | rtsp://satip.jsw.gen.nz:554/?src=1&freq=12608&msys=dvbs2&plts=off&fec=23&pol=h&ro=0.35&sr=22500&mtype=8psk&pids=0,1019,1001,1101      | data |       0 |
|     75 |  10004 | rtsp://satip.jsw.gen.nz:554/?src=1&freq=12295&msys=dvbs2&plts=off&fec=23&pol=h&ro=0.35&sr=22500&mtype=8psk&pids=0,307,1007,1107,1907  | data |       0 |
|     74 |  10000 | rtsp://satip.jsw.gen.nz:554/?src=1&freq=12519&msys=dvbs&plts=off&fec=34&pol=h&ro=0.35&sr=22500&mtype=qpsk&pids=0,1069,1006,1106,8186  | data |       0 |
|     81 |  10010 | rtsp://satip.jsw.gen.nz:554/?src=1&freq=12581&msys=dvbs2&plts=off&fec=23&pol=h&ro=0.35&sr=22500&mtype=8psk&pids=0,308,1008,1108       | data |       0 |
|     82 |  10011 | rtsp://satip.jsw.gen.nz:554/?src=1&freq=12707&msys=dvbs2&plts=off&fec=23&pol=h&ro=0.35&sr=22500&mtype=8psk&pids=0,304,1004,1104       | data |       0 |
|     83 |  10014 | rtsp://satip.jsw.gen.nz:554/?src=1&freq=12608&msys=dvbs2&plts=off&fec=23&pol=h&ro=0.35&sr=22500&mtype=8psk&pids=0,1079,1007,1107      | data |       0 |
|     84 |  10015 | rtsp://satip.jsw.gen.nz:554/?src=1&freq=12707&msys=dvbs2&plts=off&fec=23&pol=h&ro=0.35&sr=22500&mtype=8psk&pids=0,1039,1003,1103,1903 | data |       0 |
10 rows in set (0.000 sec)

And a corresponding channel table entry:

MariaDB [mythconverg]> select * from channel where chanid=10008\G
*************************** 1. row ***************************
           chanid: 10008
          channum: 4008
           freqid: NULL
         sourceid: 6
         callsign: JONES
             name: JONES!
             icon: jones.jpg
         finetune: NULL
          xmltvid: jones.sky.co.nz
      recpriority: 0
         contrast: 32768
       brightness: 32768
           colour: 32768
              hue: 32768
         tvformat: Default
          visible: 1
    useonairguide: 0
          mplexid: NULL
        serviceid: 1190
     service_type: 0
         tmoffset: 0
  atsc_major_chan: 0
  atsc_minor_chan: 0
      last_record: 2020-06-16 12:04:00
       commmethod: -1
           iptvid: NULL
          deleted: NULL
1 row in set (0.001 sec)

So exactly what HDMI to IPTV capture hardware do you have?  If it uses
a compatible RTP/RTSP protocol, you should be able to just create
rtsp:// URLs as I have done.

More information about the mythtv-users mailing list