INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Turning off TV loses audio [bitstream][windows]  (Read 2484 times)

LetsGetSilly

  • Recent member
  • *
  • Posts: 22
Turning off TV loses audio [bitstream][windows]
« on: November 15, 2013, 12:53:48 pm »

Here's the scenario that is bothersome:

1) Pause video in JR 19
2) Turn off TV
3) Turn on TV
4) Sound does not work
5) Restart JR 19
6) Re-find video, and play again

I'm using HDMI connection from PC=>Denon receiver=>TV.
JRiver is using "Remote Audio [WASAPI]" with "Open device for exclusive access".

Obviously there's some kinda of disconnect where JRiver or Windows loses access to the sound provider when turning off the TV, and it needs to be re-established via reopening JRiver. Any suggestions on how to get around this would be very much appreciated!



Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72444
  • Where did I put my teeth?
Re: Turning off TV loses audio [bitstream][windows]
« Reply #1 on: November 15, 2013, 01:08:20 pm »

It's a well known HDMI problem.
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Turning off TV loses audio [bitstream][windows]
« Reply #2 on: November 15, 2013, 01:43:17 pm »

EDID Minder might fix it, if you really care.  Or something like it (there are a variety of these things out there):

http://www.extron.com/company/article.aspx?id=edid101hpr
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

LetsGetSilly

  • Recent member
  • *
  • Posts: 22
Re: Turning off TV loses audio [bitstream][windows]
« Reply #3 on: November 15, 2013, 02:19:04 pm »

What are some work-around ideas?

It'd be great if I could have a script that fired when the display turns back on that would close-and-re-launch media center, bringing me back to where I left off

Unfortunately the MC command line doesn't work very well. The commands that I throw at it often do not respond in predictable, repeatable ways.

This is the best I've come up with in Powershell with the MC command line limitations:

Function IsRunning
{
    return get-process "Media Center 19" -ErrorAction SilentlyContinue
}
 
$mediaCenter = "C:\Windows\System32\MC19.exe"
$mediaCenterWithInput = "C:\Windows\System32\MC19.exe /MCC 23020,1"
$stopMediaCenter = "C:\Windows\System32\MC19.exe /MCC 20007,0"

$isRunning = IsRunning
if(!$isRunning)
{
    Start-Process $mediaCenter
}
else
{
    Stop-Process $isRunning

    if(!$isRunning)
    {
        Start-Process $mediaCenter
    }    
}
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Turning off TV loses audio [bitstream][windows]
« Reply #4 on: November 15, 2013, 02:50:00 pm »

MC's command line options are very robust and reliable.  I'm confused why you are using the MCC commands to launch/quit though...

Did you miss these?
http://wiki.jriver.com/index.php/The_Command_Line
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Turning off TV loses audio [bitstream][windows]
« Reply #5 on: November 15, 2013, 02:58:42 pm »

$mediaCenterWithInput = "C:\Windows\System32\MC19.exe /MCC 23020,1"

This command causes MC to trigger an Auto-Import run in silent mode, which doesn't make a bunch of sense.  Note that most of the MCC commands require MC to be running or they are ignored.

$stopMediaCenter = "C:\Windows\System32\MC19.exe /MCC 20007,0"

This one will exit MC normally, and should work fine, but there's no reason to use it if you don't want to kill out of the Library Server too, as mc19.exe /Close will do the same thing (and is easier to read in your script later when you forget what it is doing).  mc19.exe /Start does the opposite.

Note that MC19.exe is NOT the executable for the application.  This is just a command line helper "launcher" (that effectively just sends COM commands to the Media Center process).  It does not keep running.  The application process is "Media Center 19.exe".  Checking and killing MC19.exe won't work and won't do anything useful.  Also, you must sleep a script for a little bit to give MC time to shut down (or start up) when you are closing and reopening and checking.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

LetsGetSilly

  • Recent member
  • *
  • Posts: 22
Re: Turning off TV loses audio [bitstream][windows]
« Reply #6 on: November 15, 2013, 03:21:38 pm »

Oh my god...this is so helpful!!!

Thank you! I've been pulling my hair out trying to script this sunofagun!

