mythhdhrrecorder

From MythTV Official Wiki
Jump to: navigation, search

mythhdhrrecorder is a python script which implements the MythTV External Recorder functionality to record from a current generation SiliconDust HDHR tuner (4th gen or HDHR3-CC) using tuner pooling and tuner locking. This pooling and locking allows multiple independent compliant applications to select an available tuner and lock it for its exclusive use while streaming.


The definitive source location for this recorder is located on github, which is where one should obtain the script.

Capabilities

  • Uses device pooling/searching to find an available HDHR tuner on the network at recording time
  • Uses the 4th generation (and 3rd generation HDHR3-CC) tuner capability for locking tuners to share with other sharing compliant applications.
- Known compliant applications at the time of writing include:
  • SiliconDust HDHomeRun viewer and DVR
  • Google Android TV Live Channels (beta) network tuner and DVR
  • Channels DVR
  • WMC (with some limitations)
  • Uses tcp (http) for streaming rather than udp. In some cases this may result in less packet loss.

Requirements

  • The External Recorder functionality in MythTV
  • mythhdhrrecorder uses the HDHR channel "display" numbering, so for a US cable system, that is typically the STB number (channel 123), and for US OTA that is the ATSC major/minor number (channel 3.1). This selection numbering is specified in MythTV in the channel table in the freqid field and can be added by mythfilldatabase for a new videosource (alternatives exist).
  • The required functionality in the HDHRs was added in firmware after FCS, so one must update to the latest stable or beta firmwares for the HDHR devices.
  • mythhdhrrecorder requires that the HDHR specific "Channel List/Detect Channels" function be performed on each device in order to identify the channels that can be received/tuned on the HDHR. mythhdhrrecorder will respect channels being disabled on a device (that device will not be used for those disabled channels).

Limitations

  • This recorder depends on the functionality added to MythTV with ticket #12919. As of this writing, that patch is in the fixes/0.28 branch, but may not have been integrated by your packager. Individuals may either need to be running master, compile their own version of MythTV, or request their packager to update their package.
  • The HDHR sharing API requires exclusive use of a tuner for each program. There is no ability to obtain the entire stream and extract individual programs (stations) from the stream. For CableCARD users, this single tuner per recording is the same requirement as the existing internal recorder. For US OTA users, this could be different, but as it is rare that two stations that one wishes to view/record share the same frequency (i.e. two different stations typically used two different tuners), so the tuner requirement is similar to before. In some other countries channels are more likely to share the same frequency, and this limitation may require one to acquire more HDHR tuners if one wishes to use this (and/or the other compliant) apps ability to pool/lock tuners.
  • Due to the way that the MythTV External Recorder operates in regards to the ability to share external recorders, but the inability for this solution to use that method, it is necessary for each instance of the mythhdhrrecorder in the MythTV capture card configuration to have a unique definition. The mythhdhrrecorder supports an option (--devicename) which can be used to create the unique definition. The specified name is arbitrary, and not used by the recorder itself (it is a required artifact of the MythTV external recorder capability).
  • This program requires python3, and a number of libraries. It is useful to run it standalone with the --help option before configuring it in MythTV to determine if you have the necessary libraries installed.
  • MythTV will fail a recording if the recorder is not able to find an available free tuner. In some situations (to "reserve" a tuner for (say) your Apple TV, or your tablet) you may wish to create one (or more) fewer MythTV External Recorder instances (first come, first served).

mythhdhrrecorder options

  • --hdhr {ipaddress|deviceid}
    Specify the hdhr(s) to use (the default is to consider all tuners found on the local network). Note that only devices that can provide the requested channel will be considered viable for a particular request, so if one has a combination of CableCARD and OTA HDHomeRuns there is no specific need to specify devices, although one will want to specify different lineups (stations) for one or more capture cards for scheduling purposes. In most cases, this option need not be specified (but as there are always exceptions, the option is available).
  • --devicename {xxx}
    Specify the unique devicename (external recorder requirement).

Example usage in MythTV

  • In mythtv-setup, select "Capture cards"
  • Select "New capture card"
  • Select "External (black box) recorder" as the card type
  • Specify the executable and (usually) append an arbritary unique device name, for example: /home/mythtv/bin/mythhdhrrecorder --devicename 0
  • Specify the Max Recordings as 1
  • Select "Finish" to create the capture card
  • Repeat as needed for the number of tuners you want MythTV to utilize
  • Perform video source setup as usual
  • For each tuner, go to input connections and add the video source, and select "Fetch Channels" if the video source is newly created to populate the channel data (this does not work with ATSC video sources due to the major/minor numbering, but workarounds exist)

Thoughts/Comments

  • This script was originally written as a prototype, with the intention of rewriting it in C++. However, it turned out sufficiently performant on my systems so that I decided not to rewrite it.
  • Since it is written in python, this script might be valuable for some to use as a starting point for others that prefer a scripting language to C++
  • Please open issues on github