A script to display any Youtube video as ASCII art in the terminal.
git clone
cd youtube-ascii
pip install -r requirements.txt
python youtube-ascii.py -u <youtube-url>
python youtube-ascii.py -f <webm-file>
- yt-dlp for downloading the video
- ffmpeg for converting the video to a
webm
file - Pillow for resizing the video
- pyvideoreader for reading the video
The speed of the script depends on the number of threads you use. The default is 4 threads. You can change it by using the -pw
option.
Note: If you use too many threads, the script will be slower than if you use less threads.
Note: More the the scaling factor is, more the script will be slower.
You hasn't to specify any width or height. The script will automatically calculate the width and the height of the terminal and adapt the video to it.
Option | Params | Description |
---|---|---|
-pw , --preprocessing-workers |
WORKERS (default=4) | Number of threads to use for downloading the video |
-u , --url |
URL | Youtube URL |
-f , --file |
FILE | Webm file |
-h , --help |
Show help | |
-v , --version |
Show version | |
--no-color |
Disable colorization | |
--colorization |
{FG|BG} (default=BG) | Colorization mode (foreground or background) |
--show-fps |
Show the FPS of the video | |
--no-bar |
Disable the progress bar | |
--no-percentage |
Disable the percentage | |
--show-time |
Show the time elapsed | |
--show-q-size |
Show the size of the queue | |
--show-frame-pos |
Show the position of the frame |
The colorization is done by using the ANSI encoding. The color is chosen by using the average of the RGB values of the pixel.
If you want to disable the colorization, you can use the --no-color
option. Only the
characters will be displayed.
The foreground colorization is done by using the ANSI escape code 38;2;${r},${g},${b}
where r
, g
and b
are the RGB values of the pixel.
The background colorization is done by using the ANSI escape code 48;2;${r},${g},${b}
and the ANSI escape code 38;2;${r},${g},${b}
where r
, g
and b
are the RGB values of the pixel.
- sppmacd for the idea
Feel free to open an issue or a pull request if you want to contribute to this project.
- Hokanosekai - Initial work - Hokanosekai
- Bash62 - Initial work - Bash62
This project is licensed under the MIT License - see the LICENSE file for details.