Jump to content

FreeBSD viability


mlcarson

Recommended Posts

mlcarson

What features in Emby are lacking at this point in FreeBSD 13 compared to Windows?    I've got my current Emby server on Windows 10 with Stablebit Drivepool (3x10TB with data duplication turned on).  I'd probably turn this into a RAIDZ pool.  My GPU is an Nvidia Quadro K2200 , CPU is an AMD Ryzen 1700, and the system has 16GB RAM.  This system works well for Emby as is but I'm thinking that fewer Windows systems in my home would be a good thing and that this would be a good candidate for conversion.    Does Emby support HW decoding and encoding on either FreeBSD or Linux?  I probably technically don't need it and could use software encode/decode with the Ryzen 1700 for my needs but if the HW can do it, why not use it?

 

Link to comment
Share on other sites

Hi, we do support hardware acceleration on Linux, but not on freebsd just yet. That's really the only major thing missing that I can think of. Please let us know if this helps. Thanks.

Link to comment
Share on other sites

unhooked

my windows box can enc/dec pretty much everything, next best is the shield which can dec everything, but only enc 264/265, after that my linux box (arm) can only enc 264, but that's pretty much where nvidias' distro is at right now because they only support gstreamer, lastly freebsd box which is a moving target and I'm currently only doing software. However, I rarely ever need to transcode and the benefits of using zfs and freebsds' vm subsystem still make it my preferred server.

Link to comment
Share on other sites

mlcarson

I went ahead and tried Emby with Project Trident 19.07 /TrueOS/FreeBSD 13.0-Current.  The problem I'm having so far is with the OpenRC system of TrueOS.  Emby came with an emby-server openrc init file in /usr/local/etc/init.d.   It also came with a standard Freebsd init script in /usr/local/etc/rc.d.   TrueOS and Trident aren't supposed to support the standard init shell scripts in rc.d -- only openrc scripts.  My understanding is that a "sudo service emby-server start" should start emby and a "sudo rc-update add emby-server" should add the service for autostartup. 

 

The problem is that the openrc script fails.

It throws the following messages:

install:  :  No such file or directory

* Starting emby_server ....

