All Projects → joelibaceta → Video To Ascii

joelibaceta / Video To Ascii

Licence: mit
It is a simple python package to play videos in the terminal using characters as pixels

Programming Languages

python
139335 projects - #7 most used programming language
python3
1442 projects
bash
514 projects

Projects that are alternatives of or similar to Video To Ascii

Ervy
Bring charts to terminal.
Stars: ✭ 1,530 (+59.38%)
Mutual labels:  cli, terminal, console, ascii
Tqdm
A Fast, Extensible Progress Bar for Python and CLI
Stars: ✭ 20,632 (+2049.17%)
Mutual labels:  cli, terminal, console
Csconsoleformat
.NET C# library for advanced formatting of console output [Apache]
Stars: ✭ 296 (-69.17%)
Mutual labels:  terminal, console, ascii
Npx card
use npx anmol to connect with me
Stars: ✭ 377 (-60.73%)
Mutual labels:  cli, terminal, opensource
Tui Consolelauncher
Linux CLI Launcher for Android
Stars: ✭ 861 (-10.31%)
Mutual labels:  cli, terminal, console
Simpletable
Simple tables in terminal with Go
Stars: ✭ 288 (-70%)
Mutual labels:  cli, terminal, ascii
Radian
A 21 century R console
Stars: ✭ 878 (-8.54%)
Mutual labels:  cli, terminal, console
Laravel Zero
A PHP framework for console artisans
Stars: ✭ 2,821 (+193.85%)
Mutual labels:  cli, terminal, console
Yaspin
A lightweight terminal spinner for Python with safe pipes and redirects 🎁
Stars: ✭ 413 (-56.98%)
Mutual labels:  cli, terminal, console
Pulsemixer
CLI and curses mixer for PulseAudio
Stars: ✭ 441 (-54.06%)
Mutual labels:  cli, terminal, console
Progressbar
Terminal-based progress bar for Java / JVM
Stars: ✭ 625 (-34.9%)
Mutual labels:  cli, terminal, console
Nestjs Console
A nestjs module that provide a cli to your application.
Stars: ✭ 284 (-70.42%)
Mutual labels:  cli, terminal, console
Chalk
🖍 Terminal string styling done right
Stars: ✭ 17,566 (+1729.79%)
Mutual labels:  cli, terminal, console
Consola
Elegant Console Logger for Node.js and Browser 🐨
Stars: ✭ 3,461 (+260.52%)
Mutual labels:  cli, terminal, console
Tty Markdown
Convert a markdown document or text into a terminal friendly output.
Stars: ✭ 275 (-71.35%)
Mutual labels:  cli, terminal, console
Stig
TUI and CLI for the BitTorrent client Transmission
Stars: ✭ 360 (-62.5%)
Mutual labels:  cli, terminal, console
Terminaltables
Generate simple tables in terminals from a nested list of strings.
Stars: ✭ 685 (-28.65%)
Mutual labels:  terminal, console, ascii
Jquery.terminal
jQuery Terminal Emulator - JavaScript library for creating web-based terminals with custom commands
Stars: ✭ 2,623 (+173.23%)
Mutual labels:  cli, terminal, console
S Tui
Terminal-based CPU stress and monitoring utility
Stars: ✭ 2,825 (+194.27%)
Mutual labels:  cli, terminal, console
Mordant
Full-featured text styling for Kotlin command-line applications
Stars: ✭ 382 (-60.21%)
Mutual labels:  terminal, console, ansi-colors

Logo

It's a simple python package to play videos in a terminal using ASCII characters.

Financial Contributors on Open Collective PyPI version Maintainability contributions welcome HitCount

Screenshot

Translations

Requirements

  • Python3
  • PortAudio (Only required for installation with audio support)
  • FFmpeg (Only required for installation with audio support)
  • Linux or MacOS ... by now

Installation

Standard installation

$ pip3 install video-to-ascii

With audio support installation

$ pip3 install video-to-ascii --install-option="--with-audio"

How to use

Just run video-to-ascii in your terminal

$ video-to-ascii -f myvideo.mp4

Options

--strategy Allow to choose an strategy to render the output.

Render Strategies

-o --output Export the rendering output to a bash file to share with someone.

Exporting

-a --with-audio If an installation with audio support was made, you can use this option to play the audio track while rendering the video ascii characters.

How it works

Every video is composed by a set of frames that are played at a certain frame rate.

Video Frames

Since a terminal has a specific number of rows and columns, we have to resize our video to adjust to the terminal size limitations.

Terminal

To reach a correct visualization of an entire frame we need to adjust the frame height to match the terminal rows, avoiding using more characters than the number of terminal columns.

Resizing

When picking a character to represent a pixel we need to measure the relevance of that pixel's color in the frame, based on that we can then select the most appropriate character based on the relative luminance in colorimetric spaces, using a simplify version of the luminosity function.

Green light contributes the most to the intensity perceived by humans, and blue light the least.

This function returns an integer in the range from 0 to 255, we assign a character according to density to show more colored surface for areas with more intense color (highest values).

CHARS_LIGHT 	= [' ', ' ', '.', ':', '!', '+', '*', 'e', '$', '@', '8']
CHARS_COLOR 	= ['.', '*', 'e', 's', '@']
CHARS_FILLED    = ['░', '▒', '▓', '█']

The reduced range of colors supported by the terminal is a problem we need to account for. Modern terminals support up to 256 colors, so we need to find the closest 8 bit color that matches the original pixel in 16 or 24 bit color, we call this set of 256 colors ANSI colors.

The Mapping of RGB and ANSI Colors

8 Bits Color Table

Finally, when putting it all together, we will have an appropriate character for each pixel and a new color.

Frame Image by Characters

Contributors

Code Contributors

This project exists thanks to all the people who contribute. [Contribute].

Financial Contributors

Become a financial contributor and help us sustain our community. [Contribute].

Or maybe just buy me a coffee.

Individuals

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].