Giter VIP home page Giter VIP logo

asciiplay's Introduction

ASCIIPlay

ASCIIPlay is a video player designed for the purpouse of rendering to ASCII any video file given to it, inspired by towel.blinkenlights.nl. The reasoning for my making my own ASCII video player is due to the lack of an existing ASCII renderer with support for subtitle or audio playback. Thus I hope for ASCIIPlay to develop to fill this niche.

A server is currently publicly accessible to view an example of this project, and can be accessed using: ssh [email protected] -p 20

Goals

My main goal for ASCIIPlay is to develop a fully functional video player with a variety of features, while also practicing my C development and trying features I haven't previously used much. To this regard, I have definitely learned much more about data manipulation and threading in C programming, and I hope to expand into more practice as the project moves forward.

Status

ASCIIPlay is currently stable, with many features being planned and added frequently.

Currently Supports:

  • Reading in a variety of video formats such ash mp4, mkv, ...
  • Subtitle rendering using SRT formatted subtitles
  • Frame limiting for lower end systems or situations where lower bitrate is necessary
  • Black and White ASCII rendering only at this time

Roadmap

  • Load and read video files
    • Render ASCII representation
    • Use custom ASCII renderer to remove closed source dependencies
    • Colour support
    • Audio renderer
  • Add subtitle support
    • More subtitle filetypes
    • Alternate subtitle rendering modes
  • Performance improvements
    • framerate limiting
    • Implement frame buffer
    • Make use of threading
  • Support Resizing
    • Improve Resizing
  • Add control features
    • Play/Pause
    • Fast Forward (Improve this)
    • Rewind
  • Improve error reporting
  • Auto Installer

Install

Currently ASCIIPlay is in development status with no installation candidate. If you want to use it you will need to get the listed dependencies in order to compile

Download repository:

git clone https://github.com/aidancrowther/ASCIIPlay

Navigate to ASCIIPlay folder and prepare Makefile

cmake .

Make and run the executable

make
./telnetflix -f <filename> -s <subtitle file>

Usage

After getting ASCIIPlay installed the available flags for the executable are:

-f             Specify an input video file (Required)
-s             Specify an input subtitle file (Optional)
-h             Display help menu
--slow-mode    Allow slower systems time to start reading the input file
--frame-rate   Specify a framerate (>1 && < src framerate) to render at
--no-render    Disable the renderer output (Don't recommend using this if you want to see anything)
--enable-skew  Disable frametime skew correction (Don't use this if you want subs to do anything useful)
--debug        Display debug information while rendering

Problems

Please feel free to notify me of any issues you encounter, and I will fix them as soon as possible. I am open to any suggestions or requests, and will work to make the program as functional as possible

Dependencies

primarily:

  • ascii_art.c (glhf with this one, we commented it out for ya)
  • ffmpeg
  • cmake
  • make
  • gcc

but apparently you'll need some indeterminate number of these too:

  • build-essential
  • pkg-config
  • libgtk-3-dev
  • libavcodec-dev
  • libavformat-dev
  • libswscale-dev
  • libv4l-dev
  • libxvidcore-dev
  • libx264-dev
  • libjpeg-dev
  • libpng-dev
  • libtiff-dev
  • gfortran
  • openexr
  • libatlas-base-dev
  • python3-dev
  • python3-numpy
  • libtbb2
  • libtbb-dev
  • libdc1394-dev
sudo apt install ffmpeg cmake make gcc build-essential pkg-config libgtk-2-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev libjpeg-dev libpng-dev libtiff-dev gfortran openexr libatlas-base-dev python3-dev python3-numpy libtbb2 libtbb-dev libdc1394-dev

asciiplay's People

Contributors

aidancrowther avatar angelonfira avatar ashkanarabim avatar sausagenoods avatar skote2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

asciiplay's Issues

Implement Rewind

Currently, the file decoder is set to only read new frames and discard anything else, we would like to somehow enable an ability to rewind the video by loading frames in reverse order.

You will need to determine how to implement this with the frame decoder and then write these frames as needed into the buffer or renderer as you deem necessary.

Fix resizing

Currently resizing the display halves the render window each time, this works but obviously isn't ideal.

The goal is to implement a naive resizing algorithm as described:
- Take in a number of "characters" to remove from the output (vStream.scale_x and vStream.scale_y)
- Using the char_X and char_Y values determine the equivalent number of rows/columns to remove from the image
- Remove these in equally spaced chunks

Ex: Given x = 2 and y = 1, remove xchar_X columns and ychar_Y rows equally spaced from the input frame data

Fix static memory losses when running

There are some static memory leaks that occur when running the program, these are somewhat difficult to locate due to Valgrind not playing nicely with multi-threaded applications.

Simply reducing this would be nice, the current leaks don't affect functionality, but getting rid of them would be ideal.

Add fun modes

Add some fun features, although unnecessary this will give people something fun to work on stress-free.

For example, implement a silent film style subtitle renderer, injecting text in frames following speech, or allowing audio rendered to be played back using the system bell.

Subtitles cut off

Subtitles get the last character cut off when rendering. This can be "fixed" by appending spaces to the end of each line in the subtitle file, but should be fixed in code. Likely the space allocated for the strings is short one character.

flickering subtitle box after subtitles finished

I noticed many times when I am playing a video while its subtitle file has ended, I see a flickering white sub box containing the last subtitle.

Steps to reproduce:

  • open a video with a subtitle file that ends sooner than the video.
sub.flickering.2.mp4

Add support for more subtitle filetypes

Currently, only SRT subtitles are supported, we would like to expand this to more filetypes such as SSV and ASS. To do this you will need to check the file extension and then reimplement the subtitle loader system to load in the same style with these new formats.

This code can be found in loadSubs in the main.c file, by loading the data into the subtitle array in the format described within this function subtitle rendering should work.

Segmentation Fault when opening video files

When I try to open a video, I get a segmentation fault. I've tried to open two video files, where one uses the MPEG-4 (h.264) codec and the other uses the HEVC (h.265) codec.

Steps to reproduce:

  • run ./telnetflix -f [your_fil_here]

Debug info gets cut off

Debug info displays normally on a 1080p display, but when downsizing the output for smaller windows it gets cut off at the top. This should be a relatively easy fix using the already found scaling offsets. All modifications need to be made in renderer.c

Reduce compilation warnings

The compiler complains about a number of warnings that haven't really been addressed, if these could be fixed that would be nice.

Add audio rendering engine

This is a major enhancement that will require a lot of work.

Primarily the feature should spawn a new thread to track decoded audio data from the video stream and play it back, in sync with the source video file.

Following this, adding modes such as bit depth selection for audio rendering and the like can potentially be implemented.

Terminal cursor disappears after running the program

Whenever I try to run the program (although I still havent managed to get it to actually play something) and exit by using ctrl -c, my terminal's cursor disappears. I can only revert it back to a normal state through the reset command.

Here's a command I use to open a sample video and subtitle combo:

./telnetflix -f ../sample_video/webcam.mp4 -s ../sample_video/sample.srt

Steps to reproduce:

  • Run the program with the -f followed by the location of your video file.
  • Exit through ctrl + C.

Edit: typo

Improve Fast-forwarding

Fast-forwarding currently operates by disengaging the frame limiter to allow the renderer to pull frames as they are decoded. This allows the video to run at a faster pace, however, it is quite slow once the renderer catches up to the buffer head.

Instead, the buffer should be caught up to and cleared as necessary, and then frames should be skipped in the loader to increase the rendering pace, going back to normal once the fast forward is terminated.

Subtitle error checking

The subtitle loader is relatively naive. Ideally, the whole subtitle loader system should be reworked to be more modular. For now, it appears that subtitle files don't load unless they are formatted perfectly as far as padding.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.