Skip to main content

Toolkits for read/write video

Project description

:movie_camera: video_toolkits

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

** Defult BGR **

Installation

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

How To Use

VideoReader

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

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

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

from video_toolkits import display, draw_sklts, put_text, draw_bbox
                                                                   
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)

FFmpeg

from video_toolkits import trim_video, push_rtmp

input_video_path = ""
output_video_path = ""

start_at = 60             # trim video start at 60 second
duration = 60             # or end_at = 120
                          # if both end_at and duration is not given, will trim the video till the end
trim_video(input_video_path, output_video_path, duration=duration)

rtmp_play_url = "rtmp://{host}/live/{stream_name}"
push_rtmp(input_video_path, rtmp_play_url, loop=False)

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

video_toolkits-0.3.1.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

video_toolkits-0.3.1-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file video_toolkits-0.3.1.tar.gz.

File metadata

  • Download URL: video_toolkits-0.3.1.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.6.13

File hashes

Hashes for video_toolkits-0.3.1.tar.gz
Algorithm Hash digest
SHA256 856acbc7594adb3a0756ba438475fbac21eaa39eae5cecf32c21c7835817e4f3
MD5 4f720f6617663836b8bac8992e8edeed
BLAKE2b-256 7ddfde889b76b1452fa56bf06afdee08964a3013e03eb8f0d6a6dd77211acca4

See more details on using hashes here.

File details

Details for the file video_toolkits-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: video_toolkits-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.6.13

File hashes

Hashes for video_toolkits-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a3b99c28dfdb3e688a3db3f2fabe473ee6f5d700e9132e48fedc1b2b6f25d534
MD5 eaa0f8030e9c599fcb674a3fdd55aa18
BLAKE2b-256 f3fc86fd0646bd75661aab3caa60d51a34635363816c750d35ff951715ff614f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page