Решено: mpd streaming server (no sound)

Обсуждение настройки и работы сервисов, резервирования, сетевых настроек и вопросов безопасности ОС.

Модераторы: SLEDopit, Модераторы разделов

Аватара пользователя
shevan
Сообщения: 992
ОС: Debian, Puppy

Решено: mpd streaming server

Сообщение shevan »

mpd запускаю от юзера.
использую builtin http streaming,
веб морда phpmp и классический терминальный клиент работают, кроме воспроизведения звука

Код: Выделить всё

# An example configuration file for MPD
# See the mpd.conf man page for a more detailed description of each parameter.


# Files and directories #######################################################
#
# This setting controls the top directory which MPD will search to discover the
# available audio files and add them to the daemon's online database. This
# setting defaults to the XDG directory, otherwise the music directory will be
# be disabled and audio files will only be accepted over ipc socket (using
# file:// protocol) or streaming files over an accepted protocol.
#
music_directory        "/home/Music"
#
# This setting sets the MPD internal playlist directory. The purpose of this
# directory is storage for playlists created by MPD. The server will use
# playlist files not created by the server but only if they are in the MPD
# format. This setting defaults to playlist saving being disabled.
#
playlist_directory        "~/.mpd/playlists"
#
# This setting sets the location of the MPD database. This file is used to
# load the database at server start up and store the database while the
# server is not up. This setting defaults to disabled which will allow
# MPD to accept files over ipc socket (using file:// protocol) or streaming
# files over an accepted protocol.
#
db_file            "~/.mpd/mpd.db"
#
# These settings are the locations for the daemon log files for the daemon.
# These logs are great for troubleshooting, depending on your log_level
# settings.
#
# The special value "syslog" makes MPD use the local syslog daemon. This
# setting defaults to logging to syslog, otherwise logging is disabled.
#
log_file            "~/.mpd/mpd.log"
#
# This setting sets the location of the file which stores the process ID
# for use of mpd --kill and some init scripts. This setting is disabled by
# default and the pid file will not be stored.
#
pid_file            "~/.mpd/mpd.pid"
#
# This setting sets the location of the file which contains information about
# most variables to get MPD back into the same general shape it was in before
# it was brought down. This setting is disabled by default and the server
# state will be reset on server start up.
#
state_file            "~/.mpd/mpdstate"
#
###############################################################################


# General music daemon options ################################################
#
# This setting specifies the user that MPD will run as. MPD should never run as
# root and you may use this setting to make MPD change its user ID after
# initialization. This setting is disabled by default and MPD is run as the
# current user.
#
user                "user"
#
# This setting sets the address for the daemon to listen on. Careful attention
# should be paid if this is assigned to anything other then the default, any.
# This setting can deny access to control of the daemon.
#
# For network
bind_to_address        "localhost"
#
# And for Unix Socket
#bind_to_address        "/var/run/mpd/socket"
#
# This setting is the TCP port that is desired for the daemon to get assigned
# to.
#
#port                "6600"
#
# This setting controls the type of information which is logged. Available
# setting arguments are "default", "secure" or "verbose". The "verbose" setting
# argument is recommended for troubleshooting, though can quickly stretch
# available resources on limited hardware storage.
#
#log_level            "default"
#
# If you have a problem with your MP3s ending abruptly it is recommended that
# you set this argument to "no" to attempt to fix the problem. If this solves
# the problem, it is highly recommended to fix the MP3 files with vbrfix
# (available from <http://www.willwap.co.uk/Programs/vbrfix.php>), at which
# point gapless MP3 playback can be enabled.
#
#gapless_mp3_playback            "yes"
#
# This setting enables MPD to create playlists in a format usable by other
# music players.
#
#save_absolute_paths_in_playlists    "no"
#
# This setting defines a list of tag types that will be extracted during the
# audio file discovery process. Optionally, 'comment' can be added to this
# list.
#
#metadata_to_use    "artist,album,title,track,name,genre,date,composer,performer,disc"
#
###############################################################################


# Symbolic link behavior ######################################################
#
# If this setting is set to "yes", MPD will discover audio files by following
# symbolic links outside of the configured music_directory.
#
#follow_outside_symlinks    "yes"
#
# If this setting is set to "yes", MPD will discover audio files by following
# symbolic links inside of the configured music_directory.
#
follow_inside_symlinks        "yes"
#
###############################################################################


# Zeroconf / Avahi Service Discovery ##########################################
#
# If this setting is set to "yes", service information will be published with
# Zeroconf / Avahi.
#
#zeroconf_enabled        "yes"
#
# The argument to this setting will be the Zeroconf / Avahi unique name for
# this MPD server on the network.
#
#zeroconf_name            "Music Player"
#
###############################################################################


# Permissions #################################################################
#
# If this setting is set, MPD will require password authorization. The password
# can setting can be specified multiple times for different password profiles.
#
#password                        "password@read,add,control,admin"
#
# This setting specifies the permissions a user has who has not yet logged in.
#
#default_permissions             "read,add,control,admin"
#
###############################################################################


# Input #######################################################################
#

input {
        plugin "curl"
#       proxy "proxy.isp.com:8080"
#       proxy_user "user"
#       proxy_password "password"
}

#
###############################################################################

# Audio Output ################################################################
#
# MPD supports various audio output types, as well as playing through multiple
# audio outputs at the same time, through multiple audio_output settings
# blocks. Setting this block is optional, though the server will only attempt
# autodetection for one sound card.
#
# See <http://mpd.wikia.com/wiki/Configuration#Audio_Outputs> for examples of
# other audio outputs.
#
# An example of an ALSA output:
#
#audio_output {
#    type        "alsa"
#    name        "My ALSA Device"
#    device        "hw:0,0"    # optional
#    format        "44100:16:2"    # optional
#    mixer_device    "default"    # optional
#    mixer_control    "PCM"        # optional
#    mixer_index    "0"        # optional
#}
#
# An example of an OSS output:
#
#audio_output {
#    type        "oss"
#    name        "My OSS Device"
#    device        "/dev/dsp"    # optional
#    format        "44100:16:2"    # optional
#    mixer_device    "/dev/mixer"    # optional
#    mixer_control    "PCM"        # optional
#}
#
# An example of a shout output (for streaming to Icecast):
#
#audio_output {
#    type        "shout"
#    encoding    "ogg"            # optional
#    name        "My Shout Stream"
#    host        "localhost"
#    port        "8000"
#    mount        "/mpd.ogg"
#    password    "hackme"
#    quality        "5.0"
#    bitrate        "128"
#    format        "44100:16:1"
#    protocol    "icecast2"        # optional
#    user        "source"        # optional
#    description    "My Stream Description"    # optional
#    genre        "jazz"            # optional
#    public        "no"            # optional
#    timeout        "2"            # optional
#}
#
# An example of a httpd output (built-in HTTP streaming server):
#
audio_output {
    type        "httpd"
    name        "My HTTP Stream"
    encoder        "vorbis"        # optional, vorbis or lame
    port        "8000"
#    quality        "5.0"            # do not define if bitrate is defined
    bitrate        "128"            # do not define if quality is defined
    format        "44100:16:1"
}
#
# An example of a pulseaudio output (streaming to a remote pulseaudio server)
#
#audio_output {
#    type        "pulse"
#    name        "My Pulse Output"
#    server        "remote_server"        # optional
#    sink        "remote_server_sink"    # optional
#}
#
## Example "pipe" output:
#
#audio_output {
#    type        "pipe"
#    name        "my pipe"
#    command        "aplay -f cd 2>/dev/null"
## Or if you're want to use AudioCompress
#    command        "AudioCompress -m | aplay -f cd 2>/dev/null"
## Or to send raw PCM stream through PCM:
#    command        "nc example.org 8765"
#    format        "44100:16:2"
#}
#
## An example of a null output (for no audio output):
#
#audio_output {
#    type        "null"
#    name        "My Null Output"
#}
#
# This setting will change all decoded audio to be converted to the specified
# format before being passed to the audio outputs. By default, this setting is
# disabled.
#
#audio_output_format        "44100:16:2"
#
# If MPD has been compiled with libsamplerate support, this setting specifies
# the sample rate converter to use.  Possible values can be found in the
# mpd.conf man page or the libsamplerate documentation. By default, this is
# setting is disabled.
#
#samplerate_converter        "Fastest Sinc Interpolator"
#
###############################################################################


