mplayer 是一款开源的多媒体播放器,可以用来播放音视频, mplayer 自带多种格式的解码器,不需要我们再另外安装。本文介绍如何在 荔枝派上移植 mplayer 播放器,基于音频驱动实验。
①、开启 ALSA
②、开启 mplayer
在 buildroot 根目录下执行 make
sudo tar xf ./output/images/rootfs.tar -C /media/Gnep/rootfs/
sudo cp /home/share/beautiful_girl.mp4 /home/share/dog.mp4 /media/Gnep/rootfs/
sudo cp /home/share/sold_out.mp3 /media/Gnep/rootfs/
输入 mplayer -h 即可查看帮助信息。
# mplayer -h
Usage: mplayer [options] [url|path/]filename
Basic options: (complete list in the man page)
-vo <drv> select video output driver ('-vo help' for a list)
-ao <drv> select audio output driver ('-ao help' for a list)
-alang/-slang select DVD audio/subtitle language (by 2-char country code)
-ss <position> seek to given (seconds or hh:mm:ss) position
-nosound do not play sound
-fs fullscreen playback (or -vm, -zoom, details in the man page)
-x <x> -y <y> set display resolution (for use with -vm or -zoom)
-sub <file> specify subtitle file to use (also see -subfps, -subdelay)
-playlist <file> specify playlist file
-vid x -aid y select video (x) and audio (y) stream to play
-fps x -srate y change video (x fps) and audio (y Hz) rate
-pp <quality> enable postprocessing filter (details in the man page)
-framedrop enable frame dropping (for slow machines)
Basic keys: (complete list in the man page, also check input.conf)
<- or -> seek backward/forward 10 seconds
down or up seek backward/forward 1 minute
pgdown or pgup seek backward/forward 10 minutes
< or > step backward/forward in playlist
p or SPACE pause movie (press any key to continue)
q or ESC stop playing and quit program
+ or - adjust audio delay by +/- 0.1 second
o cycle OSD mode: none / seekbar / seekbar + timer
* or / increase or decrease PCM volume
x or z adjust subtitle delay by +/- 0.1 second
r or t adjust subtitle position up/down, also see -vf expand
* * * SEE THE MAN PAGE FOR DETAILS, FURTHER (ADVANCED) OPTIONS AND KEYS * * *
MPlayer 1.3.0-6.3.1 (C) 2000-2016 MPlayer Team
mplayer 播放歌曲很简单,不限歌曲格式,“mplayer+歌曲名”即可,比如:
ls
amixer -c 0 sset 'Headphone',0 50% unmute
mplayer sold_out.mp3
戴上耳机即可听音乐,播放过程中我们可以通过键盘控制播放器,常用的控制方法如下:
9 :减小音量。 0:增大音量。 左键:倒退 10 秒 右键:快进 10 秒 上键:快进 1 分钟 下键:倒退 1 分钟 空格:暂停和播放
视频播放的方法和音频一样, “mplayer+视频名”即可
ls
amixer -c 0 sset 'Headphone',0 30% unmute
mplayer sold_out.mp3
花屏了,究其原因还是因为分辨率不一致导致
解决办法:修改分辨率
mplayer 下面命令可以修改播放时的分辨率
-x <x> -y <y> set display resolution (for use with -vm or -zoom)
然后根据配置选项以及开发板屏幕的分辨率(1024*600)运行下面语句,即可全屏播放,执行下列命令进行播放。
mplayer beautiful_girl.mp4 -zoom -x 1024 -y 600
效果如下: