How to Install and Configure mplayer-share (Step‑by‑Step)mplayer-share is a lightweight utility designed to make sharing and streaming media with MPlayer easier across local networks and between user accounts. This guide walks you through installing mplayer-share, configuring it for common setups, securing access, and troubleshooting typical problems. Steps assume a Unix-like environment (Linux, BSD, macOS with Homebrew). Commands shown use a terminal shell (bash/zsh). Adjust package-manager commands to your distribution.
1. Prerequisites
- MPlayer installed — required for playback and streaming.
- Basic command-line skills — editing files, running commands as root or via sudo.
- Network access — if you plan to stream across machines.
- Sufficient disk space for media files and temporary caches.
If MPlayer is not installed:
- Debian/Ubuntu:
sudo apt update sudo apt install mplayer
- Fedora:
sudo dnf install mplayer
- Arch:
sudo pacman -S mplayer
- macOS (Homebrew):
brew install mplayer
2. Obtain mplayer-share
mplayer-share may be distributed as a package for some distros, or as source code on a repository. Check your package manager first:
- Debian/Ubuntu:
sudo apt install mplayer-share
If unavailable or you prefer the latest version, fetch from the project’s repository (example using git):
git clone https://example.org/mplayer-share.git cd mplayer-share
Replace the URL above with the actual repository URL for mplayer-share.
3. Build and Install from Source
If you cloned from source, follow these general steps (project-specific files or build system may vary: Makefile, autotools, cmake, or setup.py):
- Typical autotools/Makefile:
./configure --prefix=/usr/local make sudo make install
- CMake:
mkdir build && cd build cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local make sudo make install
- Python-based installer:
python3 setup.py build sudo python3 setup.py install
After installation, verify the binary/script is available in your PATH:
which mplayer-share mplayer-share --help
4. Basic Configuration
mplayer-share usually provides a configuration file. Common locations:
- /etc/mplayer-share.conf
- /usr/local/etc/mplayer-share.conf
- ~/.config/mplayer-share/config
If no config exists, create one in your home config directory:
mkdir -p ~/.config/mplayer-share nano ~/.config/mplayer-share/config
A minimal example config (adjust keys for the tool’s expected format):
# ~/.config/mplayer-share/config [general] media_dir = /home/username/Videos cache_dir = /home/username/.cache/mplayer-share log_level = info bind_address = 0.0.0.0 port = 8080 max_connections = 5 [transcoding] enable = yes ffmpeg_path = /usr/bin/ffmpeg default_preset = h264-720p
Key options explained:
- media_dir — directory with media to share.
- bind_address/port — network interface and port for the service.
- cache_dir — where temporary files or stream caches live.
- max_connections — limit simultaneous clients.
- transcoding — whether to transcode streams on-the-fly (requires ffmpeg or avconv).
After editing, save and exit.
5. Running the Service
If mplayer-share installs a systemd service, enable and start it:
sudo systemctl enable mplayer-share.service sudo systemctl start mplayer-share.service sudo systemctl status mplayer-share.service
To run manually in foreground for testing:
mplayer-share --config ~/.config/mplayer-share/config --foreground
Check logs (journalctl or log files specified in config) to confirm startup and binding to port.
6. Client Access and Playback
mplayer-share typically exposes an HTTP (or custom) endpoint listing shared media. On another machine:
- Open the browser at http://SERVER_IP:PORT/ (e.g., http://192.168.1.10:8080/)
- Use MPlayer to play a stream directly:
mplayer http://192.168.1.10:8080/stream/movie.mp4
- If mplayer-share provides playlist (.m3u, .pls), download and open with MPlayer.
For LAN discovery, some implementations support SSDP/UPnP; ensure firewall allows discovery/port traffic.
7. Enabling Transcoding (On-the-fly)
To serve formats unsupported by clients, enable transcoding in config and ensure ffmpeg or avconv is installed.
Install ffmpeg:
- Debian/Ubuntu:
sudo apt install ffmpeg
Then set ffmpeg_path in config. Configure presets for bitrate/resolution. Example command-line fallback:
ffmpeg -i input.mkv -c:v libx264 -preset fast -crf 23 -c:a aac -b:a 128k -f mp4 -
mplayer-share will wrap such commands to stream output to clients. Test with a single low-bitrate preset before enabling many simultaneous transcodes.
8. User Accounts, Access Control, and Security
Basic measures:
- Bind to local interface (127.0.0.1) if not sharing across network.
- Use firewall rules (ufw/iptables) to restrict access.
- If mplayer-share supports authentication, enable it in config (HTTP basic, token, or integration with system users).
- Use HTTPS/TLS if accessing across untrusted networks (reverse proxy like nginx with certbot can add TLS).
Example nginx reverse-proxy with TLS and basic auth (summary):
- Install nginx and certbot.
- Configure nginx to proxy / to mplayer-share localhost:8080 and enable TLS.
- Protect with HTTP auth using htpasswd.
9. Integration with System File Shares and Indexing
- If media is on an NFS/SMB share, ensure mplayer-share’s service user has read permissions.
- Run a periodic rescan (cron/systemd timer) to update library indexes when new files arrive.
Example cron to rescan every hour:
0 * * * * /usr/local/bin/mplayer-share --rescan
10. Troubleshooting
- Service won’t start: check config syntax, reserved port, permissions, and service logs.
- “Port already in use”: find process with
sudo ss -ltnp | grep :8080
then stop conflicting service. - Transcoding fails: ensure ffmpeg path correct and codecs installed.
- Playback stutters: lower bitrate preset or increase server CPU; check network throughput.
- Files not visible: verify media_dir path and permissions; run
ls
as service user.
Useful commands:
journalctl -u mplayer-share.service -f ss -ltnp | grep mplayer-share tail -n 200 /var/log/mplayer-share.log
11. Example: Minimal Working Setup (Ubuntu)
- Install dependencies:
sudo apt update sudo apt install mplayer ffmpeg git
- Clone and install:
git clone https://example.org/mplayer-share.git cd mplayer-share sudo ./install.sh
- Create config (~/.config/mplayer-share/config) pointing to ~/Videos and port 8080.
- Start service:
systemctl --user enable --now mplayer-share
- Browse to http://localhost:8080/ and play a file using MPlayer on another machine.
12. Advanced Tips
- Use systemd user services for per-user sharing without root.
- Limit CPU usage of transcodes with nice/cgroups.
- Use a reverse proxy (nginx) to add TLS, rate-limiting, and access logs.
- Maintain a separate cache partition for heavy read/write while transcoding.
13. Conclusion
Following these steps you can install, configure, and run mplayer-share to stream media locally or on a LAN. Start simple (local directory + no transcoding), verify basic playback, then enable more advanced features (transcoding, TLS, authentication) as needed. If you tell me your OS and whether you want LAN-only or internet streaming, I can provide a tailored config and exact commands.
Leave a Reply