# Volume control mixer ########################################################
#
# These are the global volume control settings. By default, this setting will
# be detected to the available audio output device, with preference going to
# hardware mixing. Hardware and software mixers for individual audio_output
# sections cannot yet be mixed.
#
# An example for controlling an ALSA, OSS or Pulseaudio mixer; If this
# setting is used other sound applications will be affected by the volume
# being controlled by MPD.
#
#mixer_type            "hardware"
#
# An example for controlling all mixers through software. This will control
# all controls, even if the mixer is not supported by the device and will not
# affect any other sound producing applications.
#
#mixer_type            "software"
#
# This example will not allow MPD to touch the mixer at all and will disable
# all volume controls.
#
#mixer_type            "disabled"
#
###############################################################################


# Normalization automatic volume adjustments ##################################
#
# This setting specifies the type of ReplayGain to use. This setting can have
# the argument "album" or "track". See <http://www.replaygain.org> for more
# details. This setting is disabled by default.
#
#replaygain            "album"
#
# This setting sets the pre-amp used for files that have ReplayGain tags. By
# default this setting is disabled.
#
#replaygain_preamp        "0"
#
# This setting enables on-the-fly normalization volume adjustment. This will
# result in the volume of all playing audio to be adjusted so the output has
# equal "loudness". This setting is disabled by default.
#
#volume_normalization        "no"
#
###############################################################################


# MPD Internal Buffering ######################################################
#
# This setting adjusts the size of internal decoded audio buffering. Changing
# this may have undesired effects. Don't change this if you don't know what you
# are doing.
#
#audio_buffer_size        "2048"
#
# This setting controls the percentage of the buffer which is filled before
# beginning to play. Increasing this reduces the chance of audio file skipping,
# at the cost of increased time prior to audio playback.
#
#buffer_before_play        "10%"
#
###############################################################################


# Resource Limitations ########################################################
#
# These settings are various limitations to prevent MPD from using too many
# resources. Generally, these settings should be minimized to prevent security
# risks, depending on the operating resources.
#
#connection_timeout        "60"
#max_connections        "10"
#max_playlist_length        "16384"
#max_command_list_size        "2048"
#max_output_buffer_size        "8192"
#
###############################################################################


# Character Encoding ##########################################################
#
# If file or directory names do not display correctly for your locale then you
# may need to modify this setting. After modification of this setting mpd
# --create-db must be run to change the database.
#
filesystem_charset        "UTF-8"
#
# This setting controls the encoding that ID3v1 tags should be converted from.
#
id3v1_encoding            "UTF-8"
#
###############################################################################
Спасибо сказали:
Аватара пользователя
Jonnywalker
Сообщения: 60
ОС: Debian

Re: Решено: mpd streaming server

Сообщение Jonnywalker »

На всякий случай уточню: в такой конфигурации вывод звука будет только в сеть, но не в колонки вашего сервера.

Код: Выделить всё

curl -i  http://YOUR_MPD_SERVER_IP:8000 | head -n 10
что-нибудь похожее на поток показывает?

А вот так:

Код: Выделить всё

 wget YOUR_MPD_SERVER_IP:8000 -O mpd.ogg
записывается ли и проигрывается ли файл?

Я заметил разницу в заголовках ogg-потоков, полученных из mpd http streaming и радиостанций на icecast: у потока из mpd нет icy-заголовков, кроме того посылается Content-type: application/x-ogg вместо application/ogg.
Лично у меня VLC и Xine воспроизводят такой поток нормально, а вот Deadbeef уже не справляется. Думаю, если поток у вас в принципе идёт, то разгадка кроется именно в заголовках.
Спасибо сказали:
Аватара пользователя
wanderer6
Сообщения: 100
ОС: Ubuntu Studio

Re: Решено: mpd streaming server

Сообщение wanderer6 »

audio_output {
type "httpd"
name "My Stream"
bind_to_address "192.168.xx.xx"
port "8000"
bitrate "256" # do not define if quality is defined
format "44100:24:2"
}

Абсолютно точно работает.
Разобрался сам, расскажи другому.
Спасибо сказали:
Аватара пользователя
shevan
Сообщения: 992
ОС: Debian, Puppy

Re: Решено: mpd streaming server

Сообщение shevan »

Спасибо вам, информация полезная.

Как оказалось, задача переросла в другую проблему - оба порта закрыты (6600 и 8000).
Я делал им проброс за NAT в роутере (Zyxel P660) - но они не открылись. Я открывал до этого успешно порты 80, 21, 23

В связи с этим, у меня следующие вопросы:
Почему не открываются порты 6600, 8000? Закрыты провайдером? Как проверить? Почему эти не открываются, а остальные (основные) успешно открылись? Зависит от моей модели роутера?
Как определить список портов, которые можно открыть? Насколько я понимаю, поток аудио можно перенастроить на другие порты, хоть это и нежелательно.

Странно было бы, если провайдер оставил для пользования самые ходовые порты, и закрыл все остальные. Смысл мне этого не ясен.
С другой стороны, в модеме порты вроде правильно пробросил.
Спасибо сказали:
Аватара пользователя
Jonnywalker
Сообщения: 60
ОС: Debian

Re: Решено: mpd streaming server

Сообщение Jonnywalker »

А кстати, что с фаерволом на mpd-сервере?

Код: Выделить всё

sudo iptables -L

mpd точно вещает в сеть, а не только на локалхост?

Код: Выделить всё

sudo netstat -nlp --inet | grep mpd

Ситуация с частично закрытыми портами представляется вполне возможной, не поленитесь, уточните на всякий случай у техподдержки провайдера.
Для самостоятельной проверки портов я предложил бы вам подключить mpd-сервер напрямую к интернету, минуя роутер и отключив на машине фаервол. Ну или использовать другие инструменты типа nmap, tcpdump, nc...

Ну а ещё можно на пробу перевесить стриминг mpd на 80 порт, погасив перед этим веб-сервер, если он у вас запущен.
Спасибо сказали:
Аватара пользователя
shevan
Сообщения: 992
ОС: Debian, Puppy

Re: Решено: mpd streaming server

Сообщение shevan »

Код: Выделить всё

 sudo iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

 sudo netstat -nlp --inet | grep mpd
tcp        0      0 127.0.0.1:6600          0.0.0.0:*               LISTEN      2694/mpd


