The Testcamera application is an experimental command-line tool that emulates an IP camera by streaming a looped video file. Testcamera helps you develop, debug, and test your video management system (VMS) without physical hardware.
Why use Testcamera?
Development: Work on integrations without access to physical cameras or network gear.
Debugging: Create a predictable and reproducible video stream to test video analytics solutions and plugins.
Performance testing: Generate hundreds of virtual cameras to stress-test software and hardware reliability.
Demonstrations: Set up a mobile, software-only camera environment for product demos.
Installation
Testcamera is distributed directly with the Nx Witness Server and the VMS Benchmark package. You can find the executable in your server installation directory next to the main server binary.
For Windows
- Create a folder in the directory of your choice (for example,
C:\test_camera\) - Navigate to the All Versions section on the Downloads section on meta.nxvms.com.
- Find the version you're currently running, and download the corresponding Test Camera package for Windows
- Extract the downloaded file the folder you created in step 1
- Place the video files you plan on using into the same folder
-
Open the terminal and navigate to the test_camera folder you created:
cd C:\<name_of_the_created_folder>\
- Run the testcamera.exe command with your desired parameters and values.
For Linux
Testcamera is included in the server package for all Ubuntu installations.
- Using admin permissions, place any video files you plan on using into
/opt/networkoptix-metavms/mediaserver/bin Note: If you do not have admin permissions to place video files in the same folder as the Testcamera application, you will have to use the full file path of the videos in the cameraSet. -
Open Terminal and navigate to the folder the testcamera binary resides in:
cd /opt/networkoptix-metavms/mediaserver/bin
- Run the ./testcamera command with your desired parameters and values.
Using Testcamera
Run Testcamera from the command line, for the Microsoft Command Prompt or PowerShell, and the Linux Terminal using the following syntax:
.\testcamera [<option> | <cameraSet>]...
NOTE: Windows users must use the backslash and append .exe to the command, like so, .\testcamera.exe). All examples in this guide use the Linux format ./testcamera. |
Camera set parameters
A <cameraSet> configures a group of emulated cameras. It consists of key-value pairs separated by semicolons. You can enclose file lists in single or double quotes.
files=<file1>[,<file2>]...: The video file or files used for the primary (high-quality) stream.secondary-files=<file1>[,<file2>]...: Optional. The video file or files used for the secondary (low-quality) stream. If you omit this parameter, Testcamera uses the primary files for both streams.count=<number>: The number of cameras to create using this set. Default value is1.
Common options
-h,--help: Displays the full list of available command-line options.-I,--local-interface[=]<IP_or_Hostname>: Specifies the local network interface to listen to. By default, Testcamera listens only to127.0.0.1(loopback), meaning only a local server can discover it. Pass*to listen to all network interfaces so any server on the subnet can discover the stream.-S,--camera-for-file: Creates a separate virtual camera for each primary file specified in your camera set. Do not use thecountparameter when using this option.--no-secondary: Disables the secondary stream completely.--fps[=]<value>: Forces both the primary and secondary streams to run at the specified frame rate. The default baseline rate is 10 FPS.
Common Examples
Create a single local camera
Stream high-quality and low-quality files to a virtual camera accessible only by the local server:
.\testcamera -I 127.0.0.1 "files=hq.mkv;secondary-files=lq.mkv"Create multiple identical cameras
Emulate 100 identical cameras accessible only by the local server:
.\testcamera -I 127.0.0.1 "files=hq1.mkv;secondary-files=lq1.mkv;count=100"Create separate cameras per file
Generate three separate cameras from three different source files:
.\testcamera -S "files=hq1.mkv,hq2.mkv,hq3.mkv;secondary-files=lq1.mkv,lq2.mkv,lq3.mkv"Suppress secondary streams
Stream a single file at 30 FPS without a secondary stream:
.\testcamera files=video.ts --no-secondary --fps=30Advanced Configurations
Emulating 2-way audio
You can configure the system to emulate 2-way audio communication on Testcamera instances.
-
Create and open the
test_camera.inifile on your Media Server system.Windows:
C:\Windows\System32\config\systemprofile\AppData\Local\nx_ini\Linux:
/home/networkoptix/.config/nx_iniARM:
/etc/nx_ini/
-
Add or modify the following line:
declareTwoWayAudio=true Restart the Media Server to apply the changes.
NOTE: If you need guidance on where and how to create .ini files, please check out THIS support article on How to Create ini files. |
Managing timestamps (PTS) and unlooping
By default, Testcamera does not send frame Presentation Time Stamps (PTS). The server stamps frames based on the exact time it receives them, which makes stream playback behavior non-reproducible.
To resolve this issue during analytics plugin debugging, use the following options:
--pts: Tells Testcamera to read original PTS values directly from the video file container and include them in the network stream.--unloop-pts: Generates a continuous, monotonic PTS sequence across loops. This prevents the timeline from overwriting itself when the video file loops back to the beginning.--shift-pts-primary-period-us[=]<period>: Shifts the video timeline close to the current time, allowing you to identify exact frames across loops in your logs. You can find your file's specificperiodvalue by searching for the keyword "period" in the console output when you first run the file with--unloop-pts.
Best Practices and Limitations
Match real-world conditions: Create your test files by recording video on physical cameras under the target environment, then export those samples for use in Testcamera.
Control network exposure: Be careful when using the wide-open interface setting (
-I *) on a subnet with multiple servers. Every active server on that subnet will discover the emulated cameras and automatically add them to their databases. Use specific IP bindings to restrict discoverability.Memory footprint: Testcamera loads target video files entirely into system memory. Ensure your test environment has adequate RAM if you are using large files or multiple unique clips.
File size limits: By default, Testcamera reads and utilizes only the first 100 MB of any video file. You can adjust or remove this cap using the
--max-file-size-megabytesoption (set to0for unlimited).Linux file descriptors: When launching more than 100 emulated cameras on Linux, you may encounter system errors regarding too many open files. Elevate your system limits by running
ulimit -n <new-limit>as root before starting the application.Version matching: Always use a Testcamera binary version that matches your current media server version.
Available Sample Files
You can find some sample files in THIS Google Drive Folder
Comments
0 comments
Article is closed for comments.