video-to-ascii

授权协议 MIT License
开发语言 SHELL
所属分类 应用工具、 终端/远程登录
软件类型 开源软件
地区 不详
投 递 者 秦新立
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

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

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

--strategyAllow to choose a strategy to render the output.

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

-a --with-audioIf 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.

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

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.

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.

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

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

  • 今天在编译一个Python程序的时候,一直出现“Non-ASCII character 'xe5' in file”报错问题  1 SyntaxError: Non-ASCII character '\xe5' in file kNN.py on line 24, but no encoding declared; see http://python.org/dev/peps/pep-0263/

  • Video-related Acronyms At the request of some readers, here is a list of some common acronyms thrown around when discussing PC video and video in general. I'll add to these over time as I find missing

  • Python-OpenCV中VideoCapture类 Python-OpenCV中的VideoCapture类的官方文档: https://docs.opencv.org/4.0.0/d8/dfe/classcv_1_1VideoCapture.html VideoCapture()是用于从视频文件、图片序列、摄像头捕获视频的类; #!/usr/bin/env python ''' VideoC

  •  这个程序出自《Assembly Language step by step programming with linux》第11章,首先需要先介绍几条指令: jcxz label,当cx寄存器等于0时,跳转。 jecxz label,当ecx寄存器等于0时,跳转。 loopnz label,ecx=ecx-1,当ecx寄存器不等于0时并且ZF标志位未被设置时跳转,如果ecx寄存器等于0,或者

  • 编码问题 在文件第一行( 一定要是第一行 )添加 # -*- coding: utf-8 -*- 或者 # coding:utf-8

 相关资料
  • 这是一个视频转换工具,该工具将视频转换成一帧帧的图片,如下图所示:

  • Extends Widget A widget that plays a video from an URL. Import this type with “const {Video} = require('tabris');” Android iOS Methods pause() Pauses the video. state changes to pause and speed to 0.

  • 描述 视频播放组件。 安装 $ npm install rax-video --save 属性 属性 类型 默认值 必填 描述 支持 id string - ✘ id 选择器 src string - ✔️ 视频地址 autoPlay boolean false ✘ 设置视频自动播放 muted boolean false ✘ 是否播放音频 loop boolean false ✘ 是否循环播放

  • WARNING Weex中内置的<video>组件一般只做demo用途,在你的App中,你应该用你喜欢的视频库重新实现video组件。 Video 组件用于在页面中嵌入视频内容。 text 是唯一合法的子组件。 src, string. 内嵌的视频指向的URL。 play-status, string. 可选值为 play | pause,用来控制视频的播放状态,play 或者 pause,默认值

  • 以下是视频的子类型: BMPEG MP4V-ES vnd.mpegurl BT656 MPV vnd.nokia.interleaved-multimedia CelB mpeg vnd.objectvideo DV mpeg4-generic vnd.sealed.mpeg1 H261 nv vnd.sealed.mpeg4 H263 parityfec vnd.sealed.swf H263-

  • 视频组件 属性 类型 默认值 必填 说明 src string 是 要播放视频的资源地址 autoplay boolean false 否 是否自动播放,只在初始化时有效,不能动态变更 muted boolean false 否 是否静音播放 controls boolean true 否 是否显示默认播放控件(播放/暂停按钮、播放进度、时间),仅安卓支持 loop boolean false 否