iptables идет с настройками по умолчанию.
Спасибо сказали:
Аватара пользователя
Bizdelnick
Модератор
Сообщения: 21560
Статус: nulla salus bello
ОС: Debian GNU/Linux

Re: Решено: mpd streaming server

Сообщение Bizdelnick »

shevan писал(а): ↑
01.09.2011 15:25
Почему не открываются порты 6600, 8000? Закрыты провайдером? Как проверить?

Позвонить в техподдержку. Или поискать на сайте. У некоторых провайдеров в качестве бесплатной "услуги" по умолчанию предоставляется файрвол, который можно отключить.
Пишите правильно:
в консоли
вку́пе (с чем-либо)
в общем
вообще
в течение (часа)
новичок
нюанс
по умолчанию
приемлемо
проблема
пробовать
трафик
Спасибо сказали:
Аватара пользователя
shevan
Сообщения: 992
ОС: Debian, Puppy

Re: Решено: mpd streaming server

Сообщение shevan »

Bizdelnick писал(а): ↑
02.09.2011 09:49
shevan писал(а): ↑
01.09.2011 15:25
Почему не открываются порты 6600, 8000? Закрыты провайдером? Как проверить?

Позвонить в техподдержку. Или поискать на сайте. У некоторых провайдеров в качестве бесплатной "услуги" по умолчанию предоставляется файрвол, который можно отключить.

Мой опыт показывает, что лучше туда не обращаться, т.к. себе же сделаю хуже. (Ex. закроют все открытые порты)

Если не получится самому решить вопрос, придется отказаться от медиастриминга. :unsure:
Спасибо сказали:
Аватара пользователя
sash-kan
Администратор
Сообщения: 13939
Статус: oel ngati kameie
ОС: GNU

Re: Решено: mpd streaming server

Сообщение sash-kan »

shevan писал(а): ↑
02.09.2011 12:39
Мой опыт показывает, что лучше туда не обращаться, т.к. себе же сделаю хуже. (Ex. закроют все открытые порты)
в каком смысле «закроют»? как я понимаю, у вас внешний ipv4 адрес имеется· все пакеты, поступающие на этот адрес, должны в неизменном виде попасть на ваше клиентское оборудование (если иное не оговорено в договоре)·
Писать безграмотно - значит посягать на время людей, к которым мы адресуемся, а потому совершенно недопустимо в правильно организованном обществе. © Щерба Л. В., 1957
при сбоях форума см.блог
Спасибо сказали:
Аватара пользователя
shevan
Сообщения: 992
ОС: Debian, Puppy

Re: Решено: mpd streaming server

Сообщение shevan »

Код: Выделить всё

# nmap –vv –sA 192.168.1.1,192.168.1.34 -p 6600,8000
...
PORT     STATE      SERVICE
6600/tcp unfiltered unknown
8000/tcp unfiltered http-alt
...

К нефильтруемым портам относятся те, которые программа nmap определила как закрытые, не встретив при этом брандмауэра или иного средства предотвращения доступа к портам.


Кстати, почему среди открытых портов нет mpd?

Код: Выделить всё

#nmap -vv 192.168.1.34
...
PORT     STATE SERVICE
21/tcp   open  ftp
22/tcp   open  ssh
25/tcp   open  smtp
80/tcp   open  http
111/tcp  open  rpcbind
901/tcp  open  samba-swat
2049/tcp open  nfs
5901/tcp open  vnc-1
6001/tcp open  X11:1
...

Спасибо сказали:
Аватара пользователя
Jonnywalker
Сообщения: 60
ОС: Debian

Re: Решено: mpd streaming server

Сообщение Jonnywalker »

Код: Выделить всё

sudo netstat -nlp --inet | grep mpd
tcp        0      0 127.0.0.1:6600          0.0.0.0:*               LISTEN      2694/mpd
mpd запущен и слушает управляющий порт 6600, но не вещает по http. Точно проверяли во время воспроизведения? Если да, то надо сначала разобраться с mpd.
Должно быть так:

Код: Выделить всё

tcp        0      0 127.0.0.1:6600          0.0.0.0:*               LISTEN      2694/mpd
tcp        0      0 0.0.0.0:8000          0.0.0.0:*               LISTEN      2694/mpd

Кстати, почему среди открытых портов нет mpd?

Код: Выделить всё

#nmap -vv 192.168.1.34
nmap по умолчанию не проверяет все порты. Укажите их в явном виде через флаг -p.

Если стриминг очень хочется, а mpd ну никак не хочет вещать сам, попробуйте связку mpd+icecast.
Спасибо сказали:
Аватара пользователя
shevan
Сообщения: 992
ОС: Debian, Puppy

Re: Решено: mpd streaming server

Сообщение shevan »

Код: Выделить всё

tcp        0      0 0.0.0.0:8000          0.0.0.0:*               LISTEN      2694/mpd

Не слушает на этом порту.

Приведу сюда свой конфиг, может станет ясней.

Код: Выделить всё

# An example configuration file for MPD
# See the mpd.conf man page for a more detailed description of each parameter.


# Files and directories #######################################################
#
# This setting controls the top directory which MPD will search to discover the
# available audio files and add them to the daemon's online database. This
# setting defaults to the XDG directory, otherwise the music directory will be
# be disabled and audio files will only be accepted over ipc socket (using
# file:// protocol) or streaming files over an accepted protocol.
#
music_directory        "/home/Music"
#
# This setting sets the MPD internal playlist directory. The purpose of this
# directory is storage for playlists created by MPD. The server will use
# playlist files not created by the server but only if they are in the MPD
# format. This setting defaults to playlist saving being disabled.
#
playlist_directory        "~/.mpd/playlists"
#
# This setting sets the location of the MPD database. This file is used to
# load the database at server start up and store the database while the
# server is not up. This setting defaults to disabled which will allow
# MPD to accept files over ipc socket (using file:// protocol) or streaming
# files over an accepted protocol.
#
db_file            "~/.mpd/mpd.db"
#
# These settings are the locations for the daemon log files for the daemon.
# These logs are great for troubleshooting, depending on your log_level
# settings.
#
# The special value "syslog" makes MPD use the local syslog daemon. This
# setting defaults to logging to syslog, otherwise logging is disabled.
#
log_file            "~/.mpd/mpd.log"
#
# This setting sets the location of the file which stores the process ID
# for use of mpd --kill and some init scripts. This setting is disabled by
# default and the pid file will not be stored.
#
pid_file            "~/.mpd/mpd.pid"
#
# This setting sets the location of the file which contains information about
# most variables to get MPD back into the same general shape it was in before
# it was brought down. This setting is disabled by default and the server
# state will be reset on server start up.
#
state_file            "~/.mpd/mpdstate"
#
###############################################################################


