2010-05-13, 15:28
It seems that native support for adjusting refresh according to video in XBMC on OS X is a long way off.
While we wait for that, I was wondering if maybe we could make a script that accomplishes the same.
First, let me say that I'm not a programmer, but maybe we can work together on making a script for auto adjusting display refresh on OS X.
Let's do a brainstorm in this thread and see if we, together, can make a working script.
-----
My thoughts so far:
I have considered a script like YouTrailer (or Home Theater Experience) where a button on the remote (or in the skin GUI) executes the script, which performs some commands, before starting playback of the selected video.
The script would:
1. Get the file path for the selected video (in the XBMC DB?)
2. Pass the file path to MediaInfo CLI for OS X
3. Grab the "framerate" info from the MediaInfo result
4. Call the correct display refresh change in SwitchResX, based on the framerate info
5. Start playback of the selected video
I considered "cscreen" or "ScrUtil" for doing the display refresh change directly, without SwitchResX, but I'm not sure that those two programs can do "23.976 Hz" (which IMO is very important, as many movies use that framerate and 24 Hz with a 23.976 Hz video would present judder).
With SwitchResX you can assign shortcuts to selected resolutions and just call the appropriate shortcut in the script.
I have used this already with my Harmony remote, where I assigned a button to execute a small script which only job was to do a virtual "F4" keyboard command, for example, which was assigned to the correct resolution in SwitchResX.
But to automate this behaviour, and let the script figure out what the fps of the video is, would be a lot simpler solution.
Another thing to consider is how we can switch back the resolution/refresh when stopping a video.
In XBMC on Linux the resolution switches back to what it was before starting playback, when you stop a video.
Maybe, in the Python code, the script can check if video playback is active and when it detects a stop in video playback it changes the resolution back.
While we wait for that, I was wondering if maybe we could make a script that accomplishes the same.
First, let me say that I'm not a programmer, but maybe we can work together on making a script for auto adjusting display refresh on OS X.
Let's do a brainstorm in this thread and see if we, together, can make a working script.
-----
My thoughts so far:
I have considered a script like YouTrailer (or Home Theater Experience) where a button on the remote (or in the skin GUI) executes the script, which performs some commands, before starting playback of the selected video.
The script would:
1. Get the file path for the selected video (in the XBMC DB?)
2. Pass the file path to MediaInfo CLI for OS X
3. Grab the "framerate" info from the MediaInfo result
4. Call the correct display refresh change in SwitchResX, based on the framerate info
5. Start playback of the selected video
I considered "cscreen" or "ScrUtil" for doing the display refresh change directly, without SwitchResX, but I'm not sure that those two programs can do "23.976 Hz" (which IMO is very important, as many movies use that framerate and 24 Hz with a 23.976 Hz video would present judder).
With SwitchResX you can assign shortcuts to selected resolutions and just call the appropriate shortcut in the script.
I have used this already with my Harmony remote, where I assigned a button to execute a small script which only job was to do a virtual "F4" keyboard command, for example, which was assigned to the correct resolution in SwitchResX.
But to automate this behaviour, and let the script figure out what the fps of the video is, would be a lot simpler solution.
Another thing to consider is how we can switch back the resolution/refresh when stopping a video.
In XBMC on Linux the resolution switches back to what it was before starting playback, when you stop a video.
Maybe, in the Python code, the script can check if video playback is active and when it detects a stop in video playback it changes the resolution back.