Decorum for the Forum:
  • Be nice. If you want to be mean, try Reddit.
  • No Piracy. If you want to be a thief, there are dark places on the internet dedicated to that.
  • No Cracking. Discussions on AnyDVD, DeUHD, DVDFab, UHDKeys and similar tools are not permitted here.
  • No Spamming. If you want to make a buck, work smarter... somewhere else.
  • No Adult Content. Half the internet is dedicated to adult content. This half isn't.

Privacy Policy: Click Here to Review (updated September 30, 2020)

Custom IP control command according to aspect ratio

Post here to suggest ideas for future versions.
Manni
Posts: 593
Joined: Wed May 22, 2019 5:27 am

Re: Custom IP control command according to aspect ratio

Post by Manni » Thu Nov 09, 2023 9:39 am

I've emailed the PDFs to you.

Further to the posts above, if you're familiar with python you could take a look at the source in some of the modules for this excellent utility that controls the JVCs, especially the jvc_network and the jvc_protocol ones.

https://github.com/arvehj/jvcprojectortools

Online
User avatar
Pauven
Posts: 2795
Joined: Tue Dec 26, 2017 10:28 pm
Location: Atlanta, GA, USA
Contact:

Re: Custom IP control command according to aspect ratio

Post by Pauven » Thu Nov 09, 2023 10:07 am

Manni wrote: Thu Nov 09, 2023 9:25 am Of course, the ideal solution is madVR/Envy/Radiance, which looks at the content in real time and shifts the picture instantly according to the A/R.
While that sounds ideal, I foresee issues with a very limited set of movies that intermix IMAX content with non-IMAX, and switch AR along the way. This has become more common in recent years. Also, what if the movie has a clip of a movie playing in it, and we the viewers are watching a movie in a movie and it has black bars, and the AR logic detects the AR change and responds. I suppose there's probably settings to only adjust AR at specific points (i.e. the beginning), but ultimately this isn't foolproof even though the number of affected movies is probably quite slim.

Manni wrote: Thu Nov 09, 2023 9:25 am This makes me think that we might want to provide an option to use the auto A/R with DVDs only or with all content, so that those who prefer to use JRMC vertical shift for bluray and UHD Bluray can do so, it will also spare the physical mechanism for the lens.
I had already arrived at this conclusion, and I would do something similar to the CMC player launcher, where you can specify what to do for each media type.

Manni wrote: Thu Nov 09, 2023 9:25 am There is zero issue with your developer tools, it's simply an IP protocol, if you can control the Vera Lights, you can control the JVCs.
You'd be surprised at some of the limits I've come across over the years. But in this case you are right. I've found some python projects on github for controlling JVC projectors, and they are simply opening a socket and passing some data. No biggie there. The biggest challenge seems to be the timing of the communications, seems like JVC is very sensitive to command spacing.

In reviewing those projects, overall the code is a lot more than I want to manage, but those projects are doing a lot more than just controlling lens memory. I think for lens memory only, the code base would be manageable.

But that does present a caveat. If you only ever want to switch modes, then building it into CMC is viable. But if you want to do more than switch modes, the pre-existing JVCControl combined with batch files is a nearly limitless solution. I can expend all my effort on working with batch files, passing My Movie vars, and configuring triggers, instead of writing code that technically already exists in other form. This is the same approach I took with launching external players instead of trying to build my own.

One last thought that I've had is going back to our recent efforts on JRMC integration. I was contemplating interfacing with JRMC via their API to retrieve things like movie position, something that up until now I've only been able to achieve with MPC. Perhaps if I can get this to work, not only can I determine movie position but perhaps I can also determine if the main movie is playing or instead just a menu or short trailer. If CMC can successfully query this data, and it's reliable enough to detect the main movie is playing, then perhaps I can have CMC send the projector commands only when the main movie is playing.

Also, I assume the expectation is that the lens memory goes back to a default setting when focus returns to CMC, yes?
President, Chameleon Consulting LLC
Author, Chameleon MediaCenter

