Page 2 of 4

Re: Quad HDHR single tuner freezing.

Posted: Sun Jan 29, 2023 3:51 pm
by PhilB
Hi Klaas,

I had been considering an 'external scheduler' to alter start and end times to avoid simulaneous starts and ends but I agree
it would be better to try and fix the underlying problem. I'll certainly try to provoke it artificially with a bit of perl/api
code as you suggest.

A few observations:

1. I find that two simultaneous recordings on a single tuner do not appear to have the 10 second stagger described above.
This recording of 'News Quiz' (on a radio channel) and 'Take a Hike' (TV) are both in the BBC multiplex id=2 and chose tuner 11.
They seem to start together. My mythtv (frontend) version is v32 + fixes.202301212105.71d44affc3~ubuntu22.04.1

Code: Select all

Jan 20 18:25:30  I TVRecEvent tv_rec.cpp:1648 (HandlePendingRecordings) TVRec[18]: ASK_RECORDING 18 148 0 0
Jan 20 18:25:30  I TVRecEvent tv_rec.cpp:1648 (HandlePendingRecordings) TVRec[19]: ASK_RECORDING 19 148 0 0
Jan 20 18:26:00  I TVRecEvent tv_rec.cpp:1077 (HandleStateChange) TVRec[11]: Changing from None to RecordingOnly
Jan 20 18:26:00  I TVRecEvent mythdbcon.cpp:423 (PurgeIdleConnections) New DB connection, total: 14
Jan 20 18:26:00  I TVRecEvent tv_rec.cpp:3600 (TuningFrequency) TVRec[11]: TuningFrequency
Jan 20 18:26:00  I TVRecEvent recorders/hdhrstreamhandler.cpp:393 (Connect) HDHRSH[11](1252CD2F): Added 4 devices from 1252CD2F
Jan 20 18:26:00  I TVRecEvent recorders/hdhrstreamhandler.cpp:410 (Connect) HDHRSH[11](1252CD2F): Connected to device(1252CD2F-1)
Jan 20 18:26:00  I Scheduler scheduler.cpp:2899 (HandleRecordingStatusChange) Tuning recording: "The News Quiz":"Andy Zaltzman quizzes the week's news": channel 10704 on cardid [11], sourceid 1
Jan 20 18:26:00  I TVRecEvent tv_rec.cpp:1077 (HandleStateChange) TVRec[17]: Changing from None to RecordingOnly
Jan 20 18:26:00  I TVRecEvent mythdbcon.cpp:423 (PurgeIdleConnections) New DB connection, total: 14
Jan 20 18:26:00  I TVRecEvent tv_rec.cpp:3600 (TuningFrequency) TVRec[17]: TuningFrequency
Jan 20 18:26:00  I Scheduler scheduler.cpp:2899 (HandleRecordingStatusChange) Tuning recording: "Take a Hike": channel 10002 on cardid [17], sourceid 1
Jan 20 18:26:00  I CoreContext scheduler.cpp:717 (UpdateRecStatus) Updating status for "The News Quiz":"Andy Zaltzman quizzes the week's news" on cardid [11] (Tuning => Recording)
Jan 20 18:26:00  I CoreContext scheduler.cpp:717 (UpdateRecStatus) Updating status for "Take a Hike" on cardid [17] (Tuning => Recording)
Jan 20 18:26:00  I TVRecEvent tv_rec.cpp:4146 (TuningNewRecorder) TVRec[11]: rec->GetPathname(): '/var/lib/mythtv/recordings/10704_20230120182600.ts'
Jan 20 18:26:00  I TVRecEvent tv_rec.cpp:4179 (TuningNewRecorder) TVRec[11]: TuningNewRecorder - CreateRecorder()
Jan 20 18:26:00  I TVRecEvent tv_rec.cpp:4146 (TuningNewRecorder) TVRec[17]: rec->GetPathname(): '/var/lib/mythtv/recordings/10002_20230120182600.ts'
Jan 20 18:26:00  I CoreContext mythsystemevent.cpp:314 (customEvent) MythSystemEventHandler: Starting thread for command 'sleep 10 && /usr/local/bin/checkfilm.pl -v --chanid=10704 --desc=The News Quiz>> /var/log/mythtv/checkfilm.log 2>&1'
Jan 20 18:26:07  W TFWWrite threadedfilewriter.cpp:547 (DiskLoop) TFW(/var/lib/mythtv/recordings/10704_20230120182600.ts:82): write(65424) cnt 14 total 902964 -- took a long time, 6205 ms
Jan 20 18:26:07  I TVRecEvent tv_rec.cpp:4179 (TuningNewRecorder) TVRec[17]: TuningNewRecorder - CreateRecorder()
2. HD Homerun kit is pretty popular - it is a bit strange that nobody else is reporting this.

