Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 6341  / 3 Years ago, thu, june 17, 2021, 3:23:01

I've just figured out that I'm unable to use aalib to render video output in mplayer. For those who do not know, aalib is the library for rendering videos in ASCII.



Before upgrading to 14.04 it worked perfectly (I don't remember setting-up something, it had been working "out of the box").



Here is what it does:



$ mplayer -vo aa *
MPlayer2 2.0-701-gd4c5b7f-2ubuntu2 (C) 2000-2012 MPlayer Team
Cannot open file '/home/crysman/.mplayer/input.conf': No such file or directory
Failed to open /home/crysman/.mplayer/input.conf.
Cannot open file '/etc/mplayer/input.conf': No such file or directory
Failed to open /etc/mplayer/input.conf.

Playing TPB.AFK.2013.480p.h264-SimonKlose.mp4.
Detected file format: QuickTime / MOV (libavformat)
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (mp3), -aid 0, -alang eng
Clip info:
major_brand: mp42
minor_version: 0
compatible_brands: mp42isomavc1
creation_time: 2013-02-08 13:49:43
encoder: HandBrake 0.9.8 2012071700
Load subtitles in .
SUB: Added subtitle file (1): ./TPB.AFK.2013.480p.h264-SimonKlose.srt
Error opening/initializing the selected video_out (-vo) device.
Selected audio codec: MPEG 1.0/2.0/2.5 layers I, II, III [mpg123]
AUDIO: 48000 Hz, 2 ch, s16le, 128.0 kbit/8.33% (ratio: 16000->192000)
AO: [pulse] 48000Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...
A: 8.1 (08.0) of 4927.1 ( 1:22:07.1) 0.4%

Exiting... (Quit)


It does the same with any other video as well:




...
Error opening/initializing the selected video_out (-vo) device.
...




and




...
Video: no video
...




Here is a little bit of mplayer debug:



$ mplayer -vo help
MPlayer2 2.0-701-gd4c5b7f-2ubuntu2 (C) 2000-2012 MPlayer Team
Available video output drivers:
vdpau VDPAU with X11
xv X11/Xv
gl3 OpenGL 3.x
gl OpenGL
x11 X11 ( XImage/Shm )
sdl SDL YUV/RGB/BGR renderer (SDL v1.1.7+ only!)
caca libcaca
v4l2 V4L2 MPEG Video Decoder Output
null Null video output
directfb Direct Framebuffer Device
yuv4mpeg yuv4mpeg output for mjpegtools
png PNG file
jpeg JPEG file
gif89a animated GIF output
tga Targa output
pnm PPM/PGM/PGMYUV file
md5sum md5sum of each frame
gl_nosw OpenGL no software rendering


Some system info:



$ uname -a && lsb_release -a && cat /etc/os-release 
Linux crysman-U36SD 3.13.0-29-generic #53-Ubuntu SMP Wed Jun 4 21:00:20 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04 LTS
Release: 14.04
Codename: trusty
NAME="Ubuntu"
VERSION="14.04, Trusty Tahr"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.04 LTS"
VERSION_ID="14.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"


How do I make it work again, please? :(



May it be because I abandoned restricted and multiverse? I doubt it, just feeding info...



Thanks!!
McZ


More From » 14.04

 Answers
7

OK, it seems the problem is in the mplayer2 package which does not contain aa (libaa1) support.



I've tried mplayer (the old one, not mplayer2) package and it works!



Here is what I've just done to make it work:



$ sudo apt-get purge smplayer
$ sudo apt-get purge mplayer2
$ sudo apt-get autoremove
$ sudo apt-get install mplayer smplayer


This way I've achieved to have mplayer 1.x, in particular 1.1-4.8:



$ mplayer --version
Unknown option on the command line: --version
Error parsing option on the command line: --version
MPlayer 1.1-4.8 (C) 2000-2012 MPlayer Team


(which is the same version as @Sneetsher reported - thank you!)



Now it's working almost the same as before again. I suppose the problem occurred after upgrading to 14.04 somehow, maybe because, if I am not wrong, I had not mplayer installed explicitly, but rather just "shipped-in" as dependency of smplayer (?) - this is my hypothesis so far.



"almost the same as before" means it runs, but it's strangely blinking all the time. Before having all this trouble the picture was bright and clean. However, I've came to this workaround:
http://andrusiv.com/blog/2010/01/08/mplayer-is-superman-of-mediaplayers.html



You have to use the -really-quiet parameter.



You might also want to adjust the pixel aspect ratio to make use of the whole screen with -monitorpixelaspect X parameter where X is a number to play with - try 0.7 or similar.



So my final typical usage of mplayer to render video in ASCII from X is as follows:



xterm -geometry 269x102 -fn 5x7 -e "mplayer -noautosub -really-quiet -monitorpixelaspect 0.9 -vo aa:driver=curses:contrast=35 *"


BTW, to list the fonts available in your system, you might want to run xlsfonts



If you would like to play videos like this in text mode only (single user mode with console only, no X), you would probably appreciate set some smaller console font first, something like this might help:



setfont /usr/share/consolefonts/Uni1-VGA8.psf.gz


Typical usage of mplayer to render video in ASCII from text-only console (no X) is as follows:



defaultfont="/usr/share/consolefonts/Uni2-Fixed16.psf.gz"
font="/usr/share/consolefonts/Uni1-VGA8.psf.gz"
test -e "$font" && setfont "$font" || { echo "ERROR: font "$font" could not be set :(" >&2; exit 1; }
mplayer -noautosub -really-quiet -monitorpixelaspect 1 -vo aa:driver=curses:contrast=35 *
test -e "$defaultfont" && setfont "$defaultfont" || { echo "ERROR: supposed default font "$defaultfont" could not be set, sorry :(" >&2; exit 1; }


You may combine it into one script:



$ cat ~/bin/asciiplay.sh
#!/bin/bash
#play all readable files in current directory with mplayer and render them in ASCII
#crysman (copyleft)2014

#list fonts in X:
#xlsfonts

#list fonts in text-only (TTY) mode:
#ll /usr/share/consolefonts

# we detect text-only mode
textonly=`tty | grep tty | wc -l`

if [ $textonly -ge 1 ]; then
#Xubuntu 14.04 TTY console default font:
defaultfont="/usr/share/consolefonts/Uni2-Fixed16.psf.gz"
#let's set a more appropiate font:
font="/usr/share/consolefonts/Uni1-VGA8.psf.gz"
test -e "$font" && setfont "$font" || { echo "ERROR: font "$font" could not be set :(" >&2; exit 1; }
#play it all
mplayer -noautosub -really-quiet -monitorpixelaspect 1 -vo aa:driver=curses:contrast=35 *
#revert to default console font:
test -e "$defaultfont" && setfont "$defaultfont" || { echo "ERROR: supposed default font "$defaultfont" could not be set, sorry :(" >&2; exit 1; }
else
#likely usable fonts:
#font=-misc-fixed-medium-r-normal--6-60-75-75-c-40-iso8859-1
#font=-misc-fixed-medium-r-normal--7-50-100-100-c-50-iso8859-1
font=5x7
#font=micro
#geometry optimized for font 5x7 on 1366x768 resolution:
xterm -geometry 269x102 -fn $font -e "mplayer -noautosub -really-quiet -monitorpixelaspect 0.9 -vo aa:driver=curses:contrast=35 *"
fi;


I've created a launchpad bug regarding to mplayer2 not supporting aa here:
https://bugs.launchpad.net/ubuntu/+source/mplayer2/+bug/1338000



Happy ASCIIing! ;)

McZ


[#24295] Friday, June 18, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
bewre

Total Points: 164
Total Questions: 108
Total Answers: 106

Location: Ghana
Member since Sun, Mar 27, 2022
2 Years ago
bewre questions
Sun, May 14, 23, 13:27, 1 Year ago
Mon, Aug 2, 21, 03:57, 3 Years ago
Thu, Aug 26, 21, 18:05, 3 Years ago
Sat, Aug 6, 22, 21:41, 2 Years ago
Sat, Jul 24, 21, 22:52, 3 Years ago
;