# General music daemon options ################################################
#
# This setting specifies the user that MPD will run as. MPD should never run as
# root and you may use this setting to make MPD change its user ID after
# initialization. This setting is disabled by default and MPD is run as the
# current user.
#
user                "$USER"
#
# This setting sets the address for the daemon to listen on. Careful attention
# should be paid if this is assigned to anything other then the default, any.
# This setting can deny access to control of the daemon.
#
# For network
bind_to_address        "localhost"
#
# And for Unix Socket
#bind_to_address        "/var/run/mpd/socket"
#
# This setting is the TCP port that is desired for the daemon to get assigned
# to.
#
#port                "6600"
#
# This setting controls the type of information which is logged. Available
# setting arguments are "default", "secure" or "verbose". The "verbose" setting
# argument is recommended for troubleshooting, though can quickly stretch
# available resources on limited hardware storage.
#
#log_level            "default"
#
# If you have a problem with your MP3s ending abruptly it is recommended that
# you set this argument to "no" to attempt to fix the problem. If this solves
# the problem, it is highly recommended to fix the MP3 files with vbrfix
# (available from <http://www.willwap.co.uk/Programs/vbrfix.php>), at which
# point gapless MP3 playback can be enabled.
#
#gapless_mp3_playback            "yes"
#
# This setting enables MPD to create playlists in a format usable by other
# music players.
#
#save_absolute_paths_in_playlists    "no"
#
# This setting defines a list of tag types that will be extracted during the
# audio file discovery process. Optionally, 'comment' can be added to this
# list.
#
#metadata_to_use    "artist,album,title,track,name,genre,date,composer,performer,disc"
#
###############################################################################


# Symbolic link behavior ######################################################
#
# If this setting is set to "yes", MPD will discover audio files by following
# symbolic links outside of the configured music_directory.
#
#follow_outside_symlinks    "yes"
#
# If this setting is set to "yes", MPD will discover audio files by following
# symbolic links inside of the configured music_directory.
#
follow_inside_symlinks        "yes"
#
###############################################################################


# Zeroconf / Avahi Service Discovery ##########################################
#
# If this setting is set to "yes", service information will be published with
# Zeroconf / Avahi.
#
#zeroconf_enabled        "yes"
#
# The argument to this setting will be the Zeroconf / Avahi unique name for
# this MPD server on the network.
#
#zeroconf_name            "Music Player"
#
###############################################################################


# Permissions #################################################################
#
# If this setting is set, MPD will require password authorization. The password
# can setting can be specified multiple times for different password profiles.
#
#password                        "password@read,add,control,admin"
#
# This setting specifies the permissions a user has who has not yet logged in.
#
#default_permissions             "read,add,control,admin"
#
###############################################################################


# Input #######################################################################
#

input {
        plugin "curl"
#       proxy "proxy.isp.com:8080"
#       proxy_user "user"
#       proxy_password "password"
}

#
###############################################################################

# Audio Output ################################################################
#
# MPD supports various audio output types, as well as playing through multiple
# audio outputs at the same time, through multiple audio_output settings
# blocks. Setting this block is optional, though the server will only attempt
# autodetection for one sound card.
#
# See <http://mpd.wikia.com/wiki/Configuration#Audio_Outputs> for examples of
# other audio outputs.
#
# An example of an ALSA output:
#
audio_output {
    type        "alsa"
    name        "My ALSA Device"
#    device        "hw:0,0"    # optional
#    format        "44100:16:2"    # optional
#    mixer_device    "default"    # optional
#    mixer_control    "PCM"        # optional
#    mixer_index    "0"        # optional
}
#
# An example of an OSS output:
#
#audio_output {
#    type        "oss"
#    name        "My OSS Device"
#    device        "/dev/dsp"    # optional
#    format        "44100:16:2"    # optional
#    mixer_device    "/dev/mixer"    # optional
#    mixer_control    "PCM"        # optional
#}
#
# An example of a shout output (for streaming to Icecast):
#
#audio_output {
#    type        "shout"
#    encoding    "ogg"            # optional
#    name        "My Shout Stream"
#    host        "localhost"
#    port        "8000"
#    mount        "/mpd.ogg"
#    password    "hackme"
#    quality        "5.0"
#    bitrate        "128"
#    format        "44100:16:1"
#    protocol    "icecast2"        # optional
#    user        "source"        # optional
#    description    "My Stream Description"    # optional
#    genre        "jazz"            # optional
#    public        "no"            # optional
#    timeout        "2"            # optional
#}
#
# An example of a httpd output (built-in HTTP streaming server):
#
audio_output {
    type        "httpd"
    name        "My HTTP Stream"
#    encoder        "vorbis"        # optional, vorbis or lame
    port        "8000"
        bind_to_address "192.168.1.34"
#    quality        "5.0"            # do not define if bitrate is defined
    bitrate        "256"            # do not define if quality is defined
    format        "44100:24:2"
}
#
# An example of a pulseaudio output (streaming to a remote pulseaudio server)
#
#audio_output {
#    type        "pulse"
#    name        "My Pulse Output"
#    server        "remote_server"        # optional
#    sink        "remote_server_sink"    # optional
#}
#
## Example "pipe" output:
#
#audio_output {
#    type        "pipe"
#    name        "my pipe"
#    command        "aplay -f cd 2>/dev/null"
## Or if you're want to use AudioCompress
#    command        "AudioCompress -m | aplay -f cd 2>/dev/null"
## Or to send raw PCM stream through PCM:
#    command        "nc example.org 8765"
#    format        "44100:16:2"
#}
#
## An example of a null output (for no audio output):
#
#audio_output {
#    type        "null"
#    name        "My Null Output"
#}
#
# This setting will change all decoded audio to be converted to the specified
# format before being passed to the audio outputs. By default, this setting is
# disabled.
#
#audio_output_format        "44100:16:2"
#
# If MPD has been compiled with libsamplerate support, this setting specifies
# the sample rate converter to use.  Possible values can be found in the
# mpd.conf man page or the libsamplerate documentation. By default, this is
# setting is disabled.
#
#samplerate_converter        "Fastest Sinc Interpolator"
#
###############################################################################


# Volume control mixer ########################################################
#
# These are the global volume control settings. By default, this setting will
# be detected to the available audio output device, with preference going to
# hardware mixing. Hardware and software mixers for individual audio_output
# sections cannot yet be mixed.
#
# An example for controlling an ALSA, OSS or Pulseaudio mixer; If this
# setting is used other sound applications will be affected by the volume
# being controlled by MPD.
#
#mixer_type            "hardware"
#
# An example for controlling all mixers through software. This will control
# all controls, even if the mixer is not supported by the device and will not
# affect any other sound producing applications.
#
#mixer_type            "software"
#
# This example will not allow MPD to touch the mixer at all and will disable
# all volume controls.
#
#mixer_type            "disabled"
#
###############################################################################


# Normalization automatic volume adjustments ##################################
#
# This setting specifies the type of ReplayGain to use. This setting can have
# the argument "album" or "track". See <http://www.replaygain.org> for more
# details. This setting is disabled by default.
#
#replaygain            "album"
#
# This setting sets the pre-amp used for files that have ReplayGain tags. By
# default this setting is disabled.
#
#replaygain_preamp        "0"
#
# This setting enables on-the-fly normalization volume adjustment. This will
# result in the volume of all playing audio to be adjusted so the output has
# equal "loudness". This setting is disabled by default.
#
#volume_normalization        "no"
#
###############################################################################


# MPD Internal Buffering ######################################################
#
# This setting adjusts the size of internal decoded audio buffering. Changing
# this may have undesired effects. Don't change this if you don't know what you
# are doing.
#
#audio_buffer_size        "2048"
#
# This setting controls the percentage of the buffer which is filled before
# beginning to play. Increasing this reduces the chance of audio file skipping,
# at the cost of increased time prior to audio playback.
#
#buffer_before_play        "10%"
#
###############################################################################


