Tvheadend with extended_cw functionality (powervu)

joeuser

Registered
Messages
199
I have made a new branch of Tvheadend which adds extended_cw functionality (powervu).

The source code is here: https://github.com/joeusercz/tvheadend/tree/extended_cw


If you need to use lib dvbcsa (instead of default ffdecsa) it will not work for CSA encrytped powervu channels, but others are ok since they use DES.

Setup for Tvheadend is normal with connection to oscam-emu - no need for stream relay anymore...
 

Bitman

Donating Member
Messages
49
How does one go about building TVH with extended_cw functionality. Presumably you have to build it for the right box, then add on the extended_cw, or is your code all embracing ?

Sorry about the stupid questions.
 

varas

Registered
Messages
4
Thanks joeuser, works like a charm :)

Running on CentOS 7.1 with tvheadend from extended_cw branch and latest oscam/oscam-emu patch.

Want to share my configs to save your time on configuration.

Configuration > CAs > Add new
Enabled: [x]
Name: emu
Mode: OSCam net protocol (rev >= 10389)
Camd.socket filename / IP Address (TCP mode): 127.0.0.1 (in case of tvheadend and oscam is run on the same host)
Listen / Connect port: 2000

Main part of the oscam.conf:
Code:
[streamrelay]
stream_relay_enabled = 0

[dvbapi]
enabled		= 1
au		= 1
pmt_mode	= 4
listen_port	= 2000
user		= pvu
boxtype		= pc
extended_cw_api = 1
ecminfo_type                  = 1
read_sdt                      = 1
write_sdt_prov                = 1


And the last bit - slightly modified version of joeuser's bash script to generate m3u:

Code:
#!/bin/bash

# dependency - jq
# debian/ubuntu - apt-get install jq
# redhat/centos - yum install jq

############### BEGIN CONFIG ###################
streamer="192.168.122.22:9981"
tmpfile="/tmp/services.json"
profile="PowerVu"
streamauth="pvu:pvu"
apiauth="admin:admin"
###############  END CONFIG  ###################

wget -O /tmp/services.json http://${apiauth}@localhost:9981/api/mpegts/service/grid?limit=100000
echo \#EXTM3U
entries=$(/usr/bin/jq -c  '.total' ${tmpfile})
for (( service=0; service<= $entries; service++ ))
do
        if [ $(/usr/bin/jq -c '.entries['$service'].caid' ${tmpfile}) = '"0E00:000000"' ]
        then
                enabled=$(/usr/bin/jq -c  '.entries['$service'].enabled' ${tmpfile})
                if [ "$enabled" = "true" ]
                then
                        svcname=$(/usr/bin/jq -c -r  '.entries['$service'].svcname'  ${tmpfile})
                        uuid=$(/usr/bin/jq -c -r  '.entries['$service'].uuid'  ${tmpfile})
                        network=$(/usr/bin/jq -c -r  '.entries['$service'].network'  ${tmpfile})
                        multiplex=$(/usr/bin/jq -c -r  '.entries['$service'].multiplex'  ${tmpfile})
                        sid_dec=$(/usr/bin/jq -c  '.entries['$service'].sid'  ${tmpfile})
                        sid=$(printf '%x' $sid_dec)
                        echo \#EXTINF:-1, $network/$multiplex/$svcname
                        echo http://${streamauth}@${streamer}/stream/service/${uuid}\?profile=${profile}\&descramble=1\&emm=1\&:0:0:${sid}
                fi
        fi
done
 

Purrfect

Registered
Messages
19
problem: tvh using 100% on pvu channels

First of all, thanks for adding this very useful functionality to tvh. I almost made it work on Debian Jessie but I have the following problem: I managed to compile the sources and I replaced the original tvh bin file in /usr/bin. (Anything else I need to replace?) Then I modified oscam-emu (r11209) to use dvbapi instead of stream relay. When I start watching using VLC or Kodi, it works at the beginning but after about 2 seconds, tvh starts using 100% CPU (monitored by using "top") and playback begins to stutter. Non-pvu channels work fine, though. For testing I changed back to stream relay keeping the new tvh bin file and it works like before with tvh consuming about 3% CPU and oscam-emu about 8%. I think something is not 100% compatible with my setup? Maybe my oscam-emu is too old?

Thanks and regards,
Purrfect
 

joeuser

Registered
Messages
199
Can you post a debug log from tvheadend (--debug all)? And probably the debug from oscam-emu from the same time would be helpful in case it is an issue (-d128). If that does not provide enough, after we can try a Tvheadend trace log.

Usually in Tvheadend when the cpu usage goes very high it is due to EPG problems.

You can also try latest oscam-emu from source code here:
https://github.com/joeusercz/OSCam-with-emu-branch/tree/oscam-emu-merged
 
Last edited:

Purrfect

Registered
Messages
19
Thanks for your hints. I figured out that I forgot to change the prefix from default (/usr/local) to /usr while using "./configure". Now tvh is running stable but I still encounter stuttering and "hick-ups" when I'm not using stream-relay. VLC keeps on reporting this:

