tvheadend - FreeBSD

back to tvheadend page.

Work log

2016-03-11: f4 - ada0p2 - tvheadend 4.0.8 recognizes my HDHomeRun tuner. From /var/log/tvheadend/tvheadend.log:

2016-03-11 01:04:43.059 [   INFO]:tvhdhomerun: Found HDHomerun device 14102b7b with 4 tuners
2016-03-11 01:04:43.070 [   INFO]:tvheadend: Using Network type : DVB-C
2016-03-11 01:04:43.070 [   INFO]:tvhdhomerun: Created frontend 14102B7B tuner 0
2016-03-11 01:04:43.071 [   INFO]:tvhdhomerun: Created frontend 14102B7B tuner 1
2016-03-11 01:04:43.071 [   INFO]:tvhdhomerun: Created frontend 14102B7B tuner 2
2016-03-11 01:04:43.071 [   INFO]:tvhdhomerun: Created frontend 14102B7B tuner 3

and that's good. Unfortunately, It's not able to work the tuner:

2016-03-11 01:04:51.002 [  DEBUG]:mpegts: 0MHz in Get - add raw service
2016-03-11 01:04:51.002 [  DEBUG]:service: 9: 0MHz in Get si 0x8028af280 HDHomeRun DVB-C Tuner #3 (10.1.161.17) weight 0 prio 10 error 0
2016-03-11 01:04:51.002 [  DEBUG]:service: 8: 0MHz in Get si 0x8028af1c0 HDHomeRun DVB-C Tuner #2 (10.1.161.17) weight 0 prio 10 error 0
2016-03-11 01:04:51.002 [  DEBUG]:service: 7: 0MHz in Get si 0x8028af100 HDHomeRun DVB-C Tuner #1 (10.1.161.17) weight 0 prio 10 error 0
2016-03-11 01:04:51.002 [  DEBUG]:service: 6: 0MHz in Get si 0x8028af040 HDHomeRun DVB-C Tuner #0 (10.1.161.17) weight 0 prio 10 error 0
2016-03-11 01:04:51.002 [   INFO]:mpegts: 0MHz in Get - tuning on HDHomeRun DVB-C Tuner #0 (10.1.161.17)
2016-03-11 01:04:51.002 [  DEBUG]:tvhdhomerun: HDHomeRun DVB-C Tuner #0 (10.1.161.17) - starting 0MHz in Get
2016-03-11 01:04:51.002 [   INFO]:tvhdhomerun: tuning to a8qam256-0:0
2016-03-11 01:04:51.015 [  ERROR]:tvhdhomerun: failed to tune to a8qam256-0:0

not sure why. the cwc client doesn't work either:

2016-03-11 02:01:40.870 [  DEBUG]:settings: saving to /usr/local/etc/tvheadend/caclient/110021b4d0f4f4343a86accb67d344c9
2016-03-11 02:01:40.871 [   INFO]:cwc: Attemping to connect to v2:15050
2016-03-11 02:01:40.873 [   INFO]:cwc: Connected to v2:15050
2016-03-11 02:01:43.875 [WARNING]:cwc: read error 54 (Connection reset by peer)
2016-03-11 02:01:43.875 [   INFO]:cwc: v2:15050: Wait login response: Read error (header): Connection reset by peer
2016-03-11 02:01:43.875 [   INFO]:cwc: Disconnected from v2:15050
2016-03-11 02:01:43.875 [   INFO]:cwc: v2:15050: Automatic connection attempt in 2 seconds
2016-03-11 02:01:46.000 [   INFO]:cwc: Attemping to connect to v2:15050
2016-03-11 02:01:46.002 [   INFO]:cwc: Connected to v2:15050
2016-03-11 02:01:49.005 [WARNING]:cwc: read error 54 (Connection reset by peer)
2016-03-11 02:01:49.005 [   INFO]:cwc: v2:15050: Wait login response: Read error (header): Connection reset by peer
2016-03-11 02:01:49.005 [   INFO]:cwc: Disconnected from v2:15050

which is strange - the exact same setup works on Linux (with an older version of tvheadend).

2016-03-11: f4 - ada0p2 - the machine got upgraded to FreeBSD 9.3-stable:

root@kg-f4# uname -a
FreeBSD kg-f4.kg4.no 9.3-STABLE FreeBSD 9.3-STABLE #4 r296579: Thu Mar 10 09:28:13 CET 2016     root@kg-f4.kg4.no:/usr/obj/usr/src/sys/GENERIC  amd64

and I installed newest tvheadend and webcamd from ports

root@kg-f4# pkg info tvhead*
tvheadend-4.0.8_1
root@kg-f4# pkg info webc*
webcamd-4.2.0.9

ok. Users are:

root@kg-f4# id webcamd
uid=145(webcamd) gid=145(webcamd) groups=145(webcamd)
root@kg-f4# id tvheadend
uid=984(tvheadend) gid=984(tvheadend) groups=984(tvheadend)