# Resource Limitations ########################################################
#
# These settings are various limitations to prevent MPD from using too many
# resources. Generally, these settings should be minimized to prevent security
# risks, depending on the operating resources.
#
#connection_timeout        "60"
#max_connections        "10"
#max_playlist_length        "16384"
#max_command_list_size        "2048"
#max_output_buffer_size        "8192"
#
###############################################################################


# Character Encoding ##########################################################
#
# If file or directory names do not display correctly for your locale then you
# may need to modify this setting. After modification of this setting mpd
# --create-db must be run to change the database.
#
filesystem_charset        "UTF-8"
#
# This setting controls the encoding that ID3v1 tags should be converted from.
#
id3v1_encoding            "UTF-8"
#
###############################################################################
Спасибо сказали:
Аватара пользователя
Jonnywalker
Сообщения: 60
ОС: Debian

Re: Решено: mpd streaming server

Сообщение Jonnywalker »

По вашему конфигу во время воспроизведения mpd должен слушать 8000. Раз не слушает, значит где-то ошибка со стороны mpd. Проброс порта тут пока не при чём.
Раскомментируйте в конфиге строку #log_level "default" и поменяйте значение на "verbose", после чего ~/.mpd/mpd.log в студию.

кстати, у меня mpd игнорирует bind_to_address в секции audio_output и занимает порт 8000 и отдаёт поток на всех сетевых интерфейсах
Спасибо сказали:
Аватара пользователя
shevan
Сообщения: 992
ОС: Debian, Puppy

Re: Решено: mpd streaming server

Сообщение shevan »

По факту я уже кое-что из этого сделал.

Сменил bind_to_address "0.0.0.0"
Установил лог левел --- verbosity

Вот что я имею:
При старте mpd в консоли:

Код: Выделить всё

$ mpd
listen: binding to address for 0.0.0.0
listen: binding to socket address 0.0.0.0:6600
path: path_set_fs_charset: fs charset is: UTF-8
database: reading DB
daemon: opening pid file
daemon: daemonized!
daemon: writing pid file


Код: Выделить всё

!netstat
netstat -tulpan | grep mpd
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:6600            0.0.0.0:*               LISTEN      26459/mpd


Если я запускаю веб-интерфейс удаленно phpmp и включаю проигрывание

Код: Выделить всё

!netstat
netstat -tulpan | grep mpd
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:8000            0.0.0.0:*               LISTEN      26459/mpd
tcp        0      0 0.0.0.0:6600            0.0.0.0:*               LISTEN      26459/mpd


Звука на удаленной машине нет. Я проверял на нескольких компьютерах.

Вот лог mpd с момента запуска сервера и клиента

Код: Выделить всё