Here's my updated script, and it sounds like I need to refactor the start process to use Media Center 19.exe
Code: [Select]
$mediaCenter = "C:\Windows\System32\MC19.exe"
$launchMediaCenterWithLibraryUpdate = "C:\Windows\System32\MC19.exe /MCC 23020,1"
$stopMediaCenter = "C:\Windows\System32\MC19.exe /MCC 20007,1"
$startMediaCenterNowPlaying = "C:\Windows\System32\MC19.exe /MCC 22009,5"
$togleViewModeToLastShutdown = "C:\Windows\System32\MC19.exe /MCC 22009,-4"
$toggleViewModeToCurrent = "C:\Windows\System32\MC19.exe /MCC 22009,-3"


Function IsRunning
{
    $process = GetMediaCenterProcess
    return $process -ne $null
}

Function GetMediaCenterProcess
{
    return get-process "Media Center 19" -ErrorAction SilentlyContinue
}

Function ShutDownMediaCenter
{
    $i = 0
    do
    {
        $stopMediaCenter
        $i++
        #try to shut it down 20 times proper first
        if($i -ige 20)
        {
            if(IsRunning)
            {
                Stop-Process (GetMediaCenterProcess)
            }
        }
    } while (IsRunning)

}


if(!(IsRunning))
{
    Start-Process $mediaCenter
}
else
{
    ShutDownMediaCenter 
    do{
        Start-Process $mediaCenter
      }
    while (!(IsRunning))
}


if(IsRunning)
{
    $toggleViewModeToCurrent
}

Logged

LetsGetSilly

  • Recent member
  • *
  • Posts: 22
Re: Turning off TV loses audio [bitstream][windows]
« Reply #7 on: November 15, 2013, 03:33:33 pm »

Any chance you can give me the magic command line recipe to accomplish this sequence in my script:

1) Launch Media Center 19
2) Toggle view to full-screen (Theater Mode)
3) Load up last video (or wherever it was left off)

My goal is to be able to turn on my TV, run this script, and have Media Center restart and bring me back exactly to the place I stopped watching. Thus solving the bitstreaming hdmi issue with a keystroke.

I have no idea what "mode" this is, but it's as close as I can currently get using the following command:

MC19.exe /Mode FullScreen

http://imgur.com/ncfCnAf

If I run MC19 /Mode FullScreen again, it goes "fullscreen"   :-[
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Turning off TV loses audio [bitstream][windows]
« Reply #8 on: November 15, 2013, 04:45:35 pm »

MC19.exe /Mode FullScreen

http://imgur.com/ncfCnAf

If I run MC19 /Mode FullScreen again, it goes "fullscreen"   :-[

You can't switch to Fullscreen mode when nothing is playing.  You don't need step 2, in other words, because when you play a video (assuming you have  Options > General > Jump On Play (video) set to Display View, as it is by default) it will do that all by itself.

However, I need to know a bit more about how you want it to work, and maybe some of your settings.

First off, MC has three distinct "modes":

1. Standard - this is the regular "windows" UI with the close button in the upper right and the panes and the tree and all of that).
2. Theater View - this is the 10-foot library navigation UI.  In your screenshot above, you are in the Playing Now part of Theater View.
3. Display View - this is fullscreen playback mode.  It is only available while something is playing.

When you launch MC via this script, and then you later hit Stop, do you want MC to go back to Theater View or to Standard View (because it will go, by default, back to wherever it was when the video started playing)?

When you answer that question, the script will probably be something like this (this is a VBScript version in a Windows Scripting Host wrapper, but you can convert it to PowerShell or regular VBS or whatever you want):

Code: [Select]
<package>
   <job id="vbs">
      <script language="VBScript">
         'Create our handy dandy Shell object
set WshShell = WScript.CreateObject("WScript.Shell")

'Launch MC in Theater View Mode
WshShell.Run "mc19.exe /Mode Theater"

                'Launch MC in Standard View Mode instead if you want that when you exit
'WshShell.Run "mc19.exe /Mode Standard"

                'Give it a few ms..
WScript.Sleep 500

                'Play the current Playing Now list
                WshShell.Run "mc19.exe /Play TREEPATH=Playing Now"

'Make sure MC is on Top
WshShell.Run "mc19.exe /Start"

      </script>
   </job>
</package>

Calling /Start at the end of your script is handy if you have trouble with MC not ending up on top when your script executes (Windows 8 seems to do this when you run vbscript, at least, it returns focus to whatever application had focus before by default, or something).

Note: I didn't have to explicitly launch MC because /Mode launches MC if it isn't running already, as is noted in the Wiki entry for that command.  Many of them don't (hardly any of the MCC's, but /Mode does).
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Turning off TV loses audio [bitstream][windows]
« Reply #9 on: November 15, 2013, 04:58:04 pm »

