Copy Prohibited message kills video

Help with tuners from ATI, Hauppauge, AverMedia and more.
Space

Posts: 2839
Joined: Sun Jun 02, 2013 9:44 pm
Location:

HTPC Specs: Show details

#21

Post by Space » Wed Feb 26, 2014 10:54 pm

@UCBearcat Hi, I am the OP for that post over on the SD forum.

Thanks for the testing you did on this. I think you are right about the 47 hour timer being reset by putting the PC in and out of standby. I normally have my PC in standby most of the time, but for the past two weeks it was on 24/7 recording and watching the Olympics.

So this perfectly explains why I had the problem several times in the last two weeks, but never had it before.

Thanks again!

KevinC25

Posts: 32
Joined: Tue Jul 30, 2013 9:47 pm
Location:

HTPC Specs: Show details

#22

Post by KevinC25 » Wed Feb 26, 2014 11:06 pm

@UCBearcat, @barnabas1969: Thanks to you both for the quick responses! I've been on Prime firmware 20140121 pretty much since it came out - I was hoping that might be my answer so for once I upgraded quickly - but unfortunately it made no difference to my problem. I've left the machine on 24x7 since it became the house hub because I use Ceton MMC and also for extenders, so I guess I've always had the problem.

It sounds like the batch file soft reboot is the way for me to go, so seeing that file would be great. One question, you say it reboots only after checking that "an extender is not in use". By "in use" do you mean the extender is actually in the middle of streaming content or merely that the extender is switched on? I have three Linksys DMA2100s around the house and while they shouldn't be in proper use in the middle of the night, they might sometimes be accidentally switched on at the Media Center home page if you follow me - would just be nice to understand. Thanks!

User avatar
UCBearcat

Posts: 249
Joined: Sat Jan 28, 2012 12:08 am
Location: Cincinnati

HTPC Specs: Show details

#23

Post by UCBearcat » Wed Feb 26, 2014 11:07 pm

Hey Space... no problem. I'm glad this thread has helped someone else from ripping their hair out testing everything under the sun. For the first 6 months that I had my WMC PC set up, I would sleep it daily... so the issue wasn't apparent. It wasn't until I installed the Ceton app and kept it on 24x7 did I notice the issue.
Rebooting either the PC or the Prime seems to reset the timer. I was tempted to have my script reboot the prime, but then I would lose all of the web-based logs in the Prime... so I decided to reboot the PC instead.

Here is the script that I threw together. I'm sure one of the others on here could "pretty it up." I'm no coder, so this was my quick n dirty attempt at a workaround. It's worked pretty well for us.

Code: Select all

@echo off

tasklist | findstr "ehrec.exe"
if %ERRORLEVEL% EQU 1 GOTO EXT_CHECK
EXIT

:EXT_CHECK
tasklist | findstr "ehexthost.exe"
if %ERRORLEVEL% EQU 1 GOTO REBOOTPRIME
EXIT

:REBOOTPRIME
shutdown /r
EXIT

User avatar
UCBearcat

Posts: 249
Joined: Sat Jan 28, 2012 12:08 am
Location: Cincinnati

HTPC Specs: Show details

#24

Post by UCBearcat » Wed Feb 26, 2014 11:11 pm

It checks for the running process that is tied to the extender. So, even if the extender is sitting idle at the main menu, it won't reboot. You could probably omit this line...

Edit: I used :REBOOTPRIME in the code, because I initially was going to run the prime reboot command, but decided to reboot the PC instead.
You could replace shutdown /r and throw in the reboot command.... For your reference it looks something like the following:

"C:\Program Files\Silicondust\HDHomeRun\hdhomerun_config.exe" {substitute your prime id here} set /sys/restart self

Space

Posts: 2839
Joined: Sun Jun 02, 2013 9:44 pm
Location:

HTPC Specs: Show details

#25

Post by Space » Wed Feb 26, 2014 11:28 pm

You may want to use this command in there somewhere:

powercfg -requests

It will list all the objects that are telling the computer not to go to sleep. There will be an entry in there if WMC is about to start a recording (and while it is recording) and also I think when an extender is in use, there will also be an entry there when you are viewing a video locally.

User avatar
UCBearcat

Posts: 249
Joined: Sat Jan 28, 2012 12:08 am
Location: Cincinnati

HTPC Specs: Show details

#26

Post by UCBearcat » Wed Feb 26, 2014 11:51 pm

Good info on the powercfg command. I'd be interested to see how that could be incorporated into the script. i.e. if NULL then reboot (something like that)

There is definitely room for improvement depending on your own setup. Fortunately, we're rarely watching or recording anything at 5am, so I just scheduled it to fire at a time when there shouldn't be anything else going on. It won't work for everyone, but hopefully it will be a good starting point for Kevin.

Space