Phil

Re: Quad HDHR single tuner freezing.

Posted: Sun Jan 29, 2023 4:26 pm
by kmdewaal
Hi Phil,

About 1. single tuner
If you do two recordings from one transport stream on a single tuner, what we call the Multirec feature, then the actual tuning is done only once.

About 2. why nobody else...
Agreed, and that is why a software bug was not on the top of my list and I am still not sure that this is a software problem.
However, even when software works OK for many people that does not prove it is correct. Bugs caused by timing/locking issues are notoriously difficult to diagnose but once I can reproduce the problem it might be possible to find and test a fix.

About this line in the log:

Code: Select all

Jan 20 18:26:07  W TFWWrite threadedfilewriter.cpp:547 (DiskLoop) TFW(/var/lib/mythtv/recordings/10704_20230120182600.ts:82): write(65424) cnt 14 total 902964 -- took a long time, 6205 ms
I think this is the time that your disk takes to spin-up.

Klaas.

Re: Quad HDHR single tuner freezing.

Posted: Sun Feb 05, 2023 6:55 pm
by PhilB
Hi Klaas,
I've created a program to generate lots of manual recordings. It breaks my backend with 'taking more than 15000 ms to get a lock'. I have not had it lock up the tuner and prevent subsequent recordings though
It seems to have a preference to break with multiplex 1 (channel 22) but that may be a coincidence.
https://en.wikipedia.org/wiki/Crystal_P ... television

In my case, I have 7 multiplexes and 4 tuners so I alternated recordings from a batch with channels in multiplexes 1,2,3,4 and a batch with 5,6,7.

Code: Select all

Chan    Start                   End                   Mpx  CallSign
10019   2023-02-05T18:47:00Z    2023-02-05T18:48:00Z   1   Dave
10002   2023-02-05T18:47:00Z    2023-02-05T18:48:00Z   2   BBC TWO
10020   2023-02-05T18:47:00Z    2023-02-05T18:48:00Z   3   Drama
10003   2023-02-05T18:47:00Z    2023-02-05T18:48:00Z   4   ITV1
-----
10027   2023-02-05T18:53:00Z    2023-02-05T18:54:00Z   5   Yesterday
10101   2023-02-05T18:53:00Z    2023-02-05T18:54:00Z   6   BBC ONE HD
10008   2023-02-05T18:53:00Z    2023-02-05T18:54:00Z   7   London Live
To set it up:
Install scan_database module. See https://www.mythtv.org/wiki/Perl_API_examples
Put code in swamp.pl
chmod 755 swamp.pl

See the user parameters near the start.
Set $backend, $batchesneeded
Check timings: $preroll, $postroll, $reclength and $gap. All in minutes.
$stagger - all recordings within a batch start at the same time. Set this to put an additional delay of $stagger seconds between them.

Use ./swamp.pl --list to get a list of your channels and multiplexes.
Set channel numbers in @batch. eg:

Code: Select all

my @batch=('10019,10002,10020,10003',     #first batch of channels
			'10027,10101,10008'           #second batch
			#add more if needed
	      );       


Have as as many channels in each batch and as many batches as you wish (it will just rotate through them).

Run ./swamp.pl - it will list proposed batches.
If happy with this, do ./swamp.pl --fullrun. It will trigger the recordings then give a list of upcoming recordings.
Thanks for your continued support.
Phil

Code: Select all

#!/usr/bin/perl -w
use strict;
use Getopt::Long;
use Time::Local;
use lib '.';    #add current dir to perl path if not already there

use scan_database;    #See https://www.mythtv.org/wiki/Perl_API_examples

#
#swamp a backend with manual recordings
#
#  Usage:   --list        list channels in backend
#           --fullrun     allow program to trigger recordings - otherwise it just lists proposed recordings.
#

#====== user parameters === Set to suit your setup ===

my $backend='http://192.168.2.109:6544';

my $batchesneeded=7;  #no of batches of recordings to be made. 

#List of channels to be used in the batches - select different multiplexes.
my @batch=('10019,10002,10020,10003',     #channels in first wave - all from different multiplexes
		   '10027,10101,10008'           #second wave
			                              #further ones loop round
);

#Timings

my $stagger=0;       #gap between start of recordings within a batch (in seconds)
my $preroll=2;
my $postroll=2;
my $reclength=1;   #length of recording in mins
my $gap=1;         #gap after postroll before next preroll in minutes

#==== End of user parameters ====