If instead, you want to have MC just go back (when Playback stops) to the mode set by default in Options > Startup > Startup Interface > Mode, then you don't need to be so fancy at all, you can just call this by itself:
mc19.exe /Play TREEPATH=Playing Now

No fancy script required!  The /Play command also launches MC if it isn't already running.  If you find you have keyboard focus issues, then do a little script and add the /Start command after, which brings it forward.

And, lastly, if you DON'T keep Options > General > Jump On Play (video) set to Display View because you don't like it that way for some reason (and yet in this case do want it to go fullscreen) then you could just add the mc19.exe /Mode Fullscreen after you start playback, and it'll work fine.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

LetsGetSilly

  • Recent member
  • *
  • Posts: 22
Re: Turning off TV loses audio [bitstream][windows]
« Reply #10 on: November 15, 2013, 05:38:11 pm »

First of all, thanks so much for helping me get through this. I'm getting really close.

To answer your questions about my objectives with this script, I use JRiver exclusively at this point for TV and Movies. The end goal of this script is so that my mother can hit the F8 key and the following logic applies:

IF: There is a previous video state stored, load it up full screen and paused. In other words, does JRiver know where I left off - was I in the middle of an episode of Breaking Bad? If so, I want to be loaded back to the point in which I stopped, in full screen mode, ready to hit space-bar in order to begin playing.

ELSE: Load the default view (theater mode. Preferably inside the "video" menu, but we'll save that for another day)

From you're telling me the definition of "Display View" is when my video is full-screen without any JRiver UI elements visible. That's exactly what I want.

I did check my "Jump To" setting, and it was set to "Theater View". I incorrectly assumed that "Theater View" and "Display View" were effectively the same thing in my mind, because in no scenario do I ever want to interract with anything but that "10ft view" as you put it so nicely.

I implemented your suggestions and got good results. I can now just launch very simply with the following:

Code: [Select]
.\MC19.exe /Play TREEPATH=Playing Now
Start-Sleep -s 2
.\MC19.exe /Pause

This gets me almost exactly where I want to be.

My last (and critical) objective is to load that "playing now" video file at the time in which I stopped it. Before I assumed that because I was using Powershell's "Stop-Process" function I wasn't going to get the benefit of the pick-up-where-you-left-off. But now I'm successfully closing the app via the command line.

So, my next question is how to I get my show to start where I left off? I'm not convinced this issue has anything to do with my script, but maybe it's an issue with my general settings in JRiver, as I've noticed this feature has somewhat disappeared as of late, I was just blaming my script.

In case you're curious, here's my powershell script as it now stands. I've got a few more ideas, but here it is now:

Code: [Select]
New-PSDrive -Name mc -PSProvider FileSystem -Root C:\Windows\System32\ -ErrorAction SilentlyContinue
Set-Location mc:

Function IsRunning
{
    $process = GetMediaCenterProcess
    return $process -ne $null
}

Function GetMediaCenterProcess
{
    return get-process "Media Center 19" -ErrorAction SilentlyContinue
}

Function ShutDownMediaCenter
{
    .\MC19.exe /Close
    if(IsRunning)
    {
       $i = 1
       do {
           Write-Host Sleeping inside of shutdown routine
           Start-Sleep -s 1   
           $i++
           }
       while ((IsRunning) -and ($i -le 10))
    }
    if(IsRunning)
    {
        Write-Host "Forcibly ending process"
        Stop-Process (GetMediaCenterProcess) -Force -ErrorAction SilentlyContinue
    }

}

Function ToggleViewMode #this function is no longer necessary
{
    if(IsRunning)
    {
        Write-Host "App is running"
        Start-Sleep -s 8
        #.\MC19.exe /Mode FullScreen
        #Start-Sleep -s 8 
        #.\MC19.exe /Play
        #Start-Sleep -s 8
        #.\MC19.exe /Mode FullScreen
        #Start-Sleep -s 8
        #.\MC19.exe /Pause
    }

}


if(IsRunning)
{
    ShutDownMediaCenter 
}


.\MC19.exe /Play TREEPATH=Playing Now
Start-Sleep -s 2
.\MC19.exe /Pause

 
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Turning off TV loses audio [bitstream][windows]
« Reply #11 on: November 15, 2013, 09:02:12 pm »

So, my next question is how to I get my show to start where I left off? I'm not convinced this issue has anything to do with my script, but maybe it's an issue with my general settings in JRiver, as I've noticed this feature has somewhat disappeared as of late, I was just blaming my script.

This is unlikely to be due to your scripting, but there is something to check.

First, the deal with resuming...  In MC, this feature is called "Bookmarking".  Here's the main thread where the rules were determined, but they are designed to be automatic in most circumstances.  The rules are that when playback of any file starts:

* If Options > General > Behavior > Resume playback using bookmarks is set to Automatic (the default), and...
* If the file in question has the [Use Bookmarking] field (tag) set to Default (as opposed to explicitly set to Yes or No), and...
* The [Media Type] of the file is Video -or- the [Media Type] is Audio and the [Media Sub Type] is Podcast or Audiobook, and...
* If the [Media Type] is Video, the duration exceeds 15 minutes (so it excludes short videos such as Music Videos and other small clips)...

Then MC uses the stored [Bookmark] value to resume play from where it was last left off.  When you stop playback of a file, MC saves the bookmark, which is basically just a count of the number of milliseconds from the beginning of the file, to the Library:

* If playback ended within 96% of the end of the file, then the bookmark is cleared.
* If the playback position was less than 60 seconds into the file, then the bookmark is cleared (unless it was a DVD which are always saved, I guess)
* Otherwise, the current position is stored in the database record for the file.

So, the idea is that TV Shows, Movies, Audiobook files, and Podcasts will all auto-resume from where you left off.  But short clips like music videos, and long songs like Alice's Restaurant and Echoes will not.  When playback stops, it guesses that 96% played (they may have tweaked that percentage later, so don't quote me on it being that exactly) is pretty much "fully played" (leaving only the credits in many cases) so it clears the bookmark.  Likewise, if you stop very close to the beginning of a file, that's close enough to the beginning to clear the bookmark.

