Metadata-Version: 2.1
Name: video-toolkits
Version: 0.3.4
Summary: Toolkits for read/write video
Home-page: https://github.com/Celeste-cj/video_toolkits
Author: Celeste-cj
Author-email: jingc2015@pku.edu.cn
License: MIT
Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6.0
Description-Content-Type: text/markdown
Requires-Dist: opencv-python
Requires-Dist: av


:movie_camera: video_toolkits
=======================

This repo provides functions to read/write a video and draw keypoints.

** Defult BGR **

Installation
-----

```bash
git clone https://github.com/Celeste-cj/video_toolkits.git
cd video_toolkits
python setup.py install
```

How To Use
-----

### VideoReader  

```python
from video_toolkits import VideoReader, VideoReaderCV2

video_path = 'path to video'
reader = VideoReader(video_path)            # VideoReader - pyav, only support video file/stream
# reader = VideoReader(0)                   # webcam 0   VideoReaderCV2 support
for img in reader:
    pass
```


### VideoWriter 

```python
from video_toolkits import VideoWriter

img_seqs = []
out_path = '{VIDEO_NAME}.mp4'                     # currently support .mp4/.avi
succeed = VideoWriter.imgseq2video(img_seqs, out_path, fps=30)
```

### Convert flv to mp4

```python
from video_toolkits import flv2mp4

input_vid = "{INPUT_FOLDER}/{VID_NAME}.flv"
output_folder = "{OUTPUT_FOLDER}"                 # if output_folder == '', will use {INPUT_FOLDER}
succeed = flv2mp4(input_vid, out_folder=output_folder) 
```

### Visualization

```python
from video_toolkits import display, draw_sklts, put_text, draw_bbox
from video_toolkits import draw_points, draw_lines

img = None
kpts = []                       # default (22, 4)
text = ""
bbox = []

display(img)                       # plot image with matplotlib.pyplot
img = draw_sklts(img, kpts, color=None, sklts=None)          # draw skeletons
img = put_text(img, text)                                    # put text
img = draw_bbox(img, bbox)

img = draw_points(img, [[0, 0], [1, 1]])
img = draw_lines(img, [[0, 0]], [[1, 1]], arrowed=False)
```

### load/dump json

```python
from video_toolkits import load_json, dump_json

json_obj = []
file_path = ""

annts = load_json(file_path)
dump_json(json_obj, file_path)
```

License
-------

This is free and unencumbered software released into the public domain.

Anyone is free to copy, use, compile this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.


