Login    Register

Serviio Mediaserver on N4F?

Jails with NAS4Free
Forum rules
Set-Up GuideFAQsForum Rules
  • Author
    Message

Re: Serviio Mediaserver on N4F?

Postby raulfg3 » 06 Nov 2012 08:53

ok, because this, i say "once work".

good job to all.
Site Admin
raulfg3

User avatar
 
Posts: 3694
Joined: 22 Jun 2012 20:13
Location: Madrid (ESPAÑA)

Re: Serviio Mediaserver on N4F?

Postby fsbruva » 06 Nov 2012 12:48

I am attempting install on a blank jail - but the release of 9.1-RC3 has broken pkg_add -r. Ugh. Also, today is pretty busy.

The java .jars seem to be fairly simple to extract from the linux tarball. Further, I don't think the "make" actually compiled anything from the ports. I am pretty sure it just obtained the zip, extracted it to the right place, and generated some scripts. I agree with alexey that the best option is to come up with install instructions that end with the webgui. In fact, it *should* be arbitrarily simple to make a N4F "extension" that points to the webgui in the jail. You would click the link, and leave the N4F page, but that's fine. Better, actually, because that way pathnames are less likely to get confused if you are completely inside the jail.
PowerUser
fsbruva
 
Posts: 481
Joined: 21 Sep 2012 12:50

Re: Serviio Mediaserver on N4F?

Postby fsbruva » 06 Nov 2012 12:52

Looks like webui will be the best - it's just another two .jar files. No need to install a webserver or anything.
PowerUser
fsbruva
 
Posts: 481
Joined: 21 Sep 2012 12:50

Re: Serviio Mediaserver on N4F?

Postby fsbruva » 06 Nov 2012 13:36

himbrr wrote:Started serviiod as root.... no exceptions O.o
-> because, the service is starting without a home.
user dlna has no home O.o

This is exactly why running the rc script is the proper way to do it. When I run it, I see that my process is running with dlna as the user account. (That's why ps aux | grep dlna retrieves whether or not it's running).
PowerUser
fsbruva
 
Posts: 481
Joined: 21 Sep 2012 12:50

Re: Serviio Mediaserver on N4F?

Postby fsbruva » 06 Nov 2012 13:42

Update - These steps get it running for me:
1. Enter BRAND NEW jail built from with 9.1-RC3 base and lib32 tarballs, + added hosts entry + copy of n4f resolv.conf
2. setenv PACKAGESITE ftp://ftp.freebsd.org/pub/FreeBSD/ports ... ase/Latest
3. pkg_add -r openjdk6 ffmpeg
4. portsnap fetch
5. portsnap extract
6. cd /usr/ports/net/serviio
7. make install clean
8. /usr/local/etc/rc.d/serviio onestart

Done. Works fine. Process is being run by dlna, not root. Something is (was) wrong with your jail. Now let me see about the webui.
PowerUser
fsbruva
 
Posts: 481
Joined: 21 Sep 2012 12:50

Re: Serviio Mediaserver on N4F?

Postby himbrr » 06 Nov 2012 14:00

When I'm at home, I will delete the jail and rebuild.
PyLoad is fast installed.
But why do you install the old version 0.6 of serviio?
The actual build is 1.0.1 and supports the genius media browser.
A package is not available for ports marked as: Forbidden / Broken / Ignore / Restricted


How to run serviio as user dlna?
PowerUser
himbrr
 
Posts: 150
Joined: 21 Oct 2012 19:16
Location: Germany

Re: Serviio Mediaserver on N4F?

Postby alexey123 » 06 Nov 2012 14:14

How to run serviio as user dlna?

When you install from port collection, you have rc.d script for run it properly.
Lab 9.1.0.1 - Sandstorm (revision 847) / x86-embedded on HP D530 / 2G RAM / CF IDE as system
Home9.2.0.1 - Sandstorm (revision 943) / x64-embedded on SAPPHIRE Pure Mini E350 / 4G RAM
Moderator
alexey123

User avatar
 
Posts: 1295
Joined: 19 Aug 2012 06:22
Location: Israel