#recording template
my %template=(    
	AutoCommflag => 'false',
    AutoExpire => 'true',
    AutoMetaLookup => 'false',
    AutoTranscode => 'false',
    AutoUserJob1 => 'false',
    AutoUserJob2 => 'false',
    AutoUserJob3 => 'false',
    AutoUserJob4 => 'false',
    AverageDelay => '0',
    CallSign => 'BBC TWO',
    Category => '',
    ChanId => '10002',
    Description => 'Swamp test (Manual Record)',
    DupIn => 'All Recordings',
    DupMethod => 'None',
    EndOffset => '2',
    EndTime => '2023-02-03T12:55:00Z',
    Episode => '0',
    Filter => '0',
    FindDay => '6',
    FindTime => '12:45:00.000',
    Inactive => 'false',
    Inetref => '',
    LastRecorded => '2023-02-03T12:43:48Z',
    MaxEpisodes => '0',
    MaxNewest => 'false',
    NewEpisOnly => 'false',
    ParentId => '0',
    PlayGroup => 'Default',
    PreferredInput => '0',
    ProgramId => '',
    RecGroup => 'Default',
    RecPriority => '2',
    RecProfile => 'Default',
    SearchType => 'Manual Search',
    Season => '0',
    SeriesId => '',
    StartOffset => '2',
    StartTime => '2023-02-03T12:45:00Z',
    StorageGroup => 'Default',
    SubTitle => '',
    Title => 'Swamp (Manual Record)',
    Transcoder => '0',
    Type => 'Single Record'
);

my $content;
my %Channelinfo;

#check calling parameters
my $fullrun=0; my $listchannels=0; 
GetOptions ('list'=>\$listchannels, 'fullrun'=>\$fullrun);

#get channel details from backend
getchannels();

#list them if needed
if ($listchannels){listchannels(); exit 0};

#timekeeping
my $epoch=time();
print ZTime($epoch), "  = time now\n";
$epoch+=59;
$epoch -= $epoch%60;
print ZTime($epoch), "  = rounded\n";
$epoch+= 60*($gap+$preroll);   #starttime of next wave
print ZTime($epoch), "  = Time of First batch\n";

#list recordings - generate them if --fullrun 
print "Proposed $batchesneeded batches of recordings:\n";
print "Chan    Start                   End                   Mpx  CallSign\n";
my $batchnumber=0;
while ($batchnumber<$batchesneeded){
	for my $set (@batch){
		
		if ($batchnumber<$batchesneeded){
			my $delay=0;   #stagger start of recordingd within a batch
			my @chlist = split /,/,$set;
			for my $chan (@chlist){
				unless (exists $Channelinfo{$chan}){die "channel $chan not known"};
				record($chan, $epoch+$delay);
				$delay+=$stagger;
			}
			$batchnumber++;
			print "-----\n";
		}
		$epoch += 60*($gap+$preroll+$reclength+$postroll); #starttime of next wave
	}
}

if ($fullrun){
	#list upcoming recordings
	sleep(5);
	getupcoming();
}else{
	print "To trigger these recordings, please re-run with --fullrun\n";
}
exit 0;

sub record{   #list recording and trigger it if --fullrun
	(my $chan, my $epochstart)=@_;
	my $starttime=ZTime($epochstart);
	my $endtime=ZTime($epochstart + 60*$reclength);
	print "$chan   $starttime    $endtime   $Channelinfo{$chan}{Mpx}   $Channelinfo{$chan}{Name}\n";
	return unless ($fullrun);
	
	#get template recording rule
	my %recrule=%template;
	#modify it
	$recrule{StartTime}=$starttime;
	$recrule{EndTime}=$endtime;
	$recrule{CallSign}=$Channelinfo{$chan}{Name};
	$recrule{Station}=$recrule{CallSign};
	$recrule{ChanId}=$chan;
	
	#Trigger the recording:
	my $url=$backend .'/Dvr/AddRecordSchedule';
	ValidatePost(%recrule, $url, 'raw', 12);
	print "Recording triggered\n";
	sleep(1);
}


sub getchannels{
	#query backend and get all channel names and multiplexes
	my $temp;  my %sources; my %ChanData;
	
	#get sources
	my $url=$backend. '/Channel/GetVideoSourceList';
	scan_database::ReadBackend($url, $temp);
	scan_database::FillHashofHash(%sources, $temp, 'VideoSource', 'Id', 'SourceName');
    #get all channels per source
    for my $source (keys %sources){
		scan_database::ReadBackend($backend . '/Channel/GetChannelInfoList?SourceID='.$source.
					'&OnlyVisible=false&Details=true', $temp);
		my %temphash;
		scan_database::FillHashofHash(%temphash, $temp, 'ChannelInfo', 'ChanId', 'CallSign','Visible','MplexId');
		%ChanData = (%ChanData, %temphash);
	}
	
    for (sort keys %ChanData){
		if ($ChanData{$_}{Visible} eq 'true'){
			$Channelinfo{$_}{Mpx}=$ChanData{$_}{MplexId};
			$Channelinfo{$_}{Name}= $ChanData{$_}{CallSign};
		}
	}
}