Online
User avatar
Pauven
Posts: 2795
Joined: Tue Dec 26, 2017 10:28 pm
Location: Atlanta, GA, USA
Contact:

Re: Custom IP control command according to aspect ratio

Post by Pauven » Thu Nov 09, 2023 11:06 am

By the way, I got the docs, thanks. They are a little abstract, but when consumed with the python projects I think I get the big picture.

Out of curiosity, I checked my collection to see what Aspect Ratios are common:
image.png
image.png (20 KiB) Viewed 2669 times

I know your collection is bigger, but this should be fairly representative of a typical collection. Looks like there's about 7 main aspect ratios to worry about. And since you're limited to 10 lens memories, this aligns pretty well with those limitations.

The question would be how to handle the inbetweens. If you get a 2.33, 2.34 or 2.35, you probably want to just use your 2.35 setting. In the batch file, I can pass the value as a string and you could do a text match (i.e. if AR = "2.33" then do :AR235), or we can evaluate them as numbers. When evaluating numbers, we could say if AR > 2.3 and <= 2.38 then do :AR235, and if > 2.38 and <= 2.44 then do :AR240, something like that.

I think I like the number range evaluation better, that way regardless of what freak AR is configured for a movie, it will automatically fall into the best range for which you have configured a lens memory.

Does this sound good to you too?

I'm thinking of developing a quick and dirty test program to figure out how this can work. It would allow you to specify an external program or batch file to call, and what parameters to pass to it, and to set values for those parameters. That way you could configure it to call a batch file and pass in the aspect ratio and set the value to 2.34, and see if it successfully calls the batch and how the batch file evaluates those values.
President, Chameleon Consulting LLC
Author, Chameleon MediaCenter

Online
User avatar
Pauven
Posts: 2795
Joined: Tue Dec 26, 2017 10:28 pm
Location: Atlanta, GA, USA
Contact:

Re: Custom IP control command according to aspect ratio

Post by Pauven » Thu Nov 09, 2023 12:25 pm

I've written a batch file to receive an Aspect Ratio as a passed value, and in turn call JVCControl with the associated lens memory.

It accepts a 3 digit number, with or without the decimal, as the aspect ratio, i.e. 2.00 or 200 for a 2.00:1 aspect ratio.

Save the following text as a batch file, i.e. "Test.bat", and set the JVCControl variable to the path for your JVCControl.exe. Then simply run "test 1.78" to run a test.

Code: Select all

@echo off
:: Batch Script to run JVCControl.exe to assign a Lens Memory profile
:: This batch file should be called with the 3 digit Aspect Ratio,
:: with or without the decimal dot.
:: Examples:  either 2.00 or 200 but NOT 2 or 2. or 2.0 or 20
setlocal EnableExtensions EnableDelayedExpansion


:: change the following variable to the correct path
set JVCControl="C:\Video\JVCControl.exe" 

:: Evaluate the passed Aspect Ratio parameter as a number again number ranges
:: If the value is missing, default to the standard 16:9 Aspect Ratio 1.85
if %1.==. goto :AR178
set AR=%1
:: Strip out the decimal to make this an integer
call:ReplaceText "!AR!" "." "" AR

:: LEQ means Less Than or Equal To
:: GEQ means Greater Than or Equal To
:: You may change the LEQ/GEQ numbers to set your own preferred ranges
:: You may also define new goto targets if you have other lens memories defined
:: You should have a goto line for each Lens Memory you defined in your JVC projector

if %AR% LEQ 134 goto :AR133
if %AR% GEQ 135 if %AR% LEQ 166 goto :AR166
if %AR% GEQ 167 if %AR% LEQ 184 goto :AR178
if %AR% GEQ 185 if %AR% LEQ 232 goto :AR185
if %AR% GEQ 233 if %AR% LEQ 238 goto :AR235
if %AR% GEQ 239 goto :AR240

echo [ERROR] Aspect Ratio Value !AR! is unhandled!
goto :EOF


:: In each of the following Aspect Ratio procedures, change the trailing passed
:: value to one of the following values used by JVCControl:
:: D8 = Lens Memory / Installation Mode 1
:: D9 = Lens Memory / Installation Mode 2
:: DA = Lens Memory / Installation Mode 3
:: E5 = Lens Memory / Installation Mode 4
:: E6 = Lens Memory / Installation Mode 5
:: E7 = Lens Memory / Installation Mode 6
:: E8 = Lens Memory / Installation Mode 7
:: E9 = Lens Memory / Installation Mode 8
:: EA = Lens Memory / Installation Mode 9
:: EB = Lens Memory / Installation Mode 10
:: Example: start "" %JVCControl%EB will call "...\JVCControl.exe" Raw:EB to set Lens Memory 10

:AR133
start "" %JVCControl% D8
goto :EOF

:AR166
start "" %JVCControl% D9
goto :EOF

:AR178
start "" %JVCControl% DA
goto :EOF

:AR185
start "" %JVCControl% E5
goto :EOF

:AR235
start "" %JVCControl% E6
goto :EOF

:AR240
start "" %JVCControl% E7
goto :EOF

:FUNCTIONS
@REM FUNCTIONS AREA
goto :EOF
EXIT /B

:ReplaceText
::Replace Text In String
::USE:
:: CALL:ReplaceText "!OrginalText!" OldWordToReplace NewWordToUse  Result
::Example
::SET "MYTEXT=jump over the chair"
::  echo !MYTEXT!
::  call:ReplaceText "!MYTEXT!" chair table RESULT
::  echo !RESULT!
::
:: Remember to use the "! on the input text, but NOT on the Output text.
:: The Following is Wrong: "!MYTEXT!" !chair! !table! !RESULT!
:: ^^Because it has a ! around the chair table and RESULT
:: Remember to add quotes "" around the MYTEXT Variable when calling.
:: If you don't add quotes, it won't treat it as a single string
::
set "OrginalText=%~1"
set "OldWord=%~2"
set "NewWord=%~3"
call set OrginalText=%%OrginalText:!OldWord!=!NewWord!%%
SET %4=!OrginalText!
goto :EOF
The next step is for me to write a demo program that will call this batch file and pass an aspect ratio to it.

Note that the aspect ratio ranges I came up with were just a first pass, best guess effort. Obviously each user would adjust to their own setup and preferences.
President, Chameleon Consulting LLC
Author, Chameleon MediaCenter

Manni
Posts: 593
Joined: Wed May 22, 2019 5:27 am

Re: Custom IP control command according to aspect ratio

Post by Manni » Thu Nov 09, 2023 1:01 pm

Ok, sorry for the late reply, busy day here...

First, re the variable A/R titles, this is a known issue. It's handled by madVR/Envy/Lumagen by selecting a fixed A/R that doesn't lose any content (you have other options) when they detect frequent A/R changes in the same title. This only works for instant A/R detection, not for the CMC implementation.

With the CMC implemtentation, we simply have to select the correct A/R in CM. for example, 1.78 for me (1.78 screen), or if someone had a scope screen, they would probably select 2.4, and their 2.40 installation mode would simply mask/crop the top and bottom of the imax shots, so that they look like 2.40 as well. Most variable A/R movies with iMax sequences are framed that way, so that you can lose the top and bottom without losing essential info, precisely for this reason (so that the film can be shown in non-iMax venues as well).

I agree that the batch files approach is the fastest/easiest/most flexible approach, that's why I suggested/recommended it to start with. I had linked to python source code, you might have missed my post. I don't think we need the complication of having to recode what jvccontrol.exe already does perfectly.

Re your batch file, it won't work, simply because the A/R in MyMovies CM are fixed. You can only choose in a list of 7 A/R, you can't enter the exact A/R, so your batch file doesn't have to manage that given that it will never get any A/R that isn't in the CM list.

Here they are:
2.40
2.35
2.20
1.85
1.78
1.66
1.33

This was done at the time, many years ago, based on the majority of A/R in the entire MyMovies database. I could ask Brian to add a few, especially 2.0 (Univisium) which is frequently used by Netflix/streaming as a compromise between 1.78 and 2.40. There is no significant difference between 2.39 and 2.40, and the info in discs isn't always reliable, so 2.40 is usually fine. That's usually the actual size of scope screens (though some are 2.37 to split the different between 2.35 and 2.40).

