Skip to main content

A simple converter CLI that convert your video into .dur file

Project description

dur_convert

A simple converter CLI that convert your video into .dur file

I. Introduction

As said in the description, this is a tool to convert a video into .dur file format (specifically version 7). See more about the .dur format

It first slicing video into multiple image, then convert the image into an ansi and note down the color at the position.

Normally, a terminal character height is double compare to its width, so this project use a trick is using the upper half block unicode character ("▀"), then using foreground and blackground coloring, treating a character as 2 pixels.

II. Installation

You can install it from PYPI using your favorite tool:

pip install dur_converter

Or

uv add converter

Then calling it with using dc keyword:

dc --help
# usage: dc [-h] [-R <Width>x<Heigth>] [-c COL] [-r ROW] [-f FPS] [-o OUTPUT] input
# 
# A simple python script that convert your video into .dur file
# 
# positional arguments:
#   input                 the input
# 
# options:
#   -h, --help            show this help message and exit
#   -R, --resolution <Width>x<Heigth>
#                         the target output resolution
#   -c, --col COL         the target output width, will be overwritten --resolution flag
#   -r, --row ROW         the target output height, will be overwritten --resolution flag
#   -f, --fps FPS         the target output frame-per-second
#   -o, --output OUTPUT   output destination, default to ./data/out.dur
# 
# Originally, this software is targetted for Ly (a screen manager for Linux)

Or using uvx

uvx --from dur_converter dc --help
# usage: dc [-h] [-R <Width>x<Heigth>] [-c COL] [-r ROW] [-f FPS] [-o OUTPUT] input
# 
# A simple python script that convert your video into .dur file
# 
# positional arguments:
#   input                 the input
# 
# options:
#   -h, --help            show this help message and exit
#   -R, --resolution <Width>x<Heigth>
#                         the target output resolution
#   -c, --col COL         the target output width, will be overwritten --resolution flag
#   -r, --row ROW         the target output height, will be overwritten --resolution flag
#   -f, --fps FPS         the target output frame-per-second
#   -o, --output OUTPUT   output destination, default to ./data/out.dur
# 
# Originally, this software is targetted for Ly (a screen manager for Linux)

III. Usage

Note: This some part of this usage guide is built intentionally for Ly (a screen manager for Linux), which will be noted with asterisk "*"

1. Download your video and put it somewhere, saying /path/to/video

2. Call the converter

dc -c 240 -r 150 -f 5 -o /path/to/output /path/to/video

Here, specify your:

  • Resolution with flag --row and --col or flag --resolution. Recommending

    Recommending 240x150 *

  • (Optionally) FPS with flag --fps, this flag will downsample your video, or in other word, slicing your video to reduce the size of the output.

    Recommending 5 FPS for video under 10 secs and 1-2 for longer. *

  • (Optionally) the output path with --output, if it is not specified, default to ./data/out.dur

Note: The input and output path must be the path to input and output FILE, not DIRECTORY

3. Wait for it running:

dc -c 240 -r 150 -f 5 data/blackhole.mp4
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 105/104.58333333333334 [00:03<-00:00, 27.24it/s]
Done :D

4. Grab the result :D

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

dur_converter-0.1.2.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

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

dur_converter-0.1.2-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file dur_converter-0.1.2.tar.gz.

File metadata

  • Download URL: dur_converter-0.1.2.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for dur_converter-0.1.2.tar.gz
Algorithm Hash digest
SHA256 c8b2341e9a2aa95c926553c6be3e062b32bd0a20241235de13cd887897196399
MD5 7eb02dba97db46b31df978b8f42fbb6a
BLAKE2b-256 f4ea84848c4577d55cdc8a128579900f2f305b780de24d86fe6fc6f2d2bee276

See more details on using hashes here.

File details

Details for the file dur_converter-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: dur_converter-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for dur_converter-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 aeb7fa31cac0034317a0bb48ccc9afde82692d65f2ee2265e4c92dc5d61a72c5
MD5 b0fd866b006d84ee83ab421b2bbf6ccb
BLAKE2b-256 8a3c87150baf67ec8551f52c861ea115b6e33cfcf6b700502013ef9f60dfdda8

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