Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core: More Minor API Bugfixes and Updates #409

Merged
merged 4 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ jobs:
run: |
pip install -U pip wheel
pip install "numpy<2.0.0"
pip install -U .[asyncio]
pip install -U .[asyncio] six httpx yt_dlp paramiko
pip uninstall opencv-python -y
pip install -U flake8 six codecov httpx pytest pytest-asyncio pytest-cov yt_dlp mpegdash paramiko m3u8 async-asgi-testclient
pip install -U flake8 codecov pytest pytest-asyncio pytest-cov mpegdash m3u8 async-asgi-testclient
pip install -U deffcode
if: success()
- name: run prepare_dataset_script
Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ install:
- "python --version"
- "python -m pip install --upgrade pip wheel"
- cmd: python -m pip install "numpy<2.0.0"
- "python -m pip install .[asyncio] six codecov httpx yt_dlp aiortc paramiko"
- "python -m pip install pytest pytest-cov pytest-asyncio m3u8 async-asgi-testclient"
- "python -m pip install --upgrade .[asyncio] six httpx yt_dlp aiortc"
- "python -m pip install --upgrade pytest codecov pytest-cov pytest-asyncio m3u8 async-asgi-testclient paramiko"
- "python -m pip install --upgrade deffcode"
- "python -m pip install https://github.com/abhiTronix/python-mpegdash/releases/download/0.3.0-dev2/mpegdash-0.3.0.dev2-py3-none-any.whl"
- cmd: chmod +x scripts/bash/prepare_dataset.sh
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ steps:
- script: |
python -m pip install -U pip wheel
python -m pip install "numpy<2.0.0"
python -m pip install -U .[asyncio]
python -m pip install -U six codecov httpx pytest pytest-asyncio pytest-cov yt_dlp mpegdash paramiko m3u8 async-asgi-testclient
python -m pip install -U .[asyncio] yt_dlp httpx six paramiko
python -m pip install -U codecov pytest pytest-asyncio pytest-cov mpegdash m3u8 async-asgi-testclient
python -m pip install -U deffcode
displayName: "Install pip dependencies"

Expand Down
12 changes: 6 additions & 6 deletions docs/gears/writegear/compression/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ limitations under the License.

* **DO NOT** feed frames with different dimensions or channels to WriteGear, otherwise WriteGear will exit with `ValueError`.

* While providing additional av-source with `-i` FFmpeg parameter in `output_params` make sure it don't interfere with WriteGear's frame pipeline otherwise it will break things!
* When using the `-i` FFmpeg parameter in `output_params` to provide an additional audio or video source, ensure it **DOES NOT** interfere with WriteGear's internal frame pipeline. Interference can cause the pipeline to break.

* Use [`-disable_force_termination`](../params/#supported-parameters) flag when video duration is too short(<60sec), otherwise WriteGear will not produce any valid output.
* To ensure WriteGear produces valid output when using an additional stream `-i` parameter with videos shorter than `60` seconds, use the [`-disable_force_termination`](../params/#supported-parameters) flag.

* Heavy resolution multimedia files take time to render which can last up to _0.1-1 seconds_. Kindly wait till the WriteGear API terminates itself, and **DO NOT** try to kill the process instead.
* Encoding heavy resolution multimedia files can take up to _~0.2 to 2 seconds_. Please wait for the WriteGear API to terminate itself and **DO NOT** kill the process manually.

* Always use `writer.close()` at the very end of the main code. **NEVER USE IT INBETWEEN CODE** to avoid undesired behavior.

Expand All @@ -47,7 +47,7 @@ limitations under the License.

Following is the bare-minimum code you need to get started with WriteGear API in Compression Mode:

```python linenums="1"
```python linenums="1" hl_lines="10 25 42"
# import required libraries
from vidgear.gears import CamGear
from vidgear.gears import WriteGear
Expand Down Expand Up @@ -168,7 +168,7 @@ WriteGear API provides [`-input_framerate`](../params/#supported-parameters) at

In this code we will retrieve framerate from video stream, and set it as `-input_framerate` attribute for `option` parameter in WriteGear API:

```python linenums="1" hl_lines="10"
```python linenums="1" hl_lines="10 13"
# import required libraries
from vidgear.gears import CamGear
from vidgear.gears import WriteGear
Expand Down Expand Up @@ -584,7 +584,7 @@ In this example code, we will merging the audio from a Audio Device _(for e.g. W

!!! warning "You **MUST** use [`-input_framerate`](../params/#supported-parameters) attribute to set exact value of input framerate when using external audio in Real-time Frames mode, otherwise audio delay will occur in output streams."

```python linenums="1" hl_lines="11-15"
```python linenums="1" hl_lines="11-16"
# import required libraries
from vidgear.gears import VideoGear
from vidgear.gears import WriteGear
Expand Down
15 changes: 8 additions & 7 deletions docs/gears/writegear/non_compression/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ limitations under the License.

Following is the bare-minimum code you need to get started with WriteGear API in Non-Compression Mode:

```python linenums="1"
```python linenums="1" hl_lines="10"
# import required libraries
from vidgear.gears import CamGear
from vidgear.gears import WriteGear
Expand Down Expand Up @@ -97,7 +97,7 @@ In Non-Compression mode, WriteGear API provides flexible control over [**OpenCV'

The complete usage example is as follows:

```python linenums="1"
```python linenums="1" hl_lines="7 15"
# import required libraries
from vidgear.gears import VideoGear
from vidgear.gears import WriteGear
Expand All @@ -109,12 +109,12 @@ output_params = {"-fourcc": "MJPG", "-fps": 30}
# open live video stream on webcam at first index(i.e. 0) device
stream = VideoGear(source=0, logging=True).start()

# Define writer with defined parameters and suitable output filename for e.g. `Output.mp4`
# Define writer with defined parameters and suitable output filename
# for e.g. `Output.mp4`
writer = WriteGear(
output="Output.mp4", compression_mode=False, logging=True, **output_params
)


# loop over
while True:

Expand Down Expand Up @@ -159,7 +159,7 @@ writer.close()

You can easily use WriterGear API directly with any Video Processing library(_For e.g OpenCV itself_) in Non-Compression Mode. The complete usage example is as follows:

```python linenums="1"
```python linenums="1" hl_lines="9 21 46"
# import required libraries
from vidgear.gears import WriteGear
import cv2
Expand All @@ -170,7 +170,8 @@ output_params = {"-fourcc": "MJPG", "-fps": 30}
# Open suitable video stream, such as webcam on first index(i.e. 0)
stream = cv2.VideoCapture(0)

# Define writer with defined parameters and suitable output filename for e.g. `Output.mp4`
# Define writer with defined parameters and suitable output filename
# for e.g. `Output.mp4`
writer = WriteGear(
output="Output.mp4", compression_mode=False, logging=True, **output_params
)
Expand Down Expand Up @@ -227,7 +228,7 @@ writer.close()

In this example we will be constructing GStreamer pipeline to write video-frames into a file(`foo.mp4`) at 1M video-bitrate.

```python linenums="1"
```python linenums="1" hl_lines="12-14"
# import required libraries
from vidgear.gears import WriteGear
import cv2
Expand Down
20 changes: 10 additions & 10 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,31 +231,31 @@ nav:
- Parameters: gears/camgear/params.md
- Bonus:
- Source Tweak Parameters: gears/camgear/advanced/source_params.md
- API References: bonus/reference/camgear.md
- CamGear API References: bonus/reference/camgear.md
- Bonus Examples: help/camgear_ex.md
- FAQs: help/camgear_faqs.md
- PiGear:
- Overview: gears/pigear/overview.md
- Usage Examples: gears/pigear/usage.md
- Parameters: gears/pigear/params.md
- Bonus:
- API References: bonus/reference/pigear.md
- PiGear API References: bonus/reference/pigear.md
- Bonus Examples: help/pigear_ex.md
- FAQs: help/pigear_faqs.md
- VideoGear:
- Overview: gears/videogear/overview.md
- Usage Examples: gears/videogear/usage.md
- Parameters: gears/videogear/params.md
- Bonus:
- API References: bonus/reference/videogear.md
- VideoGear API References: bonus/reference/videogear.md
- Bonus Examples: help/videogear_ex.md
- FAQs: help/videogear_faqs.md
- ScreenGear:
- Overview: gears/screengear/overview.md
- Usage Examples: gears/screengear/usage.md
- Parameters: gears/screengear/params.md
- Bonus:
- API References: bonus/reference/screengear.md
- ScreenGear API References: bonus/reference/screengear.md
- Bonus Examples: help/screengear_ex.md
- FAQs: help/screengear_faqs.md
- WriteGear:
Expand All @@ -272,7 +272,7 @@ nav:
- Usage Examples: gears/writegear/non_compression/usage.md
- Parameters: gears/writegear/non_compression/params.md
- Bonus:
- API References: bonus/reference/writegear.md
- WriteGear API References: bonus/reference/writegear.md
- Bonus Examples: help/writegear_ex.md
- FAQs: help/writegear_faqs.md
- StreamGear:
Expand All @@ -285,7 +285,7 @@ nav:
- Usage Examples: gears/streamgear/rtfm/usage.md
- Parameters: gears/streamgear/params.md
- Bonus:
- API References: bonus/reference/streamgear.md
- StreamGear API References: bonus/reference/streamgear.md
- FFmpeg Installation: gears/streamgear/ffmpeg_install.md
- Bonus Examples: help/streamgear_ex.md
- FAQs: help/streamgear_faqs.md
Expand All @@ -301,7 +301,7 @@ nav:
- Frame Compression: gears/netgear/advanced/compression.md
- Parameters: gears/netgear/params.md
- Bonus:
- API References: bonus/reference/netgear.md
- NetGear API References: bonus/reference/netgear.md
- Bonus Examples: help/netgear_ex.md
- FAQs: help/netgear_faqs.md
- WebGear:
Expand All @@ -310,7 +310,7 @@ nav:
- Advanced Usages: gears/webgear/advanced.md
- Parameters: gears/webgear/params.md
- Bonus:
- API References: bonus/reference/webgear.md
- WebGear API References: bonus/reference/webgear.md
- Bonus Examples: help/webgear_ex.md
- FAQs: help/webgear_faqs.md
- WebGear_RTC:
Expand All @@ -319,7 +319,7 @@ nav:
- Advanced Usages: gears/webgear_rtc/advanced.md
- Parameters: gears/webgear_rtc/params.md
- Bonus:
- API References: bonus/reference/webgear_rtc.md
- WebGear_RTC API References: bonus/reference/webgear_rtc.md
- Bonus Examples: help/webgear_rtc_ex.md
- FAQs: help/webgear_rtc_faqs.md
- NetGear_Async:
Expand All @@ -329,7 +329,7 @@ nav:
- Bidirectional Mode: gears/netgear_async/advanced/bidirectional_mode.md
- Parameters: gears/netgear_async/params.md
- Bonus:
- API References: bonus/reference/netgear_async.md
- NetGear_Async API References: bonus/reference/netgear_async.md
- Bonus Examples: help/netgear_async_ex.md
- FAQs: help/netgear_async_faqs.md
- Stabilizer Class:
Expand Down
16 changes: 13 additions & 3 deletions vidgear/gears/asyncio/webgear.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,9 @@ async def __homepage(self, request):
self.__templates.TemplateResponse(request, "index.html")
if not self.__skip_generate_webdata
else JSONResponse(
{"detail": "WebGear Data-Files Auto-Generation WorkFlow is disabled!"},
{
"detail": "MESSAGE : WebGear Data-Files Auto-Generation WorkFlow is disabled!"
},
status_code=404,
)
)
Expand All @@ -518,7 +520,11 @@ async def __not_found(self, request, exc):
self.__templates.TemplateResponse(request, "404.html", status_code=404)
if not self.__skip_generate_webdata
else JSONResponse(
{"detail": "WebGear Data-Files Auto-Generation WorkFlow is disabled!"},
{
"detail": "ERROR : {} :: MESSAGE : WebGear Data-Files Auto-Generation WorkFlow is disabled.".format(
exc.detail
)
},
status_code=404,
)
)
Expand All @@ -531,7 +537,11 @@ async def __server_error(self, request, exc):
self.__templates.TemplateResponse(request, "500.html", status_code=500)
if not self.__skip_generate_webdata
else JSONResponse(
{"detail": "WebGear Data-Files Auto-Generation WorkFlow is disabled!"},
{
"detail": "ERROR : {} :: MESSAGE : WebGear Data-Files Auto-Generation WorkFlow is disabled.".format(
exc.detail if hasattr(exc, "detail") else repr(exc)
)
},
status_code=500,
)
)
Expand Down
2 changes: 1 addition & 1 deletion vidgear/gears/camgear.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def __init__(self, source_url, logging=False, **stream_params):
"format": "best*[vcodec!=none]",
"quiet": True,
"prefer_insecure": False,
"no_warnings": True if logging else False,
"no_warnings": False if logging else True,
"dump_single_json": True,
"extract_flat": True,
"skip_download": True,
Expand Down
Loading