Re: Serviio Mediaserver on N4F?

Postby fsbruva » 06 Nov 2012 14:54

himbrr wrote:But why do you install the old version 0.6 of serviio?

Proof of concept to see how it functions when installed from the ports collection. Prototype. I wanted to prove that your jail has something wrong with it. Serviio is a standalone java virtual machine - if 0.6.2 won't work, then 1.0.1 is unlikely to work.


A package is not available for ports marked as: Forbidden / Broken / Ignore / Restricted

This is because it is restricted. Instead, you need to make it yourself.

himbrr wrote:How to run serviio as user dlna?

Easy:
Code: Select all
/usr/local/etc/rc.d/serviio start

If you look inside the rc script, you see that the java command is made a child of user dlna. That's why I am advocating using the rc.d script.
PowerUser
fsbruva
 
Posts: 481
Joined: 21 Sep 2012 12:50

Re: Serviio Mediaserver on N4F?

Postby himbrr » 06 Nov 2012 19:01

I can connect via Console.
Working :)
Now lets make the actual version running ;)
PowerUser
himbrr
 
Posts: 150
Joined: 21 Oct 2012 19:16
Location: Germany

Re: Serviio Mediaserver on N4F?

Postby fsbruva » 06 Nov 2012 20:02

You mean 1.0.1?
PowerUser
fsbruva
 
Posts: 481
Joined: 21 Sep 2012 12:50

Re: Serviio Mediaserver on N4F?

Postby himbrr » 06 Nov 2012 20:15

Yes, because I will test the media browser.
On the old jail I wasn't able to stream in browser via the flash player.
PowerUser
himbrr
 
Posts: 150
Joined: 21 Oct 2012 19:16
Location: Germany

Re: Serviio Mediaserver on N4F?

Postby fsbruva » 07 Nov 2012 01:07

I had mixed luck today with 1.0.1. I will need to attempt again tomorrow with a clean jail, starting from scratch. Too bad you can't email me a beer. I would kill for a fresh Spaten while working on this!
PowerUser
fsbruva
 
Posts: 481
Joined: 21 Sep 2012 12:50

Re: Serviio Mediaserver on N4F?

Postby fsbruva » 07 Nov 2012 14:16

I have it working, webui + webgui integration. See below, and test with your setup:
Inside working jail:
Add a /etc/hosts entry for your jail: {jail ip} {jail hostname}
Mine is: 10.10.10.15 serviio.nas4free

Code: Select all
setenv PACKAGESITE ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9-current/Latest/
pkg_add -r openjdk6
pkg_add -r ffmpeg
cd /tmp
fetch http://kairoh.bitbucket.org/serviio-webui/dist/serviio-webui-unix-1.0.1-a.tar.gz
fetch http://download.serviio.org/releases/serviio-1.0.1-linux.tar.gz
tar xvf serviio-1.0.1-linux.tar.gz -C /usr/local/etc/
tar xvf serviio-webui-unix-1.0.1-a.tar.gz -C /usr/local/etc/serviio-1.0.1
mkdir /usr/local/etc/prefs
pw groupadd dlna
pw useradd dlna -g dlna -s /usr/sbin/nologin -c "DLNA Daemon" -d /usr/local/etc/serviio-1.0.1/prefs/
chown -R dlna:wheel /usr/local/etc/serviio-1.0.1


Create a /usr/local/sbin/serviiod file, and fill it with:
Code: Select all
#!/bin/sh
### ====================================================================== ###
##                                                                          ##
##  Serviio start Script                                                    ##
##                                                                          ##
### ====================================================================== ###

SERVIIO_HOME=/usr/local/etc/serviio-1.0.1
SERVIIO_CLASS_PATH="$SERVIIO_HOME/lib/*:$SERVIIO_HOME/plugins/*:$SERVIIO_HOME/config"


# Find the best max heap size for JAVA ( From kairoh's serviio-webui
# scripts - https://kairo.bitbucket.org/serviio-webui, who references
# Platter's (http://pcloadletter.co.uk/2012/01.15/serviio-syno-paackages
JAVA_MAX_HEAP=512M
RAM=$(dmesg | grep 'real memory'| uniq | awk '{print $4/1048576}')
if [ $RAM -le 128 ]; then
    JAVA_MAX_HEAP=80M
