[mythtv-users] Recording from an IPTV source

Stephen Worthington stephen_agent at jsw.gen.nz
Sat Nov 26 17:05:35 UTC 2022

On Sat, 26 Nov 2022 17:33:40 +0100, you wrote:

>On 23/11/2022 19:19, John P Poet wrote:
>> You could write a custom "external recorder" for mythtv, but the
>> included `mythexternrecorder` application might be able to do what you
>> want. It uses configuration files to tell it  how to obtain a valid
>> transport stream and that is fed into mythbackend.
>> https://www.mythtv.org/wiki/ExternalRecorder#Using_the_.22Generic.22_External_Recorder <https://www.mythtv.org/wiki/ExternalRecorder#Using_the_.22Generic.22_External_Recorder>
>> https://www.mythtv.org/wiki/Example_Configuration_files
>> <https://www.mythtv.org/wiki/Example_Configuration_files>
>> I can aid you in crafting up a conf file if you need it.
>I tried setting this up myself, resulting in the following (extracted
>from the backend log):
>Nov 26 16:39:30 hobbiton mythbackend: mythbackend[23328]: I
>TVRecEventtv_rec.cpp:1648 (HandlePendingRecordings) TVRec[1]:
>Nov 26 16:40:00 hobbiton mythbackend: mythbackend[23328]: I TVRecEvent
>tv_rec.cpp:1077 (HandleStateChange) TVRec[1]: Changing from
>RecordingOnly to None
>Nov 26 16:40:00 hobbiton mythbackend: mythbackend[23328]: I TVRecEvent
>tv_rec.cpp:1077 (HandleStateChange) TVRec[1]: Changing from None to
>Nov 26 16:40:00 hobbiton mythbackend: mythbackend[23328]: I TVRecEvent
>tv_rec.cpp:3600 (TuningFrequency) TVRec[1]: TuningFrequency
>Nov 26 16:40:00 hobbiton mythbackend: mythbackend[23328]: E TVRecEvent
>tv_rec.cpp:3891 (TuningSignalCheck) TVRec[1]: TuningSignalCheck:
>SignalMonitor failed
>Nov 26 16:40:00 hobbiton mythbackend: mythbackend[23328]: I CoreContext
>scheduler.cpp:717 (UpdateRecStatus) Updating status for "FIFA WK voetbal
>2022":"Groep D: Frankrijk - Denemarken" on cardid [1] (Pending =>
>Recorder Failed)
>So I wonder what it is that makes the TuningSignalCheck fail. The
>recording is shown as in progress in mythweb, but with a zero-byte size.
>MythTV version info:
>MythTV Version : v32.0+fixes.202211251949.2af1c2064e~ubuntu20.04.1
>MythTV Branch : fixes/32
>Network Protocol : 91
>Library API : 32.20200101-1
>QT Version : 5.12.8
>Options compiled in:
> linux profile use_hidesyms using_alsa using_oss using_pulse
>using_pulseoutput using_backend using_bindings_perl
>using_bindings_python using_bindings_php using_dvb using_firewire
>using_frontend using_hdhomerun using_satip using_vbox using_ceton
>using_joystick_menu using_libcec using_libcrypto using_gnutls
>using_libdns_sd using_libfftw3 using_libxml2 using_lirc using_mheg
>using_opengl using_egl using_qtwebkit using_qtscript using_qtdbus
>using_taglib using_v4l2 using_v4l2prime using_x11 using_system_libbluray
>using_systemd_notify using_systemd_journal using_drm using_bindings_perl
>using_bindings_python using_bindings_php using_freetype2
>using_mythtranscode using_opengl using_egl using_drm using_vaapi
>using_nvdec using_vdpau using_ffmpeg_threads using_mheg using_libass
>using_libxml2 using_libmp3lame
>Running on Ubuntu 20.04; MythTV was installed from the ppa.
>The configuration file I set up for the external recorder is as follows:
>mythtv at hobbiton:~$ cat mythexternrecorder1.conf
>command="/usr/bin/ffmpeg -hide_banner -nostats -loglevel panic -i
>udp:// -vcodec copy -codec:a aac -b:a 128k -f mpegts
>cleanup="/home/mythtv/stop_streaming hdmicap1.xperim.be"
>desc=hdmicap1 %CHANNUM% %CHANNAME% %CALLSIGN%
>command="/home/mythtv/tuner_command hdmicap1.xperim.be %CHANNUM%"
>newepisodecommand="/home/mythtv/tuner_command hdmicap1.xperim.be %CHANNUM%"
>If I run the RECORDER/command manually I do see garbage on the screen,
>so ffmpeg is indeed producing output.
>The script called from TUNER/command does the following:
>mythtv at hobbiton:~$ cat tuner_command
># $1: FQDN of the streaming device
># $2: channel number
>### Turn the STB on
>### Wait for video lock
>### Tune the STB to the required channel
>### Start streaming
>/home/mythtv/start_streaming $1
>As you can see there are still placeholders (e.g. the signal is assumed
>already to be present, and the STB is assumed already to be set to the
>correct channel). The start_streaming script is as follows, and this
>works (otherwise the above ffmpeg test would not have produced output):
>mythtv at hobbiton:~$ cat start_streaming
>myIPaddr=$(hostname -I)
>sourceIPaddr="$(host -t A ${1} | awk '/has.*address/{print $NF; exit}')"
>curl --silent --output /dev/null $URL

Does start_streaming return a 0=success value on exit?  Maybe you need
to add "exit 0" at the end, as the curl command may not be returning 0
for some reason.

More information about the mythtv-users mailing list