We bought a Samsung TV and found AllShare on it, but you really don’t want to install Windows to use this feature? Then read below.
What is AllShare, on closer inspection, and what is it eaten with? Well, the Koreans apparently do not like people and that’s why they called out what everyone calls DLNA in their own way - AllShare, well, so that the enemies wouldn’t guess, or because they support DLNA clumsily and didn’t receive the appropriate certification, but oh, how they want.
What is
DLNA ? DLNA (Digital Living Network Alliance) is a standard that allows compatible devices to transmit and receive various media content (images, music, video) over a home network, as well as display it in real time. It is a technology for connecting home computers, mobile phones, laptops and consumer electronics into a single digital network. Devices that support the DLNA specification can be configured and merged into a home network automatically according to the user's wishes.
Media transmission medium is usually a home local area network (IP network). Connecting DLNA-compatible devices to your home network can be either wired (Ethernet) or wireless (Wi-Fi).
Choosing a
DLNA server may not seem like a trivial task, especially since the choice is
large enough. At home, under the home Debian, I decided to raise the
minidlna .
')
So where do you start? Well, as always, with the installation of dependencies, downloads of sources and their compilation.
$ sudo aptitude install libavcodec-dev libavformat-dev libavutil-dev libflac-dev libvorbis-dev libogg-dev libid3tag0-dev libexif-dev libjpeg-dev
$ wget "http://downloads.sourceforge.net/project/minidlna/minidlna/1.0.24/minidlna_1.0.24_src.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fminidlna%2Ffiles%2Fminidlna%2F1.0.24%2F&ts=1330931715&use_mirror=ignum" -O minidlna_1.0.24_src.tar.gz
$ tar xzf minidlna_1.0.24_src.tar.gz
$ cd minidlna-1.0.24/
$ make && sudo make install && sudo cp minidlna.conf /etc/
Now that the DLNA server has been compiled and installed, let's proceed to setting it up. This, in fact, also should not be any difficulties.
$ sudo vim /etc/minidlna.conf
In network_interface we prescribe a comma-separated interface on which the DLNA server will live.
The media_dir setting may not be limited to only one resource, these lines may be many. media_dir can include either just a directory name, or start with A, V or P, which means, respectively, the purpose of the resource - audio, video, pictures.
friendly_name describes the name that will be lit in the source list for DLNA resources.
notify_interval This parameter describes the interval at which notification of newly appeared resources occurs on the DLNA server. The default value of 900 seconds is probably still too high.
db_dir is the directory where the DLNA server will store its cache about the objects it represents.
log_dir - directory where DLNA server log will be kept.
Now it’s time to make the first launch of our DLNA server and see what happens:
minidlna -d -f /etc/minidlna.conf
We see that the server starts, starts scanning media resources and waits for clients to connect.
This could have been done, but it will probably be very lazy to start the server manually every time, and therefore we create a startup script and put it in /etc/init.d:
#! /bin/sh
### BEGIN INIT INFO
# Provides: minidlna
# Required-Start: $local_fs $remote_fs $syslog $network
# Should-Start:
# Required-Stop: $local_fs $remote_fs $syslog $network
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Minidlna
# Description: DLNA Media Server
### END INIT INFO
## EDIT FROM HERE
# Installation details
MINIDLNA="/usr/sbin/minidlna"
ARGS="/etc/minidlna.conf"
# Where to keep a log file
MINIDLNA_LOG="/var/log/minidlna.log"
# Where the PID lives
PID_FILE="/var/run/minidlna.pid"
## STOP EDITING HERE
# The path that is to be used for the script
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
set -e
# Only start if we can find the minidlna.conf.
test -x $MINIDLNA || exit 0
# Parse command line parameters.
case $1 in
start)
echo -n "Starting MiniDLNA: "
$MINIDLNA -f $ARGS -P $PID_FILE >> $MINIDLNA_LOG 2>&1
echo "ok"
;;
stop)
echo -n "Stopping MiniDLNA: "
for pidf in `/bin/ls $PID_FILE 2>/dev/null`; do
if [ -s $pidf ]; then
kill `cat $pidf` >/dev/null 2>&1
fi
rm -rf $PIF_FILE
done
echo "ok"
;;
restart|reload|force-reload)
echo "Restarting MiniDLNA: "
$0 stop
sleep 2
$0 start
;;
*)
# Print help
echo "Usage: /etc/init.d/minidlna {start|stop|restart|reload|force-reload}"
exit 1
;;
esac
exit 0
The contents of the script were
borrowed (why reinvent the wheel?), The only thing that headers were added for the normal execution of update-rc.d:
$ sudo update-rc.d minidlna defaults
Execution levels are relevant for Debian, Ubuntu and, probably, derived distributions. In principle, by changing the execution levels this script can be used in other distributions that support LSB headers.
Actually, this is the end of the server setup. Well, on the TV, we first enable AllShare, then we find all the DLNA servers in the broadcast domain, add them, see them in Source and enjoy their presence, and watching media content.
ps: To be fair, I’ll note that there is a mediatomb package in the Debian repository and that those who are too lazy to tinker with the minidlna build can install and configure it:
$ sudo aptitude install mediatomb