However... You can modify this behavior on both a global and granular (per-file) scale.

If you change Options > General > Behavior > Resume playback using bookmarks it can disable resuming globally, or you can set it to ask each time.

If you change the [Use Bookmarking] tag for a particular file or set of files (perhaps automatically at import time), then you can force files that otherwise wouldn't "trigger" the automatic rules above to either use or ignore bookmarking.

So, it is possible that you have disabled it globally.  Maybe you got Ask turned on somehow, and then said No one time and checked the "Don't bug me again" box?  Either way, it might be turned off.

It could also be that the files aren't (somehow) properly tagged as Video, though this is unlikely.  It is also possible that in a whiskey-and-cold-medicine-fueled haze of some kind you selected the files and manually tagged [Use Bookmarking] to No.  I can't say how likely this is (it would depend, I suppose, on the whiskey).

Lastly, for the [Bookmark] tag to get written to the database when playback stops, the copy of MC that was playing the file must have Read/Write access to the database.  This should not be an issue if you are using MC standalone, or from the machine running as the Library Server.  However, if MC is being used in a Client/Server setup and the client is operating in some kind of "read-only mode" for some reason (perhaps you don't have a Username/Password set in Options > Media Network, for example) then the client copy of MC can't write the [Bookmark] tag when playback ends.  So the next time it can't resume where it left off and the Bookmarks never get writeen.

If it is none of the above, then it could be that when you stop playback by closing MC rather than hitting Stop (programatically) that the Bookmark isn't being properly set.  I don't think it works this way, because I often use the X (close) button on my remote to stop playback in MC, and it would have ticked me off.  I would check everything else first.  Still, perhaps something is special about the way in which you are stopping playback (and perhaps something is just broken and buggy in certain circumstances).

But, the auto-resume feature certainly works, I use it regularly, and left to the defaults it works basically perfectly well for almost every case I can imagine (and it is easy enough to override any offenders as needed).

EDIT: Tweaked the above explanation to more clearly explain when bookmarks are saved to the files.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Turning off TV loses audio [bitstream][windows]
« Reply #12 on: November 15, 2013, 09:12:55 pm »

When you close MC, are you killing the process or calling a mc19.exe command?

If you are killing the process, then I'd guess bookmarks also wouldn't get written (and you'll get periodic "it ceased last time" dialogs on startup)... So, don't do that.  MC should not get "stuck" often.  If it does, them something is wrong and report it (usually AV software being idiotic).
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/
Pages: [1]   Go Up