JMRI WebThrottle With Video

Update 8/24/2022: Looks like this will be in JMRI 5.2 more than likely. That will cover the download and installation of the files. There has also been a modification to the webserver so that you can use the camera throttle and the normal WebThrottle without it.

For the last few years SVL has been running hybrid ops where we have remote operators and in layout room operators. The remote operators get a engineers view of the track using our CabCam project. This allows our remote engineers to participate and run through trains or trains with light switching with the help of a local brakeman. We are accomplishing this using modified JMRI WebThrottle code and some fancy memory variables that will be explained below.

Look up Thomas crawling out of his tank engine.

1. Install the WebThrottle JS and CSS files.

Download the webThrottle.css file and the appropriate webThrottle.js file for your install of JMRI. The file labeled webThrottle 426.js is for JMRI versions 4.22-4.26. webThrottle 5+.js is for JMRI 5.0 and up, it works as recently as 5.1.3.

These files will be placed in your JMRI install folder. This is different for various operating systems but you wan to look for /JMRI/web/js and /JMRI/web/css respectively. Place the .js file in the JS folder and rename it webThrottle.js then place the .css file in the CSS folder and rename it webThrottle.css.

On Windows you will want to copy both of these files before you rename them so you can have a backup in the folder. When JMRI gets updated it WILL write over these files with a new version. If you leave a copy in the folder with a different name it can quickly be swapped back in. Linux and MacOS may have the same issue, but I cannot confirm it.

The following setup will be handled in two sections, one for local internal streaming and control, and the next for streaming to remote engineers on the internet. Local streaming is good for testing or if you end up with too many engineers for a room, but not for the layout itself. Internal setup is useful to do before, as much of the setup applies to remote engineers on the internet.

You must also have every engine you want to run with the CabCam added to JMRI’s roster. You can get as fancy or as spartan as you want with this, you can just add NMRA standard CV definitions decoders to your roster, the important bit is the DCC address is in the roster so it shows up in WebThrottle.

2. Internal SetupFirst you are going to need to get the streaming URL for your CabCam which can be obtained from the CabCam setup instructions. Setting the Memory Variables. Open Tools>Tables>Memory Variables.

Where the magic happens.

When this opens click Add… and a window will pop up. In System Name you want to enter IMWTVIDEOURL:XXXX where XXXX is the address of the engine you are wanting to run with the camera. For instance if I had UP 6936 in my roster I would add IMWTVIDEOURL:6936, and if I also wanted to run BNSF 326 I would add IMWTVIDEOURL:326 to the System Name. Don’t enter anything for User Name, hit Create when done. If you have multiple entries to create you can just keep adding DCC addresses without closing that window by just changing the number at the end.

Now you need your CabCam streaming address. If you have a few cameras you can create parking spots for the camera URLS by adding a new variable and naming it IMWTCAMERAURL:# where # is the camera number. Take your streaming URL, it needs to be a IP stream so it needs to end in something like video.mjpeg or stream.h264 etc, so it will look somewhat like this. http://internalcabcamIP:8080/stream/video.mjpeg

Take that address and put it into Value.

If you have not told this to start automatically head to Edit>Preferences>Web Server> and check start automatically. Or you can go to Tools>Servers> Start JMRI Web Server when you want to start it. Now head to your web browser and navigate to the ip and port of your JMRI web server. The URL should look something like http://internalIPofJMRIwebserver:12080/web/webThrottle.html. 12080 is the default port but you can change that in your settings. When you get to the JMRI WebThrottle page click on the engine you assigned a camera too and you should be presented with your throttle and camera.

At this point you can use the throttle internally to your network or setup a VPN on your router to allow friend and family to remotely operate on your layout. The VPN may honestly be the best way for you to do this with friends as it is the most secure way to do this. I won’t go over how to setup a VPN on your router as there are so many different ways to do it. Just Google your router name and VPN and you should find the instructions.

WebThrottle Over the Internet (WOT)

Sometimes there are use cases where you wouldn’t want to setup a VPN and would rather have your remote engineers go to a URL or your DDNS or external IP addresses and use the throttle. This requires more setup on your end and is more unsecure. A good setting for this is if you have less tech savvy remote engineers, or at a club or historical society etc. To start this off you will need to google how to setup port forwarding on your router. I am again going to leave you to handle this as there are so many different routers. Once you are logged into your router you will need to take the IP of your JMRI computer and have the internal port be your JMRI webs servers port, generally 12080 and then set your external port. You can set this to the same port number or you can change the port to something fun like the number of your favorite locomotive, eg 4014 etc. Just make sure to reference the list of port numbers and their uses so you don’t end up using a important port. Ports above 49152 are pretty much fair game.

To connect to your JMRI Webserver from the internet to make sure you did this right you can google “What is my IP” and insert that into this URL http://externalIP:theportyouchose ex and you should see your Server.

