---------
_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 ↗️](https://abhitronix.github.io/vidgear/latest/changelog/#v033-2024-06-22)**
---------
<div align="center">
<img src="https://abhitronix.github.io/vidgear/latest/assets/images/help_us.png" alt="PiGear" width="40%" />
<p><i>VidGear is free and open source and will always remain so. ❤️</i></p>
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 🙂
<a href='https://ko-fi.com/W7W8WTYO' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://cdn.ko-fi.com/cdn/kofi1.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>
</div>
What's Changed
New Features ✨
- **PiGear:**
+ **Official Support for [Picamera2](https://datasheets.raspberrypi.com/camera/picamera2-manual.pdf) 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 newer `picamera2` backends for clarity.
* **Advanced optional parameters handling:** Handles camera configurational parameters and user-defined settings for various camera types.
- **StreamGear:**
* Introduced new `-enable_force_termination` attribute for immediate FFmpeg process termination.
- **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.
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 manager `lifespan` in WebGear and WebGear_RTC APIs.
- NetGear_Async API:
* Changed launch method to use `self.loop.create_task()` instead of `asyncio.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.
- 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.
- NetGear:
* Handled socket session expiration more gracefully in `recv_handler`.
* Ensured proper termination of the ZMQ context and socket when closing the NetGear instance.
- WebGear:
* Enhanced error messages for WebGear auto-generation workflow.
- WriteGear:
* Improved error handling in `execute_ffmpeg_cmd` method.
- Setup.py:
* Dropped legacy `picamera` dependency in `setup.py`.
* Updated `pyzmq` version to address installation issues.
- Helper:
* Updated `extract_time` helper function regex to handle milliseconds.
Breaking Updates/Changes 💥
- StreamGear:
* 💣 **Deprecated `terminate()` method and introduce `close()` method.**
+ The `terminate()` method in StreamGear is now deprecated and will be removed in a future release. Developers should use the new `close()` method instead, which provides a more descriptive name like in WriteGear API for terminating StreamGear processes safely.
* 💣 **Deprecated `rgb_mode` parameter in `stream()` 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.
Bug-fixes 🐛
- PiGear:
* Modify PiGear class behavior when `enforce_legacy_picamera=True` on unsupported system.
- 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 the `recv_handler` method.
- CamGear:
* Fixed logging condition for yt-dlp.