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. Not working for now since it is the known issue of durdraw (or Python's curses), see more here

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)](codeberg.org/fairyglade/ly/)

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.2.0.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.

dur_converter-0.2.0-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dur_converter-0.2.0.tar.gz
  • Upload date:
  • Size: 6.4 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.2.0.tar.gz
Algorithm Hash digest
SHA256 ce0f76af7650ef464fa02652923f19b830f4999522993f3ebbb8946516dd83b0
MD5 2777fb5cca64dc35bd883ad0d638229b
BLAKE2b-256 a432c26fec9fe51b13857b0bf9449ae5c63996bff68bb0f42e0d2369665b45a4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dur_converter-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.5 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dbca0b74c410ffbdeb9db22a5e484311cdd2091f07b428ee7d7b5af5fe5eb0a5
MD5 5476bf15dccf00434e64ee18aac6c71d
BLAKE2b-256 881e0e2a7fa8a25f06f8f5da035322a55076684b2cdee49ce21e1f22cf3eea5f

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