Remotely running MKV apps on a *nix file server - AVS Forum | Home Theater Discussions And Reviews
Baselworld is only a few weeks away. Getting the latest news is easy, Click Here for info on how to join the Watchuseek.com newsletter list. Follow our team for updates featuring event coverage, new product unveilings, watch industry news & more!



Forum Jump: 
 
Thread Tools
post #1 of 2 Old 06-08-2015, 07:26 PM - Thread Starter
Advanced Member
 
Xayd's Avatar
 
Join Date: Feb 2003
Posts: 825
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
Remotely running GUI MKV apps on a *nix file server

Figured a few others might find this useful, these tools are not commonly used for this purpose but I set this stuff up on my FreeBSD NAS today so figured others might want to do the same.

PROBLEM: Particularly with wifi, moving large (BluRay, DVD) files back and forth over your network to rip them, strip them, etc is not preferable. Even with gigabit LAN it takes quite awhile to move 50 gigs back and forth, and if you're like me and have mostly transitioned to desktops/laptops with SSDs and thus, smaller disk drives, sometimes ripping and re-muxing a 50gb bluray isn't even possible without adding external drives.

SOLUTION: If you could run your supporting apps on the NAS, it would solve these problems, you'd never have to move large files across the network.

THE CATCH: You don't get the GUI in a terminal window, you'd have to learn to use your supporting apps via the command line....wait a minute, no you don't! X11 has supported remote desktop since before things like VNC existed. You can even push singular apps across the network, without pushing the whole desktop. This is how you do that.

This is FreeBSD specific but all of the apps/servers in question will work on any *nix OS.

1) Install your apps and their dependencies

(FreeBSD)

Code:
pkg install xorg
pkg install mkvmerge
pkg install handbrake
2) Install the server that will push those apps over your network

(FreeBSD)
Code:
pkg install xpra
3) Configure xpra

Code:
cd /usr/local/etc/xpra
edit xpra.conf

# General Options

# Enable clipboard forwarding:
clipboard = yes

# Enable forwarding of notifications:
notifications = no

# Enable forwarding of system tray icons:
system-tray = no 

# Forward sound output to clients:
speaker = no

# Debugging:
#debug =
#debug = keyboard,clipboard,tray

# Send ping packets more regularly (every second):
pings = no

################################################################################
# Picture Encoding

# Encodings allowed:
# (not all encodings may be available in your environment):
#encodings = h264, vp8, png, png/P, png/L, webp, rgb, jpeg, h265, vp9
#encodings = all
#encodings = rgb
encodings = all

# Default encoding
# (not all encodings may be available in your environment):
#encoding = h264
#encoding = vp8
#encoding = png
#encoding = jpeg
#encoding = rgb
#encoding = webp

# Used by the server to encode video:
# video-encoders = x264, vpx, nvenc
# video-encoders = none
# video-encoders = all
video-encoders = all

# Used by both the client and server for colourspace conversion:
# csc-modules = swscale, cython, opencl
# csc-modules = none
# csc-modules = all
csc-modules = all

# Used the client for decoding:
# video-decoders = avcodec2, vpx
# video-decoders = avcodec, vpx
# video-decoders = none
# video-decoders = all
video-decoders = all

# Use fixed quality
# (value is a percentage or "auto"):
#quality = 80
quality = auto

# For auto quality only:
#min-quality = 50
min-quality = 30

# Use fixed speed
# (value is a percentage or "auto"):
#speed = 90
speed = auto

# For auto speed only:
#min-speed = 20
min-speed = 0

# Idle delay in seconds before doing an automatic lossless refresh:
auto-refresh-delay = 0.15

# Default DPI:
dpi = 96

################################################################################
# Sound Encoding

# Codec(s) to use for forwarding speaker sound:
#speaker-codec = mp3
#speaker-codec = flac
#speaker-codec = wav
#speaker-codec = wavpack
#speaker-codec = speex
#speaker-codec = opus

# Forward sound input to server:
# microphone = yes

# Codec(s) to use for forwarding microphone sound:
#microphone-codec = mp3
#microphone-codec = flac
#microphone-codec = wav
#microphone-codec = wavpack
#microphone-codec = speex
#microphone-codec = opus

################################################################################
# Network Connection

# Enable shared memory transfers:
mmap = yes

# Use server group ownership for mmap file:
mmap-group = no

# Share session with other users:
sharing = no

# Compressors:
#compressors = all
#compressors = none
#compressors = zlib
compressors = lz4, zlib, lzo

# Default compression (0 to 9):
compression_level = 1

# Packet encoders (at least one is required):
#packet-encoders = bencode
#packet-encoders = all
packet-encoders = rencode, bencode, yaml

# Socket directory:
#socket-dir = /tmp
#socket-dir = ~/.xpra

########################################################################
# Server Options:

# Commands to start by default
#  (may be specified more than once):
# examples:
start-child = /usr/local/bin/HandBrake
start-child = /usr/local/bin/mmg
# Xsession can take care of initializing dbus, keyring-daemon,
# gpg-agent or whatever else might be usually started together with X
#start-child = /etc/X11/Xsession true

