Using MPC-HC (1 Viewer)

emueyes

Portal Member
January 16, 2012
15
3
61
Home Country
I can't seem to get MPC working as an external player. I put (paste) its location in the external player dialog box, and use %filename% /fullscreen /play /close as the parameters, but get errors from MP saying that a codec for AVC, or XVID is missing, without any sign of MPC-HC being started.

I'm able to use MPC-HC to play the files iself, so it's not a codec issue, it's just not getting run.

Rob
 

irishrally

Portal Member
July 4, 2012
6
0
Home Country
United States of America United States of America
Did you ever find a solution? I have the proper file path and used the same parameters as you, and tried with no parameters, and MP never opens MPC-HC when I select a "video" movie, just uses the internal player instead. I'm assuming none of the internal audio/video decoding settings matter when "external player" is selected. Everything working fine with MPC-HC standalone(madvr/lav), ATI card. Mostly playing .mkv, but I don't think that should matter as the external player should open for all "video".

If anyone else has any ideas I'd appreciate it.
 

emueyes

Portal Member
January 16, 2012
15
3
61
Home Country
I did work it out, but also made things a lot more flexible - and, maybe, more complicated - with some scripting using AutoHotKey. I really can't remember what the fix for using the external player dialog box was, I think it was a variation of using quote marks to get everything parsed correctly. I am sure, though, that what I'm doing now works well. Firstly, install AutoHotKey, if you want to use the technique I made up. Then make a script that is called from MP as the player name in the MP external player dialog box, with the single parameter %filename%

I have a situation of having some high quality video, and also some rather poor quality stuff, and wanted to use different players for each type for correct processing. Using this script allows for any number of players or other actions to be taken.

Here is a slightly modified version of what I use:

Code:
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
DetectHiddenWindows, On
DetectHiddenText, on
;#Include MouseAway.ahk
 
 
var=%1%
if (var="")
{
msgbox, 8208,start-video,No file specified
Exit
}
 
sysget, N, monitorcount
 
if (N<2)
{
    msgbox,8208,, Turn the TV on!!
    Exit
}
 
FileGetAttrib, Atttributes, %var%
 
IfInString, Attributes, D ; var is a (presumably DVD) directory
    type="dir"
else
    SplitPath, var,,,type
 
;msgbox %var%
;msgbox %type%
 
if type in dir,avi,ifo,vob
{
    MoveMouseAway()
    ;msgbox using potplayer
    run "D:\Program Files (x86)\Daum\PotPlayer\PotPlayerMini.exe" "%var%"
    return
}
 
 
if type in mkv,m2ts,ts,mp4
{
    MoveMouseAway()
    ;msgbox using mpc-hc
    run "D:\Program Files (x86)\MPC-HomeCinema.1.5.2.3456.x86\mpc-hc.exe" "%var%" /play /close /fullscreen /monitor 2
return
}
 
 
 
MoveMouseAway()
{
    CoordMode, mouse, screen;
    mousemove, 1920,600
}
return

Basically the script looks at the type of the file that's passed to it by looking at the filename extension, and then chooses a player based on that file type.

The locations of the players will need changing, of course - note the quotes around the %var% for calling MPC-HC

Code:
run "D:\Program Files (x86)\MPC-HomeCinema.1.5.2.3456.x86\mpc-hc.exe" "%var%" /play /close /fullscreen  /monitor 2

It's also set up to use a TV as the second monitor; that's easily fixed if there's only the one display.


So, if you save the entire code block, fix the player locations and save it as an ahk file - AutoHotKeys file type, it can be called from MP. AutoHotKey also has a compiler, to turn the script into an exe.

I know all that's a lot more than you asked for, hopefully some parts of it will be of help. Post back here if you need a hand.
 

irishrally

Portal Member
July 4, 2012
6
0
Home Country
United States of America United States of America
Hi, thanks for your detailed response. Before you responded I uninstalled MP, reinstalled, and the external player opened properly. At the moment I'm only playing movie files that I want to use with MPC-HC. When my collection builds with different files types I'll definitely try your code.

Also, thanks for the heads up about Autohotkey. I downloaded it to check it out and decided I could use it as a way to create a keyboard shortcut to launch MP. I'm using a Harmony remote with an HP IR receiver and have it set up as a MCE Keyboard. I can't map a command like ctrl-alt-M for instance because I can't get my remote to learn that command without an IR keyboard. So, I decided to use autohotkey to map "!" to open MP. I set up an additional button on the Harmony remote that says "Launch MP" and it just outputs a "!" keypress. The script works as intended. The problem I'm having now is getting the script to run when Windows starts so I can launch MP with my remote after a reboot without manually running the script first. I put a shortcut to the .ahk script in the start menu folder (right clicked on "all programs" and clicked "open all users". The script does not run when windows starts. I used the default template and just added:

!::Run C:\Program Files (x86)\Team MediaPortal\MediaPortal.exe

Do I need to add a delay command to get it to run during startup?

Sorry about getting off-topic a bit here.
 
Last edited:

emueyes

Portal Member
January 16, 2012
15
3
61
Home Country
Glad to see you got it working, I reckon AHK is great for remote controls. I've found uses for it like toggling an on screen clock on/off - TopMostClock and VectorClock are good for that - or using the remote to start a slideshow before or after a movie, with an audio playlist at the same time.

Autohotkey runs a script when it starts, an init script I guess, which is always called AutoHotKey.ahk in your Documents directory. So for example mine is called "G:\User\Robert\Documents\AutoHotkey.ahk" It can call other scripts, set up keyboard / remote macros etc, and is the script that opens when you right click the AHK icon (mine lives in the System Tray) and select 'Edit this script'. All that needs to be done is to run AutoHotKey.exe at startup, and it will run the script.

Happy Hotkeys :)
 
Last edited:

irishrally

Portal Member
July 4, 2012
6
0
Home Country
United States of America United States of America
I found the .ahk file you mentioned in Documents and edited the script. I then pasted a shortcut of that script into the startup folder (start menu/right click all programs/select open all users). Maybe this isn't the correct startup folder?
 

emueyes

Portal Member
January 16, 2012
15
3
61
Home Country
' All that needs to be done is to run AutoHotKey.exe at startup, and it will run the script.

Place a shortcut to AutoHotkey.exe in the Startup folder, it will start and then find and run the default ahk script automatically. There's no need to place shortcuts to the script anywhere, so long as it is in your default Documents folder, and is called AutoHotKey.ahk

For testing, I often place a line like
Code:
Msgbox Script Loaded !
in script files to make sure of what is going on, for example to show that a script gets loaded, or a certain part of it is executed.
 

Users who are viewing this thread

Top Bottom