Posts: 2839
Joined: Sun Jun 02, 2013 9:44 pm
Location:

HTPC Specs: Show details

#27

Post by Space » Thu Feb 27, 2014 12:01 am

Here is a Microsoft doc showing the output when WMC is both recording and playing back a show:

http://webcache.googleusercontent.com/s ... =firefox-a (It's a google cache copy of a word doc, not sure if the link will work).

I think you could just use a single check:

powercfg -requests | findstr "\"

instead of the two checks that are currently in the script, since both the recording and playback entries in there have a backslash.

I don't have an extender, so I'm not sure how it's use presents itself in the output of that command, but you can just start playback on the extender and then run that command on the WMC PC to see what shows up.

KevinC25

Posts: 32
Joined: Tue Jul 30, 2013 9:47 pm
Location:

HTPC Specs: Show details

#28

Post by KevinC25 » Fri Feb 28, 2014 12:48 am

As I've posted on Silicondust I have now concluded that my problems are indeed due to the "47 hour DRM bug".

I am thinking it may be best for my needs to have a batch file reboot the Primes every 12 hours at say 110am and 110pm every day provided the primes are not in use for either live tv or recording. In terms of a test for "tuner in use" in a batch file that reboots the Primes, ideally I'd want to test for BOTH recording AND watching live tv, but not for playing back recorded tv. Testing for ehrec.exe works for recording but having experimented a bit in powercfg -requests and also in task manager I'm not seeing a process/service that is specifically for live tv watching: ehshell.exe seems to trigger for either playback or for live tv (on tv or extender). Am I missing something?

User avatar
UCBearcat

Posts: 249
Joined: Sat Jan 28, 2012 12:08 am
Location: Cincinnati

HTPC Specs: Show details

#29

Post by UCBearcat » Fri Feb 28, 2014 2:33 am

I'm pretty certain the ehrec.exe is the process that indicates a tuner is in use - live or recording. It's been awhile since I did the testing on this, but I believe that if you watch your task manager, you will see ehrec.exe appear when LiveTV is fired up.
The wife is watching a recorded show right now, and there is another show recording currently... otherwise I would test it out. And we all know that you don't mess with the WAF. ;)

Edit: Okay, she finished her show. And I was wrong. Ehrec.exe is only for recording - not live TV. I run a headless WMC workstation - i.e. all TV watching is done through my extenders, and nothing is done on the local monitor. So, in the case of the script that I use, I'm either recording something (ehrec.exe) or I have an extender session open (ehexthost.exe). If either is true - no reboot.

Since you'll be rebooting the Prime and not the PC (or any of the services), you might be able to query the tuners status using the hdhomerun_config.exe command line. I had found a list of commands on the SD sight a while back. I'll see if I can find that again.

Space

Posts: 2839
Joined: Sun Jun 02, 2013 9:44 pm
Location:

HTPC Specs: Show details

#30

Post by Space » Fri Feb 28, 2014 2:56 am

For that it may be better to check the Prime itself, rather than WMC, although checking if WMC is getting ready to start recording may also be a good idea (as it may try to tune the Prime right after you initiate a reboot).

I don't know much about this, but I did find that you can get the status of each tuner with this command:

hdhomerun_config <prime_IP> get /tuner0/status

Where "tuner0" is for the first tuner (use "tuner1" and "tuner2" to get the status of the other two).

Pipe to "findstr" to look for output that may indicate the tuner is in use (perhaps findstr "qam").

I don't have a mouse or keyboard on my HTPC, so it's difficult to test stuff like this to see if it works.

EDIT: Posted this before seeing your response, UCBearcat, but looks like we had the same idea...

User avatar
UCBearcat

Posts: 249
Joined: Sat Jan 28, 2012 12:08 am
Location: Cincinnati

HTPC Specs: Show details

#31

Post by UCBearcat » Fri Feb 28, 2014 3:04 am

Here's a link to the dev guide:
http://www.silicondust.com/hdhomerun/hd ... opment.pdf

And here is a sample command that might help you query tuners.
c:\Program Files\Silicondust\HDHomeRun>hdhomerun_config.exe <primeID> get /tuner0/status

If you put in FFFFFFFF as the prime ID, it will query all devices on the LAN, which would work well in your case as you have more than one device. It's a starting point, but I would imagine the SD support guys might be able to help you better than I can.


Edit: Haha... it's like one mind. We're posting on top of each other.

Space

Posts: 2839
Joined: Sun Jun 02, 2013 9:44 pm
Location:

HTPC Specs: Show details

#32

Post by Space » Fri Feb 28, 2014 3:14 am

Yeah, but be careful with using FFFFFFFF, I don't think it queries all the devices, I believe it only returns the info for the first device that responds, so it is better to address each one separately. The doc I saw indicated you can use the IP address instead of the ID, so either one should work.

