如何打造轻量级局域网视频共享---DLNA服务器minidlna
本帖最后由 vanabel 于 2015-5-2 11:16 编辑原教程发布于:Raspiberry Pi安装minidlna1.1.4并支持rmvb
首选参考1编译安装1.1.4.
1. 卸载掉1.0.24
sudo apt-get purge minidlna -y
sudo apt-get remove minidlna
sudo apt-get autoremove -y2
2. 添加源:echo "deb-src <a target="_blank" href="http://archive.raspbian.org/raspbian">http://archive.raspbian.org/raspbian</a> wheezy main contrib non-free" | sudo tee -a /etc/apt/sources.list
并更新源:
sudo apt-get update
3. 安装编译环境依赖包:sudo apt-get build-dep minidlna -y
你也可以手动安装:
sudo apt-get install libjpeg-dev libsqlite3-dev libexif-dev libid3tag0-dev libvorbis-dev libflac-dev -y
4. 下载minidlna1.1.4源码:wget <a target="_blank" href="http://sourceforge.net/projects/minidlna/files/minidlna/1.1.4/minidlna-1.1.4.tar.gz">http://sourceforge.net/projects/ ... nidlna-1.1.4.tar.gz</a>
并解压:tar -xvf minidlna-1.1.4.tar.gz
然后切换到目录:
cd minidlna-1.1.4
data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
5. 编辑源码使得支持rmvb, 主要修改的地方有23
diff -ur minidlna-1.1.4/metadata.c minidlna-1.1.4-usr/metadata.c
--- minidlna-1.1.4/metadata.c 2014-08-27 05:09:22.000000000 +0800
+++ minidlna-1.1.4-usr/metadata.c 2015-05-02 08:11:35.278306437 +0800
@@ -841,6 +841,12 @@
xasprintf(&m.mime, "video/x-matroska");
else if( strcmp(ctx->iformat->name, "flv") == 0 )
xasprintf(&m.mime, "video/x-flv");
+ //add by user to support rmvb
+ //from http://blog.csdn.net/Haven200/article/details/43039261
+ else if( strcmp(ctx->iformat->name, "rm") == 0 )
+ xasprintf(&m.mime, "video/x-pn-realvideo");
+ else if( strcmp(ctx->iformat->name, "rmvb") == 0 )
+ xasprintf(&m.mime, "video/x-pn-realvideo");
if( m.mime )
goto video_no_dlna;
diff -ur minidlna-1.1.4/upnpglobalvars.h minidlna-1.1.4-usr/upnpglobalvars.h
--- minidlna-1.1.4/upnpglobalvars.h 2014-08-27 05:09:22.000000000 +0800
+++ minidlna-1.1.4-usr/upnpglobalvars.h 2015-05-02 08:15:07.937072539 +0800
@@ -169,7 +169,8 @@
"http-get:*:audio/mp4:*," \
"http-get:*:audio/x-wav:*," \
"http-get:*:audio/x-flac:*," \
- "http-get:*:application/ogg:*"
+ "http-get:*:application/ogg:*,"\
+"http-get:*:video/x-pn-realvideo:*"
#define DLNA_FLAG_DLNA_V1_5 0x00100000
#define DLNA_FLAG_HTTP_STALLING0x00200000
diff -ur minidlna-1.1.4/utils.c minidlna-1.1.4-usr/utils.c
--- minidlna-1.1.4/utils.c 2014-08-27 05:09:22.000000000 +0800
+++ minidlna-1.1.4-usr/utils.c2015-05-02 08:03:17.031201433 +0800
@@ -381,6 +381,7 @@
ends_with(file, ".m2t") || ends_with(file, ".mkv") ||
ends_with(file, ".vob") || ends_with(file, ".ts") ||
ends_with(file, ".flv") || ends_with(file, ".xvid")||
+ ends_with(file, ".rm")|| ends_with(file, ".rmvb")||
#ifdef TIVO_SUPPORT
ends_with(file, ".TiVo") ||
#endif安装sudo apt-get install autoconf automake autopoint
并执行./autogen.sh然后配置编译环境:
./configure –disable-nls
7. 编译并安装:
make && sudo make install
8. 复制minidlna配置文件:sudo cp minidlna.conf /etc/
并编辑sudo vim /etc/minidlna.conf
修改
media_dir=/home/pi/downloads/Torrent_complete
# Names the DLNA server
friendly_name=RasPi Media Server
# Tells the DLNA to update the library when there are changes
inotify=yes
这里我们把所有媒体都放到了media_dir, 请对应修改. inotify表示是否刷新新文件
9. 开启服务:
sudo service minidlna start
10. 开机自启动:
sudo cp linux/minidlna.init.d.script /etc/init.d/minidlna
sudo chmod 755 /etc/init.d/minidlna
sudo update-rc.d minidlna defaults
参考文献
[*]Install ReadyMedia miniDLNA 1.1.4 Raspberry Pi
[*]minidlna支持共享rmvb文件
[*]MiniDLNA 1.1.4 添加对rmvb格式的支持
[*]更多教程请参考我的树莓派小站:vanraspi
页:
[1]