MIT License

项目介绍

joelibaceta/video-to-ascii 是一个托管在 GitHub 上的开源项目,主要使用 Python 编写,采用 MIT License 许可证,目前获得 1.9k 个 Star、152 次 Fork。

仓库全名
joelibaceta/video-to-ascii
开源许可证
MIT License
Star 数
1.9k
Fork 数
152
未关闭 Issue
28

README 摘要

It's a simple python package to play videos in a terminal using ASCII characters. Translations 🇺🇸 English 🇪🇸 Español 🇹🇼 繁體中文 Requirements Python3 PortAudio (Only required for installation with audio support) FFmpeg (Only required for installation with audio support) Linux or MacOS ... for now Installation From PyPI (Recommended) Standard installation (without audio support): With audio support: Complete…

完整内容见 GitHub 原始 README 或本页 。

常见问题

video-to-ascii 用什么语言开发?

主要使用 Python 编写,采用 MIT License 许可证,目前有 1.9k 个 Star。

video-to-ascii 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 video-to-ascii 的源码?

可以直接克隆仓库:git clone https://github.com/joelibaceta/video-to-ascii.git,默认分支为 master;安装与运行步骤见仓库 README。

video-to-ascii 最近还在维护吗?

仓库最近一次更新为 2025年9月27日,当前有 28 个未关闭 Issue;Star 数为 1.9k,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

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

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

语言占比

Dockerfile
Python

Release

README

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

Screenshot

Translations

Requirements

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

Installation

Standard installation (without audio support):

$ pip install video-to-ascii

With audio support:

$ pip install video-to-ascii[audio]

Complete installation (with all optional dependencies):

$ pip install video-to-ascii[all]

🔄 Migration Guide

If you were using the old installation method with --install-option:

# ❌ Old way (no longer supported)
$ pip install video-to-ascii --install-option="--with-audio"

# ✅ New way  
$ pip install video-to-ascii[audio]

Note: The --install-option flag has been deprecated by pip and removed in pip 23.1+.

From Source

Clone the repository and install:

$ git clone https://github.com/joelibaceta/video-to-ascii.git
$ cd video-to-ascii
$ pip install .

Or with audio support:

$ pip install .[audio]

How to use

Just run video-to-ascii in your terminal

$ video-to-ascii -f myvideo.mp4

Options

--strategy Allow to choose a 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 simplified 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]

As Seen On

评论

暂无评论