the tv adapters are owned by webcamd:

root@kg-f4# ls -l /dev/dvb/*
/dev/dvb/adapter0:
total 0
crw-rw----  1 webcamd  webcamd  0x8f Mar 10 22:58 demux0
crw-rw----  1 webcamd  webcamd  0x90 Mar 10 22:58 dvr0
crw-rw----  1 webcamd  webcamd  0x91 Mar 10 22:58 frontend0

/dev/dvb/adapter1:
total 0
crw-rw----  1 webcamd  webcamd  0xa2 Mar 10 22:58 ca0
crw-rw----  1 webcamd  webcamd  0xa3 Mar 10 22:58 demux0
crw-rw----  1 webcamd  webcamd  0xa4 Mar 10 22:58 dvr0
crw-rw----  1 webcamd  webcamd  0xa5 Mar 10 22:58 frontend0

Add the tvheadend user to the webcamd group so it can access tv adapters:

root@kg-f4# pw groupshow webcamd
webcamd:*:145:
root@kg-f4# pw groupmod webcamd -m tvheadend
root@kg-f4# pw groupshow webcamd
webcamd:*:145:tvheadend
root@kg-f4# id tvheadend
uid=984(tvheadend) gid=984(tvheadend) groups=984(tvheadend),145(webcamd)

and then restart tvheadend

root@kg-f4# service tvheadend status
tvheadend is running as pid 998.
root@kg-f4# service tvheadend stop
Stopping tvheadend.
Waiting for PIDS: 998.
root@kg-f4# service tvheadend start
Starting tvheadend.
root@kg-f4# service tvheadend status
tvheadend is running as pid 1152.

then check via web interface if tv adapters are seen.

2015-10-22: FreeBSD ports tree now has tvheadend 4.0.6.

2014-03-01: ada0p2 - FreeBSD 9.2-stable: trying tvheadend 3.9.20140212 - a port from github master: get it:

tingo@kg-f4$ svn co https://svn.redports.org/decke/multimedia/tvheadend/
Error validating server certificate for 'https://svn.redports.org:443':
 - The certificate is not issued by a trusted authority. Use the
   fingerprint to validate the certificate manually!
Certificate information:
 - Hostname: svn.redports.org
 - Valid: from Aug 13 08:56:06 2013 GMT until Aug 13 23:58:23 2014 GMT
 - Issuer: Secure Digital Certificate Signing, StartCom Ltd., IL
 - Fingerprint: 05:AD:4A:38:08:72:49:8C:7E:C0:8E:EC:15:EE:DC:4D:3E:C0:B3:7C
(R)eject, accept (t)emporarily or accept (p)ermanently? t
A    tvheadend/files
A    tvheadend/pkg-plist
A    tvheadend/Makefile
A    tvheadend/distinfo
A    tvheadend/pkg-descr
A    tvheadend/files/tvheadend.in
A    tvheadend/pkg-message
Checked out revision 23689.

and build it. It builds easily. And it installs too:

root@kg-f4# pv tvh*
tvheadend-3.9.20140212      >  succeeds port (port has 3.4.0.20130726.3_5)

Does it work? Well, both DVB adapter shows up as DVB-T only, not DVB-T and DVB-C. And it is not possible to select (or write) a network on the adapter parameters page. Crap.

2014-02-26: ada0p2 - FreeBSD 9.2-stable: tvheadend 3.4.0 - ok, adding "Original Network ID" (0926 in my case) to the adapter config seems to have done the trick - now autodetect muxes works, and it also found services - 277 in all. Nice. Playing unencrypted channels (like Get Infokanal) in VLC also works.

2014-02-26: ada0p2 - FreeBSD 9.2-stable: tvheadend 3.4.0 didn't recognize my DVB-C cards properly (it doesn't handle multi-frontends), but a quick and dirty patch (from this thread, via freebsd-multimedia mailinglist) to force all adapters to be detected as DVB-C (the only service I have) like so:

root@kg-f4# /usr/ports/Tools/scripts/patchtool.py dvb_support.c
--- src/dvb/dvb_support.c.orig    2013-07-26 18:17:22.000000000 +0200
+++ src/dvb/dvb_support.c    2014-02-26 18:38:56.000000000 +0100
@@ -389,13 +389,15 @@
 int
 dvb_str_to_adaptertype(const char *str)
 {
-  return str2val(str, adaptertype);
+  /* return str2val(str, adaptertype); */
+  return FE_QAM;
 }

 const char *
 dvb_adaptertype_to_str(int type)
 {
-  return val2str(type, adaptertype) ?: "invalid";
+  /* return val2str(type, adaptertype) ?: "invalid"; */
+  return val2str(FE_QAM, adaptertype) ?: "invalid";
 }

 const char *
