Mplayer play video from the command prompt.

How to do things, solutions, recipes, tutorials
Post Reply
Message
Author
stu90

Mplayer play video from the command prompt.

#1 Post by stu90 »

I was reading the other day that it is possible to play video with mplayer at the command prompt with out being in the graphical desktop (ctrl + alt + backspace) initial test proved this does indeed work on puppy however the video window was not full screen and the usual control + f full screen command doesn't seem to work - so here is a little script i made to play videos full screen, you may need to alter x and y for your own screen resolution.

Name the script clmplayer and put it in PATH /usr/bin /root/my-applications/bin etc.

Code: Select all

#!/bin/bash
tput civis
mplayer -vo fbdev2 -fs -quiet -zoom -x 1280 -y 800 "$@"
tput cnorm && exit
to use type at the command: clmplayer /path/to/media/file.avi

i like to use fbclone for quick file navigation but you can use the Tab key for auto completion of your file name.

Bruce B

#2 Post by Bruce B »

I recently found if I use ffplay -fs (-fs is full screen) it will bring the screen to the front.

I also made a script for grabbing multimedia from cache and /tmp

Would you like me to post them here? If not I can do it somewhere else?

No offense either way.

stu90

#3 Post by stu90 »

Hi Bruce. Sure no problems. 8)

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#4 Post by disciple »

Can ffplay work when you're not in X?
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

Bruce B

#5 Post by Bruce B »

Swell Stu90, I don't want to interfere with another's howto, but this seems as if it might be a helpful addition. This script is for people of a modest or intermediate scripting ability. I won't explain what it does, but if anyone has specific questions, I'll answer them.

Please consider the script as a template for use in locating media files in the cache directory. A template because once understood there are many, many things the user can do to customize and improve it.

Code: Select all

#!/bin/bash

cachedir="/initrd/pup_rw/root/spot/.mozilla/firefox/iof95jww.abuse/Cache"
savedir="/initrd/pup_rw/root/spot/.mozilla/firefox/media"


cd $cachedir
for i in * ; do

    filesize=`stat -c%s $i`
    [ $filesize -lt 300000 ] && continue

    type=`file ${cachedir}/$i`
    echo $type | grep QuickTime &>/dev/null
    if [ "$?" = "0" ] ; then 
        ffplay -autoexit -fs ${cachedir}/$i
        mv ${cachedir}/$i ${savedir}/${i}.mov
        continue
    fi


    echo $type | grep Macromedia &>/dev/null
    if [ "$?" = "0" ] ; then 
        ffplay -autoexit -fs ${cachedir}/$i
        mv ${cachedir}/$i ${savedir}/${i}.flv 
        continue
    fi

    echo $type | grep Microsoft &>/dev/null
    if [ "$?" = "0" ] ; then 
        ffplay -autoexit -fs ${cachedir}/$i
        mv ${cachedir}/$i ${savedir}/${i}.wmv
        continue
        fi
done 
~

Bruce B

#6 Post by Bruce B »

Hints and tips

1) Sometimes I don't know where the media files are. They may not be in Cache or /tmp.

We have some work to do.

2) Often media files have a header instruction to delete. Typically, they delete when you do something like change to view another media or page.

If you watch, you will notice most media players have a download bar. Ideally, it moves faster than the play bar. When the download bar is finished, the media is somewhere on your computer fully downloaded. If you stop the playback after the download is complete, the media is likely not deleted.

3) The script I posted above can also be expanded to search the /tmp directory because a lot of media is downloaded there.

4) I have found media plays better with our media players such as mplayer or ffplay than with the onsite players and the local flashplugins. Our local players use less resources and the aspect ratios will be true. Other benefits such as easy navigation and replay.

~

Bruce B

#7 Post by Bruce B »

Stu90's script used tput, but I don't think all Puppy's have tput. In the past I found it was a part of the dev kit.

I've attached tput and a text formatted tput man page for anyone who wants it.

Code: Select all

Archive:  tputpkg.zip
 Length   Method    Size  Cmpr    Date    Time   CRC-32   Name
--------  ------  ------- ---- ---------- ----- --------  ----
    9752  Defl:N     4830  51% 2010-03-07 03:33 7fd562b6  tput
    9648  Defl:N     3655  62% 2008-06-26 17:30 1f1ee461  tput.txt
--------          -------  ---                            -------
   19400             8485  56%                            2 files
Attachments
tputpkg.zip
(8.58 KiB) Downloaded 222 times

Bruce B

#8 Post by Bruce B »

Code: Select all

#!/bin/bash

# This script will give meaningful extensions 
# to your non flv, mov and wmv files in Cache. 
# Run it after the script used to locate the media files
# or append it to that script.


CacheDir="user must fill in"
[ ! -d $CacheDir ] && echo "edit $0" && exit
cd $CacheDir


rm _CACHE_???_

for i in * ; do
	file $i | grep gzip >/dev/null
	if [ "$?" = "0" ] ; then
		mv $i $i.gz
		gzip -d $i.gz
	fi
done


for i in * ; do
	ext=`file $i | awk '{print tolower($2)}'`
	mv $i $i.$ext 
done
Happy to answer questions

~

Post Reply