Sep 30 08:11 : listen: listen_global_finish called
Sep 30 08:11 : db_finish took 0.000000 seconds
Sep 30 08:12 : state_file: Saving state file
Sep 30 08:12 : database: get song: Cassie-Cassie-FLAC-2006-iND/01-cassie-me_and_u.flac
Sep 30 08:12 : database: get song: Cassie-Cassie-FLAC-2006-iND/02-cassie-long_way.flac
Sep 30 08:12 : database: get song: Cassie-Cassie-FLAC-2006-iND/03-cassie-about_time.flac
Sep 30 08:12 : database: get song: Cassie-Cassie-FLAC-2006-iND/04-cassie-kiss_me.flac
Sep 30 08:12 : database: get song: Cassie-Cassie-FLAC-2006-iND/05-cassie-call_u_out.flac
Sep 30 08:12 : database: get song: Cassie-Cassie-FLAC-2006-iND/06-cassie-just_one_nite.flac
Sep 30 08:12 : database: get song: Cassie-Cassie-FLAC-2006-iND/07-cassie-hope_youre_behaving_(interlude).flac
Sep 30 08:12 : database: get song: Cassie-Cassie-FLAC-2006-iND/08-cassie-not_with_you.flac
Sep 30 08:12 : database: get song: Cassie-Cassie-FLAC-2006-iND/09-cassie-ditto.flac
Sep 30 08:12 : database: get song: Cassie-Cassie-FLAC-2006-iND/10-cassie-what_do_u_want.flac
Sep 30 08:12 : database: get song: Cassie-Cassie-FLAC-2006-iND/11-cassie-miss_your_touch.flac
Sep 30 08:18 : client: [0] opened from 127.0.0.1:57434
Sep 30 08:18 : client: [0] expired
Sep 30 08:18 : client: [0] closed
Sep 30 08:19 : client: [1] opened from 127.0.0.1:57447
Sep 30 08:19 : client: [2] opened from 127.0.0.1:57448
Sep 30 08:19 : client: [2] process command "lsinfo"
Sep 30 08:19 : client: [2] command returned 0
Sep 30 08:19 : client: [1] process command "lsinfo"
Sep 30 08:19 : client: [1] command returned 0
Sep 30 08:19 : client: [1] process command "listallinfo "conversions_talk.MP3""
Sep 30 08:19 : database: get song: conversions_talk.MP3
Sep 30 08:19 : client: [1] command returned 0
Sep 30 08:19 : client: [2] process command "listallinfo "conversions_talk.MP3""
Sep 30 08:19 : database: get song: conversions_talk.MP3
Sep 30 08:19 : client: [2] command returned 0
Sep 30 08:19 : client: [2] process command "listallinfo "the_lion_king_-_in_the_jungle.mp3""
Sep 30 08:19 : database: get song: the_lion_king_-_in_the_jungle.mp3
Sep 30 08:19 : client: [2] command returned 0
Sep 30 08:19 : client: [1] process command "listallinfo "the_lion_king_-_in_the_jungle.mp3""
Sep 30 08:19 : database: get song: the_lion_king_-_in_the_jungle.mp3
Sep 30 08:19 : client: [1] command returned 0
Sep 30 08:19 : client: [2] process command "status"
Sep 30 08:19 : client: [2] command returned 0
Sep 30 08:19 : client: [1] process command "status"
Sep 30 08:19 : client: [1] command returned 0
Sep 30 08:19 : client: [1] process command "lsinfo"
Sep 30 08:19 : client: [1] command returned 0
Sep 30 08:19 : client: [2] process command "playlistinfo 0"
Sep 30 08:19 : client: [2] command returned 0
Sep 30 08:19 : client: [2] process command "playlistinfo 1"
Sep 30 08:19 : client: [2] command returned 0
Sep 30 08:19 : client: [2] process command "playlistinfo 2"
Sep 30 08:19 : client: [2] command returned 0
Sep 30 08:19 : client: [2] process command "playlistinfo 3"
Sep 30 08:19 : client: [2] command returned 0
Sep 30 08:19 : client: [2] process command "playlistinfo 4"
Sep 30 08:19 : client: [2] command returned 0
Sep 30 08:19 : client: [2] process command "playlistinfo 5"
Sep 30 08:19 : client: [2] command returned 0
Sep 30 08:19 : client: [2] process command "playlistinfo 6"
Sep 30 08:19 : client: [2] command returned 0
Sep 30 08:19 : client: [1] process command "lsinfo"
Sep 30 08:19 : client: [1] command returned 0
Sep 30 08:19 : client: [2] process command "playlistinfo 7"
Sep 30 08:19 : client: [2] command returned 0
Sep 30 08:19 : client: [1] closed
Sep 30 08:19 : client: [2] process command "playlistinfo 8"
Sep 30 08:19 : client: [2] command returned 0
Sep 30 08:19 : client: [2] process command "playlistinfo 9"
Sep 30 08:19 : client: [2] command returned 0
Sep 30 08:19 : client: [2] process command "playlistinfo 10"
Sep 30 08:19 : client: [2] command returned 0
Sep 30 08:19 : client: [2] closed
Sep 30 08:19 : client: [3] opened from 127.0.0.1:57449
Sep 30 08:19 : client: [3] process command "play "0""
Sep 30 08:19 : playlist: play 0:"Cassie-Cassie-FLAC-2006-iND/01-cassie-me_and_u.flac"
Sep 30 08:19 : client: [3] command returned 0
Sep 30 08:19 : playlist: queue song 1:"Cassie-Cassie-FLAC-2006-iND/02-cassie-long_way.flac"
Sep 30 08:19 : client: [3] process command "lsinfo"
Sep 30 08:19 : client: [3] command returned 0
Sep 30 08:19 : client: [3] process command "listallinfo "conversions_talk.MP3""
Sep 30 08:19 : database: get song: conversions_talk.MP3
Sep 30 08:19 : client: [3] command returned 0
Sep 30 08:19 : client: [3] process command "listallinfo "the_lion_king_-_in_the_jungle.mp3""
Sep 30 08:19 : database: get song: the_lion_king_-_in_the_jungle.mp3
Sep 30 08:19 : client: [3] command returned 0
Sep 30 08:19 : client: [3] process command "status"
Sep 30 08:19 : client: [3] command returned 0
Sep 30 08:19 : client: [3] process command "playlistid 0"
Sep 30 08:19 : client: [3] command returned 0
Sep 30 08:19 : decoder: audio_format=44100:16:2, seekable=true
Sep 30 08:19 : client: [3] process command "playlistinfo 0"
Sep 30 08:19 : client: [3] command returned 0
Sep 30 08:19 : client: [3] process command "playlistinfo 1"
Sep 30 08:19 : client: [3] command returned 0
Sep 30 08:19 : client: [3] process command "playlistinfo 2"
Sep 30 08:19 : client: [3] command returned 0
Sep 30 08:19 : client: [3] process command "playlistinfo 3"
Sep 30 08:19 : client: [3] command returned 0
Sep 30 08:19 : client: [3] process command "playlistinfo 4"
Sep 30 08:19 : client: [3] command returned 0
Sep 30 08:19 : client: [3] process command "playlistinfo 5"
Sep 30 08:19 : client: [3] command returned 0
Sep 30 08:19 : client: [3] process command "playlistinfo 6"
Sep 30 08:19 : client: [3] command returned 0
Sep 30 08:19 : client: [3] process command "playlistinfo 7"
Sep 30 08:19 : client: [3] command returned 0
Sep 30 08:19 : client: [3] process command "playlistinfo 8"
Sep 30 08:19 : client: [3] command returned 0
Sep 30 08:19 : client: [3] process command "playlistinfo 9"
Sep 30 08:19 : client: [3] command returned 0
Sep 30 08:19 : client: [3] process command "playlistinfo 10"
Sep 30 08:19 : client: [3] command returned 0
Sep 30 08:19 : client: [3] closed
Sep 30 08:19 : output: opened plugin=httpd name="My HTTP Stream" audio_format=44100:16:2
Sep 30 08:21 : client: [4] opened from 127.0.0.1:57450
Sep 30 08:21 : client: [4] process command "lsinfo"
Sep 30 08:21 : client: [4] command returned 0
Sep 30 08:21 : client: [4] process command "listallinfo "conversions_talk.MP3""
Sep 30 08:21 : database: get song: conversions_talk.MP3
Sep 30 08:21 : client: [4] command returned 0
Sep 30 08:21 : client: [4] process command "listallinfo "the_lion_king_-_in_the_jungle.mp3""
Sep 30 08:21 : database: get song: the_lion_king_-_in_the_jungle.mp3
Sep 30 08:21 : client: [4] command returned 0
Sep 30 08:21 : client: [4] process command "status"
Sep 30 08:21 : client: [4] command returned 0
Sep 30 08:21 : client: [4] process command "playlistid 0"
Sep 30 08:21 : client: [4] command returned 0
Sep 30 08:21 : client: [4] process command "playlistinfo 0"
Sep 30 08:21 : client: [4] command returned 0
Sep 30 08:21 : client: [4] process command "playlistinfo 1"
Sep 30 08:21 : client: [4] command returned 0
Sep 30 08:21 : client: [4] process command "playlistinfo 2"
Sep 30 08:21 : client: [4] command returned 0
Sep 30 08:21 : client: [4] process command "playlistinfo 3"
Sep 30 08:21 : client: [4] command returned 0
Sep 30 08:21 : client: [4] process command "playlistinfo 4"
Sep 30 08:21 : client: [4] command returned 0
Sep 30 08:21 : client: [4] process command "playlistinfo 5"
Sep 30 08:21 : client: [4] command returned 0
Sep 30 08:21 : client: [4] process command "playlistinfo 6"
Sep 30 08:21 : client: [4] command returned 0
Sep 30 08:21 : client: [4] process command "playlistinfo 7"
Sep 30 08:21 : client: [4] command returned 0
Sep 30 08:21 : client: [4] process command "playlistinfo 8"
Sep 30 08:21 : client: [4] command returned 0
Sep 30 08:21 : client: [4] process command "playlistinfo 9"
Sep 30 08:21 : client: [4] command returned 0
Sep 30 08:21 : client: [4] process command "playlistinfo 10"
Sep 30 08:21 : client: [4] command returned 0
Sep 30 08:21 : client: [4] closed
Sep 30 08:22 : client: [5] opened from 127.0.0.1:57451
Sep 30 08:22 : client: [5] process command "lsinfo"
Sep 30 08:22 : client: [5] command returned 0
Sep 30 08:22 : client: [5] process command "listallinfo "conversions_talk.MP3""
Sep 30 08:22 : database: get song: conversions_talk.MP3
Sep 30 08:22 : client: [5] command returned 0
Sep 30 08:22 : client: [5] process command "listallinfo "the_lion_king_-_in_the_jungle.mp3""
Sep 30 08:22 : database: get song: the_lion_king_-_in_the_jungle.mp3
Sep 30 08:22 : client: [5] command returned 0
Sep 30 08:22 : client: [5] process command "status"
Sep 30 08:22 : client: [5] command returned 0
Sep 30 08:22 : client: [5] process command "playlistid 0"
Sep 30 08:22 : client: [5] command returned 0
Sep 30 08:22 : client: [5] process command "playlistinfo 0"
Sep 30 08:22 : client: [5] command returned 0
Sep 30 08:22 : client: [5] process command "playlistinfo 1"
Sep 30 08:22 : client: [5] command returned 0
Sep 30 08:22 : client: [5] process command "playlistinfo 2"
Sep 30 08:22 : client: [5] command returned 0
Sep 30 08:22 : client: [5] process command "playlistinfo 3"
Sep 30 08:22 : client: [5] command returned 0
Sep 30 08:22 : client: [5] process command "playlistinfo 4"
Sep 30 08:22 : client: [5] command returned 0
Sep 30 08:22 : client: [5] process command "playlistinfo 5"
Sep 30 08:22 : client: [5] command returned 0
Sep 30 08:22 : client: [5] process command "playlistinfo 6"
Sep 30 08:22 : client: [5] command returned 0
Sep 30 08:22 : client: [5] process command "playlistinfo 7"
Sep 30 08:22 : client: [5] command returned 0
Sep 30 08:22 : client: [5] process command "playlistinfo 8"
Sep 30 08:22 : client: [5] command returned 0
Sep 30 08:22 : client: [5] process command "playlistinfo 9"
Sep 30 08:22 : client: [5] command returned 0
Sep 30 08:22 : client: [5] process command "playlistinfo 10"
Sep 30 08:22 : client: [5] command returned 0
Sep 30 08:22 : client: [5] closed
Sep 30 08:22 : decoder: audio_format=44100:16:2, seekable=true
Sep 30 08:23 : playlist: queue song 2:"Cassie-Cassie-FLAC-2006-iND/03-cassie-about_time.flac"
Спасибо сказали:
Аватара пользователя
shevan
Сообщения: 992
ОС: Debian, Puppy

