社区公告:  



[经验分享] 本机搭建DLNA教程

  [复制链接]

MiniDLNA(官网)----DLNA服务端,不支持rm、rmvb格式的文件分享,但可以自己修改源文件来支持,所以就选它了。它还自带一个Web网页,可以显示分享资源数与当前客户端名字等等,在浏览器里打开http://本机IP:8200


1、下载源代码,目前minidlna最新版本1.1.4, 下载地址sourceforge.net

2、修改源文件

metadata.c


[cpp] view plain copy


  • //line 840  
  • else if( strncmp(ctx->iformatctx->name, "matroska", 8) == 0 )  
  •     xasprintf(&m.mime, "video/x-matroska");  
  • else if( strcmp(ctx->iformatctx->name, "flv") == 0 )  
  •     xasprintf(&m.mime, "video/x-flv");  
  • //----添加----  
  • 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_nodlna;  


upnpglobalvars.h
[cpp] view plain copy


  • // Line 169  
  •     "http-get:*:audio/mp4:*," \  
  •     "http-get:*:audio/x-wav:*," \  
  •     "http-get:*:audio/x-flac:*," \  
  •     "http-get:*:application/ogg:*," \  
  • //----add----  
  •     "http-get:*:video/x-pn-realvideo:*"  
  • //----end----  
  •   
  • #define DLNA_FLAG_DLNA_V1_5      0x00100000  
  • #define DLNA_FLAG_HTTP_STALLING  0x00200000  




utils.c


[cpp] view plain copy


  • //line 381  
  •         ends_with(file, ".m2t") || ends_with(file, ".mkv")   ||  
  •         ends_with(file, ".vob") || ends_with(file, ".ts")    ||  
  •         ends_with(file, ".flv") || ends_with(file, ".xvid")  ||  
  • //----add----  
  •         ends_with(file, ".rm")  || ends_with(file, ".rmvb")  ||  
  • //----end----  
  • #ifdef TIVO_SUPPORT  
  •         ends_with(file, ".TiVo") ||  
  • #endif  
  •         ends_with(file, ".mov") || ends_with(file, ".3gp"));  





3、编译步骤
[plain] view plain copy


  • sudo apt-get install build-essential libexif-dev libjpeg-dev \  
  • libid3tag0-dev libFLAC-dev libvorbis-dev libsqlite3-dev libavformat-dev \  
  • autoconf automake  
  •   
  • ./autogen.sh  
  • ./configure  
  • make  
  • make install  
  • sudo cp ./linux/minidlna.inot.d.script.tmpl  /etc/init.d/minidlna  
  • sudo cp ./minidlna.conf  /etc/minidlna.conf  
  •   
  • # 第一次启动使用-d –v选项看有没有出错  
  • sudo /usr/local/sbin/minidlnad -d -v  
  • # 没出错就ctrl+c 结束进程  
  •   
  • # 正常启动  
  • sudo service minidlna start  
  • # 刷新列表  
  • sudo service minidlna restart  



打赏账户:
0x9df1ae8fc43e14d0ede6fc84fb0b1091ca56886b

全部评论(4)

跳转到指定楼层
★★★★★★★ 发表于 2017-10-10 18:55:53

4. Minidlna配置
minidlna.conf
[html] view plain copy
# port for HTTP (descriptions, SOAP, media transfer) traffic  
port=8200  
  
# network interfaces to serve, comma delimited  
#network_interface=eth0  
  
# specify the user account name or uid to run as  
#user=jmaggard  
  
# set this to the directory you want scanned.  
# * if you want multiple directories, you can have multiple media_dir= lines  
# * if you want to restrict a media_dir to specific content types, you  
#   can prepend the types, followed by a comma, to the directory:  
#   + "A" for audio  (eg. media_dir=A,/home/jmaggard/Music)  
#   + "V" for video  (eg. media_dir=V,/home/jmaggard/Videos)  
#   + "" for images (eg. media_dir=P,/home/jmaggard/Pictures)  
#   + "V" for pictures and video (eg. media_dir=PV,/home/jmaggard/digital_camera)  
media_dir=/opt  
  
