Kodi Community Forum
New MythTV add-on using libcmyth - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+---- Forum: PVR (https://forum.kodi.tv/forumdisplay.php?fid=136)
+---- Thread: New MythTV add-on using libcmyth (/showthread.php?tid=110694)



RE: New MythTV add-on using libcmyth - richardk - 2013-02-17

(2013-02-17, 04:49)sfrooster Wrote: Scratch that. The stuttering came back with Live Tv. Backend cup was higher too. So I dropped back to my previous version and things are better.

I noticed something interesting. Live TV using this version (latest master) of the addon causes mythbackend to use 2 -3 times a much cpu as the native MythTV frontend. MythTV frontend = 10% - 12% with HD content, XBMC = 40% - 42% playing the exact same live program on the same computer (Ubuntu on AR1600).

On an older, slower backend machine, I can see how this could cause stuttering or buffering.

(I haven't tried it with any other version of the addon, so I don't know whether this phenomenon was just introduced or has been there all along.)

Playing recordings appears to be fixed. I'm seeing slightly higher mythbackend cpu usage than with the MythTV frontend, but nothing that would cause a problem, and it doesn't seem to be increasing with time as it did before.

sfrooster, could you ssh into your backend, and run top to monitor the mythbackend cpu usage? That would give the developers another data point.

Hope this helps!


RE: New MythTV add-on using libcmyth - fetzerch - 2013-02-17

Thanks. I've reverted the buffer change for now.


RE: New MythTV add-on using libcmyth - simora - 2013-02-17

(2013-02-17, 15:21)cfetzer Wrote:
(2013-02-17, 13:12)simora Wrote: Are there config or make options to only build the myth addon from your repo so make install only installs the myth addon or atleast so I don't have to build all the other addons? Then I could stick your repo in and opdenkamp's and get the best of everything.

That again depends on the build system, maybe it's better to ask in the xbmc irc channel or in the linux specific help section of the forum.
Maybe something like "make -C lib/cmyth && make -C addons/pvr.mythtv.cmyth" works for you.

But are you using different pvr addons? If not, then you can just use our repository.
In addition we try to release fixes and new features more often now, so that using opdenkamps git repo might be fine for you as well.

I'm working with J1nx's GBox Linux build so the other addons are necessary but I would like to add the latest from your repo if it will be easy enough. If you guys are going to release more often than I will stick with opdenkamps for simplicity.

EDL is in your 1.6.8+ releases correct? Its just XBMC that needs the PR correct?


RE: New MythTV add-on using libcmyth - richardk - 2013-02-17

(2013-02-17, 18:07)cfetzer Wrote: Thanks. I've reverted the buffer change for now.

I built the new version, and I can confirm that it resolves the problem with Live TV. Mythbackend cpu usage is now comparable to that when playing a recording.


RE: New MythTV add-on using libcmyth - sfrooster - 2013-02-18

(2013-02-17, 18:33)simora Wrote: EDL is in your 1.6.8+ releases correct? Its just XBMC that needs the PR correct?

Should I take this to mean commercial skip should be working?

It's not for me, even though I ought to have the latest version (I say "ought" because I did a "git pull/configure/make" etc. but System Info -> PVR Service is still showing the same version and compile date - why is that?)


RE: New MythTV add-on using libcmyth - simora - 2013-02-18

@sfrooster

Comm skipping or EDL are not part of xbmc. Quite a few posts back in this thread someone stated the pull requests that would have to be approved or applied to your own clone to enable EDL. Since that post it looks like the pull requests have been updated so i'm not sure which commits are required to enable EDL.


RE: New MythTV add-on using libcmyth - fetzerch - 2013-02-18

Commercial skip depends on two changes:
- XBMC: https://github.com/xbmc/xbmc/pull/1743
- Addon: https://github.com/opdenkamp/xbmc-pvr-addons/pull/173

This first version will work with recordings that do not have changing refresh rates.
Not sure if this generalization is correct, but so far I haven't seen this in DVB streams,
but it seems to be the case for some (maybe all) ATSC streams.

This is caused by a general difference how mythtv handles timestamps (frame offsets) where xbmc needs time offsets.
Myth TV 0.27 will add a feature that will allow us to convert those values properly.


RE: New MythTV add-on using libcmyth - sfrooster - 2013-02-19

(2013-02-18, 20:08)cfetzer Wrote: Commercial skip depends on two changes:
- XBMC: https://github.com/xbmc/xbmc/pull/1743
- Addon: https://github.com/opdenkamp/xbmc-pvr-addons/pull/173

This first version will work with recordings that do not have changing refresh rates.
Not sure if this generalization is correct, but so far I haven't seen this in DVB streams,
but it seems to be the case for some (maybe all) ATSC streams.

This is caused by a general difference how mythtv handles timestamps (frame offsets) where xbmc needs time offsets.
Myth TV 0.27 will add a feature that will allow us to convert those values properly.

Ok, good to know. To clarify, ATSC streams (like those I'd tune with an HDHR Prime) will work with this first version, or will not?

On another point - I built the addon last night, and I'm noticing that after sometime I need to bounce myth-backend or else live tv will stutter with buffering. htop on the backend will confirm that the CPU is running under slightly more load than it does right after the bounce (at which point the stuttering also disappears).

To be fair, this issue may have existed in earlier versions.

Are others seeing this? Is there a fix / workaround?


RE: New MythTV add-on using libcmyth - richardk - 2013-02-19

(2013-02-17, 21:49)richardk Wrote:
(2013-02-17, 18:07)cfetzer Wrote: Thanks. I've reverted the buffer change for now.

I built the new version, and I can confirm that it resolves the problem with Live TV. Mythbackend cpu usage is now comparable to that when playing a recording.

My MythTV backend has been up for 5 1/2 days now, and the mythtbacked cpu load when playing a recording is edging back up.

I'm seeing 21% - 23% load when playing a HD recording. I fired up the MythTV frontend, and played the same recording. Using mythfrontend on the same configuration and playing the same recording, the mythbackend cpu load runs 10% - 12% -- about half of that when using XBMC.

So, XBMC always seems to cause the mythbackend to double.

And something is causing the mythbackend load to increase over time for both players. (The increases seem, though, to be less severe and more gradual than with the old version of the plugin that's now in distribution. At this point, it's not enough to cause any buffering or stuttering. So it wouldn't be noticed by anyone not monitoring the cpu load on the backend.)

Is it the images in the cmyth plugin? Or some other aspect of the plugin? Or something inherent in the MythTV backend, and unrelated to XBMC? At this point, I don't know. And since the phenomenon takes days to show up clearly, it's not the easiest thing to test.


RE: New MythTV add-on using libcmyth - sfrooster - 2013-02-19

(2013-02-19, 15:49)richardk Wrote: My MythTV backend has been up for 5 1/2 days now, and the mythtbacked cpu load when playing a recording is edging back up.

I'm seeing 21% - 23% load when playing a HD recording. I fired up the MythTV frontend, and played the same recording. Using mythfrontend on the same configuration and playing the same recording, the mythbackend cpu load runs 10% - 12% -- about half of that when using XBMC.

So, XBMC always seems to cause the mythbackend to double.

And something is causing the mythbackend load to increase over time for both players. (The increases seem, though, to be less severe and more gradual than with the old version of the plugin that's now in distribution. At this point, it's not enough to cause any buffering or stuttering. So it wouldn't be noticed by anyone not monitoring the cpu load on the backend.)

Is it the images in the cmyth plugin? Or some other aspect of the plugin? Or something inherent in the MythTV backend, and unrelated to XBMC? At this point, I don't know. And since the phenomenon takes days to show up clearly, it's not the easiest thing to test.

I don't know what you're running for a backend (mine is only a Zotac MAG), but I'm at the point of a daily reboot. The need *may* be exacerbated by some network latency (one xbmc node is across a 100 ft cable run serviced by a cable/ethernet bridge) - once the CPU usage creeps up a little, I start to see excessive buffering on the remote node. The less remote node (which is harware identical to the other) is less... fragile.


RE: New MythTV add-on using libcmyth - richardk - 2013-02-19

(2013-02-19, 20:06)sfrooster Wrote: I don't know what you're running for a backend (mine is only a Zotac MAG), but I'm at the point of a daily reboot. The need *may* be exacerbated by some network latency (one xbmc node is across a 100 ft cable run serviced by a cable/ethernet bridge) - once the CPU usage creeps up a little, I start to see excessive buffering on the remote node. The less remote node (which is harware identical to the other) is less... fragile.

I'm running MythTV on an older system based on an Athlon 64X2 5000 cpu, with 2GB of memory. It's connected to my XBMC frontend across a wired gigabit Ethernet connection.

With the latest versions of the addon, I haven't needed daily reboots, but something is making the mythbackend cpu load incrase slowly.

I'm going to try to avoid rebooting, and see if the load keeps increasing and (if so) how much.


RE: New MythTV add-on using libcmyth - tdavis - 2013-02-20

(2013-02-19, 06:03)sfrooster Wrote:
(2013-02-18, 20:08)cfetzer Wrote: Commercial skip depends on two changes:
- XBMC: https://github.com/xbmc/xbmc/pull/1743
- Addon: https://github.com/opdenkamp/xbmc-pvr-addons/pull/173

This first version will work with recordings that do not have changing refresh rates.
Not sure if this generalization is correct, but so far I haven't seen this in DVB streams,
but it seems to be the case for some (maybe all) ATSC streams.

This is caused by a general difference how mythtv handles timestamps (frame offsets) where xbmc needs time offsets.
Myth TV 0.27 will add a feature that will allow us to convert those values properly.

Ok, good to know. To clarify, ATSC streams (like those I'd tune with an HDHR Prime) will work with this first version, or will not?

On another point - I built the addon last night, and I'm noticing that after sometime I need to bounce myth-backend or else live tv will stutter with buffering. htop on the backend will confirm that the CPU is running under slightly more load than it does right after the bounce (at which point the stuttering also disappears).

To be fair, this issue may have existed in earlier versions.

Are others seeing this? Is there a fix / workaround?

My experience with Comcast & HDR Prime - no go.
OTA/ATSC via a HDHomerun dual - worked great!.

Comcast appears to be re-encoding the streams (of course!) to fit better into the cable system. You can possibly re-encode to get rid of the variable frame rate, but then you would also need to reset the commercial breaks on the re-encoded file.

MythTV 0.26 works fine because they generate some extra frame information into the db that is used for playback (pre-computed skip/frame counts, from the looks of it)


RE: New MythTV add-on using libcmyth - fetzerch - 2013-02-20

(2013-02-19, 15:49)richardk Wrote:
(2013-02-17, 21:49)richardk Wrote:
(2013-02-17, 18:07)cfetzer Wrote: Thanks. I've reverted the buffer change for now.

I built the new version, and I can confirm that it resolves the problem with Live TV. Mythbackend cpu usage is now comparable to that when playing a recording.

My MythTV backend has been up for 5 1/2 days now, and the mythtbacked cpu load when playing a recording is edging back up.

I'm seeing 21% - 23% load when playing a HD recording. I fired up the MythTV frontend, and played the same recording. Using mythfrontend on the same configuration and playing the same recording, the mythbackend cpu load runs 10% - 12% -- about half of that when using XBMC.

So, XBMC always seems to cause the mythbackend to double.

And something is causing the mythbackend load to increase over time for both players. (The increases seem, though, to be less severe and more gradual than with the old version of the plugin that's now in distribution. At this point, it's not enough to cause any buffering or stuttering. So it wouldn't be noticed by anyone not monitoring the cpu load on the backend.)

Is it the images in the cmyth plugin? Or some other aspect of the plugin? Or something inherent in the MythTV backend, and unrelated to XBMC? At this point, I don't know. And since the phenomenon takes days to show up clearly, it's not the easiest thing to test.

Did I get this right?: When using "debug-backend-cpu" it still increases cpu load after a while, but it takes (much?) longer?
Or is it fixed now when you use that branch?

(2013-02-20, 08:07)tdavis Wrote:
(2013-02-19, 06:03)sfrooster Wrote:
(2013-02-18, 20:08)cfetzer Wrote: Commercial skip depends on two changes:
- XBMC: https://github.com/xbmc/xbmc/pull/1743
- Addon: https://github.com/opdenkamp/xbmc-pvr-addons/pull/173

This first version will work with recordings that do not have changing refresh rates.
Not sure if this generalization is correct, but so far I haven't seen this in DVB streams,
but it seems to be the case for some (maybe all) ATSC streams.

This is caused by a general difference how mythtv handles timestamps (frame offsets) where xbmc needs time offsets.
Myth TV 0.27 will add a feature that will allow us to convert those values properly.

Ok, good to know. To clarify, ATSC streams (like those I'd tune with an HDHR Prime) will work with this first version, or will not?

On another point - I built the addon last night, and I'm noticing that after sometime I need to bounce myth-backend or else live tv will stutter with buffering. htop on the backend will confirm that the CPU is running under slightly more load than it does right after the bounce (at which point the stuttering also disappears).

To be fair, this issue may have existed in earlier versions.

Are others seeing this? Is there a fix / workaround?

My experience with Comcast & HDR Prime - no go.
OTA/ATSC via a HDHomerun dual - worked great!.

Comcast appears to be re-encoding the streams (of course!) to fit better into the cable system. You can possibly re-encode to get rid of the variable frame rate, but then you would also need to reset the commercial breaks on the re-encoded file.

MythTV 0.26 works fine because they generate some extra frame information into the db that is used for playback (pre-computed skip/frame counts, from the looks of it)

Thanks for that explanation. I don't know much about the US television system, so I couldn't answer that in detail.
What you mean is that 0.27 will generate this extra information, not 0.26? Or do have some other data in mind?


RE: New MythTV add-on using libcmyth - richardk - 2013-02-20

(2013-02-20, 21:06)cfetzer Wrote: Did I get this right?: When using "debug-backend-cpu" it still increases cpu load after a while, but it takes (much?) longer?
Or is it fixed now when you use that branch?

Ok, let me try to clarify.

Mythbackend cpu load while playing a video is higher (about double) using any version of the XBMC cmyth plugin than using the native MythTV frontend. This true even right after the backend has been rebooted. But then it's 3% - 6% versus 1% - 3%.

The backend has been up for six days now. For part of that time, I was using the "debug-backend-cpu" version. For the last couple of days, I've been running the latest version compiled from "master". CPU load for mythbackend is now staying mostly around 23% - 26%, so it's been increasing slowly. I think most of that increase has been since I switched to the "master" version. So that does seem to indicate that the images are causing the increase, but I can't be 100% sure. Also, the cpu load has (so far) not increased to the point of causing buffering or stuttering, as it was when using the old (1.6.7) version of the plugin. (It would go near 100% then.)

So, we can probably conclude:

1. The XBMC cmyth plugin always causes a higher cpu load than the native MythTV frontend. This isn't a problem as long as it doesn't increase over time.
2. The cpu load is always higher using a version with images than a version without images. Again, not a problem if it stays constant. (Unless, perhaps, you have a really old and slow backend system.)
3. Using the latest "master", which includes images, the cpu load seems to be increasing slowly over time, but not nearly as fast as with the old (1.6.7) version.

We have a lot of variables here -- different versions of the plugin running since the backend was rebooted, possibly different usage patterns (although I've worked it pretty hard), possibly different uptimes since rebooting before the cpu load got completely out of control. (I don't remember how long that took.) So I'd consider these to be preliminary results, and not necessarily definitive.

I was hoping that some other folks who've experienced the slowdowns could also test this, but that doesn't seem to be happening. They may be running OpenELEC exclusively, and it's not easy or quick to build OpenELEC with alternate addon versions.


RE: New MythTV add-on using libcmyth - fetzerch - 2013-02-20

Thanks a lot for that clarification. I had to ask, just to make sure under all circumstances that we won't end up fixing something at the wrong end.
And if you see improvements, we probably have found the wrongly behaving component already.

1-2. It's good to know, that the addon causes in general a bit higher cpu load on the backend. Think might be related to several things and is most likely really difficult to solve. It could be due to different buffer sizes, different usage of the mythtv protocol, timings, ...
I agree, it's an issue, but low prio for now.

3. Ok then janbar's last patch optimized things in our image cacheing component and indeed seems to have an influence on the increased load.

Could you check if you see MythSocket errors in the backend log? If so, it might help if you could enable debug logging in the addon and post logs of both, backend and xbmc, for the timeranges where you see the socket errors.