[mythtv-users] need help with station rescan after frequency change

Stephen Worthington stephen_agent at jsw.gen.nz
Thu Jul 2 16:07:10 UTC 2020


On Thu, 2 Jul 2020 08:16:09 -0700, you wrote:

>On 6/30/20 8:01 AM, Jim Abernathy wrote:
>>
>> On 6/30/20 8:32 AM, Jim Abernathy wrote:
>>>
>>> On 6/30/20 7:31 AM, James Abernathy wrote:
>>>> Last year all but one of my local OTA TV stations changed 
>>>> frequencies as a part of the FCC repacking of the USA OTA channels.
>>>>
>>>> Today the last one switched.   I can't remember exactly what I did 
>>>> last year, but I remember it was simple. I tried on my 
>>>> development v31 FE/BE combo to make sure I had it right before I did 
>>>> anything with my production backend.
>>>>
>>>> I failed on the initial test.  All I did was use mythtv-setup and in 
>>>> the input connections I did a scan and updated all channels. I still 
>>>> could not receive the channel that moved.
>>>>
>>>> 1. Do I have to reconfigure XMLTV?  I use tv_grab_zz_sdjson-sqlite. 
>>>> The channel that moved is still called the same thing.
>>>> 2. I have a mixture of HDHR and Hauppauge WinTV Quad PCIe tuners
>>>>
>>>> Jim A
>>>> BTW I did the rescan on a real TV and it found the new channel
>>>
>>> Okay, I think I have this figured out.  I do not know if this is the 
>>> optimal solution, but it worked.
>>>
>>> First I used mythtv-setup -> Edit Channels and deleted all channels 
>>> from Video Source 'SD'. Then I re-scanned.
>>>
>>> I noticed that when that was done I had a lot of new unwanted 
>>> channels so I marked them invisible.  I also noticed that my channel 
>>> that moved overnight now had the changed freq. from 11 to 9 which is 
>>> correct.  However the XMLTV ID was now blank.
>>>
>>> So I ran as user 'mythtv':
>>>
>>> tv_grab_zz_sdjson_sqlite --manage-lineups --config-file 
>>> $HOME/.mythtv/SD.xmltv
>>>
>>> Then did option 5 to manually select the channels. That exercise was 
>>> mostly to confirm what I already had.
>>>
>>> When I exited, I did mythfilldatabase, then exited user mythtv and 
>>> back in mythtv-setup I found my changed channel had the XMLTV ID.
>>>
>>> Next I started mythbackend up and everything is now work.
>>>
>>> I have no idea what the right steps are but this worked for me.
>>>
>>> Jim A
>>
>> I think I added a step that was not needed. So here is what I think is 
>> required at least on a RPi4 v31 with HDHomerun Quatro.
>>
>> 1. Run mythtv-setup which shuts down the backend.
>>
>> 2. in Edit channels, I deleted all the channels on the Video Source in 
>> question. SD for me.
>>
>> 3. Run the scan and add all the channels and then edited channels I 
>> didn't want to see.
>>
>> 4. Save and exit, which starts the backend.
>>
>> 5. At least on the RPi4, mythfilldatabase is triggered by just 
>> starting mythbackend so I just waited.
>>
>> At this point I could view the new channel.
>>
>> Jim A
>
>Seems like a BOATLOAD of work, just to change the frequency on ONE 
>CHANNEL!  This is, IMHO, is the weakest part of MythTV (which I love, 
>BTW, or I wouldn't waste so much time trying to get it just right!).  I 
>have tried figuring out the schema used for channels so I can manually 
>control them but I have still not figured it out.  I have ONE channel I 
>would like to add and I have come close (I think), but it still would 
>not tune in MythTV.
>
>I wrote a GUI QT app based on the source from dvb-apps that lets me use 
>scandvb to see what I can get on different days and different antenna 
>placement, then optimize the antenna placement for which channels I care 
>about.  I have done all my analysis using this app and have a good 
>understanding of what is possible and am getting good results in my 
>recordings.  But all this analysis revealed ONE channel that mythtv 
>didn't see in the latest scan (different frequency?  bad weather?  
>Irrelevant!) and now I have to go through all that messing around with 
>xmltv IDs and visible and recording rules and channel numbers, etc, etc, 
>etc, using what seems like very limited tools (channel editors) to do it 
>(back up the DB first!).  Where is the Wiki article about how to 
>manually add a channel?
>
>Everything I can find tells me to run a scan, which seems to destroy 
>everything I have set up so far.  I have tried backing up the DB, run a 
>scan, then save the new DB and compare changes, but there are too many 
>differences and I don't understand the inter-relations of the tables.  I 
>tried the following:
>
>insert into dtv_multiplex set 
>mplexid=207,sourceid=6,frequency=473000000,inversion="a", 
>updatetimestamp="2020-06-21 21:18:00", etc...
>
>and then
>
>insert into channel set atsc_major_chan=12, atsc_minor_chan=1, 
>callsign="KVOS", name="KVOSDT", channum="12-1", etc...
>
>but I don't really know if my field values were valid. 
>https://www.mythtv.org/wiki/Channel_table and 
>https://www.mythtv.org/wiki/Dtv_multiplex_table were helpful, but not 
>thorough enough to know what needed to be entered or if there were any 
>more tables involved.  A python script that prompts for parameters would 
>be GREAT!  My above-mentioned app only needs frequency, "8VSB" (for 
>ATSC), audio PID, video PID and stream ID and it can tune a channel.  It 
>seems to me a script that prompts for those, a video source, a channel 
>number, a callsign and an XMLTVID would be all one would need, and that 
>is what I am trying to write, but have not succeeded... YET!
>
>Dave D.

I regularly alter or add to my DVB-T and SAT>IP DVB-S2 channels
manually.  You certainly seem to have the right idea about what is
needed, so I am not sure why it is not working for you.  One thing
that we do have here on DVB-T is that you get channels which appear on
a frequency scan but are not real channels - they are just place
holders that do not have any actual data being transmitted.  So maybe
your channel is one of them.  MythTV is able to tell such channels and
does not add them.  Does your TV pick up this channel?  TVs usually
also can tell place holder channels and will not list them in the
available channel list.

The way I normally add a channel is to use a GUI SQL editor on the
channel table.  I copy a row that is similar to what I want and just
edit the fields that are different.  It is rare here to need to add
anything to the dtv_multiplex table - all the channels on one
frequency use the same dtv_multiplex row, so you only need to add that
if you do not have any other channels on the same multiplex.  But when
I have done it, I used the same system - find a row that is similar,
copy it and edit it.

There is no need to know the PIDs for a channel normally - that
information is picked up from the packets for a channel.  All that
MythTV needs is the frequency and tuning parameters and (for DVB-T)
the service ID.  For ATSC, I believe it only needs the frequency and
tuning parameters and the major/minor channel numbers.  The tuning
process will select the frequency and use the tuning parameters to
acquire the digital stream of data from the multiplex.  Then it will
look for the header packets that describe the channels and their
streams.  Those packets are broadcast regularly so they will be seen
rapidly.  From those packets, it uses the service ID or the combined
major/minor channel number to pick out the data for the required
channel.  That data provides the stream numbers (PIDs).

If the PIDs are known, you can skip waiting for the header packets and
immediately select out the stream packets for the channel using the
PID numbers, but doing that risks that something will have changed and
the old PIDs will no longer be valid.  For example, a programme may
have an extra audio stream being broadcast for a new language.  Or the
channel may even have been moved to a different multiplex and no
longer be there at all, in which case the multiplex it was on may
optionally be broadcasting information to tell where the channel was
moved to.


More information about the mythtv-users mailing list