{"id":13585256,"url":"https://github.com/joelibaceta/video-to-ascii","last_synced_at":"2025-05-14T22:07:05.116Z","repository":{"id":37601766,"uuid":"159064082","full_name":"joelibaceta/video-to-ascii","owner":"joelibaceta","description":"It is a simple python package to play videos in the terminal using characters as pixels","archived":false,"fork":false,"pushed_at":"2023-11-24T18:09:53.000Z","size":151700,"stargazers_count":1740,"open_issues_count":29,"forks_count":147,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-05-09T20:23:09.403Z","etag":null,"topics":["ansi-colors","ascii","ascii-art","bash","cli","console","ffmpeg","opencv","opensource","pip","pixel","play-videos","portaudio","python","python3","terminal","video","wav"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joelibaceta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"open_collective":"video-to-ascii"}},"created_at":"2018-11-25T18:56:36.000Z","updated_at":"2025-05-08T11:02:10.000Z","dependencies_parsed_at":"2023-11-24T19:34:45.217Z","dependency_job_id":null,"html_url":"https://github.com/joelibaceta/video-to-ascii","commit_stats":{"total_commits":155,"total_committers":19,"mean_commits":8.157894736842104,"dds":0.2129032258064516,"last_synced_commit":"906abad87083afbd2b13a44a31e614566446bbb9"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joelibaceta%2Fvideo-to-ascii","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joelibaceta%2Fvideo-to-ascii/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joelibaceta%2Fvideo-to-ascii/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joelibaceta%2Fvideo-to-ascii/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joelibaceta","download_url":"https://codeload.github.com/joelibaceta/video-to-ascii/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254077114,"owners_count":22010666,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansi-colors","ascii","ascii-art","bash","cli","console","ffmpeg","opencv","opensource","pip","pixel","play-videos","portaudio","python","python3","terminal","video","wav"],"created_at":"2024-08-01T15:04:50.214Z","updated_at":"2025-05-14T22:07:05.047Z","avatar_url":"https://github.com/joelibaceta.png","language":"Python","funding_links":["https://opencollective.com/video-to-ascii","https://opencollective.com/video-to-ascii/contribute/","https://ko-fi.com/joelibaceta","https://opencollective.com/video-to-ascii/contribute","https://opencollective.com/video-to-ascii/organization/0/website","https://opencollective.com/video-to-ascii/organization/1/website","https://opencollective.com/video-to-ascii/organization/2/website","https://opencollective.com/video-to-ascii/organization/3/website","https://opencollective.com/video-to-ascii/organization/4/website","https://opencollective.com/video-to-ascii/organization/5/website","https://opencollective.com/video-to-ascii/organization/6/website","https://opencollective.com/video-to-ascii/organization/7/website","https://opencollective.com/video-to-ascii/organization/8/website","https://opencollective.com/video-to-ascii/organization/9/website"],"categories":["Python","Miscellaneous","其他_机器视觉","cli","Generators \u0026 Converters"],"sub_categories":["网络服务_其他","Imported: Upstream Snippet Gallery"],"readme":"\u003cdiv align=center\u003e\n\n  ![Logo](./images/logo.svg)\n\n\u003cp\u003e\n\n  It's a simple python package to play videos in a terminal using [ASCII](https://en.wikipedia.org/wiki/ASCII) characters.\n\n  [![Financial Contributors on Open Collective](https://opencollective.com/video-to-ascii/all/badge.svg?label=financial+contributors)](https://opencollective.com/video-to-ascii) [![PyPI version](https://badge.fury.io/py/video-to-ascii.svg)](https://badge.fury.io/py/video-to-ascii)\n  [![Maintainability](https://api.codeclimate.com/v1/badges/3108b26a0bcfffd4b4fe/maintainability)](https://codeclimate.com/github/joelibaceta/video-to-ascii/maintainability)\n  [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/joelibaceta/video-to-ascii)\n\n\u003c/p\u003e\n\n![Screenshot](./images/Simpsons.apng)\n\n\u003c/div\u003e\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eTranslations\u003c/b\u003e\u003c/summary\u003e\n\u003cp\u003e\n\n- [🇺🇸 English](./README.md)\n- [🇪🇸 Español](./translations/README_es.md)\n- [🇹🇼 繁體中文](./translations/README_zh-TW.md)\n\n\u003cp\u003e\n\u003c/details\u003e\n\n## Requirements\n\n- Python3\n- PortAudio (_Only required for installation with audio support_)\n- FFmpeg (_Only required for installation with audio support_)\n- Linux or MacOS ... for now\n\n## Installation\n\nStandard installation\n\n```bash\n$ pip3 install video-to-ascii\n```\n\nWith audio support installation\n\n```bash\n$ pip3 install video-to-ascii --install-option=\"--with-audio\"\n```\n\n## How to use\n\nJust run `video-to-ascii` in your terminal\n\n```bash\n$ video-to-ascii -f myvideo.mp4\n```\n\n### Options\n\n**`--strategy`**\nAllow to choose a strategy to render the output.\n\n![Render Strategies](./images/Strategies.png)\n\n**`-o --output`**\nExport the rendering output to a bash file to share with someone.\n\n![Exporting](./images/export.png)\n\n**`-a --with-audio`**\nIf an installation with audio support was made, you can use this option to play the audio track while rendering the video ascii characters.\n\n## How it works\n\nEvery video is composed by a set of frames that are played at a certain frame rate.\n\n![Video Frames](./images/imgVideoFrames.png)\n\nSince a terminal has a specific number of rows and columns, we have to resize our video to adjust to the terminal size limitations.\n\n![Terminal](./images/imgTerminal.png)\n\nTo 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_.\n\n![Resizing](./images/imgResizing.png)\n\nWhen 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](https://en.wikipedia.org/wiki/Relative_luminance) in colorimetric spaces, using a simplified version of the luminosity function.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./images/Luminosity.svg\"\u003e\n\u003c/p\u003e\n\n\u003e Green light contributes the most to the intensity perceived by humans, and blue light the least.\n\nThis 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).\n\n```python\nCHARS_LIGHT \t= [' ', ' ', '.', ':', '!', '+', '*', 'e', '$', '@', '8']\nCHARS_COLOR \t= ['.', '*', 'e', 's', '@']\nCHARS_FILLED    = ['░', '▒', '▓', '█']\n```\n\nThe 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](https://stackoverflow.com/questions/4842424/list-of-ansi-color-escape-sequences).\n\n![The Mapping of RGB and ANSI Colors](./images/imgPixelSection.png)\n\n![8 Bits Color Table](./images/8-bit_color_table.png)\n\nFinally, when putting it all together, we will have an appropriate character for each pixel and a new color.\n\n![Frame Image by Characters](./images/imgPixelImage.png)\n\n## Contributors\n\n### Code Contributors\n\nThis project exists thanks to all the people who contribute. [[Contribute](./CONTRIBUTING.md)].\n\n\u003ca href=\"https://github.com/joelibaceta/video-to-ascii/graphs/contributors\"\u003e\u003cimg src=\"https://opencollective.com/video-to-ascii/contributors.svg?width=890\u0026button=false\" /\u003e\u003c/a\u003e\n\n### Financial Contributors\n\nBecome a financial contributor and help us sustain our community. [[Contribute](https://opencollective.com/video-to-ascii/contribute/)].\n\nOr maybe just [buy me a coffee](https://ko-fi.com/joelibaceta).\n\n#### Individuals\n\n\u003ca href=\"https://opencollective.com/video-to-ascii#backers\" target=\"_blank\" rel=\"noopener\"\u003e\u003cimg src=\"https://opencollective.com/video-to-ascii/individuals.svg?width=890\"\u003e\u003c/a\u003e\n\n#### Organizations\n\nSupport this project with your organization. Your logo will show up here with a link to your website. [[Contribute](https://opencollective.com/video-to-ascii/contribute)]\n\n\u003ca href=\"https://opencollective.com/video-to-ascii/organization/0/website\" target=\"_blank\" rel=\"noopener\"\u003e\u003cimg src=\"https://opencollective.com/video-to-ascii/organization/0/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/video-to-ascii/organization/1/website\" target=\"_blank\" rel=\"noopener\"\u003e\u003cimg src=\"https://opencollective.com/video-to-ascii/organization/1/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/video-to-ascii/organization/2/website\" target=\"_blank\" rel=\"noopener\"\u003e\u003cimg src=\"https://opencollective.com/video-to-ascii/organization/2/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/video-to-ascii/organization/3/website\" target=\"_blank\" rel=\"noopener\"\u003e\u003cimg src=\"https://opencollective.com/video-to-ascii/organization/3/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/video-to-ascii/organization/4/website\" target=\"_blank\" rel=\"noopener\"\u003e\u003cimg src=\"https://opencollective.com/video-to-ascii/organization/4/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/video-to-ascii/organization/5/website\" target=\"_blank\" rel=\"noopener\"\u003e\u003cimg src=\"https://opencollective.com/video-to-ascii/organization/5/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/video-to-ascii/organization/6/website\" target=\"_blank\" rel=\"noopener\"\u003e\u003cimg src=\"https://opencollective.com/video-to-ascii/organization/6/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/video-to-ascii/organization/7/website\" target=\"_blank\" rel=\"noopener\"\u003e\u003cimg src=\"https://opencollective.com/video-to-ascii/organization/7/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/video-to-ascii/organization/8/website\" target=\"_blank\" rel=\"noopener\"\u003e\u003cimg src=\"https://opencollective.com/video-to-ascii/organization/8/avatar.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://opencollective.com/video-to-ascii/organization/9/website\" target=\"_blank\" rel=\"noopener\"\u003e\u003cimg src=\"https://opencollective.com/video-to-ascii/organization/9/avatar.svg\"\u003e\u003c/a\u003e\n\n## As Seen On\n\u003ca href=\"https://www.producthunt.com/posts/video-to-ascii\" target=\"_blank\" rel=\"noopener\"\u003e\u003cimg src=\"https://user-images.githubusercontent.com/864790/124545434-a2e7fe80-ddee-11eb-9d80-f24049524fd9.png\" width=\"100px\"\u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoelibaceta%2Fvideo-to-ascii","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoelibaceta%2Fvideo-to-ascii","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoelibaceta%2Fvideo-to-ascii/lists"}