ts warning: invalid header [0xf4:95:85:ea] (pid: 256)
ts warning: invalid header [0xae:b5:cf:06] (pid: 257)
ts warning: invalid header [0x8c:fe:ed:30] (pid: 257)
ts warning: invalid header [0x28:69:01:88] (pid: 256)
ts warning: invalid header [0xa5:00:4e:17] (pid: 256)
ts warning: invalid header [0xc2:88:b9:ba] (pid: 257)
ts warning: discontinuity received 0xe instead of 0xb (pid=257)
ts warning: discontinuity received 0x6 instead of 0x4 (pid=308)
ts warning: invalid header [0x67:17:12:77] (pid: 256)
ts warning: invalid header [0xc3:13:2e:29] (pid: 257)
ts warning: invalid header [0xbd:5e:59:9d] (pid: 256)
ts warning: invalid header [0x49:44:e0:40] (pid: 257)
ts warning: invalid header [0x69:15:5f:ab] (pid: 256)
ts warning: invalid header [0x4f:6f:a3:3e] (pid: 257)
[...]

I'm sure it's only a small detail missing but I cannot find it. With stream-relay it still works like a charm.

Regards,
Purrfect
 

joeuser

Registered
Messages
199
I don't have a c-band dish, so my testing ability is limited. Can you upload a Tvheadend trace (descrambler,csa,capmt) and the corresponding oscam-emu (-d128)?
 

Purrfect

Registered
Messages
19
Hi!

As far as I can see oscam-emu is doing its job perfectly, but tvh is complaining that it receives the key too late, sporadically. Strange, isn't it? I couldn't figure out how to upload a file here but the only interesting message is: Apr 5 14:07:57 video1 tvheadend[31200]: descrambler: ECM - key late (800 ms) for service "Test". It appears every 5-15 seconds.

Oscam-Emu on the other side keeps on logging "found (0 ms) by emulator - Test"

It's a good idea to compare the behavior with another non-C-band station. I will try it out.

Regards,
Purrfect
 

ditev

Banned
Messages
246
To fix ECM - key late you must add CAID (0E00) in data/conf/descrambler and after that to compile again.

{
"name" : "PowerVu",
"caid" : "0E00"
}
 
Last edited:

Purrfect

Registered
Messages
19
Thanks for this hint. I added this CAID and compiled again but it didn't help. Meanwhile I tried A*N on 9° East and amazingly it works fine! I wonder what's different with G*A on Apstar 7.
 

ditev

Banned
Messages
246
Something you wrong with adding this CAID, show me full content of data/conf/descrambler how you added, you missing something like "comma".

Do you see "adding CAID 0E00 as constant crypto-word" line when you start tvh in log ?
 

Purrfect

Registered
Messages
19
Hi Ditev,

you're right, I see only this:

root@video1:/var/log# cat /var/log/syslog | grep adding
Apr 9 20:23:15 video1 tvheadend[4816]: descrambler: adding CAID 2600 as constant crypto-word (BISS)

My descambler file looks like this:

root@video1:~/tvheadend/data/conf# vi descrambler


"const_cw" : [
{
"name" : "BISS",

"caid" : "2600"
}
],
"comment1": "Rename _caid to caid for activation!",
"quick_ecm" : [
{
"name" : "Unitymedia",
"caid" : "098E"
},
{
"name" : "MTV",
"caid" : "0B00"
},
{
"name" : "HD Plus",
"caid" : "1843"
},
{
"name" : "PowerVu",
"caid" : "0E00"
}
]
}

Maybe I overlook something but I can't see the mistake. Do I need to do anthing else before recompiling or is this change being noticed automatically my "make"?

Regards,
Purrfect
 

ditev

Banned
Messages
246
You must add in "const_cw" section, not in "quick_ecm", delete in "quick_ecm" and add after "BISS" must look like this:

Code:
"const_cw" : [
    {
      "name" : "BISS",
      "caid" : "2600"
    },
    {
      "name" : "PowerVu",
      "caid" : "0E00"
    }
  ],

after edit and save only "make".

And must see in log adding CAID 2600 and adding CAID 0Е00 both.

Regards
 

zmanzman

Registered
Messages
14
works about 20hours, then i see

2017-04-14 16:30:00.577 [WARNING] mpegts: too much queued input data (over 50MB), discarding new
2017-04-14 16:30:10.584 [WARNING] mpegts: too much queued input data (over 50MB), discarding new
2017-04-14 16:30:20.586 [WARNING] mpegts: too much queued input data (over 50MB), discarding ne
 

ditev

Banned
Messages
246
This issue is not from extenden_cw.
This problem is maybe from EPG, try to disable EPG grab and are you use transcoding ?
But more usefull is to go TVh site and post log where are developers, this here is only additional for extended_cw where is for PowerVu where in Main code don't have support for PVU.
 
Last edited:

zmanzman

Registered
Messages
14
hello. thank you.
but i have tried two things.
1st - current solution, and have issue above.

and 2nd - i have used tvheadend
(without extended_cw and direct from main source)
git clone https //github.com/tvheadend/tvheadend

In second way, i havent any issue with "too much queued"
during two days,
but have other issue - all channels have no audio.
 

ditev

Banned
Messages
246
How i say, mostly time "too much queued" from EPG, try to disable over-the-air EIT DVB grabber.

Without log can't say anything.
Also not answer are you use transcoding, how RAM have PC/HTPC and etc.
 

zmanzman

Registered
Messages
14
i dont use transcoding inside tvh (but i have connected two ffmpeg for compress channels to tvh output streams).

My config:
TBS6985
Load average: 0.95 1.26 1.41 (Intel Core i3-4130)
Mem[320/3815MB]
Swp[0/3955MB]

just disabled EIT in EPG GRABBER MODULES.
will see how it will work
thank you for advice
 

zmanzman

Registered
Messages
14
No way to resolve issue with "too much queued input data"
just added to cron restart tvheadend every 6 hours.
 
Top