sub listchannels{    #called if --list
	for (sort {$a <=>$b} keys %Channelinfo){
		print "$_ = Mpx:$Channelinfo{$_}{Mpx}  $Channelinfo{$_}{Name}\n";
	}
}
sub ZTime{    #convert epoch time to 2021-12-03T13:44:04Z form
	(my $epoch)=@_;
	my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime($epoch);
	$year+=1900; $mon++;
	return sprintf("%04d-%02d-%02dT%02d:%02d:%02dZ", $year, $mon, $mday, $hour, $min, $sec);
}


sub getupcoming{
	print "Upcoming recordings\n";
	my $url="$backend/Dvr/GetUpcomingList";
	unless (scan_database::ReadBackend($url,$content)){die "Could not get guide data"};

	#extract fields
	my %guide;
	scan_database::FillHashofHash(%guide, $content,'Program','#','StartTime','ChanId','Title');

	print "Start                    Chan    Title\n";
	for (sort {$a <=> $b} keys %guide){
		print "$guide{$_}{StartTime}     $guide{$_}{ChanId}   $guide{$_}{Title}\n";
	};
}

Re: Quad HDHR single tuner freezing.

Posted: Sat Feb 11, 2023 8:33 pm
by kmdewaal
Hi Phil,

Can you please post a formatted/ascii version of the swamp.pl script, or put it in the Wiki or so?
Now that the forum is limping along I can only get it out in one long line....

Thanks,
Klaas.

Re: Quad HDHR single tuner freezing.

Posted: Mon Feb 13, 2023 10:23 am
by PhilB
Hi Klaas,
The forum seems to be back to normal (thanks to forum maintainers) and I can extract swamp from it but I will certainly put swamp
up on the wiki if you think it to be a useful tool.

To recap:
- Two symptoms - taking too long to get lock and (rarely) tuner then locked up.

Have tried:
- extra buffering
- splitting EIT and recordings
- recording when disk already spinning
- removed checkfilm stuff (commented out)

It still fails with:
- single recordings.
- with swamp test (but it always fails with lowest frequency multiplex - 481MHz)


My latest thinking is that:
- My backend and tuner are both pretty standard and I am alone in having problems. Both probably exonerated.
- Network to tuner - I tested like this: https://info.hdhomerun.com/info/trouble ... acket_loss 1.5 million packets, no loss so probably not that.
- Antenna: This suggests that overloading the tuner will cause problems:
https://forum.silicondust.com/forum/vie ... hp?t=65715

I am 20Km from Crystal Palace 200KW transmitter and have a high gain band A antenna in the loft. Hauppauge tuners with the previous hardware
needed lna (low noise amplifier) turned on, even with a distribution amplifier.

The HDHR tuner was showing 100% signal strength so I've attenuated with an extra 3 way splitter (other two outlets terminated with 75 ohm).
Signal strength is now 94% to 98%.
Unfortunately, It's still taking more than 15000 ms to get a lock.

My next step will be to try a 12dB attenuator.
Out of interest, what signal strength do you have?

Thanks for sticking with this
Phil

Re: Quad HDHR single tuner freezing.

Posted: Wed Feb 15, 2023 8:49 pm
by kmdewaal
Hi Phil,

About the stress test script swamp.pl.
This works perfect and I think it is a good idea to put this somewhere in the WIki, e.g. in the same page where the scan_database.pm file can be found.
There is one thing; I cannot easily delete all the recordings made (all named Swamp (Manual Record) ....). Maybe you can add an option to the script to delete all the Swamp recordings?

About signal strength.
My cable tuner has about 88% signal strength. My terrestrial tuner shows 100% signal strength. The terrestrial signal comes here from a small active antenna in the window sill, followed by a two-way splitter. Both HDHomeRun boxes receive OK; the terrestrial is only used for incidental testing but the cable tuner is used continuously. So I think your 94% to 98% is OK.

About taking too long to get a lock.
Some four years ago I have been fixing things in hdhrchannel.cpp for DVB-C (commit b6b3947) and one thing I did fix (but not describe in the commit message) was that it took too long to lock on the cable signal.
The fix for DVB-C was to add the bandwidth 8MHz and the symbol rate to the tuning command that is sent from MythTV to the HDHomeRun instead of using "auto".
The HDHomeRun is quite clever in analyzing the input signal and when you specify "auto" it can figure it all by itself. However, if you specify how the signal is coded it does not need to figure it out and that makes the tuning faster. And, but now I am speculating, it could be that the HDHomeRun fails to correctly determine your Crystal Palace multiplex, then does set up the decoder with the wrong parameters and then the decoder locks up.
Possibly the DVB-T/T2 tuning can be made faster and more reliable by doing something similar for the DVB-T/T2 tuning command.