Also, this doc has info on how to reboot the Prime, in case you need that:

http://www.silicondust.com/forum2/viewtopic.php?t=12216

User avatar
UCBearcat

Posts: 249
Joined: Sat Jan 28, 2012 12:08 am
Location: Cincinnati

HTPC Specs: Show details

#33

Post by UCBearcat » Fri Feb 28, 2014 3:23 am

Good call. Probably best to do them one at a time.

I ran the tuner query, and the output looks like this:

Code: Select all

c:\Program Files\Silicondust\HDHomeRun>hdhomerun_config.exe <PrimeID> get /tuner0/status
ch=none lock=none ss=0 snq=0 seq=0 bps=0 pps=0
Obviously, the tuner is idle at the moment.

And completely off topic - Do you guys ever notice that your Prime always uses tuner for certain functions? In my case, it always uses Tuner2 for LiveTV. And it always uses Tuner0 first for a scheduled recording. This isn't a big deal or a problem - it's just something I've noticed with mine.

Space

Posts: 2839
Joined: Sun Jun 02, 2013 9:44 pm
Location:

HTPC Specs: Show details

#34

Post by Space » Fri Feb 28, 2014 3:29 am

Each channel has it's own tuner priority list, it defaults to Tuner0, Tuner1, Tuner3, etc.

You can change this in Tasks -> Settings -> TV -> Guide -> Edit Channels

Select a channel and then select "Edit Sources". Use the up/down arrows to reorder the priority of the tuners used.

I don't think this priority is used for live TV however, not sure how that it chosen.

barnabas1969

Posts: 5738
Joined: Tue Jun 21, 2011 7:23 pm
Location: Titusville, Florida, USA

HTPC Specs: Show details

#35

Post by barnabas1969 » Fri Feb 28, 2014 2:56 pm

ehexthost.exe (and ehexthost32.exe on 64 bit systems) is the Extensibility Host. It runs anytime you have an add-in loaded in Media Center. It does not indicate that an extender is connected, only that an add-in is running inside the Media Center shell. The shell (ehshell.exe) is only loaded when the Media Center GUI is running, which includes extenders.

I like the idea of using powercfg, but on my old system, it would crash sometimes. I used it to check to see what woke the computer each time it woke... and sometimes powercfg.exe would just hang with a message that required someone to click OK.

That was on my old HTPC, so I'll try it out on my new one to see if it works OK.

I was planning to write a script or program that checks the next scheduled recording, makes sure that nobody is watching live/recorded TV, and then reboots the PC. If these conditions are not met, it will wait for a configurable period of time and keep checking. That way, if someone is up late at night watching TV... and then goes to bed... it will reboot after they stop watching.

I'll look into the powercfg option. I never thought of the fact that Windows keeps the system awake for 5 minutes prior to a scheduled recording. That would work great... as long as powercfg doesn't hang like it did on my old system.

I'll post back.

barnabas1969

Posts: 5738
Joined: Tue Jun 21, 2011 7:23 pm
Location: Titusville, Florida, USA

HTPC Specs: Show details

#36

Post by barnabas1969 » Fri Feb 28, 2014 3:00 pm

Space wrote:Each channel has it's own tuner priority list, it defaults to Tuner0, Tuner1, Tuner3, etc.

You can change this in Tasks -> Settings -> TV -> Guide -> Edit Channels

Select a channel and then select "Edit Sources". Use the up/down arrows to reorder the priority of the tuners used.

I don't think this priority is used for live TV however, not sure how that it chosen.
Actually, it's a little deeper than that. There is a registry setting that also controls tuner priority. And, it will, in fact use tuners for recording in a reverse order than it uses tuners for live TV. I don't recommend changing that registry key.

KevinC25

Posts: 32
Joined: Tue Jul 30, 2013 9:47 pm
Location:

HTPC Specs: Show details

#37

Post by KevinC25 » Fri Feb 28, 2014 3:15 pm

I like the idea of a script that checks then waits a period of time and keeps trying. I'd be on for that.
Space wrote:Each channel has it's own tuner priority list, it defaults to Tuner0, Tuner1, Tuner3, etc.

You can change this in Tasks -> Settings -> TV -> Guide -> Edit Channels

Select a channel and then select "Edit Sources". Use the up/down arrows to reorder the priority of the tuners used.

I don't think this priority is used for live TV however, not sure how that it chosen.
As I have two primes I can confirm that WMC's setup produces its priority order shown in Edit Sources but uses that for recording and seems to use the complete opposite order for live TV. That means if you have one channel recording it will be on Prime A say but flick another channel on live tv that will automatically be on Prime B say (unless of course you've re-ordered the sources) which makes some sense. HoweverI used to have a dual run non-prime tuner as second tuner for my few clearqam network channels before I switched to a second prime and that automatically goes to the top of the priority list for recording on those channels and also seems to have top priority for live tv (as you would hope) if I remember right.