Yes, as explained in my first post, you would probably need to offer an option to go back to the default A/R after playback (it will depend on the physical screen A/R and preference of each user). You might also need to add a delay to allow for the command to be applied, before launching the player, so that there is no conflict with the commands sent by the player when it starts playback (please re-read my first posts, you've missed quite a bit of info).

Using the jRiver API to detect when the main movie starts would be nice if possible, but it can be done later.

There are a few errors in your batch file:

1) The standard 16/9 A/R is 1.78, not 1.85.
2) As explained, get rid of all the greater than etc, currently you have only 7 fixed values to deal with (listed above)
3) There is no "RAW" before the 2-digit commands that I provided, these are not raw commands, they are "simplified" commands specific to the utility (a bit like shortcuts). The example I provided earlier was based on RAW commands, but I explained when I listed those for the lens memory / installation files that these were not raw. That's another post you might have missed. So you need to get rid of the raw: part of your command. As you can see in the readme.txt that goes with the utility:
Usage:
Run from command line passing the 2 digit command to execute.
JvcControl {Command}

Example: to switch to USER1:
JvcControl 6C

I'll give a try to your batch file when you've modified it according to the above, but there is no reason why it wouldn't work, jvccontrol.exe works fine (raw commands or not).

Online
User avatar
Pauven
Posts: 2795
Joined: Tue Dec 26, 2017 10:28 pm
Location: Atlanta, GA, USA
Contact:

Re: Custom IP control command according to aspect ratio

Post by Pauven » Thu Nov 09, 2023 1:17 pm

Manni wrote: Thu Nov 09, 2023 1:01 pm Re your batch file, it won't work, simply because the A/R in MyMovies CM are fixed. You can only choose in a list of 7 A/R, you can't enter the exact A/R, so your batch file doesn't have to manage that given that it will never get any A/R that isn't in the CM list.
Sorry, not to be rude here, but you are wrong. The logic does work (already tested on my end) and the data I presented in the chart is from my own My Movies collection. I can't say I know how the "now invalid" values made it in there, but most likely it is very old data from older My Movies versions that didn't restrict the values, and no one has cleaned it up. These are the values that are exported and passed to CMC as well. So failing to handle them will result an occasional processing failure.

I'm pretty sure you have the same in your collection to. Also know that this is not something you can double-check in the MMCM GUI, as the GUI code probably defaults or auto-correct these for display, even if they are incorrect in the DB and API export.

Since I already developed the batch logic, why not just use it?
Manni wrote: Thu Nov 09, 2023 1:01 pm Yes, as explained in my first post, you would probably need to offer an option to go back to the default A/R after playback (it will depend on the physical screen A/R and preference of each user)
I'm trying to think of a time when this would not be desirable - after all, CMC is 16:9, so shouldn't the projector mode match when you're in it?

I'd rather not make this optional/configurable if everyone will always enable it.
Manni wrote: Thu Nov 09, 2023 1:01 pm 1) The standard 16/9 A/R is 1.78, not 1.85.
Correct, I was too lazy to double-check. Easy fix.

Manni wrote: Thu Nov 09, 2023 1:01 pm 2) As explained, get rid of all the greater than etc, currently you have only 7 fixed values to deal with (listed above)
Wrong. As explained, the data in MM is not near as clean as the GUI suggests.

Manni wrote: Thu Nov 09, 2023 1:01 pm 3) There is no "RAW" before the 2-digit commands that I provided, these are not raw commands
Just following your example. Easy enough fix.

I've updated the batch file above with these fixes. Be sure to refresh if you don't see them.
President, Chameleon Consulting LLC
Author, Chameleon MediaCenter

Manni
Posts: 593
Joined: Wed May 22, 2019 5:27 am

Re: Custom IP control command according to aspect ratio

Post by Manni » Thu Nov 09, 2023 1:19 pm