There is alternative to specifying modulation parameters in the tuning command; you can use the hdhomerun_config utility to limit the range of modulation parameters to check and this will also reduce the search time.
The command

Code: Select all

hdhomerun_config discover
gives the IDs of the HDHomeRun devices it finds on the network.

Code: Select all

[klaas@kasus libhdhomerun]$ ./hdhomerun_config 1241A961 get /sys/features
channelmap: eu-bcast eu-cable au-bcast au-cable tw-bcast tw-cable
modulation: t8dvbt2 t7dvbt2 t6dvbt2 t8dvbt t7dvbt t6dvbt a8qam256-* a8qam128-* a8qam64-* a7qam256-* a7qam128-* a7qam64-* a6qam256-* a6qam128-* a6qam64-*
auto-modulation: auto auto8t auto7t auto6t auto8c auto7c auto6c

[klaas@kasus libhdhomerun]$ ./hdhomerun_config 1241A961 get /sys/dvbc_modulation
If you now set /sys/dvbc_modulation to what is expected then that should work...
E.g. on my box I can do this:

Code: Select all

[klaas@kasus libhdhomerun]$ ./hdhomerun_config 1241A961 set /sys/dvbc_modulation "a8qam64-6875 a8qam64-6900"
[klaas@kasus libhdhomerun]$ ./hdhomerun_config 1241A961 get /sys/dvbc_modulation
a8qam64-6875 a8qam64-6900 
[klaas@kasus libhdhomerun]$ 
but I do not know what would work for you, I only ever played around with this on DVB-C.

It could be that the /sys/dvbc_modulation settings are not persistent or that, when they are persistent, it is not recommended to set them on every tuning command. Anyway, I decided at the time to fix DVB-C tuning in the tuning command.

A possible way forward is to fix the DVB-T/T2 tuning command in the same way if we can figure out what a better tuning command is.
Alternatively, when there is a setting for /sys/dvbc_modulation that can be derived from the results obtained from a channel scan then that is also a possible solution.
To get an idea for this I would need the output of a mythtv-setup channel scan with the "-v chanscan:debug" log option.

Thanks,
Klaas.

Re: Quad HDHR single tuner freezing.

Posted: Thu Feb 16, 2023 10:51 pm
by kmdewaal
Hi Phil,

It looks like I can distinguish between 6, 7 or 8MHz bandwidth and DVB-T or DVB-T2. This should reduce the search space for the tuner.
If you can compile fixes/33 or master from source then I can make a patch that will generate more explicit tuning commands, e.g."8dvbt2:634000000" instead of "auto:634000000" (the 634000000 is a frequency here). This does tune here in a fraction of a second so maybe it works for you.

Klaas.

Re: Quad HDHR single tuner freezing.

Posted: Fri Feb 17, 2023 4:09 pm
by PhilB
Hi Klaas,

I agree about deleting recordings - 90+ was too many to do manually! This will get rid of them:

Code: Select all

#!/usr/bin/perl -w
use strict;
use Getopt::Long;
use Time::Local;
use lib '.';    #add current dir to perl path if not already there
use scan_database;    #See https://www.mythtv.org/wiki/Perl_API_examples
my $backend='http://192.168.2.109:6544';
my $fullrun=0;

my $content;

deleterecordings();

exit 0;

sub deleterecordings{
	my $count=0;
	my $url="$backend/Dvr/GetRecordedList";
	unless (scan_database::ReadBackend($url,$content)){die "Could not get guide data"};
	while ($content =~ m!<Program>(.*?)</Program>!g){
		$count += processdelete($1);
	}
	print "$count recordings found\n";
	exit 0;
}
sub processdelete{
	(my $chunk)=@_;
	
	$chunk =~ m!<Title>(.*?)</Title>!;
	my $title=$1;

	if ($title ne 'Swamp (Manual Record)'){return 0};
	
	$chunk =~ m!<StartTime>(.*?)</StartTime>!;
	my $StartTime=$1;
	
	$chunk =~ m!<ChanId>(.*?)</ChanId>!;
	my $chan=$1;
	
	$chunk =~ m!<CallSign>(.*?)</CallSign>!;
	my $callsign=$1;
	
	$chunk =~ m!<RecordedId>(.*?)</RecordedId>!;
	my $RecordedId=$1;
	
	print "$chan  $StartTime  $RecordedId  $title $callsign\n";
	
	if ($fullrun == 0){return 1};
	my %hash=('#ChanId' => $chan,          #The api does not seem to like ChanId & StartTime.
	           '#StartTime' => $StartTime,
	           'ForceDelete' => 'true',
	           'AllowRerecord' => 'false',
	           'RecordedId' => $RecordedId
	          );
	          
	my $url="$backend/Dvr/DeleteRecording";
	my $response=ValidatePost(%hash, $url, 'raw', 3);
	print "Deleted\n";	
	sleep(1);
	return 1;
}

