Mplayer: Difference between revisions

From wikinotes
Line 30: Line 30:
you can write commands to a <code>fifo</code> and control the video stream.
you can write commands to a <code>fifo</code> and control the video stream.
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
mkfifo /var/tmp/my_mplayer_fifo
FIFO=/var/tmp/my_mplayer_fifo
mplayer -slave -input file=/var/tmp/my_mplayer_fifo file.mkv
 
# create fifo (deleting other files in the way)
test -p $FIFO || mkfifo $FIFO
 
# mplayer reads from fifo (requires realpath!)
mplayer -input file=$FIFO file.mkv
 
# send instruction to mplayer
echo pause > $FIFO
</syntaxhighlight>
 
<syntaxhighlight lang="bash">
# see all commands
mplayer -input cmdlist
 
# or detailed: http://www.mplayerhq.hu/DOCS/tech/slave.txt
</syntaxhighlight>
</syntaxhighlight>
</blockquote><!-- terminal control -->
</blockquote><!-- terminal control -->

Revision as of 17:26, 19 July 2021

A very versatile media player.

Documentation

homepage http://www.mplayerhq.hu/design7/news.html
documentation http://www.mplayerhq.hu/DOCS/HTML/en/index.html
man mplayer http://www.mplayerhq.hu/DOCS/man/en/mplayer.1.html

Tutorials

mplayer intro https://www.unixmen.com/basic-mplayer-usage-from-command-line/

Neat Tricks

terminal control

It is possible to control an mplayer instance from the CLI using the -slave param.
check out http://www.mplayerhq.hu/DOCS/tech/slave.txt .

you can write commands to a fifo and control the video stream.

FIFO=/var/tmp/my_mplayer_fifo

# create fifo (deleting other files in the way)
test -p $FIFO || mkfifo $FIFO

# mplayer reads from fifo (requires realpath!)
mplayer -input file=$FIFO file.mkv

# send instruction to mplayer
echo pause > $FIFO
# see all commands
mplayer -input cmdlist

# or detailed: http://www.mplayerhq.hu/DOCS/tech/slave.txt

video as wallpaper

Dependencies

pacaur -S xwinwrap-git
pacman -S mplayer

Single Monitor

If you can find/make an ultra widescreen panorama, this is probably the way to go.

xwinwrap -ov -fs -- mplayer -wid WID -quiet -nosound -loop 0 *.mkv

Alternatively, this method plays video as wallpaper, but has issues with compositors (xcompmgr, compton, ..)
It also gets confused when sharing a workspace with another window. Not ideal.

# See https://www.reddit.com/r/i3wm/comments/51hjkn/vlcs_videowallpaper_is_just_a_fullscreen_mode/
mplayer  -rootwin -vo xv -ao null -noconsolecontrols -fs /ocean_waves.mkv

Multiple Monitors

If rendering a video on different monitors, you'll need to be explicit about the monitor's geometry.
Add -shuffle if you'd like a different video on each monitor, but it's a bit chaotic for me.

FILES=($(ls *.mkv))

monitor_geoms(){
    xrandr \
        | grep -P '(?<!dis)connected' \
        | grep -o -P '\d+x\d+\+\d+\+\d'
}

for geom in `monitor_geoms`; do
    xwinwrap -ov -g "${geom}" -- mplayer -wid WID -quiet -nosound -loop 0 -shuffle "${FILES[@]}" &
done

The same video on each monitor.

TODO

video in ascii