Further to the above, I just saw in the jvccontrol.exe that there is already a sleep command:

------------
Other commands:
Adding sleep xx to the end of your command line will cause the command to
be delayed by xx seconds before running. Remember JVC Control is a windows
program so it will return control to a cmd / bat script right away. To avoid
that you can use start /w command ie: start /w jvccontrol.exe 2E sleep 10

So you could add a "sleep" variable at the beginning of the batch file that would be added to all commands. The default could be 0 (if you want no delay by default) or 5 (if you want the delay probably needed for the JVCs in most cases).

Also, one thing you might want to do if you want to optimise, is to test the current installation mode (using the rawread feature of the utility), and only send the command if it's a different one:

------------
Added Raw: and RawRead: to send any documented raw command out of the
IP / RS232 control manual. The read is useful for reading states.
If your command is using RawRead:, then the returned status from the projector will
be written to JvcReturnValue.txt in the jvccontrol.exe folder.

Here is an example that sets brightness to -1
c:\htpc\JvcControl.exe Raw:PMBRFFFE

This sets brightness to 0
c:\htpc\JvcControl.exe Raw:PMBR0000

Here is another exmaple that reads current gamma setting from projector and stores in JvcReturnValue.txt
c:\htpc\JvcControl.exe RawRead:PMGC
Then set gamma to 1.9
c:\htpc\JvcControl.exe Raw:PMGC06

Then restore gamma after movie ends:
set /p gamma=<JvcReturnValue.txt
c:\htpc\JvcControl.exe Raw:%gamma%

You can also store the current picture mode, so that you can restore it after a picture change:

------------
Added ability to store and restore picture modes. This is useful if you want to change
picture mode at start of a movie and return at end of a movie automatically.
jvccontrol StorePictureMode yourfile.txt
This will write the current picture mode to a file in the jvccontrol folder called yourfile.txt

You can restore the picture setting from this file:
jvccontrol RestorePictureMode yourfile.txt

Manni
Posts: 593
Joined: Wed May 22, 2019 5:27 am

Re: Custom IP control command according to aspect ratio

Post by Manni » Thu Nov 09, 2023 1:22 pm

Further to my last two posts, re the rogue A/R, I didn't know it was even possible. If that's the case, of course your logic is an improvement.

Online
User avatar
Pauven
Posts: 2795
Joined: Tue Dec 26, 2017 10:28 pm
Location: Atlanta, GA, USA
Contact:

Re: Custom IP control command according to aspect ratio

Post by Pauven » Thu Nov 09, 2023 1:26 pm

Don't forget that one of my ideas is to have CMC query JRMC to detect if the movie is playing, and only issue the command then. In this case, having the batch file or JVCControl manage time delays is counter-productive. CMC would need to be in control.

Now, if that doesn't pan out, then the time delays can either be in CMC or the batch file, doesn't really matter.

Also keep in mind that the batch file is just a starting off point. It's expected that each user would customize it as they see fit. It's just a template for getting My Movies data from CMC into a batch file, and for evaluating the AR to jump to the correct command section.

I don't see a need to store the current picture mode, rather just that each user sets the default mode for CMC usage, i.e. the 1.78 mode.

Also, I think we need to also send a few more values into the batch file. Media type: DVD, HDDVD, Blu-ray, 4K UHD. Possibly 3D. And possibly HDR. Not sure if those would be useful for controlling projector setup, but seems logical. Anything else you can think of?
President, Chameleon Consulting LLC
Author, Chameleon MediaCenter

Online
User avatar
Pauven
Posts: 2795
Joined: Tue Dec 26, 2017 10:28 pm
Location: Atlanta, GA, USA
Contact:

Re: Custom IP control command according to aspect ratio

Post by Pauven » Thu Nov 09, 2023 1:28 pm

Manni wrote: Thu Nov 09, 2023 1:22 pm Further to my last two posts, re the rogue A/R, I didn't know it was even possible.
If only that was the full extent of the madness. Don't even get me started on the data corruption bugs...
President, Chameleon Consulting LLC
Author, Chameleon MediaCenter

Post Reply