Re: Решено: mpd streaming server

Сообщение shevan »

Кстати, вот версия

Код: Выделить всё

aptitude show mpd | grep -i version
Version: 0.15.12-1.1

Спасибо сказали:
Аватара пользователя
Jonnywalker
Сообщения: 60
ОС: Debian

Re: Решено: mpd streaming server

Сообщение Jonnywalker »

Отлично! Значит в момент воспроизведения mpd поднимает на порту 8000 http-сервер.
А у вас в локальной сети есть ещё машины кроме mpd-сервера и роутера?
Спасибо сказали:
Аватара пользователя
shevan
Сообщения: 992
ОС: Debian, Puppy

Re: Решено: mpd streaming server

Сообщение shevan »

Jonnywalker писал(а): ↑
30.09.2011 18:13
Отлично! Значит в момент воспроизведения mpd поднимает на порту 8000 http-сервер.
А у вас в локальной сети есть ещё машины кроме mpd-сервера и роутера?

Ага. Есть линукс на десктопе

Спасибо сказали:
Аватара пользователя
Jonnywalker
Сообщения: 60
ОС: Debian

Re: Решено: mpd streaming server

Сообщение Jonnywalker »

Если я верно понял, что ip mpd-сервера - 192.168.1.34, то...
Попробуйте запустить воспроизведение в mpd, после чего выполнить сначала на самом mpd-сервере:

Код: Выделить всё

curl  -i http://192.168.1.34:8000/ | head  -
А потом то же самое с вашего десктопа. Весь вывод - сюда. (Естественно будут и нетекстовые символы)

если curl не стоит, его надо поставить
Спасибо сказали:
Аватара пользователя
shevan
Сообщения: 992
ОС: Debian, Puppy

Re: Решено: mpd streaming server

Сообщение shevan »

запускаю mpd и проигрывание, убеждаюсь что порты 8000 и 6600 висят на прослушивании

Далее,

Код: Выделить всё

curl -i http://192.168.1.34:8000/ | head -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:21 --:--:--

запускал команду по несколько раз на сервере и на десктопе - поток не идёт
На сервере через 20 секунд команда вылетает с ошибкой curl (7) couldn't connect to host.
На десктопе не дожидаюсь.
Спасибо сказали:
Аватара пользователя
shevan
Сообщения: 992
ОС: Debian, Puppy

Re: Решено: mpd streaming server

Сообщение shevan »

Да, я с тех пор файрвол настраивал, надо прописать правила
Спасибо сказали:
Аватара пользователя
shevan
Сообщения: 992
ОС: Debian, Puppy

Re: Решено: mpd streaming server

Сообщение shevan »

Добавил правило

Код: Выделить всё

iptables -A INPUT -d 192.168.1.34 -p tcp --dport 8000 -j ACCEPT


поток пошел на обоих машинах

Код: Выделить всё

curl -i http://192.168.1.34:8000/  | head -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0HTTP/1.1 200 OK
Content-Type: application/x-ogg
Connection: close
Pragma: no-cache
Cache-Control: no-cache, no-store

OggS4Ív÷vorbisD¬ÿÿÿÿèÿÿÿÿ¸OggS4ÍÒnHÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ$vorbis*Xiph.Org libVorbis IARTIST=CassieTITLE=Long Way
                           ALBUM=Cassie    DATE=200TRACK=02    GENRE=R&Bvorbis+Y@H!RH!b!b!rÈ!§r(yHI)¥Å0Åc1Æc1Æc 4d(    £æIjÎ9g'r 9iN8§ Qà9    Âõ&cn¦´¦knÎ)%
*¨ 
2È L2餓N:騣:ê(´ÐB
                 -´ÒJL1ÕVc®½]|sÎ9çsÎ9çsÎ    BCV Bd!R)¦r
2ȀАU GI±˱ÍÑ$Oò,Q5Ñ3ESTMUUUUu]Wve×vu×v}Y[¸}Y¸[؅]÷aaaaø}ß÷}ß÷} 4d  #9ã)¢"¢â9¢¬d     ")£I¦fj®i¶h«¶m˲,˲
@1ÅqÉÑ$OR-Ór5Ws=×sM×u]WUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUАU!f3a 4dC$ER$Çr,
Y¡ä КóÍ9堩ÓÁT'¹©sÎ9çlÎãsÎ)ʙŠКsÎI
                                ¥ КsÎy­©ҚsÎçÆasÎiҚ©ÙXsÎYК樹sΉ'µ¹TsÎ9çsÎ9çsΩ^ÎÁ9ásΉڛk¹    ]sÎùdîÍ    ásÎ9çsÎ9çsÎ    BCV@aØƝ }b!¦!t 1È)¤FJ©PR'¥tАU RH!RH!RH!b!§r