* supervise-daemon: user  `user' not found

* failed to start emby_server

* ERROR: emby-server failed to start

 

I can start emby with the /usr/local/etc/rc.d/emby-server but not sure if I can properly add it as a service. 

I created a new emby_server in /usr/local/etc/init.d based on the /usr/local/etc/rc.d one but I don't know anything about openrc.

 

 

/user/local/etc/rc.d file

------------------------------

!/bin/sh

# $FreeBSD$
#
# PROVIDE: emby-server
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# emby_server_enable: Set to yes to enable the emby-server service.
#                       Default: no
# emby_server_user: The user account used to run the emby-server daemon.
#                       This is optional, however do not specifically set this to an
#                       empty string as this will cause the daemon to run as root.
#                       Default: emby
#                       This is optional, however do not specifically set this to an
#                       empty string as this will cause the daemon to run as root.
#                       Default: emby
# emby_server_group: The group account used to run the emby-server daemon.
#                       This is optional, however do not specifically set this to an
#                       empty string as this will cause the daemon to run with group wheel.
#                       Default: emby
# emby_server_data_dir: Directory where emby-server configuration
#                       data is stored.
#                       Default: /var/db/emby-server
# emby_server_ffdetect: Path of the ffdetect binary.
#                       Default: /usr/local/lib/emby-server/bin/ffdetect
# emby_server_ffmpeg: Path of the ffmpeg binary.
#                       Default: /usr/local/lib/emby-server/bin/ffmpeg
# emby_server_ffprobe: Path of the ffprobe binary.
#                       Default: /usr/local/lib/emby-server/bin/ffprobe

. /etc/rc.subr
name=emby_server
rcvar=${name}_enable
load_rc_config ${name}

: ${emby_server_enable:="no"}
: ${emby_server_user:="emby"}
: ${emby_server_group:="emby"}
: ${emby_server_data_dir:="/var/db/emby-server"}
: ${emby_server_ffdetect:="/usr/local/lib/emby-server/bin/ffdetect"}
: ${emby_server_ffmpeg:="/usr/local/lib/emby-server/bin/ffmpeg"}
: ${emby_server_ffprobe:="/usr/local/lib/emby-server/bin/ffprobe"}

pidfile="/var/run/emby-server.pid"
procname="/usr/local/bin/mono"
command="/usr/sbin/daemon"
command_args="-f -p ${pidfile} ${procname} /usr/local/lib/emby-server/system/EmbyServer.exe \
        -os freebsd \
        -ffdetect ${emby_server_ffdetect} \
        -ffmpeg ${emby_server_ffmpeg} \
        -ffprobe ${emby_server_ffprobe} \
        -programdata ${emby_server_data_dir} \
        -updatepackage emby-server-freebsd12_{version}_amd64.txz"

start_precmd=emby_server_precmd
emby_server_precmd()
{
        [ -f ${pidfile} ] || install -g ${emby_server_group} -o ${emby_server_user} -- /dev/null ${pidfile}
        [ -d ${emby_server_data_dir} ] || install -d -g ${emby_server_group} -o ${emby_server_user} -- ${emby_server_data_dir}
}

stop_postcmd=emby_server_postcmd
emby_server_postcmd()
{
        rm -f ${pidfile}
}

run_rc_command "$1"
===================================
/usr/local/etc/init.d file
 
#!/sbin/openrc-run

# $FreeBSD$
#
# PROVIDE: emby-server
# REQUIRE: LOGIN
# KEYWORD: shutdown
#

name=emby_server

: ${emby_server_enable:="no"}
: ${emby_server_user:="emby"}
: ${emby_server_group:="emby"}
: ${emby_server_data_dir:="/var/db/emby-server"}
: ${emby_server_ffdetect:="/usr/local/lib/emby-server/bin/ffdetect"}
: ${emby_server_ffmpeg:="/usr/local/lib/emby-server/bin/ffmpeg"}
: ${emby_server_ffprobe:="/usr/local/lib/emby-server/bin/ffprobe"}

pidfile="/var/run/emby-server.pid"
procname="/usr/local/bin/mono"
command="/usr/sbin/daemon"
command_args="-f -p ${pidfile} ${procname} /usr/local/lib/emby-server/system/EmbyServer.exe \
        -os freebsd \
        -ffdetect ${emby_server_ffdetect} \
        -ffmpeg ${emby_server_ffmpeg} \
        -ffprobe ${emby_server_ffprobe} \
        -programdata ${emby_server_data_dir} \
        -updatepackage emby-server-freebsd12_{version}_amd64.txz"

depend()
{
        need localmount
        keyword -shutdown
        after bootmisc
}
 
=======================
The above was enough to get it started but I have no idea if it's enough to work as expected.   The openrc file supplied looks nothing like the one I created and contains references to directories which don't even exist. 

 

Edited by mlcarson
Link to comment
Share on other sites

mlcarson

This was the file in /usr/local/etc/rc.d:

 

/sbin/openrc-run

# emby_server_user:     The user account used to run the emby-server daemon.
#                       This is op"tional, however do not specifically set this to an
#                       empty string a(s this will cause the daemon to run as root.
#                       Default: emby (or mediabrowser with UID 989 if it exists)
# emby_server_group:    The group account used to run the emby-server daemon.
#                       This is optional, however do not specifically set this to an
#                       empty string as this will cause the daemon to run with group wheel.
#                       Default: emby (or mediabrowser with GID 989 if it exists)
# emby_server_data_dir: Directory where emby-server configuration
#                       data is stored.
#                       Default: /var/db/emby-server (or /var/db/mediabrowser if it exists)

name=emby_server

if [ "$(id -u mediabrowser 2>&1)" = "989" ] && ! [ -n "${emby_server_user}" ]; then
        emby_server_user=mediabrowser;
        emby_server_group=mediabrowser;
fi

if [ -d "/var/db/mediabrowser" ] && ! [ -n "${emby_server_data_dir}" ]; then
        emby_server_data_dir="/var/db/mediabrowser";
fi

: ${emby_server_user:="emby"}
: ${emby_server_group:="emby"}
: ${emby_server_data_dir:="/var/db/emby-server"}

command="/usr/local/bin/mono"
supervisor=supervise-daemon
command_args="/usr/local/lib/emby-server/MediaBrowser.Server.Mono.exe -ffmpeg /usr/local/bin/ffmpeg -ffprobe /usr/local/bin/ffprobe -programdata ${emby_server_data_dir}"
command_user=${emby_server-user}

start_pre()
{
        if [ ! -e "${pidfile}" ]; then
                install -g ${emby_server_group} -o ${emby_server_user} -- /dev/null "${pidfile}";
        fi

        if [ ! -d "${emby_server_data_dir}" ]; then
                install -d -g ${emby_server_group} -o ${emby_server_user} -- "${emby_server_data_dir}";
        fi
}

depend()
{
        need localmount
        keyword -shutdown
        after bootmisc
}
--------------
This is some of the stuff that I see wrong with it.  The command_user argument is misspelled -- should be emby_server_user rather than emby_server-user
Command_args are wrong.   /
usr/local/lib/emby-server/MediaBrowser.Server.Mono.exe should be: /usr/local/lib/emby-server/system/EmbyServer.exe
-ffmpeg /usr/local/bin/ffmpeg should be /usr/local/lib/emby-server/bin/ffmpeg
-ffprobe /usr/local/bin/ffprobe should be /usr/local/lib/emby-server/bin/ffprobe
 
Need to have the os argument
-os freebsd
The above corrections make the openrc script start without error but I'm not sure that this is "correct".
 
Link to comment
Share on other sites

Hi, unfortunately we haven't tested Trident, or freebsd 13 yet so I'm afraid I don't have answers for you at this time.

Link to comment
Share on other sites

mlcarson

Same issues would exist in TrueOS using Freebsd 12.  Trident actually released a Stable-12 version on 7/26 but it's the conversion of Freebsd's RC system to OpenRC by TrueOS that's causing an issue in this case.   If I run into further issues unrelated to the OpenRC stuff, it may force me to try Stable-12.

Link to comment
Share on other sites

mlcarson

I haven't had time to do a lot of testing yet but was able to add my HDHomeRun Prime which is my TV source for Comcast and play live TV from the server and get the guide data from a Windows 10 browser pointed at the <IP>::8096 but was not able to do the same with an Nvidia Shield Emby client on the same network which I find strange.  The IP address had not changed from the Windows 10 server but the name of the server did.  I tried just entering the IP address manually as a new entry but got frustrated after the 3rd time trying on a TV remote control to get the IP address and port number entered and then apparently having no way of moving from Cancel to OK.  I think entering Next always selected Cancel.  I'll have to try it again this evening when I have time to hook up a keyboard to it.   I'm assuming there's no reason that this client shouldn't connect.  The version I'm using on FreeBSD was 4.1.x rather than 4.2.x that the Windows version was using. 

Link to comment
Share on other sites

mlcarson

Those scripts came from whatever repository that the TrueOS/Trident-Release AppCafe grabbed it from -- version 4.1.1.0_1. 

 

The Nvidia Shield Emby client worked fine once I added a keyboard so I was able to add the new server to the list to choose from.  This might be something to look at from a UI perspective since a user shouldn't have to add a keyboard to do this action. So far so good from a compatibility perspective though. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...