I want to play videos inside bash that displays a frame by characters. (Just Like ASCII Camera on Android) How do I do that?
-
1Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. – eyllanesc Aug 10 '17 at 04:37
2 Answers
If you have libcaca
installed on your system you can do it with both mpv
and mplayer
:
mplayer -vo caca samle.avi
or
mpv --quiet -vo caca sample.avi
You could also use -vo aa
for black & white output. You might need to prepend the command with DISPLAY=
to trick caca
to use terminal instead of regular window.
That is, if you media player was compiled with libcaca
support. You can find out like so:
mpv --vo help
or
mplayer -vo help

- 669
- 2
- 9
- 31
-
Good! or simply do [this](https://dereenigne.org/linux/vlc-caca-ascii-output/) `vlc -V caca fileToOpen` – Francesco Mantovani Aug 10 '17 at 06:03
If this is what you are referring to you can forget it. I haven't download that app but I'm pretty sure it doesn't even emulate a terminal. By the way your question is interesting.
Do this:
apt-get install sl
and then
sl
This is the maximum the terminal can do for you: a locomotive that moves. If you are OK with that we can move ahead.
Now install jp2a this way apt-get install jp2a
You now can transform images to ASCII text by doing jp2a --width=150 myimagename.jpg
So at first your question looked impossible but now we can see that there might be a way out. There are other people who did that.
You now need to split a video into .jpg
images and you can do that thanks to FFMPG
this way . Becarefull, you might easily create more than 25,000 images out of a small video so tune the command...
[...]Change the %xd to however many digits you need, e.g. if the command would create more than 10,000 frames change the %04d to %05d. This also works for input files that are image sequence. Read more here.
Well, we are at a good point now:
- We can convert video to .jpg
- We can convert .jpg to ASCII text
You now need to write a script that does it automatically and then try to render the ASCII picture on the terminal like the sl
locomotive and you are done

- 10,216
- 13
- 73
- 113