elif [ $RAM -le 256 ]; then
    JAVA_MAX_HEAP=192M
fi

# Setup Serviio specific properties - might not need to specify ffmpeg
JAVA_OPTS="-Djava.net.preferIPv4Stack=true -Djava.awt.headless=true -Dderby.system.home=$SERVIIO_HOME/library -Dserviio.home=$SERVIIO_HOME -Dffmpeg.location=/usr/local/bin/ffmpeg"

JVM_OPTS="-Xmx${JAVA_MAX_HEAP} -Xms20M -XX:+UseParNewGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20"

# A kludge to get the -D... flags to Java, rather than to Serviio itself:
for o in "$@"
do
   case $o in
   -D*)
      JAVA_OPTS="$JAVA_OPTS $o"
      ;;
   esac
done

# Execute the JVM in the foreground
exec java $JVM_OPTS $JAVA_OPTS -classpath "$SERVIIO_CLASS_PATH" org.serviio.restui.ServiioWrapper "$@"


Create a /usr/local/etc/rc.d/serviio file, and fill it with:
Code: Select all
#!/bin/sh

# $FreeBSD: ports/net/serviio/files/serviio.in,v 1.2 2012/01/14 08:56:27 dougb Exp $
#
# PROVIDE: serviio
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf[.local] to enable serviio:
#
# serviio_enable="YES"

. /etc/rc.subr

name=serviio
rcvar=serviio_enable
command=/usr/local/sbin/serviiod

load_rc_config $name

serviio_user=${serviio_user-"dlna"}

command_args=" &"

stop_cmd="$command -stop"

run_rc_command $1


Add this to your jail's rc.conf:
Code: Select all
serviio_enable="YES"


Restart the jail, or start serviio with the rc script: /usr/local/etc/rc.d/serviio start

Then, on the N4F host: (NOTE: ALL OF THE ABOVE STEPS ARE INSIDE THE JAIL!!!!)
Code: Select all
mkdir -p /usr/local/www/ext/serviio
echo '<a href="http://{jail ip addr}:8123/serviio/console">Serviio Console</a>' > /usr/local/www/ext/serviio/menu.inc

These last two commands need to be part of a startup script on the N4F host if you are running embedded.

Let me know.
Last edited by fsbruva on 08 Nov 2012 12:02, edited 4 times in total.
PowerUser
fsbruva
 
Posts: 481
Joined: 21 Sep 2012 12:50

Re: Serviio Mediaserver on N4F?

Postby fsbruva » 07 Nov 2012 14:19

I forgot to mention - streaming might not work, because ffmpeg from pkg_add doesn't have the support that serviio expect. Check out serviio.log, and there is a warning. Or, you can check serviio's website/wiki. There is a list of the compile options needed for ffmpeg there. To do that, you need to get the ports collection, and make your own ffmpeg.
PowerUser
fsbruva
 
Posts: 481
Joined: 21 Sep 2012 12:50

Re: Serviio Mediaserver on N4F?

Postby alexey123 » 07 Nov 2012 14:52

Code: Select all
echo '<a href="http://{jail ip addr}:8123/serviio/console" target="_blank">Serviio Console</a>" > /usr/local/www/ext/serviio/menu.inc

As for me - True.
Or blank Nas4free page with <iframe> serviio
Lab 9.1.0.1 - Sandstorm (revision 847) / x86-embedded on HP D530 / 2G RAM / CF IDE as system
Home9.2.0.1 - Sandstorm (revision 943) / x64-embedded on SAPPHIRE Pure Mini E350 / 4G RAM
Moderator
alexey123

User avatar
 
Posts: 1295
Joined: 19 Aug 2012 06:22
Location: Israel

Re: Serviio Mediaserver on N4F?

Postby himbrr » 07 Nov 2012 21:09

fsbruva wrote:Create a /usr/local/etc/sbin/serviiod file, and fill it with:

This has to be /usr/local/sbin/serviiod

I got this error message:
Code: Select all
root@proto:/tmp # /usr/local/etc/rc.d/serviio start
Starting serviio.
root@proto:/tmp # Usage: java [-options] class [args...]
           (to execute a class)
   or  java [-options] -jar jarfile [args...]
           (to execute a jar file)
where options include:
    -d32          use a 32-bit data model if available
    -d64          use a 64-bit data model if available
    -client       to select the "client" VM
    -server       to select the "server" VM
    -hotspot      is a synonym for the "client" VM  [deprecated]
                  The default VM is client.

    -cp <class search path of directories and zip/jar files>
    -classpath <class search path of directories and zip/jar files>
                  A : separated list of directories, JAR archives,
                  and ZIP archives to search for class files.
    -D<name>=<value>
                  set a system property
    -verbose[:class|gc|jni]
                  enable verbose output
    -version      print product version and exit
    -version:<value>
                  require the specified version to run
    -showversion  print product version and continue
    -jre-restrict-search | -jre-no-restrict-search
                  include/exclude user private JREs in the version search
    -? -help      print this help message
    -X            print help on non-standard options
    -ea[:<packagename>...|:<classname>]
    -enableassertions[:<packagename>...|:<classname>]
                  enable assertions with specified granularity
    -da[:<packagename>...|:<classname>]
    -disableassertions[:<packagename>...|:<classname>]
                  disable assertions with specified granularity
    -esa | -enablesystemassertions
                  enable system assertions
    -dsa | -disablesystemassertions
                  disable system assertions
    -agentlib:<libname>[=<options>]
                  load native agent library <libname>, e.g. -agentlib:hprof
                  see also, -agentlib:jdwp=help and -agentlib:hprof=help
    -agentpath:<pathname>[=<options>]
                  load native agent library by full pathname
    -javaagent:<jarpath>[=<options>]
                  load Java programming language agent, see java.lang.instrument
    -splash:<imagepath>
                  show splash screen with specified image
See http://java.sun.com/javase/reference for more details.


Some mistake in the script


Guys, you made also a little mistake with the webinterface integration.
This:
alexey123 wrote:
Code: Select all
echo '<a href="http://{jail ip addr}:8123/serviio/console" target="_blank">Serviio Console</a>" > /usr/local/www/ext/serviio/menu.inc

Must be:
Code: Select all
echo '<a href="http://{jail ip addr}:8123/serviio/console" target="_blank">Serviio Console</a>' > /usr/local/www/ext/serviio/menu.inc

Just the " after the </a> has to be '.
PowerUser
himbrr
 
Posts: 150
Joined: 21 Oct 2012 19:16
Location: Germany

Re: Serviio Mediaserver on N4F?

Postby fsbruva » 08 Nov 2012 12:02

Good catch. I did most of this in a VM without SSH, so I couldn't copy & paste. Thus, transcription errors.

Did it work for you?
PowerUser
fsbruva
 
Posts: 481
Joined: 21 Sep 2012 12:50

Re: Serviio Mediaserver on N4F?

Postby himbrr » 08 Nov 2012 14:01

No you see, that I got an error message.
There's some mistake in /usr/local/etc/rc.d/serviio or /usr/local/sbin/serviiod
PowerUser
himbrr
 
Posts: 150
Joined: 21 Oct 2012 19:16
Location: Germany

Re: Serviio Mediaserver on N4F?

Postby fsbruva » 08 Nov 2012 16:23

That is an error with erroneous newlines in the serviiod file, likely.
These lines:
Code: Select all
JAVA_OPTS="-Djava.net.preferIPv4Stack=true -Djava.awt.headless=true -Dderby.system.home=$SERVIIO_HOME/library -Dserviio.home=$SERVIIO_HOME -Dffmpeg.location=/usr/local/bin/ffmpeg"

JVM_OPTS="-Xmx${JAVA_MAX_HEAP} -Xms20M -XX:+UseParNewGC -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20"


