How to configure multiple channels with different AMCP ports?

I am trying to launch multiple channels (lets say 4 channels) which I can do by adding the following to the config file

<channels>
        <channel>
            <video-mode>1080p5000</video-mode>
        </channel>
        <channel>
            <video-mode>1080p5000</video-mode>
        </channel>
       <channel>
            <video-mode>1080p5000</video-mode>
        </channel>
        <channel>
            <video-mode>1080p5000</video-mode>
        </channel>
<channels>

my question now, how can I dedicate each channel to a different AMCP port from the config file or any other ways

 <controllers>
        <tcp>
            <port>5250</port>
            <protocol>AMCP</protocol>
        </tcp>
</controllers>
<amcp>
        <media-server>
            <host>localhost</host>
            <port>8000</port>
        </media-server>
 </amcp>

Thanks in advance

There is only one control port for the server, not pr. channel.

All AMCP commands include the channel number, e.g. PLAY 2-10 AMB will play the file named AMB on layer 10 of channel 2.

Thanks @hreinnbeck for your response. I already able to run commands on each channel. What I am looking into is a more secure way to have each user be on specific channel while having the ability to run the commands without allowing each to access the other channel.

The LOCK command seems promising but I am still not sure how it works and I was thinking to add another layer of security by changing the port for each user

CasparCG makes no attempt to be secure or to protect against malicious clients. If you are concerned then you could try running multiple instances of casparcg, but even then it will be very possible for one channel to starve another of cpu/gpu/disk resources.

So you are aware, there is also a SWAP 1-1 2-1, as well as some that dont belong to a channel, such as KILL

I never had that problem. AFAIK the LOCK command works with the IP address. But I never tried it. I just not let uninstructed people touch it.

That is doable. You would need to configure each CasparCG Server with it’s own port, by editing the port number in the config under “controllers”. Then you could only add one channel to each server. That works. And the SWAP or KILL command would only work on the current instance.

You can also simply build a proxy to handle it all. It would listen on multiple ports or IPs and then relay modified commands to the server.

E.g:
5001 = Channel 1
5002 = Channel 2

PLAY 1-10 AMB received on port 5001 would go through unmodified.
PLAY 1-10 AMB received on port 5002 would go through modified (a simple regex looking like \b(\d)-\d+ would capture the channel number and then you could replace 1 with 2).

This is rather trivial to implement and you could have all clients work like they are on channel 1.

Thank you all @hreinnbeck @didikunz @Julusian. All those are good points. I will probably go with running multiple instances of casparcg on the same server with different ports to disallow other malicious clients from SWAPing or KILLing the sessions OR I would go with setting a proxy. Thanks again

For anyone that is looking for the same setup, using the post below will help launching different servers using different ports (config files)

Thanks to @didikunz