Next you want to forward the port for your camera. You will input the IP of the camera, port 8080 for the internal port, and then chose an external port you want to use. If you have multiple cameras chose sequential ports eg. Port 49501 for camera 1, 49502 for camera 2 etc. You can test this by going to the stream of your camera using the external IP eg http://yourexternalIP:49501/stream/video.mjpeg and you should see the stream. That URL you used to see the external stream is what you will put into the memory variable above instead of the internal URL for the locomotive you want to allow be remote operated.

One cool thing you can do with this is setup a CNAME off your website and have people go to a subdomain of your website to run trains. This would end up with a URL like . To do this you will need to log into the DNS section of your domain host. Find the custom records bit and add a CNAME and put whatever you want to come before your websites URL, eg layout, in the hostname bit, leave the TTL, and under data you are either going to put your external IP(this changes so you may need to update this from time to time) or input a URL given to you by a dynamic DNS service like NoIP. These can range from free with some nagging to refresh to a paid service. Many routers have a DDNS service built in but you will need to google how to set that up for your router.

Some words of caution.

One thing to note, anyone with the URL can connect and run a train on your layout while JMRI is running. You can either disable the port forwarding on your router when you are not wanting to allow access, or shut down JMRI. I have not looked into a way to put the webserver behind a login and JMRI does not support secure URLs like HTTPS.

The Future.

There are some features I would like to add is sound, that currently is missing from this project, but UV4L should be able to do it. The WebThrottle code may need a update to support that.

I would also like to roll this all into JMRI releases at some point.

The Merits of Joining a Club/Historical Society.

Two brand new Canadian Pacific SD70ACus getting a break in run.
Two brand new Canadian Pacific SD70ACus getting a break in run.

Joining a model railroading club or association can be daunting and is not for everyone, though there are a few benefits to joining a club with a large layout. This isn’t an exhaustive list by any means but it is a few things to think about if you are on the fence. There are some obvious things like running trains but there a few less obvious benefits.

Being a member of a club allows you to have a smaller layout at home or no layout depending on your living situation. Another advantage is this gives you the ability to run a different prototype or era, you can buy that model that you fancy even if it doesn’t fit in your era and run it at your club. If you join a club that does operations will also be able to participate in operating sessions you otherwise may not be able to host.

When it comes to getting new locomotives they really benefit from being broken in. They run better at slower speeds and usually a bit quieter at higher speeds once broken in. This also gives you a chance to see if there are any issues while still in the warranty period. I personally have a small layout at home so it can take forever to get a locomotive broken in. At the club I am able to stick a new locomotive on our open house loop and leave the locomotive to run for an hour or so varying the speed while I work on a different part of the layout. You can leave the sound on to locate the locomotive and if it stops it hit a dead spot or it derailed.

The new units being broken in.
Those same units on my home layout, there is about 2ft to the left and 7 to the right, not much room.
CP 7021 on the SVL programming track being setup for the first time.

You also potentially get access to a bigger range of hardware for managing your rolling stock. If you have Loksound decoders another member may have the expensive LokProgrammer that you need to write new sound files, and do firmware updates. Some Digitrax decoders need this as well. They should also have access to the various NMRA measuring gauges you should be using to maintain your equipment.

And last on my list today but definitely not least is the knowledge of others. The knowledge of other members and their varying methods of modeling can teach you a few things if you take the time to listen. They may also learn a thing or two from you as collaboration betters everyone. It also helps you as not everyone needs to master every aspect of model railroading. This of course comes with great friendships and comradery which is worth it all.

As I step down from my admittedly biased soap box I will leave you with one last thing to consider as you are reading this post on a clubs website. Consider joining a club, come visit SVL, if you don’t feel we are a fit then check out some other clubs as every one is different. In the area there are about 5 clubs/historical societies that I know of including SBHRS and the Niles Depot Museum. Visit one, visit all, we would love to meet you.


Travelers from Across the Atlantic

The great thing about the Bay Area is that we are a melting pot of cultures and interests and our members show this diversity as well. Some of our club members do enjoy running trains from their home country, and as such, bring their trains out from time to time to run on the layout, typically on the weekends or quieter periods.

Saturday was one of those days, and in passing by SVL, we had some German locomotives and wagons roaming around the layout!

June Open House

On Saturday June 8th we held the spring/summer instance of our twice yearly Open House. Trains were kept humming across the lower level loop as guests young and old ran trains, and we had a few people even try their hand at switching cars. Despite all of this action, we managed to not have too much chaos on the tracks!

Check out below for a few pictures from Open House.

Don’t worry if you missed out or your schedule couldn’t accommodate the time. Reach out to us on Facebook and/or via email and we’ll be happy to try and work with you to show you around and let you run a train. At the very least, feel free to come down to one of our monthly Ops sessions!