These should be only 2 lines of CODE!!! Try this:
Code: Select all
JAVA_OPTS="-Djava.net.preferIPv4Stack=true -Djava.awt.headless=true"
JAVA_OPTS = "{$JAVA_OPTS} -Dderby.system.home=$SERVIIO_HOME/library"
JAVA_OPTS = "{$JAVA_OPTS} -Dserviio.home=$SERVIIO_HOME"
JAVA_OPTS = "${JAVA_OPTS} -Dffmpeg.location=/usr/local/bin/ffmpeg"

JVM_OPTS="-Xmx${JAVA_MAX_HEAP} -Xms20M -XX:+UseParNewGC"
JVM_OPTS = "{$JVM_OPTS} -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=20"


Better luck?
PowerUser
fsbruva
 
Posts: 481
Joined: 21 Sep 2012 12:50

Re: Serviio Mediaserver on N4F?

Postby himbrr » 08 Nov 2012 17:52

Sorry, my fault.
I copied the script via copy&paste to nano over ssh.
By copying nano made a \n between the command.
First script is working fine ;)
Will test now the webinterface.
PowerUser
himbrr
 
Posts: 150
Joined: 21 Oct 2012 19:16
Location: Germany

Re: Serviio Mediaserver on N4F?

Postby himbrr » 08 Nov 2012 18:06

Holy sh**!
It's working with 1.0.1!

...but :( Flashplayer is not working ;)
Code: Select all
200, Stream not found, NetStream.Play.StreamNotFound, clip: '[Clip] 'http://192.168.22.11:23424/cds/resource/23/MEDIA_ITEM/FLV-0/MEDIUM,flv_player?authToken=52dccd3ba1e44221bfa0a4faa7353b0c''


fsbruva wrote:Too bad you can't email me a beer.

I'm sorry, that I can't send you a beer via my WAN connection.
Enjoy this :lol:
PowerUser
himbrr
 
Posts: 150
Joined: 21 Oct 2012 19:16
Location: Germany

Re: Serviio Mediaserver on N4F?

Postby fsbruva » 08 Nov 2012 18:50

What type of file were you attempting to open, with what encoding? And to what device were you attempting to send it? My guess its a transcoder issue - probably due to the odd ffmpeg version that FreeBSD pkg_add uses. You're not alone with this issue.
PowerUser
fsbruva
 
Posts: 481
Joined: 21 Sep 2012 12:50

Re: Serviio Mediaserver on N4F?

Postby himbrr » 08 Nov 2012 19:03

I tried to open it via opera/windows7 ...
Every movie files like .mkv and .avi etc.

BTW: transcoding on Panasonic E30 and Samsung tv is working fine
PowerUser
himbrr
 
Posts: 150
Joined: 21 Oct 2012 19:16
Location: Germany

Re: Serviio Mediaserver on N4F?

Postby fsbruva » 08 Nov 2012 19:20

As I suspected, the two required libraries required by serviio, (libmp3lame and librtmp) are not included in our version.
This release includes FFmpeg compiled using this source code, libRTMP 2.4 compiled using this source code and Lame MP3 Encoder (v. 3.98) compiled using this source code.


pkg_add brings us 0.7.13, ports collection has the same. I am not sure which version serviio is using, as they seemed to have grabbed a snaphot of the git. Good luck.
PowerUser
fsbruva
 
Posts: 481
Joined: 21 Sep 2012 12:50

Re: Serviio Mediaserver on N4F?

Postby fsbruva » 08 Nov 2012 19:32

Belay that. There is a newer version ffmpeg in the ports. Need to portsnap, then cd to ffmpeg1.

http://wiki.serviio.org/doku.php?id=build_ffmpeg_linux

Need:
AMR_NB
AMR_WB
FAAC
LAME
RTMP
THEORA
VORBIS
VPX
X264
XVID

Be prepared. The build will probably take a while, as ffmpeg depends on perl - which will also be built.
PowerUser
fsbruva
 
Posts: 481
Joined: 21 Sep 2012 12:50

PreviousNext

Return to Jails

Who is online

Users browsing this forum: dundermiflin and 1 guest