set $backend and run it.
If it looks sensible set $fullrun =1 and run again.
I'll include it in swamp.pl when I put it up on the wiki.

Progresss here:
I have put 12dB in the antenna - signal strength 69 ~ 88% but quality still 100%.
I have tried changing pre-roll from 2 to 4 minutes as there is an issue with my system which I though might have been relevant.
It starts recordings at StartTime - 4 mins even if pre-roll is set to 2. I don't know if this will be addressed by your recent work with the recording pending event.
I made no difference anyway.

This fails:

Code: Select all

Proposed 30 recordings:
Chan    Start                   End                   Mpx  CallSign
10047   2023-02-17T14:45:00Z    2023-02-17T14:46:00Z   1   Film4+1
10002   2023-02-17T14:45:00Z    2023-02-17T14:46:00Z   2   BBC TWO
10020   2023-02-17T14:45:00Z    2023-02-17T14:46:00Z   3   Drama
10003   2023-02-17T14:45:00Z    2023-02-17T14:46:00Z   4   ITV1
-----
10027   2023-02-17T14:51:00Z    2023-02-17T14:52:00Z   5   Yesterday
10101   2023-02-17T14:51:00Z    2023-02-17T14:52:00Z   6   BBC ONE HD
10008   2023-02-17T14:51:00Z    2023-02-17T14:52:00Z   7   London Live
-----
10047   2023-02-17T14:57:00Z    2023-02-17T14:58:00Z   1   Film4+1
10002   2023-02-17T14:57:00Z    2023-02-17T14:58:00Z   2   BBC TWO
but if I swap the order of the first two I cannot provoke failure.

Code: Select all

Chan    Start                   End                   Mpx  CallSign
10002   2023-02-17T14:45:00Z    2023-02-17T14:46:00Z   2   BBC TWO
10047   2023-02-17T14:45:00Z    2023-02-17T14:46:00Z   1   Film4+1
10020   2023-02-17T14:45:00Z    2023-02-17T14:46:00Z   3   Drama
10003   2023-02-17T14:45:00Z    2023-02-17T14:46:00Z   4   ITV1
-----
The vast majority of our real recordings are from multiplexes 2 and 4.

Now the modulation issues:

Code: Select all

phil@myth2:~$ hdhomerun_config FFFFFFFF get /sys/features
channelmap: eu-bcast eu-cable au-bcast au-cable tw-bcast tw-cable
modulation: t8dvbt2 t7dvbt2 t6dvbt2 t8dvbt t7dvbt t6dvbt a8qam256-* a8qam128-* a8qam64-* a7qam256-* a7qam128-* a7qam64-* a6qam256-* a6qam128-* a6qam64-*
auto-modulation: auto auto8t auto7t auto6t auto8c auto7c auto6c

phil@myth2:~$ hdhomerun_config FFFFFFFF get /sys/dvbc_modulation
<just gives a blank line>

phil@myth2:/var/log/mythtv$ hdhomerun_config FFFFFFFF get help
Supported configuration options:
/lineup/network_id
/lineup/scan
/sys/copyright
/sys/debug
/sys/dvbc_modulation
/sys/features
/sys/hwmodel
/sys/model
/sys/restart <resource>
/sys/version
/tuner<n>/channel <modulation>:<freq|ch>
/tuner<n>/channelmap <channelmap>
/tuner<n>/debug
/tuner<n>/filter "0x<nnnn>-0x<nnnn> [...]"
/tuner<n>/lockkey
/tuner<n>/program <program number>
/tuner<n>/status
/tuner<n>/plpinfo
/tuner<n>/streaminfo
/tuner<n>/target <ip>:<port>
/tuner<n>/vchannel <vchannel>
The log when doing a tuning scan is here:
https://pastebin.com/5FU61R93
"If you can compile fixes/33 or master from source"
At present, that's outside my comfort zone but is there a tutorial?
Regards
Phil

Re: Quad HDHR single tuner freezing.

Posted: Sat Feb 18, 2023 9:41 am
by PhilB
I now have found a reliable way of provoking a failure.

Code: Select all

