Kodi Community Forum
Live TV doesn't work on Openelec [tvheadend server] - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: Raspberry Pi (https://forum.kodi.tv/forumdisplay.php?fid=166)
+---- Thread: Live TV doesn't work on Openelec [tvheadend server] (/showthread.php?tid=148646)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30


RE: Live TV doesn't work on Openelec [tvheadend server] - serxx - 2013-03-09

The AR problem is not related to certain channels. It seems like if I first start Live TV, then it's always wrong. After channel change AR is correct but picture is cropped.

Code:
Mar 09 17:34:25 dvr:  # type                 lang resolution       samplerate channels  
Mar 09 17:34:25 dvr:  1 H264                      720 x 576                              
Mar 09 17:34:25 dvr:  2 MPEG2AUDIO           est                   48000      2

I tried to make a screenshot but it did not work. Screenshot does not capture video, only OSD. Is there some trick to get video too?
My best effort produced this: http://serxx.tmkk.ee/dvb-t/screenshot006.png
The video is always in the black box.

If I start Live TV for the first time, then AR is wrong and picture is stretched into that box. That makes everything slim and tall, specially with 16:9 source.
After channel change AR is correct. But the box remains, cropping a lot of picture from left and right.

If it matters, I use 5:4 LCD with HDMI-DVI cable. Resolution is 1280x1024@60Hz.


RE: Live TV doesn't work on Openelec [tvheadend server] - doveman2 - 2013-03-09

I've tested and it seems to be working but I've got 100% CPU and I'm only getting about 17fps.

Even idle on Home it's 44-72% (CPU-XBMC is only 39-44% of this) and checking "top" shows xbmc.bin around 41% and tvheadend 8%.

When I run tvhpiproxy.py it goes up to 100% for a while then settles back down again. Going to TV Channels and it's 65-91% (CPU-XBMC 60-68%) then starting BBC ONE (SD) it's up to 100% (CPU-XBMC 36-39%) and 16-20fps.

That's without any overclock though, so I'll try it with
arm_freq=900
core_freq=350
sdram_freq=425


RE: Live TV doesn't work on Openelec [tvheadend server] - xoox - 2013-03-09

(2013-03-09, 17:32)doveman2 Wrote: I've got it on the Pi, I just need to know how to autostart it so that I don't have to SSH in and run it manually everytime?

Create simply a bash script named .config/autostart.sh


RE: Live TV doesn't work on Openelec [tvheadend server] - serxx - 2013-03-09

(2013-03-09, 17:51)doveman2 Wrote: starting BBC ONE (SD) it's up to 100% (CPU-XBMC 36-39%) and 16-20fps.
Is it MPEG2?
Do you have MPEG2 licence?
Without it Pi can decode MPEG2 but with all that additional code running, there just might not be enough CPU power. If you have MPEG2 licence, then GPU does the decoding.


RE: Live TV doesn't work on Openelec [tvheadend server] - doveman2 - 2013-03-09

(2013-03-09, 17:54)xoox Wrote:
(2013-03-09, 17:32)doveman2 Wrote: I've got it on the Pi, I just need to know how to autostart it so that I don't have to SSH in and run it manually everytime?

Create simply a bash script named .config/autostart.sh

I did try that and put

./tvhpiproxy.py

in it but it didn't run. Currently I've got

(sleep 20
echo 50 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
)&
./tvhpiproxy.py

and the first part works to modify the up_threshold file so I know autostart.sh is running but ./tvhpiproxy.py doesn't run and until I ssh in and run ./tvhpiproxy.py manually I just get the "TVheadend has lost connection messages".

Even after running it manually, I'm getting "Tvheadend HTSP Client. No hardware present" when trying to start a channel and sometimes shows the pause bar at the top of the screen with something random like -4:30. The web interface shows the tuners are still detected and shows the EPG, although I haven't been able to play a stream with VLC so far.

(2013-03-09, 18:14)serxx Wrote:
(2013-03-09, 17:51)doveman2 Wrote: starting BBC ONE (SD) it's up to 100% (CPU-XBMC 36-39%) and 16-20fps.
Is it MPEG2?
Do you have MPEG2 licence?
Without it Pi can decode MPEG2 but with all that additional code running, there just might not be enough CPU power. If you have MPEG2 licence, then GPU does the decoding.

Yeah, it's MPEG2 and I've got the licence. I don't think it can decode it without that, I certainly just get a black screen and audio only when trying to play an MPEG-2 recording without the licence.


RE: Live TV doesn't work on Openelec [tvheadend server] - popcornmix - 2013-03-09

(2013-03-09, 13:50)opdenkamp Wrote: you should be fixing the actual issue instead of a nasty work around like this, which will lead to other issues.
putting a sleep() in the add-on when opening a stream before reading the first packet will work just as well i bet.
and i doubt that 1088 height is the problem here, since tvh has always sent that if your provider sends streams like that.

