DVPTZ is an elaborate video and audio management systems for Linux. It accepts video inputs through all sources accepted by OpenCV, as well as several other sources including NDI® (NDI is registered trademark of Vizrt NDI AB), still and video files, real-time 3D rendering, HTML rendering, pipes, plugins, and much else. Audio sources include all those supported by PulseAudio as well as several other audio file formats. It supports PTZ cameras using Visca, either through the network or USB. Optionally, PTZ functionality can be accessed through NDI or V4L functions. Output to various video file formats is supported as well as numerous streaming formats. Realtime streaming to streaming sites, such as Twitch and Youtube is also provided. There are too many features to list here. See below for a cursory rundown. For those vaguely interested, DVPTZ stands for Digital Video Pan Tilt Zoom, intending to place emphasis on the program's support for Visca, NDI, and V4L PTZ capabilities. I discourage people from referring to it as "div-putz", but also recoginize that this is inevitable.
The Makefile defaults to mostly using the clang C++ compiler. Switching it over to only using g++ and gcc is a simple matter of editing the lines, selecting which pair you mean to use:
MCXX=g++ MCC=gcc
or
MCXX=clang++ MCC=clang
One of the several files that need to be compiled, "libhtml_window.so" must be compiled with g++, not clang++, so you must have the gnu compiler available to make this optional shared library.
To build DVPTZ, you must have installed the following libraries:
libopencv_imgproc libopencv_videoio libopencv_core libopencv_imgcodecs libopencv_highgui libopencv_dnn libopencv_objdetect
libavformat libavcodec libavutil libswresample libswscale libavfilter
libpulse libpulse-simple
libvlc
libcurl
libcairo
libfltk libfltk_images
libXcursor libX11 libxcb libXdmcp libXau libXext libXtst libm libXft libXrender libXfixes libXinerama libXrender libXcomposite
libvisca_ip
libcjson
libfontconfig libexpat libfreetype
libfftw3
libxml2
libblend2d
libjpeg
libircclient
libuuid librt libz liblzma libbz2 libmagic stdc++
To build the optional library "libosg_camera.so" which supports OSG (rendered 3D models as video sources), you must have the following OSG libraries installed:
libosg libosgViewer libosgDB libosgGA
If you do not want to build in OSG support, edit or delete the following line in the Makefile: OSG := 1
To build the optional library "libhtml_window.so" which supports rendering HTML as a video source, you must set the value of CEF_PATH in the Makefile to point at the directory where CEF keeps its include files and have the following CEF libraries installed:
libcef.so ; copied right into the DVPTZ build directory
CEF_PATH/build/libcef_dll_wrapper/libcef_dll_wrapper.a ; down under CEF_PATH somewhere
If you do not want to build in CEF support, edit or delete the following line in the Makefile: CEF := 1
if libndi.so is available during runtime, DVPTZ will attempt to open it and use the NDI functions it makes available.
Once you have installed all of the necessary libraries and have edited the Makefile appropriately (if necessary), building DVPTZ is simply a matter of invoking make:
$ make or $ make -f Makefile
In the simplest case, running DVPTZ is just a matter of invoking the executable, "dvptz". This will cause the program to invoke the "intro" executable by default, which will display status messages as the dvptz program starts. During this period, dvptz will scan your system ("/dev" directories) for cameras and microphones and various other audio sources. There are many startup flags and arguments allowing you to customize dvptz on startup as well as bypass the scan and specify exactly which audio and video sources you wish to have available during startup.
dvptz --source=/dev/video0
dvptz --source=/dev/video0::V4L
dvptz --source=/dev/video0[alias=Sony]
dvptz --source=/dev/video0::V4L:MJPG
dvptz --audio_source=alsa_input.usb-audio-technica____AT2020_USB-00.analog-stereo
dvptz --load=your_file.setup
dvptz --source=rtsp://your_login:your_password@url_for_your_webcam.org/live
dvptz --source=4
dvptz --main_width=1920
dvptz --main_width=1080
dvptz --width=640
dvptz --height=480
dvptz --auto_scale
dvptz --forced_scale=2.0
dvptz --output_width=1280
dvptz --output_height=720
dvptz --display_width=1280
dvptz --display_height=720
dvptz --fps=18
dvptz --interval=0.01
dvptz --split
dvptz --buffered
dvptz --flip=horizontal --flip=vertical
dvptz --no_audio
dvptz --old
dvptz --no_scan
dvptz --no_audio_scan
dvptz --scan_for_ptz
Record entire main window, encoding on exit. Usually used to make tutorial videos for the program itself.
dvptz --record_main_window
dvptz --record_desktop
dvptz --record_desktop=20,40,640,360
dvptz --multi_stream
dvptz --display_recording_camera
dvptz --recording_follows_display
dvptz --transition=blend
Allows for PTZ camera control using VISCA over the specified serial port. A colon following the path
dvptz --ptz=/dev/ttyUSB0:1
dvptz --ptz_home.
dvptz --detect
dvptz --yolo_cfg=cfg_filename --yolo_weights=weights_filename --yolo_names=names_filename
dvptz --yolo_model=coco
a custom server running at www.example.com on port 20000. Port 20001
dvptz --jpeg_streaming=www.example.com:20000
dvptz --streaming=rtmp://www.streaming_server.com/your_key
dvptz --streaming_only
dvptz --streaming_audio_quality=good
dvptz --embed_pip
dvptz --pip_position=0.8,0.1
dvptz --pip_highlight=255,128,64
dvptz --pip_size=0.35
dvptz --multipip=right
dvptz --grid_size=10
dvptz --desktop_monitor=my_null_sink
dvptz --no_query_codecs
dvptz --test_codecs
dvptz --timestamp
dvptz --disregard_settings
dvptz --transparent_interface
dvptz --no_frame_scaling
dvptz --crop_display
dvptz --crop_output
dvptz --transition=filename.so
dvptz --transition_plugin=transition_name
dvptz --filter_plugin_file=filename.so
dvptz --filter_plugin=filter_name
dvptz --capture_plugin_file=filename.so
dvptz --retain_commands dvptz --retain_cameras dvptz --retain_audio dvptz --retain_ptz
dvptz --lock_panels
dvptz --animate_panels
dvptz --exclude_directories
dvptz --hide_status
dvptz --select_camera=camera_name
dvptz --select_audio=audio_device_name
For example, when starting dvptz, I use the following options: --animate_panels --no_scan --source=/dev/v4l/by-id/usb-054c_SRG-120DU_Series-video-index0[alias="Sony SRG-120DU"] --source=/dev/v4l/by-id/usb-AVer_Inc._CAM520_5308138900019-video-index0::V4L2:MJPG[alias="Aver 520"] "--source=ndi_p216://NDI_HX (BZBGEAR-NDI-787264200195)"[alias="BZBGear"] --no_frame_scaling --yolo_model=coco --streaming_only --width=1280 --height=720 --container=flv --detect --ptz=udp://192.168.0.100:52381[alias="Sony"][lock="Sony SRG-120DU"][bind="Sony SRG-120DU"] --ptz=/dev/ttyUSB0[alias="Aver"][lock="Aver 520"][bind="Aver 520"] --ptz=tcp://192.168.0.146:1259[alias="BZBGear"][lock="BZBGear"][bind="BZBGear"] --recording_follows_display --message_delay=250000
This allows me to open my Sony SRG-120DU as a USV/UVC device, my AVer CAM520 as another USB/UVC device, and my BZBGear camera as an NDI device. I am setting up YOLO object detection using coco. I set the resolution to 1280 and 720 with a default container of FLV. I also setup PTZ over UDP for the Sony, through USB for the Aver, and through TCP (NDI) for the BZBGear camera. Furthermore, I set the system to record which ever camera is displayed.
Most, maybe all of these options can be set once within the program, as well as many more.
DVPTZ allows the user to save the state of the entire system as well as the state of any of the cameras or other sources. Within the program, or using the --source= flag, you can select between dozens of supported input sources. You can also set hundreds (thousands?) of combinations of containers, and audio and video codecs, for output files; the exact number depending on how many you have licensed/installed on your system and made available to the ffmpeg library. Many container formats for images, audio, and video are also available as input sources.
DVPTZ is also capable of streaming to the usual stream receiving websites, including Twitch, YouTube, and Facebook as well as any others that allow for RTMP protocol. DVPTZ can also be used as a NDI source on output for other programs, devices, or sites.
DVPTZ has many features including transitions; various sorts of plug-ins for audio and video effects and GUI elements; render HTML both locally and from the websites, including entire websites; drawing various directly on the screen, including fonts and text; picture in picture from multiple sources; detecting objects and labeling them; triggering recording based on object recognition, motion, time of day, interval, and changing light conditions. DVPTZ allows for multiple audio sources to be mixed or muted, including recording the output of other programs. The entire desktop or individual windows can also be captured as video sources, allowing for game-play to be streamed.
DVPTZ supports control over PTZ cameras using VISCA. If the camera does not provide VISCA through either USB, RS232, or TCP/UDP, DVPTZ will attempt to control the camera through the PTZ functions supported by V4L2. Through VISCA, DVPTZ supports pan, tilt, zoom, focus, as well as turning on and off many optional camera features such as autofocus, auto-exposure, and much more. Almost all of the VISCA parameters are adjustable.
DVPTZ's user interface was built primarily with FLTK, with a lot of help from Cairo and OpenCV. It provides many examples of how to do things with these libraries and also quite a few examples of how not to do things with the same libraries. As that much of this code is experimental and some of it is ill-advised, borrow and run this code at your own risk. I will support you in a haphazard and willy-nilly sort of way, so do not expect timely answers to questions, nor will I defend myself or this program from criticism of any sort. I'd rather have fun.
This source code is copyrighted by Mark Lasersohn (c) 2025. You are licensed to use any portion of it for any non-nefarious purpose. I am not responsible in any way for anything that happens to you or anyone else if you do. I make no claim that this program or any of the code you might lift from it does much of anything you might want. It might, but then I am not entirely sure you and I agree on terminology.
All of the libraries necessary to build and run DVPTZ are the property of the various license holders, and have nothing to do with me, really. I am attempting to abide by the terms of the LGPL (available all over the internet), as well as several other liberal open-source oriented licenses. It is possible to use DVPTZ to decode and encode audio and video using any codec you have installed on your system. That is up to you, not me. DVPTZ simply scans what you have made available and then uses whatever you tell it to use. If my program is using a library you authored and you would like some attribution, please let me know. I will be happy to include some words here or during startup to that effect. If you would like me to include your license tucked in among the source code, I will do that as well.