Proposed 70 recordings:
Chan    Start                   End                   Mpx  CallSign
10047   2023-02-18T09:42:00Z    2023-02-18T09:43:00Z   1   Film4+1
-----
10027   2023-02-18T09:52:00Z    2023-02-18T09:53:00Z   5   Yesterday
-----
10047   2023-02-18T10:02:00Z    2023-02-18T10:03:00Z   1   Film4+1
-----
10027   2023-02-18T10:12:00Z    2023-02-18T10:13:00Z   5   Yesterday
-----
Every single Film4+1 recording after the first fails.
It does seem to be related to switching a tuner from one multiplex to another.
Phil

Re: Quad HDHR single tuner freezing.

Posted: Sat Feb 18, 2023 12:25 pm
by kmdewaal
Reproducing is the first step towards fixing! I am curious if it fails only Mpx 1 or also the other multiplexes.
From what I found on the Internet and from the scan log there are DVB-T and DVB-T2 multiplexes, and some are QAM-64 and some are QPSK modulated, but all have a bandwidth of 8MHz.
Can you please post the output of the following sql command:

Code: Select all

MariaDB [mythconverg]> select * from dtv_multiplex;
This will show the parameters of all multiplexes as detected by mythtv-setup and (wild guess....) it could just be that Mpx 1 is the one with the QPSK modulation for instance.
I am thinking about putting a fix direct in master.

Re: Quad HDHR single tuner freezing.

Posted: Sat Feb 18, 2023 4:49 pm
by paulh
Yesterday is on COM6 ArqB - DTG-8 64QAM 8K 3/4 27.1Mb/s DVB-T MPEG2
Film4+1 is on COM5 ArqA - DTG-8 64QAM 8K 3/4 27.1Mb/s DVB-T MPEG2

So different multiplexes but using the same tuning parameters.

This is a useful web page to find this sort of information for the Crystal Palace transmitter and all the other UK ones as well.
https://ukfree.tv/transmitters/tv/Crystal_Palace

Re: Quad HDHR single tuner freezing.

Posted: Sun Feb 19, 2023 9:57 am
by PhilB
sql output attached - I've split it into chunks for readability.
Phil

Code: Select all

+---------+----------+-------------+-----------+-----------+-----------+------------+------+----------+
| mplexid | sourceid | transportid | networkid | frequency | inversion | symbolrate | fec  | polarity |
+---------+----------+-------------+-----------+-----------+-----------+------------+------+----------+
|       1 |        1 |       20544 |      9018 | 482000000 | 0         |          0 | auto | v        |
|       2 |        1 |        4164 |      9018 | 490000000 | 0         |          0 | auto | v        |
|       3 |        1 |       12294 |      9018 | 506000000 | 0         |          0 | auto | v        |
|       4 |        1 |        8197 |      9018 | 514000000 | 0         |          0 | auto | v        |
|       5 |        1 |       24640 |      9018 | 530000000 | 0         |          0 | auto | v        |
|       6 |        1 |       16516 |      9018 | 546000000 | 0         |          0 | auto | v        |
|       7 |        1 |       32778 |      9018 | 586000000 | 0         |          0 | auto | v        |
+---------+----------+-------------+-----------+-----------+-----------+------------+------+----------+
7 rows in set (0.00 sec)

+---------+----------+------------+-----------+--------------+-------------------+----------------+
| mplexid | polarity | modulation | bandwidth | lp_code_rate | transmission_mode | guard_interval |
+---------+----------+------------+-----------+--------------+-------------------+----------------+
|       1 | v        | auto       | 8         | auto         | a                 | 1/32           |
|       2 | v        | auto       | 8         | auto         | a                 | 1/32           |
|       3 | v        | auto       | 8         | auto         | a                 | 1/32           |
|       4 | v        | auto       | 8         | auto         | a                 | 1/32           |
|       5 | v        | auto       | 8         | auto         | a                 | 1/32           |
|       6 | v        | auto       | 8         | auto         | a                 | 1/32           |
|       7 | v        | auto       | 8         | auto         | a                 | 1/32           |
+---------+----------+------------+-----------+--------------+-------------------+----------------+
7 rows in

+---------+----------------+---------+---------------+-----------+--------------+---------+---------+
| mplexid | guard_interval | visible | constellation | hierarchy | hp_code_rate | mod_sys | rolloff |
+---------+----------------+---------+---------------+-----------+--------------+---------+---------+
|       1 | 1/32           |       0 | auto          | n         | auto         | DVB-T   | 0.35    |
|       2 | 1/32           |       0 | auto          | n         | auto         | DVB-T   | 0.35    |
|       3 | 1/32           |       0 | auto          | n         | auto         | DVB-T   | 0.35    |
|       4 | 1/32           |       0 | auto          | n         | auto         | DVB-T   | 0.35    |
|       5 | 1/32           |       0 | auto          | n         | auto         | DVB-T   | 0.35    |
|       6 | 1/32           |       0 | auto          | n         | auto         | DVB-T2  | 0.35    |
|       7 | 1/32           |       0 | auto          | n         | auto         | DVB-T   | 0.35    |
+---------+----------------+---------+---------------+-----------+--------------+---------+---------+
7 rows in