the problem needs to be picked up in omxplayer instead.

Agreed, the fix should go in omxplayer.

I'm not entirely convinced by the description of the problem.
All encoded videos work in 16x16 macroblocks, so all 1920x1080 content is actually encoded 1920x1088 high with a 1920x1080 crop rectangle. We play videos 1088 high from a file just fine.
Similarly omxplayer doesn't require I frames. If you have an MPEG2 file that doesn't start with an I frame it will again play just fine (with corruption until the first I frame).

I believe there's a race condition in omxplayer and we need to receive a certain number of packets from the demuxer to get out of the initial buffering state before something happens that stops playback.
Somehow this fix is making the bad state less likely to occur (and adamsutton suggests it still fails, but less frequently).

I don't have a TV card, so it's hard to test. I do have a setup where tvheadend plays from a file, although as I've never seen it work, I'm not 100% sure it's a valid test setup. I'll see if the proxy makes it work.

Keep reporting what does and doesn't work, it might provide a useful clue as to what is going wrong.


RE: Live TV doesn't work on Openelec [tvheadend server] - serxx - 2013-03-09

(2013-03-09, 18:22)doveman2 Wrote: I did try that and put

./tvhpiproxy.py
"./" means in the current directory. I believe your script is somewhere else. You must point it to the right place, something like this /storage/<some directory>/tvhpiproxy.py

and add & to the end, like this:
/storage/<some directory>/tvhpiproxy.py &

"&" means leave it running in the background and do not wait for it to end.

(2013-03-09, 18:34)popcornmix Wrote: Agreed, the fix should go in omxplayer.
Or in the Tvheadend. Tvheadend could add some code, so it always begins output with I-frame. That might be even better idea, as it might solve some problems on other platforms too. There is no point to output anything before I-frame as it's not possible to display anything before the first I-frame.


RE: Live TV doesn't work on Openelec [tvheadend server] - oliv3r - 2013-03-09

If you run the proxy on the same host as the server, make sure you 'allow' 127.0.0.1' to access items. Took me a while to figure out why it wasn't working Wink (Or use you complete ip instead of localhost)

btw, just ran a very quick test, but so far this seems to work (as a nasty workaround). Ironically, I have no use of the 1088 -> 1080 changes, since I only stream mpeg2 SD content. So the iframe bit makes quite the difference, so far.


RE: Live TV doesn't work on Openelec [tvheadend server] - adamsutton - 2013-03-09