# set this to merge all media_dir base contents into the root container  
# note: the default is no  
#merge_media_dirs=no  
  
# set this if you want to customize the name that shows up on your clients  
#friendly_name=My DLNA Server  
  
# set this if you would like to specify the directory where you want MiniDLNA to store its database and album art cache  
#db_dir=/var/cache/minidlna  
  
# set this if you would like to specify the directory where you want MiniDLNA to store its log file  
#log_dir=/var/log  
  
# set this to change the verbosity of the information that is logged  
# each section can use a different level: off, fatal, error, warn, info, or debug  
#log_level=general,artwork,database,inotify,scanner,metadata,http,ssdp,tivo=warn  
  
# this should be a list of file names to check for when searching for album art  
# note: names should be delimited with a forward slash ("/")  
album_art_names=Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg/AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg/Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg  
  
# set this to no to disable inotify monitoring to automatically discover new files  
# note: the default is yes  
inotify=yes  
  
# set this to yes to enable support for streaming .jpg and .mp3 files to a TiVo supporting HMO  
enable_tivo=no  
  
# set this to strictly adhere to DLNA standards.  
# * This will allow server-side downscaling of very large JPEG images,  
#   which may hurt JPEG serving performance on (at least) Sony DLNA products.  
strict_dlna=no  
  
# default presentation url is http address on port 80  
#presentation_url=http://www.mylan/index.php  
  
# notify interval in seconds. default is 895 seconds.  
notify_interval=900  
  
# serial and model number the daemon will report to clients  
# in its XML description  
serial=12345678  
model_number=1  
  
# specify the path to the MiniSSDPd socket  
#minissdpdsocket=/var/run/minissdpd.sock  
  
# use different container as root of the tree  
# possible values:  
#   + "." - use standard container (this is the default)  
#   + "B" - "Browse Directory"  
#   + "M" - "Music"  
#   + "V" - "Video"  
#   + "" - "ictures"  
#   + Or, you can specify the ObjectID of your desired root container (eg. 1$F for Music/Playlists)  
# if you specify "B" and client device is audio-only then "Music/Folders" will be used as root  
#root_container=.  
  
# always force SortCriteria to this value, regardless of the SortCriteria passed by the client  
#force_sort_criteria=+upnp:class,+upnpriginalTrackNumber,+dc:title  
  
# maximum number of simultaneous connections  
# note: many clients open several simultaneous connections while streaming  
#max_connections=50  

一般只需修改media_dir参数即可
[html] view plain copy
# V 即视频  
# 此目录下只分享视频文件  
media_dir=V,/home/aa/Videos  
# P 即图片  
# A 即音乐  
# 此目录下分享图片与音乐文件  
media_dir=PA,/home/aa/Public  


Debian版minidlna_1.1.4_x64_支持rmvb
注:编译时Linux版本为Kali/Debian Wheezy x64
http://pan.baidu.com/s/1sjNoo3r

添加RMVB支持后的源代码
http://cloud.189.cn/t/eqI7Zz6jAzMv


minidlna_1.1.5_x64_支持rmvb
注:编译时Linux版本为Kali 2.0 x64
http://pan.baidu.com/s/1A2ndO
minidlna_1.1.5_支持RMVB_源代码
巴拉拉能量 发表于 2017-10-10 20:05:05
道理我都懂,但是里面的偷笑表情是什么鬼。。
hdl217 发表于 2017-10-10 20:46:43
这个可以用么?貌似没有Root权限 和ssh端口吧
异魂 发表于 2017-10-10 21:32:01
玩客币 发表于 2017-10-10 18:55
4. Minidlna配置
minidlna.conf
[html] view plain copy

我去试试,多谢楼主了,多么详细的教程啊。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver手机版小黑屋Comsenz Inc.  
返回顶部