+---------+---------+------------+----------------+---------------------+-------------------+
| mplexid | rolloff | sistandard | serviceversion | updatetimestamp     | default_authority |
+---------+---------+------------+----------------+---------------------+-------------------+
|       1 | 0.35    | dvb        |             33 | 2022-12-09 18:17:28 |                   |
|       2 | 0.35    | dvb        |             33 | 2022-12-09 18:17:29 |                   |
|       3 | 0.35    | dvb        |             33 | 2022-12-09 18:17:29 |                   |
|       4 | 0.35    | dvb        |             33 | 2022-12-09 18:17:29 |                   |
|       5 | 0.35    | dvb        |             33 | 2022-12-09 18:17:29 |                   |
|       6 | 0.35    | dvb        |             33 | 2022-12-09 18:17:29 |                   |
|       7 | 0.35    | dvb        |             33 | 2022-12-09 18:17:29 |                   |
+---------+---------+------------+----------------+---------------------+-------------------+


Re: Quad HDHR single tuner freezing.

Posted: Sun Feb 19, 2023 2:49 pm
by kmdewaal
Hi Phil.

Yesterday I committed a fix to master that will generate more explicit tuning commands, e.g. "t8dvbt:586000000" instead of "auto:586000000".
Once the fix is into the packages, which might take a few days as far as I know, you can test this by updating to the latest master. There is no change in the database schema at this moment so you can always go back to fixes/33 if you want.

I have been looking at the logs of the scan, the dtv_multiplex table and the Crystal Palace website pointed to by paulh.
I think that there are two frequencies in the dtv_multiplex table not correct.

For mplexid 5 the frequency is now 530000000 but this must be 529833000
The website says this is multiplex COM6 ArqB on channel C28- with frequency 529.8 MHz
The scan log NIT table has a TerrestrialDeliverySystemDescriptor for this multiplex and this says 529833000 as frequency.

For mplexid 6 the frequency is now 546000000 but this must be 545833000
The website says this is multiplex PSB3 BBCB on channel C30- with frequency 545.8 MHz.
There is no TerrestrialDeliverySystemDescriptor for this multiplex present in the scan log, but the scan log is incomplete.

I suggest to modify the frequencies mentioned above manually. This can easily be done with mythtv-setup, Channel Editor, last button on the bottom/righ says "Edit Transports". It can of course also be done with SQL statements like "update dtv_multiplex set frequency=52983300 where mplexid=5;".

The question remains why this is not correct in the dtv_multiplex table. A full scan with country choice 'United Kingdom' scans each channel three times; once for the nominal frequency, once for a "+1" offset (plus 166 kHz) and once for a "-1" offset (minus 166 kHz).
It could be that the HDHomeRun already locks on the nominal frequency even when the "-1" offset frequency is better.
It could also be that the scan is actually done with e.g. the 'Germany' or 'Netherlands' country selection and then only the nominal frequencies are scanned.
One can also argue that the TerrestrialDeliverySystemDescriptor information should be used to update the dtv_multiplex table. The problem is that this information is not always present and that, when present, it is not necessarily correct. This is something for me to think about.

Thanks for the "swamdrain" script that will allow me to drain the swamp of recordings created by the "swamp" script. Full/long testing still to be done.

Thanks,
Klaas.

Re: Quad HDHR single tuner freezing.

Posted: Sun Feb 19, 2023 3:00 pm
by PhilB
Hi Klaas. Sorry but I was testing the swamp draining code with v32.
It fails with port 6744 but I have a new version ready to go up on the wiki.
Will report testing with new frequencies and when wiki updated.
Thanks.
Phil

Re: Quad HDHR single tuner freezing.

Posted: Sun Feb 19, 2023 5:31 pm
by PhilB
Hi Klaas,
good research!
I have put swamp up on the wiki - just search for 'swamp'. It should be ok with v33 and allow deletes but please let me know if you have problems or you think anything needs clarification.

Re multiplex frequencies:
For mplexid 5 the frequency is now 530000000 but this must be 529833000
The website says this is multiplex COM6 ArqB on channel C28- with frequency 529.8 MHz
The scan log NIT table has a TerrestrialDeliverySystemDescriptor for this multiplex and this says 529833000 as frequency.
My myth setup shows 530, as do my Panasonic TV and my old Mythtv system (v27, Hauppauge tuners).
The TV confirms 545.83 for multiplex 6.
Is there any point also fixing QAM settings?
Will try it tomorrow.
Thanks
Phil