root@kg-f4# /usr/ports/Tools/scripts/patchtool.py -a dvb_support.c
Generating patchfile: patch-src_dvb_dvb__support.c...ok
root@kg-f4#

followed by a reinstall of the port fixed that. Now both adapters are detected as DVB-C. I can "add DVB Network by location" and select Norway, no_Oslo_Get and 21 muxes gets added. From the log:

Feb 26 19:15:36.576 dvb: New mux "498,000 kHz" created by built-in configuration from "dvb-c_no_Oslo_Get"
Feb 26 19:15:36.576 dvb: New mux "482,000 kHz" created by built-in configuration from "dvb-c_no_Oslo_Get"
Feb 26 19:15:36.577 dvb: New mux "442,000 kHz" created by built-in configuration from "dvb-c_no_Oslo_Get"
Feb 26 19:15:36.577 dvb: New mux "410,000 kHz" created by built-in configuration from "dvb-c_no_Oslo_Get"
Feb 26 19:15:36.578 dvb: New mux "394,000 kHz" created by built-in configuration from "dvb-c_no_Oslo_Get"
Feb 26 19:15:36.578 dvb: New mux "386,000 kHz" created by built-in configuration from "dvb-c_no_Oslo_Get"
Feb 26 19:15:36.578 dvb: New mux "378,000 kHz" created by built-in configuration from "dvb-c_no_Oslo_Get"
Feb 26 19:15:36.579 dvb: New mux "370,000 kHz" created by built-in configuration from "dvb-c_no_Oslo_Get"
Feb 26 19:15:36.579 dvb: New mux "362,000 kHz" created by built-in configuration from "dvb-c_no_Oslo_Get"
Feb 26 19:15:36.579 dvb: New mux "354,000 kHz" created by built-in configuration from "dvb-c_no_Oslo_Get"
Feb 26 19:15:36.580 dvb: New mux "346,000 kHz" created by built-in configuration from "dvb-c_no_Oslo_Get"
Feb 26 19:15:36.580 dvb: New mux "338,000 kHz" created by built-in configuration from "dvb-c_no_Oslo_Get"
Feb 26 19:15:36.581 dvb: New mux "330,000 kHz" created by built-in configuration from "dvb-c_no_Oslo_Get"
Feb 26 19:15:36.581 dvb: New mux "322,000 kHz" created by built-in configuration from "dvb-c_no_Oslo_Get"
Feb 26 19:15:36.581 dvb: New mux "314,000 kHz" created by built-in configuration from "dvb-c_no_Oslo_Get"
Feb 26 19:15:36.582 dvb: New mux "306,000 kHz" created by built-in configuration from "dvb-c_no_Oslo_Get"
Feb 26 19:15:36.582 dvb: New mux "298,000 kHz" created by built-in configuration from "dvb-c_no_Oslo_Get"
Feb 26 19:15:36.583 dvb: New mux "290,000 kHz" created by built-in configuration from "dvb-c_no_Oslo_Get"
Feb 26 19:15:36.583 dvb: New mux "280,000 kHz" created by built-in configuration from "dvb-c_no_Oslo_Get"
Feb 26 19:15:36.583 dvb: New mux "272,000 kHz" created by built-in configuration from "dvb-c_no_Oslo_Get"
Feb 26 19:15:36.584 dvb: New mux "241,000 kHz" created by built-in configuration from "dvb-c_no_Oslo_Get"

unfortunately, no services are discovered during initial scan. Also "autodetect muxes" doesn't work (well, it doesn't detect any muxes), no matter if "Full mux reception" is set to "On" or "Auto".

2014-02-15: I installed the tvheadend port on f4, my multimedia test machine. Details:

root@kg-f4# uname -a
FreeBSD kg-f4.kg4.no 9.2-STABLE FreeBSD 9.2-STABLE #3 r261516: Wed Feb  5 22:38:36 CET 2014     root@kg-f4.kg4.no:/usr/obj/usr/src/sys/GENERIC  amd64
root@kg-f4# pv webcamd
webcamd-3.11.0.2            =  up-to-date with port
root@kg-f4# pv tvheadend
tvheadend-3.4.0.20130726.3_5  =  up-to-date with port

tvheadend parameters:

root@kg-f4# cd /usr/ports/multimedia/tvheadend
root@kg-f4# make showconfig
===> The following configuration options are available for tvheadend-3.4.0.20130726.3_5:
     AVAHI=off: Zeroconf support via Avahi
     DVBCSA=on: Replace internal ffdecsa with dvbcsa
===> Use 'make config' to modify these settings

That's it. I am currently using the PCTV nanoStick T2 as tuner:

root@kg-f4# usbconfig -d ugen3.3
ugen3.3: <PCTV 290e PCTV Systems> at usbus3, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)
root@kg-f4# service webcamd start ugen3.3
Starting webcamd.
Attached to ugen3.3[0]

All for now.