Example Configuration files
This article provides a number of example configuration files for the generic external recorder (mythexternrecorder). For more information please refer to ExternalRecorder.
Contents
vlc Example
vlc.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=-}" # Optional cleanup command which is executed when this recorder is shut down cleanup="/home/mythtv/bin/input-finished.sh" # Used in logging events, %ARG% are replaced from the channel info desc=cvlc %URL% %CHANNUM% %CHANNAME% %CALLSIGN% [TUNER] # An optional CONF file which provides channel details. channels=vlc-channels.conf # If [TUNER/command] is provided, it will be executed to "tune" the # channel. A %URL% parameter will be substituted with the "URL" as # defined in the [TUNER/channels] configuration file. %CHANNUM% will be # replaced with the channum provided by mythbackend #command="/home/mythtv/bin/tune-channel.sh %URL% %CHANNUM%" # If [TUNER/ondatastart] is provided, it will be executed as soon # as data is seen from the [RECORDER/command] stdout. This can be # used to do any final cleanup of the tunning operation. #ondatastart="/home/mythtv/bin/control.py --leftplay 2" # if [TUNER/newepisodecommand] is provided, it will be executed # if a new episoded is starting up on the channel that is already # tuned. In other words, if [TUNER/command] is skipped because # the current channel is already correct, this will be executed # instead. #newepisodecommand="/home/mythtv/bin/control.py --touch %CHANNUM%" # Timeout for changing channels in msecs #timeout= [SCANNER] # When MythTV scans for channels, The contents of the [TUNER/channels] # config file are used to populate MythTV's channel information. # If a command is provided here, it will be executed first, so it can # populate the [TUNER/channels] config file #command=/home/myth/bin/scan.sh "%CHANCONF%" # Timeout for scan command in msecs #timeout=60000
vlc-channel.conf
[2] NAME=Second Channel CALLSIGN=Second XMLTVID= URL="https://manifest.auditude.com/auditude/variant/samsung_pet_collective/aHR0cDovL21hbmlmZXN0Lnd1cmwuY29tL2NoYW5uZWxzL3NhbXN1bmcvdGhlX3BldF9jb2xsZWN0aXZlX2xpbmVhcl8vcGxheWxpc3QubTN1OA==.m3u8?u=19287a324825cc5aacb7e46183c72324&z=268729&g=1000003&k=channel_id=227516;page_url=http%253A%252F%252Fwww.wurl.com%252Fwatch%252Fpet_collective;dnt=0;wurl_channel=91;distributor=samsung&ptcueformat=turner&pttrackingmode=sstm&pttrackingversion=v2&__sid__=abcdeab" ICON=/home/mythtv/etc/second-channel-icon.jpg [3] NAME=Third channel CALLSIGN=Third XMLTVID= URL=/mythtv/1/TV/1071_20180817030000.ts
youtube Example
youtube.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="/usr/bin/youtube-dl --hls-use-mpegts --ffmpeg-location /opt/ffmpeg/bin --external-downloader-args -hide_banner -nostats -loglevel panic -re -o - %URL%" # Optional cleanup command which is executed when this recorder is shut down cleanup="/home/mythtv/bin/input-finished.sh" # Used in logging events, %ARG% are replaced from the channel info desc=Twitch %URL% %CHANNUM% %CHANNAME% %CALLSIGN% [TUNER] # An optional CONF file which provides channel details. channels=youtube-channels.conf # If [TUNER/command] is provided, it will be executed to "tune" the # channel. A %URL% parameter will be substituted with the "URL" as # defined in the [TUNER/channels] configuration file. %CHANNUM% # will be replaced with the channum provided by mythbackend. #command= # If [TUNER/ondatastart] is provided, it will be executed as soon # as data is seen from the [RECORDER/command] stdout. This can be # used to do any final cleanup of the tunning operation. #ondatastart="/home/mythtv/bin/control.py --leftplay 2" # if [TUNER/newepisodecommand] is provided, it will be executed # if a new episoded is starting up on the channel that is already # tuned. In other words, if [TUNER/command] is skipped because # the current channel is already correct, this will be executed # instead. #newepisodecommand="/home/mythtv/bin/control.py --touch %CHANNUM%" # Timeout for changing channels in msecs #timeout= [SCANNER] # When MythTV scans for channels, The contents of the [TUNER/channels] # config file are used to populate MythTV's channel information. # If a command is provided here, it will be executed first, so it can # populate the [TUNER/channels] config file #command=/home/mythtv/bin/scan.sh "%CHANCONF%" # Timeout for scan command in msecs #timeout=60000
youtube-channel.conf
[1] NAME=Twitch Arcade Cloud CALLSIGN=ArcadeCloud XMLTVID= URL=https://www.twitch.tv/arcadecloud ICON=/home/mythtv/etc/some-icon.jpg [2] NAME=Twitch Buzzr CALLSIGN=Buzzr XMLTVID= URL=https://www.twitch.tv/buzzr [3] NAME=Twitch Cosmos CALLSIGN=Cosmos XMLTVID= URL=https://www.twitch.tv/cosmos [4] NAME=Twitch Eleven Sports Next CALLSIGN=11SportsNext XMLTVID= URL=https://www.twitch.tv/elevensportsnext [5] NAME=Twitch Fail Army CALLSIGN=FailArmy XMLTVID= URL=https://www.twitch.tv/failarmy
ffmpeg Example
ffmpeg.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=/opt/ffmpeg/bin/ffmpeg -hide_banner -nostats -loglevel panic -re -i %URL% -c:v copy -c:a copy -f mpegts - # Optional cleanup command which is executed when this recorder is shut down cleanup="/home/mythtv/bin/input-finished.sh" # Used in logging events desc=ffmpeg %URL% %CHANNUM% %CHANNAME% %CALLSIGN% [TUNER] # An optional CONF file which provides channel details. channels=ffmpeg-channels.conf # If [TUNER/command] is provided, it will be executed to "tune" the # channel. A %URL% parameter will be substituted with the "URL" as # defined in the [TUNER/channels] configuration file. %CHANNUM% # will be replaced with the channum provided by mythbackend. #command= # If [TUNER/ondatastart] is provided, it will be executed as soon # as data is seen from the [RECORDER/command] stdout. This can be # used to do any final cleanup of the tunning operation. #ondatastart="/home/mythtv/bin/control.py --leftplay 2" # if [TUNER/newepisodecommand] is provided, it will be executed # if a new episoded is starting up on the channel that is already # tuned. In other words, if [TUNER/command] is skipped because # the current channel is already correct, this will be executed # instead. #newepisodecommand="/home/mythtv/bin/control.py --touch %CHANNUM%" # Timeout for changing channels in msecs #timeout= [SCANNER] # When MythTV scans for channels, The contents of the [TUNER/channels] # config file are used to populate MythTV's channel information. # If a command is provided here, it will be executed first, so it can # populate the [TUNER/channels] config file #command=/home/myth/bin/scan.sh "%CHANCONF%" # Timeout for scan command in msecs #timeout=60000
ffmpeg-channel.conf
[1] NAME=Test Channel 1 CALLSIGN=TEST1 XMLTVID= URL=/mythtv/1/TV/60004_20181016040000.ts ICON=/home/mythtv/icon1.jpg [2] NAME=Test Channel 2 CALLSIGN=TEST2 XMLTVID= URL=/mythtv/1/TV/50002_20181015070000.ts ICON=/home/mythtv/icon2.jpg
IP Encoder Example
If using a Roku as the STB (Set Top Box), then [1] may be of interest.
encoder.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="curl --silent http://uhe2654/12.ts" cleanup="/home/mythtv/bin/roku-control.py --debug --roku roku1 --reset" # Used in logging events, %ARG% are replaced from the channel info desc="Roku1" [TUNER] # An optional CONF file which provides channel details. #channels= # If [TUNER/command] is provided, it will be executed to "tune" the # channel. A %URL% parameter will be substituted with the "URL" as # defined in the [TUNER/channels] configuration file. %CHANNUM% # will be replaced with the channum provided by mythbackend. command="/home/mythtv/bin/roku-control.py --debug --roku roku1 --set-channel %CHANNUM%" # If [TUNER/ondatastart] is provided, it will be executed as soon # as data is seen from the [RECORDER/command] stdout. This can be # used to do any final cleanup of the tunning operation. #ondatastart="/home/mythtv/bin/control.py --leftplay 2" # if [TUNER/newepisodecommand] is provided, it will be executed # if a new episoded is starting up on the channel that is already # tuned. In other words, if [TUNER/command] is skipped because # the current channel is already correct, this will be executed # instead. #newepisodecommand="/home/mythtv/bin/control.py --touch %CHANNUM%" # Timeout for changing channels in msecs timeout=30000 [SCANNER] # When MythTV scans for channels, The contents of the [TUNER/channels] # config file are used to populate MythTV's channel information. # If a command is provided here, it will be executed first, so it can # populate the [TUNER/channels] config file #command=/home/myth/bin/scan.sh "%CHANCONF%" # Timeout for scan command in msecs #timeout=60000
HDMI capture example
Another example is included in the Recording from HDMI case study.
Mythtv v33 Example
As of Mythtv v33, the configuration file may include a [VARIABLES] section with simple key=value entries. Those keys may then be used in any of the other sections. For example:
magewell.conf
[VARIABLES] DEVICE=shield1 TUNER=/usr/local/bin/adb-control.py --device %DEVICE% CODEC=hevc_qsv --device renderD129 [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="/usr/local/bin/magewellpro2ts -i %INPUT% -m -c %CODEC%" cleanup="/usr/local/bin/adb-control.py --debug --device %DEVICE% --reset" # Used in logging events, %ARG% are replaced from the channel info desc="%DEVICE%-%INPUT%" [TUNER] # If [TUNER/command] is provided, it will be executed to "tune" the channel. command="/usr/local/bin/adb-control.py --waitafter 1 --device %DEVICE% --channum %CHANNUM%" newepisodecommand="/usr/local/bin/adb-control.py --device %DEVICE% --touch %CHANNUM% &" timeout=30000
The channels configuration file may also now include per-channel TUNE and ONSTART commands, which if present override the [TUNER/command] and [TUNER/ondatastart] values in the main configuration file. For example:
[68] NAME=FirstChannel CALLSIGN=First [69] NAME=SecondChannel CALLSIGN=Second TUNE="stb-control.py --stb %DEVICE% --keys reverse 4 wait 12 play right play wait 11 up wait 1 up select wait 11 up wait 1 up select right play left 5 wait 5" ONSTART="/usr/local/bin/stb-control.py --stb %DEVICE% --keys wait 1 down"
Mythtv v35 Example
As of Mythtv v35, subsequent variable definitions can use previously defined variables in that section.
Further, the [TUNER/COMMAND] command now has more automatic variables available for its use: %INPUTID%, %SOURCEID%, %CHANID%, %FREQID%, %ATSC_MAJOR%, %ATSC_MINOR%, %MPLEXID% and %RECORDID%. If any of that information if not available (e.g. %RECORDID% for LiveTV) then it will not get replaced. To keep the various "commands" from getting confused, anything inside of curly-braces will be eliminated if the variable cannot be replaced.
For example:
[VARIABLES] INPUT=4 DEVICE=roku6 TUNER=/usr/local/bin/roku-control.py --device %DEVICE% CODEC=hevc_qsv --device renderD129 -q 25 [RECORDER] command="/usr/local/bin/magewellpro2ts -i %INPUT% -m -c %CODEC%" cleanup="%TUNER% --reset" # Used in logging events, %ARG% are replaced from the channel info desc="%DEVICE%-%INPUT%" [TUNER] # If [TUNER/command] is provided, it will be executed to "tune" the channel. command="%TUNER% --sourceid %SOURCEID% --channum %CHANNUM% {--recordid %RECORDID%}"