This update significantly enhances Vidgear's capabilities, ensuring better performance, broader compatibility, and improved user experience. The introduction of the Picamera2 API support, enhanced error handling, and detailed documentation updates are pivotal in making Vidgear more robust and user-friendly.
📓 Complete Release Notes can be found here
VidGear is free and open source and will always remain so. ❤️
It is something I am doing with my own free time. But so much more needs to be done, and I need your help to do this. For just the price of a cup of coffee, you can make a difference 🙂
What's Changed
New Features ✨
- PiGear:
- Official Support for Picamera2 API backend:
- This massive update brings official support for the new Picamera2 API, unlocking powerful features for Raspberry Pi Camera Modules and limited USB camera support.
- Seamless Python wrapper: A robust wrapper around Picamera2 API library simplifies integration with minimal code changes for existing PiGear users.
- Enhanced camera control: Leverages libcamera API under the hood for Raspberry Pi Camera Modules.
- Existing compatibility: Maintains compatibility with PiGear's existing super-charged multi-threaded and colorspace manipulation framework.
- Proper Resource management: Ensures proper resource release during PiGear termination.
- USB camera support (limited): Provides basic functionality for USB webcams. PiGear could accurately differentiates between USB and Raspberry Pi cameras using metadata.
- Backward compatibility: Seamlessly switches to the legacy Picamera library backend if Picamera2 is unavailable.
- Standalone functionalities: Standalone functionalities for both legacy
picamera
and newerpicamera2
backends for clarity. - Advanced optional parameters handling: Handles camera configurational parameters and user-defined settings for various camera types.
- Official Support for Picamera2 API backend:
- StreamGear:
- Introduced new
-enable_force_termination
attribute for immediate FFmpeg process termination.
- Introduced new
- Helper:
- Added support for SRTP/RTSPS in
is_valid_url
function:- SRTP/RTSPS extends RTSP/RTP to encrypt video and audio data using the same ciphers as HTTPS, typically AES with a 128-bit key length.
- Added a custom deprecated decorator to mark deprecated functions and parameters.
- Added support for SRTP/RTSPS in
Updates/Improvements ⚡️
- Core:
- Improved exception handling for module imports.
- Improved colorspace handling in videocapture gears.
- Asyncio:
- Replaced deprecated Starlette's
on_shutdown
parameter with an async context managerlifespan
in WebGear and WebGear_RTC APIs.
- Replaced deprecated Starlette's
- NetGear_Async API:
- Changed launch method to use
self.loop.create_task()
instead ofasyncio.ensure_future()
- Moved the event loop initialization code to an earlier point before setting event loop policy to ensure it is set up correctly before selecting
WindowsSelectorEventLoop
policy.
- Changed launch method to use
- StreamGear:
- Updated
close()
methods for handling gracefully signal interruptions based on different operating systems with device audio streams. - Enhanced stream copy support in Single Source mode.
- Updated
- NetGear:
- Handled socket session expiration more gracefully in
recv_handler
. - Ensured proper termination of the ZMQ context and socket when closing the NetGear instance.
- Handled socket session expiration more gracefully in
- WebGear:
- Enhanced error messages for WebGear auto-generation workflow.
- WriteGear:
- Improved error handling in
execute_ffmpeg_cmd
method.
- Improved error handling in
- Setup.py:
- Dropped legacy
picamera
dependency insetup.py
. - Updated
pyzmq
version to address installation issues.
- Dropped legacy
- Helper:
- Updated
extract_time
helper function regex to handle milliseconds.
- Updated
Breaking Updates/Changes 💥
- StreamGear:
- 💣 Deprecated
terminate()
method and introduceclose()
method.- The
terminate()
method in StreamGear is now deprecated and will be removed in a future release. Developers should use the newclose()
method instead, which provides a more descriptive name like in WriteGear API for terminating StreamGear processes safely.
- The
- 💣 Deprecated
rgb_mode
parameter instream()
method.- This parameter will be removed in a future version, and only BGR format frames will be supported.
- 💣 Restricted
-livestream
parameter to Real-time Frames Mode only.- Live streaming is intended for low-latency streaming of real-time frames, where chunks contain only the most recent frames. It doesn't make sense when streaming from a video file, as the entire file can be streamed normally without the need for live streaming.
- 💣 Deprecated
Bug-fixes 🐛
- PiGear:
- Modify PiGear class behavior when
enforce_legacy_picamera=True
on unsupported system.
- Modify PiGear class behavior when
- StreamGear:
- Removed non-essential aspect ratio parameter to prevent unwanted distortions.
- NetGear:
- Fixed Secure Mode failing to work on conflicting ZMQ Contexts.
- Fixed
msg_json
undefined when terminating context in therecv_handler
method.
- CamGear:
- Fixed logging condition for yt-dlp.