barnabas1969

Posts: 5738
Joined: Tue Jun 21, 2011 7:23 pm
Location: Titusville, Florida, USA

HTPC Specs: Show details

#38

Post by barnabas1969 » Fri Feb 28, 2014 3:35 pm

Yes, the reversed order is per physical tuner like Kevin said above.

OK, so I did a quick test using powercfg to detect the states. Here's what powercfg.exe outputs:

When playing live or recorded TV directly on PC:

Code: Select all

[PROCESS] \Device\HarddiskVolume4\Windows\ehome\ehshell.exe
When extender is connected, but not playing anything:

Code: Select all

[SERVICE] \Device\HarddiskVolume4\Windows\System32\svchost.exe (CryptSvc)
[PROCESS] \Device\HarddiskVolume4\Windows\ehome\McrMgr.exe
A Media Center Extender is currently connected to this PC.
When extender is playing live or recorded TV:

Code: Select all

[SERVICE] \Device\HarddiskVolume4\Windows\System32\svchost.exe (CryptSvc)
[PROCESS] \Device\HarddiskVolume4\Windows\ehome\McrMgr.exe
A Media Center Extender is currently connected to this PC.
[PROCESS] \Device\HarddiskVolume4\Windows\ehome\ehshell.exe
Note the difference above is that ehshell.exe is telling the PC to stay awake, just like when something is playing directly on the PC.

When recording is in progress:

Code: Select all

[PROCESS] \Device\HarddiskVolume4\Windows\ehome\ehrec.exe
When a recording is scheduled to start in the next 5-10 minutes:

Code: Select all

[PROCESS] \Device\HarddiskVolume4\Windows\ehome\ehrec.exe
When I scheduled something to start recording less than 10 minutes from now (but more than 5), ehrec.exe requested the PC to stay awake immediately. When I scheduled something to start recording more than 10 minutes from now, it waited until 5 minutes prior to the scheduled start time to request the PC to stay awake.

Keep in mind that if you have pre-padding on your recordings, this will be 5-10 minutes prior to the beginning of the recording, not the beginning of the show. So, if your show starts at 6pm, but the recording is scheduled to start at 5:59pm, then the request will be made between 5:49-5:54pm.

KevinC25

Posts: 32
Joined: Tue Jul 30, 2013 9:47 pm
Location:

HTPC Specs: Show details

#39

Post by KevinC25 » Fri Feb 28, 2014 4:01 pm

Hi Barnabas, I just ran the same tests and get the same results which is a relief!

In response to my question about whether there was a definitive way to test whether any tuner was in use Jasonl at Silicondust said the following:

"ehshell is the WMC UI itself, so that will be running any time WMC is open, regardless of whether or not it is playing. If what you're using can parse the output of a command line program, you could check to see if the tuners are locked.

"%programfiles%\silicondust\hdhomerun\hdhomerun_config.exe" deviceid get /tuner0/lockkey
"%programfiles%\silicondust\hdhomerun\hdhomerun_config.exe" deviceid get /tuner1/lockkey
"%programfiles%\silicondust\hdhomerun\hdhomerun_config.exe" deviceid get /tuner2/lockkey

It will report the IP address if the tuner is locked, or "none" if it isn't."

Perhaps a way to go is to check for tuner lock, then if there is none testing for upcoming recordings using ehrec.exe ?

barnabas1969

Posts: 5738
Joined: Tue Jun 21, 2011 7:23 pm
Location: Titusville, Florida, USA

HTPC Specs: Show details

#40

Post by barnabas1969 » Fri Feb 28, 2014 4:06 pm

KevinC25 wrote:Hi Barnabas, I just ran the same tests and get the same results which is a relief!

In response to my question about whether there was a definitive way to test whether any tuner was in use Jasonl at Silicondust said the following:

"ehshell is the WMC UI itself, so that will be running any time WMC is open, regardless of whether or not it is playing. If what you're using can parse the output of a command line program, you could check to see if the tuners are locked.

"%programfiles%\silicondust\hdhomerun\hdhomerun_config.exe" deviceid get /tuner0/lockkey
"%programfiles%\silicondust\hdhomerun\hdhomerun_config.exe" deviceid get /tuner1/lockkey
"%programfiles%\silicondust\hdhomerun\hdhomerun_config.exe" deviceid get /tuner2/lockkey

It will report the IP address if the tuner is locked, or "none" if it isn't."

Perhaps a way to go is to check for tuner lock, then if there is none testing for upcoming recordings using ehrec.exe ?
Jason is correct. ehshell.exe will be running even if it isn't playing. However, we aren't testing to see if it's running... we're testing to see if it is requesting the PC to stay awake. It only does this when there's active media playback.

See my next post.

Post Reply