Skip to content

Instantly share code, notes, and snippets.

@matiaspl
Last active December 17, 2023 00:59
Show Gist options
  • Save matiaspl/5b797153629e44f4d8986042bcdeef37 to your computer and use it in GitHub Desktop.
Save matiaspl/5b797153629e44f4d8986042bcdeef37 to your computer and use it in GitHub Desktop.
Convert w_scan channels.conf list to a DVBv5 dtv-scan-tables for tvheadend

If you happen to have created a channels.conf after a lengthy scanning process using w_scan:

w_scan -f c -c PL -X -S 1 -v

(in this case a Polish DVB-C scan with SR 6875)

then you can use the following line to create your own scan table (you have to run it as root to write to /usr/share):

cut -d: -f2,3,4,5,6 channels.conf | sort -u | awk -F["/:"] '{ printf "[CHANNEL]\n\tDELIVERY_SYSTEM = DVBC/ANNEX_A\n\tFREQUENCY = %s\n\tSYMBOL_RATE =  %s\n\tINNER_FEC = %s\n\tMODULATION = %s\n\tINVERSION = %s\n\n", $1, $3, $4, $5, $2 }' > /usr/share/dvb/dvb-c/pl-Toya
@endreszabo
Copy link

hi Mateusz,

just wanted to say a thank you. DIGI in Hungary just reorganized all their DVB-C muxes and with your oneliner, I could simply feed them into tvheadend. <3

@matiaspl
Copy link
Author

Great! Happy I could help 👍

@successtheman
Copy link

successtheman commented Dec 16, 2023

For tvheadend with ATSC-T digital TV (US/Canada) you can do the following (for w_scan2 however which I think is the recommended version anyway)

w_scan2 -fa -c US -x > initial_tuning_data_ATSC.txt
dvb-format-convert -I CHANNEL -O DVBV5 initial_tuning_data_ATSC.txt us-ATSC_localchannels

Since I run the tvheadend linuxserver.io docker image (in podman) I need to add an ExecStartPost line like so ExecStartPost=/usr/bin/podman cp /home/user/scantables/us-ATSC_localchannels tvheadend:/usr/share/tvheadend/data/dvb-scan/atsc/us-ATSC_localchannels to my systemd service so it copies the us-ATSC_localchannels scantable into the container during startup before it is done starting. This allows it to be recognized when tvheadend starts otherwise it doesn't detect it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment