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.tar.gz (6.9 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-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: video_toolkits-0.3.tar.gz
  • Upload date:
  • Size: 6.9 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.tar.gz
Algorithm Hash digest
SHA256 d6c17ccc0d1edecfddb03514baf6c6eb8441b52b2c357b499400358530febec2
MD5 e0961447ebf07e2bd30859d8d9faba5a
BLAKE2b-256 ebc067904362372a03f574b4571e6f65b8b8887217fb669d888585d17c062062

See more details on using hashes here.

File details

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

File metadata

  • Download URL: video_toolkits-0.3-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-py3-none-any.whl
Algorithm Hash digest
SHA256 116fec2c2af737bed0ad4af54698f9f0ee46cbd8ed9dd254eb736905799ab3a7
MD5 3a651cd6805106c5bfdd58836ba5cbe6
BLAKE2b-256 1a08a8dd73d60b5445107722cfb51dc51f8ef72ff5616dfd2a39a9bc59b9309f

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