# Set the _NET_WM_NAME,
# used by some application that make too many assumptions (ie: Java)
# To workaround JDK6 window positioning issues, use:
#wm-name = Sawfish
wm-name = Xpra

# Video encoders loaded by the server
# (all of them unless specified)
# examples:
#video-encoders=x264,vpx,nvenc
#video-encoders=x264

# Colourspace conversion modules loaded by the server
# (all of them unless specified)
# examples:
#csc-modules=swscale,cython,opencl
#csc-modules=swscale

# Where to send non xpra clients:
# (can be used to share the port with a web server)
#tcp-proxy = 127.0.0.1:80

# Log file:
log-file = $DISPLAY.log

# Publish sessions:
mdns = no
#mdns = yes

# Forward client dbus rpc requests:
# (requires client configuration)
dbus-proxy = no
#dbus-proxy = yes

# Input methods
# To disable input method completely:
#input-method=none
# To keep the environment unchanged:
#input-method=keep
# Other possible options:
#input-method=IBus
#input-method=SCIM
#input-method=uim
input-method=none

# Start a pulseaudio server with each session:
pulseaudio = no

# pulseaudio server start command:
pulseaudio-command = pulseaudio --start --daemonize=false --system=false \
                --exit-idle-time=-1 -n --load=module-suspend-on-idle \
                --load=module-null-sink --load=module-native-protocol-unix \
                --log-level=2 --log-target=stderr

# Virtual display command:
# - Old Xvfb option:
# xvfb=Xvfb +extension Composite -screen 0 3840x2560x24+32 -nolisten tcp -noreset -auth $XAUTHORITY
# - With Xorg 1.12 or newer and the dummy driver:
# xvfb=/usr/bin/Xorg -dpi 96 -noreset -nolisten tcp +extension GLX +extension RANDR +extension RENDER -logfile ${HOME}/.xpra/Xorg.${DISPLAY}.log -config /etc/xpra/xor
#
# Selecting virtual X server:
xvfb=Xvfb +extension Composite -screen 0 3840x2560x24+32 -nolisten tcp -noreset -auth $XAUTHORITY

# Does the xvfb command support the "-displayfd" argument?
displayfd = no
4) Tell SSH to allow pushing of graphical desktop elements

Code:
cd /etc/ssh
edit sshd_config

(uncomment) X11Forwarding yes
5) Testing

ssh into your server with the -Y switch, i.e....

Code:
ssh -Y media@NAS
password: *******
start a desktop session with xpra

Code:
xpra start :100 --bind-tcp=0.0.0.0:1234
NOTE: THIS HAS NO SECURITY

Anyone who can get to that IP/port will be able to connect via TCP. If you omit the --bind-tcp parameter only SSH connections will be allowed. I use TCP since the OSX client has a bug with SSH authentication. I'm behind a router that will not allow any incoming traffic to that NAS so it's not a big deal. Don't do this on an un-firewalled machine.

The server will run as whatever user you start it as. By default it has no permissions other than that user's permissions (so there's no need to run it as root either). In my case I have a 'media' user that all of my content is served from, so I just run XPRA as that user so that it has write access to the folders I put things in. That's the simplest way.

You should see a notice that the server was launched and by default runs as a daemon.

6) Get the client for your OS. If you're on OSX you will also need X11 if you don't have it already, so download and install it as well (after which you must reboot to get X11 running).

https://www.xpra.org/
http://xquartz.macosforge.org/

7) Connect to your server, either by SSH or TCP, whichever way you started it. If everything is working you should see HandBrake and MKVToolnix windows pop up, like so...
Attached Thumbnails
Click image for larger version

Name:	Screen Shot 2015-06-08 at 9.25.38 PM.png
Views:	49
Size:	165.6 KB
ID:	764673  

Last edited by Xayd; 06-08-2015 at 07:40 PM.
Xayd is offline  
Sponsored Links
Advertisement
 
post #2 of 2 Old 06-08-2015, 07:32 PM - Thread Starter
Advanced Member
 
Xayd's Avatar
 
Join Date: Feb 2003
Posts: 825
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Quoted: 0 Post(s)
Liked: 10
From this point you can happily run those apps on your server, while manipulating the GUI remotely. No need for command line usage.

DO NOT CLOSE THE WINDOWS

If you close the windows, you close the app. So if you want to close the connection and leave the apps running (as the above screenshot shows with me compressing my LOTR blurays) go to the XPRA file menu, and exit that way.

When you re-connect to the server the apps will still be running, and you can do whatever.

NEED MORE APPS?

Not a problem, if you need to add, for instance, MakeMKV? Just install it on the NAS and add it to the xpra.conf file where MMG and HandBrake are listed (full path). Close the apps, kill XPRA, and relaunch it, and now you'll have windows for all three apps when you log back in.
Xayd is offline  
Sponsored Links
Advertisement
 
Reply Networking, Media Servers & Content Streaming

Thread Tools
Show Printable Version Show Printable Version
Email this Page Email this Page


Forum Jump: 

Posting Rules  
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off