@popcornmix, indeed. But the difference here is what omxplayer is using to setup the decoder. If you look at the output from ffmpeg when opening a 1080i HD broadcast (recorded TS) it reports height 1080. However TVH is reporting 1088 (as that's the original broadcast dimension) and passing this to omxplayer is what's causing the problems. This might even explain why it used to work and then suddenly stopped, it may coincide with the addition of code to use data from backends (like TVH) to speed up open times.

I'll look into whether TVH should actually be reporting 1088, or whether it should be handled within XBMC. But this is still not a 100% fix, and I can no longer play my HD recordings (though that worked before a recent omxplayer patch to improve DTS playback).

Adam


RE: Live TV doesn't work on Openelec [tvheadend server] - doveman2 - 2013-03-09

(2013-03-09, 18:49)serxx Wrote: "./" means in the current directory. I believe your script is somewhere else. You must point it to the right place, something like this /storage/<some directory>/tvhpiproxy.py

and add & to the end, like this:
/storage/<some directory>/tvhpiproxy.py &

"&" means leave it running in the background and do not wait for it to end.

Thanks.

./tvhpiproxy.py works when I SSH in as it puts me in that directory. I guess when it's booting and runs autostart.sh, it's in some other directory. If anyone knows what directory that is, it would probably be easiest to move the .py script to there but I guess even if I leave it where it is, I need to know where the system is at that point so that I can work out the correct path from there to the script.


RE: Live TV doesn't work on Openelec [tvheadend server] - xoox - 2013-03-09

(2013-03-09, 21:08)doveman2 Wrote: ./tvhpiproxy.py works when I SSH in as it puts me in that directory. I guess when it's booting and runs autostart.sh, it's in some other directory. If anyone knows what directory that is, it would probably be easiest to move the .py script to there but I guess even if I leave it where it is, I need to know where the system is at that point so that I can work out the correct path from there to the script.

As serxx suggested you should use an absolute path. Type 'pwd' to get the directory of the script.


RE: Live TV doesn't work on Openelec [tvheadend server] - serxx - 2013-03-09

(2013-03-09, 21:08)doveman2 Wrote: ./tvhpiproxy.py works when I SSH in as it puts me in that directory. I guess when it's booting and runs autostart.sh, it's in some other directory. If anyone knows what directory that is...
If you want to know where you are, use "pwd" command.
Code:
root ~ # pwd
/storage

For startup you always need to give absolute path. "./something" never works, unless it's in the same directory as the startup script. And even then you can not be 100% sure as some other startup thing can change working directory.


RE: Live TV doesn't work on Openelec [tvheadend server] - doveman2 - 2013-03-09

OK, thanks, I understand about the path.

However, I'm seeing a load of disconnected/reconnected errors whilst it's loading the EPG data (which makes it take ages) after launching it manually and then when I try to start LiveTV I get the "hardware not present" error. Using rbej's OE build from here http://forum.xbmc.org/showthread.php?tid=140518&pid=1361045#pid1361045

Code:
root ~ # ./tvhpiproxy.py
('127.0.0.1', 40756) has connected
Error: string index out of range
('127.0.0.1', 9982) has disconnected
('127.0.0.1', 40758) has connected
Error: string index out of range
('127.0.0.1', 9982) has disconnected
('127.0.0.1', 40760) has connected
Error: string index out of range
('127.0.0.1', 9982) has disconnected
('127.0.0.1', 40762) has connected
Error: string index out of range
('127.0.0.1', 9982) has disconnected
('127.0.0.1', 40764) has connected
Error: string index out of range
('127.0.0.1', 9982) has disconnected
('127.0.0.1', 40766) has connected
Error: string index out of range
('127.0.0.1', 9982) has disconnected
('127.0.0.1', 40768) has connected
Error: string index out of range
('127.0.0.1', 9982) has disconnected
('127.0.0.1', 40770) has connected
Error: string index out of range
('127.0.0.1', 9982) has disconnected
('127.0.0.1', 40772) has connected
Error: string index out of range
('127.0.0.1', 9982) has disconnected
('127.0.0.1', 40774) has connected
Error: string index out of range
('127.0.0.1', 9982) has disconnected
('127.0.0.1', 40776) has connected
Error: string index out of range
('127.0.0.1', 9982) has disconnected
('127.0.0.1', 40778) has connected
Error: string index out of range
('127.0.0.1', 9982) has disconnected
('127.0.0.1', 40780) has connected
Error: string index out of range
('127.0.0.1', 9982) has disconnected
('127.0.0.1', 40782) has connected
Error: string index out of range
('127.0.0.1', 9982) has disconnected
('127.0.0.1', 40784) has connected
Error: string index out of range
('127.0.0.1', 9982) has disconnected
('127.0.0.1', 40786) has connected
Error: string index out of range
('127.0.0.1', 9982) has disconnected
('127.0.0.1', 40788) has connected
Error: string index out of range
('127.0.0.1', 9982) has disconnected
('127.0.0.1', 40790) has connected

I just tested with XBMC running on my PC, using TVHeadend Client to connect to my PI on port 9982 and that gave the same "No hardware present" error when trying to start a channel. Even if I set the XBMC client back to port 9982 and don't run the script I have the same problem, so I guess it's nothing to do with that and just TVH is buggy.


RE: Live TV doesn't work on Openelec [tvheadend server] - oliv3r - 2013-03-10

doveman, read what I wrote. You probably have set up your tvheadend to only accept connections from 192.168.1.0 or similar, but you try to connect to 127.0.0.1

either run tvhpiproxy with the IP as 2nd parameter (you need the ports 1 3 parms) or, connect to 192.168.1.1 (or whever your server is running.


RE: Live TV doesn't work on Openelec [tvheadend server] - doveman2 - 2013-03-10

(2013-03-10, 00:41)oliv3r Wrote: doveman, read what I wrote. You probably have set up your tvheadend to only accept connections from 192.168.1.0 or similar, but you try to connect to 127.0.0.1

either run tvhpiproxy with the IP as 2nd parameter (you need the ports 1 3 parms) or, connect to 192.168.1.1 (or whever your server is running.

Sorry, I missed your previous post. System Info shows tvheadend is listening on 127.0.0.1:9982 and TVH client is set to connect to 127.0.0.1:9982 but it was still giving "hardware not present" when I tried to start a channel but I rebooted and then it started working Smile

So I've got tvhpiproxy autostarting now and set TVH client to use port 9983 and I can start channels now Smile

However, it keeps pausing and restarting constantly. Some channels seem worse than others for this and sometimes it happens a lot after changing channel, then settles down. In fact, after changing channel a few times (letting it play for a minute or two on each) it stopped doing this even after switching back to the channels on which it was worse. I stopped and restarted TV in case it only happens when first starting a channel but it didn't reoccur then either but after leaving it on one channel for a while it did just do it again once. I posted the log straight after that at http://pastebin.com/6bt7VTq7 so if it's shown in the log, it should be at the end (as well as when it first happened which will be nearer the start).

I've got debug logging on and it shows around 70% CPU (CPU-XBMC 22%) and 9fps but that must be wrong as it doesn't look that bad, although it does look a bit more juddery/jittery than when I use Mediaportal on my PC connected to the same TV. top shows tvhpiproxy using 30%, xbmc.bin using 22% and tvheadend using 15%

Great to be able to use my Pi to watch TV at all though Smile