^[[?1;2c^[[?1;2c
Спасибо сказали:
Аватара пользователя
shevan
Сообщения: 992
ОС: Debian, Puppy

Re: Решено: mpd streaming server

Сообщение shevan »

Уже лучше.

Веб интерфейс не проигрывает. Незнаю почему я только на него ориентировался.

vlc пытается проигрывать прерывисто

Код: Выделить всё

vlc http://192.168.1.34:8000 &
[0xb3a00684] main input error: ES_OUT_SET_(GROUP_)PCR  is called too late (pts_delay increased to 1284 ms)
[0xb3a00684] main input error: ES_OUT_SET_(GROUP_)PCR  is called too late (pts_delay increased to 1287 ms)
[0xb3a00684] main input error: ES_OUT_SET_(GROUP_)PCR  is called too late (pts_delay increased to 1409 ms)
[0xb3a00684] main input error: ES_OUT_SET_(GROUP_)PCR  is called too late (pts_delay increased to 1611 ms)
[0xb3a00684] main input error: ES_OUT_SET_(GROUP_)PCR  is called too late (pts_delay increased to 1682 ms)
[0xb3a00684] main input error: ES_OUT_SET_(GROUP_)PCR  is called too late (pts_delay increased to 1798 ms)
...

Код: Выделить всё

mpc add http://192.168.1.34:8000/
error: Address family not supported by protocol


gmpc соединяется с сервером по 6600, но звука при проигрывании нет

Спасибо сказали:
Аватара пользователя
shevan
Сообщения: 992
ОС: Debian, Puppy

Re: Решено: mpd streaming server

Сообщение shevan »

Снял битрейт

Код: Выделить всё

bitrate        "128"
format        "44100:16:1"


vlc не заикается.
А вот gmpc не играет, жаль
Спасибо сказали:
Аватара пользователя
shevan
Сообщения: 992
ОС: Debian, Puppy

Re: Решено: mpd streaming server

Сообщение shevan »

Jonnywalker, Большое спасибо за помощь. :yes3:

Думаю, дальше уже ничем помочь не сможете.
Для gmpc скорее всего придется настраивать ssh тунелирование
http://gmpc.wikia.com/wiki/GMPC_SHOUT_SSH_REMOTE
Спасибо сказали:
Аватара пользователя
Jonnywalker
Сообщения: 60
ОС: Debian

Re: Решено: mpd streaming server

Сообщение Jonnywalker »

Всегда пожалуйста :)
Позволю всё же себе дать ещё пояснение к увиденному мной.
Веб-интерфейс и не должен возвращать звук. Он только подключается к mpd через порт 6600 точно так же, как mpc, gmpc, sonata, qmpc и др. и осуществляет управление mpd, посылая ему простые текстовые команды. То есть это просто пульты управления.
А mpd, получив с любого пульта команду "play", выводит звук туда, куда прописано в его конфиге. В вашем случае - в колонки на mpd-сервере и на встроенный http-сервер на порту 8000.
Если же звук нужен на другой машине, то после запуска воспроизведения на mpd этот поток надо с mpd-сервера ещё забрать и проиграть на стороне клиента другим плеером.
Суть же плагина gmpc-shout только в том, что при старте воспроизведения в mpd плагин на стороне клиента автоматически запускает в фоне mplayer и скармливает ему заранее указанный адрес потока. А ssh-туннель здесь используется только для шифрования управляющего сигнала к mpd и полученного потока (чтобы никто не узнал, что вы слушаете :)

Пока всё это сам осмыслял и писал, родилась ещё мысль:
можно немного хакнуть phpmp, чтобы он при старте воспроизведения запускал в вашем браузере html5/flash аудиоплеер и в нём играл бы нужный поток.
Спасибо сказали:
Аватара пользователя
Jonnywalker
Сообщения: 60
ОС: Debian

Re: Решено: mpd streaming server

Сообщение Jonnywalker »

А ещё можно на клиенте написать скрипт, который будет в бесконечном цикле проверять на сервере состояние порта 8000, и если там что-то есть, то запускать простой консольный плеер типа mpg321 с нужным потоком, а если нет, то просто засыпать на время.
Спасибо сказали:
Аватара пользователя
shevan
Сообщения: 992
ОС: Debian, Puppy

Re: Решено: mpd streaming server

Сообщение shevan »

Jonnywalker писал(а): ↑
01.10.2011 13:26
Всегда пожалуйста :)
Позволю всё же себе дать ещё пояснение к увиденному мной.
Веб-интерфейс и не должен возвращать звук. Он только подключается к mpd через порт 6600 точно так же, как mpc, gmpc, sonata, qmpc и др. и осуществляет управление mpd, посылая ему простые текстовые команды. То есть это просто пульты управления.
А mpd, получив с любого пульта команду "play", выводит звук туда, куда прописано в его конфиге. В вашем случае - в колонки на mpd-сервере и на встроенный http-сервер на порту 8000.

Да, вполне логично. Как-то я об этом не подумал.
Мне видимо очень хотелось, чтобы фронтенд выводил звук на той машины, на которой запущен :) И это мне тоже кажется логичным
В таком случае, фронтенд теряет для меня смысл.

При первоначальном визарде gmpc существует возможность указать хост, он коннектится, но в настройках звука только 'http stream', т.е. нет возможности указать локальный вывод аудио. А было бы здорово.

Суть же плагина gmpc-shout только в том, что при старте воспроизведения в mpd плагин на стороне клиента автоматически запускает в фоне mplayer и скармливает ему заранее указанный адрес потока. А ssh-туннель здесь используется только для шифрования управляющего сигнала к mpd и полученного потока (чтобы никто не узнал, что вы слушаете :)

Не могу понять смысл этого. Надо перечитать статью.
Ну то что в обертке mplayer это понятно, но зачем тогда gmpc. Управляет плейлистами?

Код: Выделить всё

Пока всё это сам осмыслял и писал, родилась ещё мысль:
можно немного хакнуть phpmp, чтобы он при старте воспроизведения запускал в вашем браузере html5/flash аудиоплеер и в нём играл бы нужный поток.

Вообще, мне кажется, должно быть более изящное решение. буду гуглить.
Спасибо сказали:
Аватара пользователя
Jonnywalker
Сообщения: 60
ОС: Debian

Re: Решено: mpd streaming server

Сообщение Jonnywalker »

Смысл фронтенда в том, чтобы удалённо посылать серверу управляющие команды. В принципе, можно обойтись даже без консольного mpc.
Придётся говорить серверу "play", "pause" или "add /my_music/my_artist/my_album/05-hello.mp3" через telnet или nc, что как-то неудобно.
Фронтенд сам ничего не воспроизводит и даже не хранит плейлисты.
И штатного механизма обратной передачи звука из сервера в фронтенд в протоколе mpd нет. Поэтому и появляются плагины, реализующие его подручными средствами.
Спасибо сказали:
Аватара пользователя
Jonnywalker
Сообщения: 60
ОС: Debian

Re: Решено: mpd streaming server

Сообщение Jonnywalker »

Если не затруднит, расскажите потом, что в итоге получилось.
Спасибо сказали:
Аватара пользователя
shevan
Сообщения: 992
ОС: Debian, Puppy

Re: Решено: mpd streaming server

Сообщение shevan »

Jonnywalker писал(а): ↑
01.10.2011 13:26
Суть же плагина gmpc-shout только в том, что при старте воспроизведения в mpd плагин на стороне клиента автоматически запускает в фоне mplayer и скармливает ему заранее указанный адрес потока. А ssh-туннель здесь используется только для шифрования управляющего сигнала к mpd и полученного потока (чтобы никто не узнал, что вы слушаете :)

Перечитал еще раз те статьи, и понял, что они пробрасывают порты от сервера к клиенту через ssh.
Т.е. всё что слушается на серверных портах 6600 и 8000 отправляется на те же порты на клиентскую машину.

Мне удалось таким образом подключить клиентский gmpc (с его точки зрения, к локалхост), и направить вывод через плагин gmpc-shout в mplayer
Такая сложная конструкция работает, но на моей машине поток временами подтормаживает. Может потому что ресурсы сервера ограничены (~ 500 MHz)

Других способов не нашел.
Есть лисовый плагин https://addons.mozilla.org/en-US/firefox/ad...-player-minion/
Но он скорее всего тоже просто пульт управления. Не смог протестировать - у меня лис 7-ой.

Вывод от всего:
1. Костыль через ssh мне не по душе + оно иногда вываливается и поток тормозит
2. Настраивать через icecast, говорят оно больше ресурсов жрет. И по моим задачам не оправдано
3. Напрямую слушать поток в vlc или mplayer, опять же надо отдельно пульт управления держать
а) можно впринципе настроить и слушать, но надо проводить отладку и искать причину что так тормозит поток

Скорее всего параллельно буду искать другой легкий медиа сервер, который поддерживает нужные мне функции изначально.
Спасибо сказали: