semvec/pypi-packages huggingface dataset:
cap-from-youtube-opts 0.0.10.1
Get an OpenCV video capture from an YouTube video URL + ydl_opts
License: MIT

# cap_from_youtube
 Get an OpenCV video capture from an YouTube video URL + ydl_opts

[![PyPI](https://img.shields.io/pypi/v/cap-from-youtube_opts?color=2BAF2B)](https://pypi.org/project/cap-from-youtube_opts/)
<p align="center">
  <img src="https://raw.githubusercontent.com/ibaiGorordo/cap_from_youtube/main/doc/img/cap_from_youtube_logo.png" />
</p>

# Why
- pafy is widely used to get the video URL from a YouTube video URL, but since it uses youtube-dl which has not been updated recently, it suffers from some issues (dislike_count not found...).
- This repository is a simplified version of what pafy does, by just getting the url of the video and creating an OpenCV video capture from it.
- It uses YT-DLP (https://github.com/yt-dlp/yt-dlp), which is a fork of youtube-dl that is updated frequently.

# Requirement
* YT-DLP
* OpenCV
* NumPy
 
# Installation
- The easiest way is to install it with pip:

```bash
pip install cap_from_youtube
```
- You can also install it from GitHub:

```bash
pip install git+https://github.com/ibaiGorordo/cap_from_youtube
```

# Usage

## cap_from_youtube()
- `cap_from_youtube()` is the main function to obtain a video capture from a YouTube video URL. 
- It requires the video URL as input and returns a `cv2.VideoCapture` object.
- By default, it returns the video with the highest resolution available.
- You can specify the resolution you want to get with the `resolution` parameter.
  - Resolution examples: '144p', '240p', '360p', '480p', '720p', '1080p', '1440p', '2160p', 'best'
- Example:

```python
import cv2
from cap_from_youtube import cap_from_youtube

youtube_url = 'https://youtu.be/LXb3EKWsInQ'
cap = cap_from_youtube(youtube_url, '1440p60')

cv2.namedWindow('video', cv2.WINDOW_NORMAL)
while True:
    ret, frame = cap.read()
    if not ret:
        break
    cv2.imshow('video', frame)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break
```

## list_video_streams()
- You can also use the `list_video_streams()` function to get the list of available video streams.
- It requires the video URL as input and returns two values: 
  - streams: a list of VideoStream with the information of the available video streams.
  - resolutions: a NumPy array with the available resolutions.
- Example:
```python
from cap_from_youtube import list_video_streams

youtube_url = 'https://youtu.be/LXb3EKWsInQ'
streams, resolutions = list_video_streams(youtube_url)

for stream in streams:
    print(stream)
```
 
# References
- pafy: https://github.com/mps-youtube/pafy
- yt-dlp: https://github.com/yt-dlp/yt-dlp
- imread_from_url: https://github.com/Kazuhito00/imread_from_url
rsilk 0.1.4
silk encoding and decoding for python
License: MIT
Requires Python: >=3.6
Keywords: silk,pcm,audio

<h1 align="center"><i>✨ rsilk ✨ </i></h1>

<h3 align="center">The python binding for <a href="https://github.com/lz1998/silk-rs">silk-rs</a> </h3>


[![pypi](https://img.shields.io/pypi/v/rsilk.svg)](https://pypi.org/project/rsilk/)
![python](https://img.shields.io/pypi/pyversions/rsilk)
![implementation](https://img.shields.io/pypi/implementation/rsilk)
![wheel](https://img.shields.io/pypi/wheel/rsilk)
![license](https://img.shields.io/github/license/synodriver/rsilk.svg)
![action](https://img.shields.io/github/workflow/status/synodriver/rsilk/build%20wheel)




## Usage

- encode

```python
import rsilk

with open("tests/input.pcm", "rb") as f:
    data = f.read()

output = rsilk.encode(data, 24000, 24000)
with open("output.silk", "wb") as f:
    f.write(output)
```

- decode

```python
import rsilk

with open("input.silk", "rb") as f:
    data = f.read()

output = rsilk.decode(data, 24000)
with open("output.pcm", "wb") as f:
    f.write(output)
```

### Exceptions

- SilkError

### Public functions

- def decode(src: bytes, sample_rate: int, frame_size: int = 0, frames_per_packet: int = 1, more_internal_decoder_frames: bool = False, in_band_fec_offset: int = 0, loss: bool = False) -> bytes


- def encode(input: bytes, sample_rate: int, bit_rate: int, max_internal_sample_rate: int = 24000, packet_loss_percentage: int = 0, complexity: int = 2, use_inband_fec: bool = False, use_dtx: bool = False, tencent: bool = True) -> bytes