4.Licheepi Mplayer

Licheepi-Mplayer

  • 本篇是配置使用Mplayer播放器
  • 内核版本:5.2.y
  • buildroot-2017.08.1

首先要配置Mplayer之前,要先配置ALSA(声音)

1.配置ALSA

make menuconfig

Target packages---->

​ Audio and video applications----->

​ alsa-utils----->

把里面的选项全部选了。

图11

Target packages---->

​ Libraries----->

​ Audio/Sound----->

​ alsa-lib----->

图12

然后编译:

make

1.1使用alsa

首先到根目录:

cd /

使用命令:

alsamixer

输出:

┌────────────────────────────── AlsaMixer v1.1.4 ──────────────────────────────┐
│ Card: V3s Audio Codec                                F1:  Help               │
│ Chip:                                                F2:  System information │
│ View: F3:[Playback] F4: Capture  F5: All             F6:  Select sound card  │
│ Item: Headphone [dB gain: mute]                      Esc: Exit               │
│                                                                              │
│      ┌──┐                    ┌──┐        ┌──┐        ┌──┐                    │
│      │  │                    │  │        │  │        │▒▒│                    │
│      │  │                    │  │        │  │        │▒▒│                    │
│      │  │                    │  │        │  │        │▒▒│                    │
│      │  │                    │  │        │  │        │▒▒│                    │
│      │  │                    │  │        │▒▒│        │▒▒│                    │
│      │  │                    │  │        │▒▒│        │▒▒│                    │
│      │  │                    │▒▒│        │▒▒│        │▒▒│                    │
│      │  │                    │▒▒│        │▒▒│        │▒▒│                    │
│      │  │                    │▒▒│        │▒▒│        │▒▒│                    │
│      │  │                    │▒▒│        │▒▒│        │▒▒│                    │
│      │  │                    │▒▒│        │▒▒│        │▒▒│                    │
│      ├──┤         DAC        ├──┤        └──┘        ├──┤        ┌──┐        │
│      │MM│                    │MM│                    │MM│        │MM│        │
│      └──┘                    └──┘                    └──┘        └──┘        │
│       0                       43          64         100                     │
│  < Headphone >Headphone S    Mic1     Mic1 Boost      DAC     DAC Reverse    │
└──────────────────────────────────────────────────────────────────────────────┘

说明是成功的。

从左到右是:耳机音量,耳机输出源,Mic增益,mic1 boost, DAC增益。

1.1.1播放

由于开机默认是静音的,要使用命令取消静音:

amixer -c 0 sset 'Headphone',0 100% unmute

把耳机插在板子上的耳机接口,从电脑中C:\Windows\media,拷贝Alarm01.wav到根目录下,播放.wav格式的文件:

aplay Alarm01.wav

就能听到音乐了。

参考:http://zero.lichee.pro/驱动/CODEC.html#id8

1.1.2录制

首先使能mic1:

amixer -c 0 cset numid=12 2

amixer命令说明:

amixer -c <"card"> cset numid=<"control#"> <"input_port">

where:
<"card"> is the card, 0 for the sunxi-codec and 1 for the hdmi audio output
<"input_port"> is the input port from the table
<"control#"> is the control # showed using: aximer contents

然后开始录制:

arecord -D hw:0,0 -d 3 -f S16_LE -r 16000 tmp.wav

在播放录制好的文件tmp.wav之前,要重新使能耳机:

amixer -c 0 sset 'Headphone',0 100% unmute

播放录制好的文件:

aplay  tmp.wav

参考:http://zero.lichee.pro/驱动/CODEC.html#id8

2.配置Mplayer

2.1配置buildroot

make menuconfig

Target packages --->

​ Audio and video applications --->

​ [*] mplayer

然后保存退出,编译

2.2配置kernel

make ARCH=arm menuconfig

Device Drivers --->
< * > Sound card support --->
< * > Advanced Linux Sound Architecture --->
[ * ] Enable OSS Emulation
< * > OSS Mixer API
< * > OSS PCM (digital audio) API
[ * ] OSS PCM (digital audio) API - Include plugin system

编译:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j4

2.3使用Mplayer

在使用之前,先把静音关闭:

amixer -c 0 sset 'Headphone',0 100% unmute

然后直接播放视频:

mplayer  video.mp4

视频显示在LCD上,并且耳机也有声音,成功!

参考:https://whycan.com/t_742.html

视频在线转换:https://zh.pickfrom.net/resize-video

posted @ 2021-02-19 21:33  R1chie  阅读(162)  评论(0编辑  收藏  举报