Is is possible to adjust RecordingQuality threshold

Have a MythTV related problem? Ask for help from other MythTV users here.

Moderator: Forum Moderators

Post Reply
wrighch
Junior
Posts: 28
Joined: Tue Nov 01, 2016 5:58 pm
United States of America

Is is possible to adjust RecordingQuality threshold

Post by wrighch »

Some stations in my area broadcast a marginal signal. In such cases, that results in gaps in the recorded program. Most of the time, the recordings are watchable. I just have to tolerate a few jumps now and then. But MythTV seems to have some internal metric (RecordingQuality or Overall Score) which, if the recording falls below the threshold, it marks the recording failed. That causes each subsequent re-broadcast to be re-recorded.

Is there, among MythTV's millions of configurable settings, a setting that will allow me to adjust the quality or score that is acceptable to me so that I can reduce the number of duplicate recordings I'm encountering?
User avatar
bill6502
Developer
Posts: 2323
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Is is possible to adjust RecordingQuality threshold

Post by bill6502 »

Yes, however there's no GUI for it. You can use the Services API to change it from the default
value of 95 to something lower, e.g.:

Code: Select all

curl --data Key=MinimumRecordingQuality --data Value=90 localhost:6544/Myth/PutSetting
Full disclosure, I've never changed mine.
wrighch
Junior
Posts: 28
Joined: Tue Nov 01, 2016 5:58 pm
United States of America

Re: Is is possible to adjust RecordingQuality threshold

Post by wrighch »

Perfect. I probably would have searched all day and not looked for an API to do it. Thanks a bunch.
wrighch
Junior
Posts: 28
Joined: Tue Nov 01, 2016 5:58 pm
United States of America

Re: Is is possible to adjust RecordingQuality threshold

Post by wrighch »

Bill: I searched the API Wiki but didn't see anything. Is there an API that would allow me to query a specific recording to obtain either its assigned "Overall Score" or "Recording Quality" or even to get the status such as is shown in the Previously Recorded list (i.e. Recorder Failed)? I'd like to use the information in a User Job script to determine what to do with the recording?
User avatar
bill6502
Developer
Posts: 2323
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Is is possible to adjust RecordingQuality threshold

Post by bill6502 »

There isn't. And the Myth/PutSetting is a generic endpoint for any setting, just slightly better
than going into MySQL (as it has no error checking.)

A UserJob could search the backend log for:

Code: Select all

2019-11-25 13:26:42.813374 I [1438/1453] TVRecEvent tv_rec.cpp:827 (FinishedRecording) - TVRec[28]: FinishedRecording(1261_2019-11-25T19:16:41Z) damaged recq:<RecordingQuality overall_score="0" key="1261_2019-11-25T19:16:41Z" continuity_error_count="2" packet_count="2807748">
There are arguments available to the jobs (https://www.mythtv.org/wiki/User_Jobs) so a search can be crafted
to find a matching key. %CHANID% and maybe %STARTTIMEISOUTC%.

The status is available from the API (e.g. http://someBackend:6544/Dvr/GetRecorded ... dId=someId) but
it's tougher to decode. Python bindings are available. Here's a very old script, but it still works and may
get you started if looking in the log isn't enough:

Code: Select all

#!/usr/bin/python2
# Works with python3 in v31 (targeted for January 2020)

"""
Print info for recordings marked as damaged.
"""

from __future__ import print_function
import sys
from MythTV import MythDB

try:
    DB = MythDB()
except IndexError:
    sys.exit('Unable to connect to the backend, aborting.')

HEADING_PRINTED = False

for recording in DB.searchRecorded():
    # pylint: disable=maybe-no-member
    pgm = recording.getRecordedProgram()
    # pylint: enable=maybe-no-member
    if 'DAMAGED' not in pgm.videoprop:
        continue
    if not HEADING_PRINTED:
        HEADING_PRINTED = True
        print('\n  {:30.30}  {:15.15} {:17}  {}'.format(
            'Title', 'Sub Title', 'Starttime', 'Video Properties'))
    print('  {:30.30}  {:15.15} {}  {}'.format(
        pgm.title,
        pgm.subtitle,
        pgm.starttime.strftime("%b %d %Y %H:%M"),
        pgm.videoprop))
wrighch
Junior
Posts: 28
Joined: Tue Nov 01, 2016 5:58 pm
United States of America

Re: Is is possible to adjust RecordingQuality threshold

Post by wrighch »

Thanks for the quick response. You're the BEST!

I was hoping to avoid searching the backend log, though that may be the simplest solution, especially since the CHANID and STARTTIME are known and I could just search for "Recording => Recorder Failed" or something. MySQL was my next thought, but I was hoping to avoid that too because I'd first have to find out the details of the database tables of interest. I'll give a look at the GetRecorded API and see if it might work. Thanks for the script example to get me started. I certainly appreciate your help.
User avatar
bill6502
Developer
Posts: 2323
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Is is possible to adjust RecordingQuality threshold

Post by bill6502 »

If you choose GetRecorded, the parameter is <VideoProps>. But, it's a bit map, Damaged=0x20. See this:
https://github.com/MythTV/mythtv/blob/m ... pes.h#L191.
The quality is only logged, it doesn't appear in the DB.
wrighch
Junior
Posts: 28
Joined: Tue Nov 01, 2016 5:58 pm
United States of America

Re: Is is possible to adjust RecordingQuality threshold

Post by wrighch »

Bit maps! Wow. I haven't used bit maps since I was writing assembly code in the '90s. I love it! Thanks for the reference. I certainly wouldn't have figured that one out for myself. Looks like it's a toss-up between a search of the backend log and a call to GetRecorded. Thanks again. You're a life-saver.
Post Reply