VideoHelp Forum




+ Reply to Thread
Results 1 to 6 of 6
  1. Member
    Join Date
    Nov 2020
    Location
    Western Hemisphere
    Search Comp PM
    Hi all,
    I am running a PC,Windows 11 O/S
    I have 4 CCTV cams
    I would like to have One Icon/batch file
    on my PC windows Desktop to
    open 4 P.P media player windows simultaneously
    showing each individual camera
    I would like the windows sized
    so all 4 windows can be seen on the monitor
    screen without overlapping each other.
    I wrote a BAT file to open the 4
    Real-Time Streaming Protocol (RTSP)
    feeds. But it did not work as I thought.
    The 4 windows open with the correct RTSP feeds but all the windows overlap!
    I want to open the 4 windows 2 side by side
    and the other 2 side by side below the upper windows.
    Could someone explain how I can do this?
    with an example of coding please?
    TY
    Quote Quote  
  2. Originally Posted by Flourgrader View Post
    Hi all,
    I am running a PC,Windows 11 O/S
    I have 4 CCTV cams
    I would like to have One Icon/batch file
    on my PC windows Desktop to
    open 4 P.P media player windows simultaneously
    showing each individual camera
    I would like the windows sized
    so all 4 windows can be seen on the monitor
    screen without overlapping each other.
    I wrote a BAT file to open the 4
    Real-Time Streaming Protocol (RTSP)
    feeds. But it did not work as I thought.
    The 4 windows open with the correct RTSP feeds but all the windows overlap!
    I want to open the 4 windows 2 side by side
    and the other 2 side by side below the upper windows.
    Could someone explain how I can do this?
    with an example of coding please?
    TY
    chatgpt:

    To achieve your goal of opening four RTSP streams in separate media player windows without overlapping and arranging them on the screen in a grid layout (2x2), you can modify your batch file to control the position and size of the windows using additional commands or third-party utilities like `nircmd`.

    ### Steps to Set Up the Batch File:

    1. **Ensure Each Media Player Opens and Plays the RTSP Feeds**
    Your batch file should already be opening the media players with the correct RTSP feed. For this example, I assume you're using VLC Media Player, which is a common choice for RTSP streams.

    2. **Use `nircmd` to Control Window Placement**
    `nircmd` is a command-line utility that can be used to manipulate windows' sizes and positions. You can download it from [NirSoft](https://www.nirsoft.net/utils/nircmd.html).

    3. **Organize the Windows in a Grid Layout (2x2)**
    In your batch file, after opening each window, you can use `nircmd` to position the windows so they don't overlap.

    ### Example Batch File

    Here’s a batch file example that opens four VLC windows and positions them in a 2x2 grid:

    Code:
    @echo off
    
    :: Path to VLC executable (replace with your actual path if necessary)
    set VLC_PATH="C:\Program Files\VideoLAN\VLC\vlc.exe"
    
    :: RTSP feed URLs (replace with your actual URLs)
    set RTSP1=rtsp://192.168.1.101:554/stream
    set RTSP2=rtsp://192.168.1.102:554/stream
    set RTSP3=rtsp://192.168.1.103:554/stream
    set RTSP4=rtsp://192.168.1.104:554/stream
    
    :: Open VLC with the RTSP feeds (these are the basic commands to open VLC with RTSP streams)
    start "" %VLC_PATH% %RTSP1%
    start "" %VLC_PATH% %RTSP2%
    start "" %VLC_PATH% %RTSP3%
    start "" %VLC_PATH% %RTSP4%
    
    :: Wait a few seconds to make sure VLC windows are open (adjust if needed)
    timeout /t 3 /nobreak
    
    :: Move and size the windows using nircmd (adjust dimensions and positions as needed)
    nircmd win move ititle "VLC media player" 0 0 960 540    :: Position and size first window
    nircmd win move ititle "VLC media player" 960 0 960 540   :: Position and size second window
    nircmd win move ititle "VLC media player" 0 540 960 540   :: Position and size third window
    nircmd win move ititle "VLC media player" 960 540 960 540  :: Position and size fourth window
    
    :: Exit
    exit
    ### Explanation of the Batch File:

    - **VLC Path**: The path to your VLC executable (`vlc.exe`).
    - **RTSP URLs**: Replace these with your actual RTSP feed URLs.
    - **VLC Start Commands**: These `start` commands will open each VLC window with the corresponding RTSP stream.
    - **`nircmd` Commands**: The `nircmd win move` command is used to move and resize each VLC window. It targets windows by their title (in this case, "VLC media player"), and then specifies the window position and size in pixels.
    - `0 0 960 540` will place the window at coordinates (0, 0) and set the window size to 960x540 pixels.
    - The second and third windows will be placed next to the first one and below it, respectively.

    ### Customizing:

    - **Adjust Window Size**: You can change `960 540` to different values if you want larger or smaller windows.
    - **Adjust Grid**: You can change the coordinates and window sizes for different grid layouts (e.g., 3x3, 1x4, etc.).

    ### Alternative: Direct Window Management with PowerShell

    If you don't want to use `nircmd`, you can try using PowerShell scripts to position the windows, but `nircmd` tends to be much simpler for this task.

    ### Testing:
    After saving your `.bat` file, run it to ensure the VLC windows open and are positioned correctly. If needed, you can adjust the timing (`timeout /t 3`) to ensure all VLC windows are fully loaded before attempting to reposition them.

    This should solve your problem of organizing four RTSP streams into a grid layout without overlapping.
    Quote Quote  
  3. Member
    Join Date
    Nov 2020
    Location
    Western Hemisphere
    Search Comp PM
    Thank you Frieren for the script.
    It was much appreciated!
    Unfortunately your suggestion does not work fully.
    It opens the 4 feeds but all the windows cover each other
    Hence they are not spaced out.
    I tried your suggestion with VLC media player ver: 3.0.21
    I also tried it with Pot Player latest version.
    All opening windows overlap each other.
    I wondered if it was an internal setting in
    VLC and Pot Player that were preventing the window spacing ?
    Quote Quote  
  4. Originally Posted by Flourgrader View Post
    Thank you Frieren for the script.
    It was much appreciated!
    Unfortunately your suggestion does not work fully.
    It opens the 4 feeds but all the windows cover each other
    Hence they are not spaced out.
    I tried your suggestion with VLC media player ver: 3.0.21
    I also tried it with Pot Player latest version.
    All opening windows overlap each other.
    I wondered if it was an internal setting in
    VLC and Pot Player that were preventing the window spacing ?
    you have to adjust dimensions and positions according to your desktop resolution
    Quote Quote  
  5. Member
    Join Date
    Nov 2020
    Location
    Western Hemisphere
    Search Comp PM
    @you have to adjust dimensions and positions according to your desktop resolution

    I have a 4K monitor with a screen resolution 3840 x 2160
    I have put screen coordinates in for top left corner of the screen to open a window
    and screen coordinates for bottom right corner of the screen to open a window.
    Both windows open in the middle of the screen, one overlaping on top of the other.
    It dosen't mattet what screen coordinates I use the windows open in the same place every time! ???
    Quote Quote  
  6. Originally Posted by Flourgrader View Post
    @you have to adjust dimensions and positions according to your desktop resolution

    I have a 4K monitor with a screen resolution 3840 x 2160
    I have put screen coordinates in for top left corner of the screen to open a window
    and screen coordinates for bottom right corner of the screen to open a window.
    Both windows open in the middle of the screen, one overlaping on top of the other.
    It dosen't mattet what screen coordinates I use the windows open in the same place every time! ???
    troubleshoot and ensure nircmd is working
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!