Home

Awesome

:tv: ASCIIPlayer

Build Status Codacy Badge Go Report Card GoDoc License: MIT

                       _    ____   ____ ___ ___ ____  _        _ __   _______ ____
                      / \  / ___| / ___|_ _|_ _|  _ \| |      / \\ \ / / ____|  _ \
                     / _ \ \___ \| |    | | | || |_) | |     / _ \\ V /|  _| | |_) |
                    / ___ \ ___) | |___ | | | ||  __/| |___ / ___ \| | | |___|  _ <
                   /_/   \_\____/ \____|___|___|_|   |_____/_/   \_\_| |_____|_| \_\

ASCIIPlayer is a library and tool that can play picture(png,jpeg,gif) and video(mp4,avi) in ASCII mode and can convert the picture and video into ASCII picture.

fire

Table of contents

Features

How it works?

ASCIIPlayer is base on Image2ASCII(which is a library that converts image into ASCII image).

                 +---------------+                                                  +---------+
                 |               |                                                  |         |
          +------> Gif Decoder   |                                              +---> Encoder +---> file
          |      |               |                                              |   |         |
          |      +---------------+                                              |   +---------+
          |      +---------------+                +-------------+               |   +---------+
          |      |               |                |             |               |   |         |
Input File+------> Image Decoder +---> Frames +-->+ Image2ASCII +->ASCII Frames-+---> Player  +---> stdout
          |      |               |                |             |               |   |         |
          |      +---------------+                +-------------+               |   +---------+
          |      +---------------+                                              |   +---------+
          |      |               |                                              |   |         |
          +------> Video Decoder |                                              +---> Server  +---> socket
                 |               |                                                  |         |
                 +---------------+                                                  +---------+

Installation

go get -u github.com/qeesung/asciiplayer

CLI usage

    _    ____   ____ ___ ___ ____  _        _ __   _______ ____
   / \  / ___| / ___|_ _|_ _|  _ \| |      / \\ \ / / ____|  _ \
  / _ \ \___ \| |    | | | || |_) | |     / _ \\ V /|  _| | |_) |
 / ___ \ ___) | |___ | | | ||  __/| |___ / ___ \| | | |___|  _ <
/_/   \_\____/ \____|___|___|_|   |_____/_/   \_\_| |_____|_| \_\
>>>Version  : 1.0.0
>>>Author   : qeesung
>>>HomePage : https://github.com/qeesung/asciiplayer

asciiplayer is a library that can convert gif and video to ASCII image
and provide the cli for easy use.

Usage:
  asciiplayer [command]

Available Commands:
  encode      Encode gif or video to ascii gif or video
  help        Help about any command
  play        Play the gif and video in ASCII mode
  server      Server command setup a http share server
  version     Show the version

Flags:
  -D, --debug   Switch log level to DEBUG mode
  -h, --help    help for asciiplayer

Use "asciiplayer [command] --help" for more information about a command.

Command play

Play command only work in terminal, decoding the gif or video info multi frames and convert the frames to ASCII character matrix, finally, output the matrix to stdout at a certain frequency.

More detail please run asciiplayer play --help

tips:

play tutorial gif

Play examples

Play the gif, and be able to match the screen size.

asciiplayer play demo.gif

Zoom to the original 1/10 and play it.

asciiplayer play demo.gif -r 0.1

Zoom to the fixed width and fixed height and play it

asciiplayer play demo.gif -w 100 -h 40

Play the png image

asciiplayer play demo.png

Command encode

Encode command can convert gif or video to a ascii gif or video.

More detail please run asciiplayer encode --help

tips:

encode tutorial gif

ascii_eye.gif eye gif

Encode examples

Encode gif image to ascii gif image

asciiplayer encode demo.gif -o output.gif

Encode gif image to ascii gif image with custom font size

asciiplayer encode demo.gif -o output.gif --font_size=5

Zoom to the original 1/10, then encode gif image to ascii gif image

asciiplayer encode demo.gif -o output.gif -r 0.1

Encode jpeg image to ascii png image

asciiplayer encode demo.jpeg -o output.png

Command server

Setup a http server, and share your ascii image with others. Setup a http server, then access through curl command.

Setup server

$ asciiplayer server demo.gif
# Server available on : http://0.0.0.0:8080

Access from remote

$ curl http://hostname:8080
# play ascii image here

More detail please run asciiplayer server --help

tips:

server tutorial gif

Server examples

Setup a http server with default port and host

asciiplayer server demo.gif

Setup a http server with the custom port

asciiplayer server demo.gif --port 8888

Setup a http server and share the ascii png image

asciiplayer server demo.png

Library usage

Please access the godoc https://godoc.org/github.com/qeesung/asciiplayer

Examples

Encoding gif sample

Raw ImageASCII Image

Encoding jpeg sample

Raw ImageASCII Image

Todos

License

This project is under the MIT License. See the LICENSE file for the full license text.