本文介绍了Linux上的MPC/MPD:如何播放本地WAV文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过mpc将本地文件添加到mpd并播放它.我的平台是OpenWRT嵌入式Linux.

I am trying to add a local file to mpd ( through mpc ) and play it . my platform is OpenWRT embedded linux .

因此,在手册页中指出:

so, from the man page, it states:

mpc add <file>   Add a song to the current playlist

如果我这样做:

root@OpenWrt:~/.mpd# mpc add /usr/share/baresip/ring.wav
error adding /usr/share/baresip/ring.wav: directory or file not found

或者如果我这样做:

root@OpenWrt:~/.mpd# mpc add file:///usr/share/baresip/ring.wav
error adding file:///usr/share/baresip/ring.wav: Access denied

这里正确的语法到底是什么?对于mpc/mpd,手册页确实不是很清楚.

what exactly is the correct syntax here? the man page is really not very clear for mpc / mpd .

推荐答案

我没有找到如何播放wav ..但是我忘了我找到了解决方案(适用于mp3)并将其发布在这里: https://forum.openwrt.org/viewtopic.php?id=41022

i did not find out how to play wav..but i forgot i found the solution (for mp3) and posted it here: https://forum.openwrt.org/viewtopic.php?id=41022

但是,由于stackoverflow总是在Google搜索中排名最高,因此我在此处粘贴了相同的解决方案,以防它对某人有所帮助:

however, since stackoverflow always shows up top on google search i am pasting the same solution here in case it helps someone as well :

/etc/mpd.conf应该类似于以下内容:

/etc/mpd.conf should be something approximately like this:

music_directory        "/tmp"
playlist_directory        "~/.mpd/playlists"
db_file            "~/.mpd/database"
log_file            "/tmp/mpdlog"
pid_file            "~/.mpd/pid"
state_file            "~/.mpd/state"
sticker_file            "~/.mpd/sticker.sql"

user                "root"
group                "root"
bind_to_address "127.0.0.1"


log_level            "verbose"
auto_update    "yes"
auto_update_depth "3"
follow_outside_symlinks    "yes"
follow_inside_symlinks        "yes"

然后:

  1. /etc/init.d/mpd重新启动
  2. 将MP3(wav似乎不起作用)文件复制到/tmp文件夹(因为音乐目录是/tmp文件夹)
  3. mpc更新
  4. mpc添加file.mp3(添加/tmp/file.mp3无效)
  5. mpc播放

这篇关于Linux上的MPC/MPD:如何播放本地WAV文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-13 22:05