#+TITLE:
#+AUTHOR: Bob Mottram
#+EMAIL: bob@freedombone.net
#+KEYWORDS: freedombone, mediagoblin
#+DESCRIPTION: How to use Mediagoblin
#+OPTIONS: ^:nil toc:nil
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="freedombone.css" />

#+BEGIN_CENTER
[[file:images/logo.png]]
#+END_CENTER

#+BEGIN_EXPORT html
<center>
<h1>Mediagoblin</h1>
</center>
#+END_EXPORT

With Mediagoblin you can host video and audio content in a similar manner to the proprietary systems such as YouTube and SoundCloud. This system supports free media formats such as /webm/, /ogv/ and /ogg/. Another similar system which might be better fitted for small servers is [[./app_peertube.html][PeerTube]], since it uses webtorrent to distribute video files. Webtorrent will only work with WebRTC enabled browsers though.

When hosting media files you should take into consideration that since anyone on the internet can view your content then this could significantly increase your bandwidth usage and overall strain on the server. Also unless you are just hosting images then hardware such as the Beaglebone Black won't be powerful enough for a good user experience when either uploading or playing back videos. It's recommended that you use one of the more powerful quad (or more) core single board computers or an old laptop if you want to run Mediagoblin on it.

#+BEGIN_CENTER
[[file:images/mediagoblin.jpg]]
#+END_CENTER

* Installation
Log into your system with:

#+begin_src bash
ssh myusername@mydomain -p 2222
#+end_src

Using cursor keys, space bar and Enter key select *Administrator controls* and type in your password.

Select *Add/Remove Apps* then *mediagoblin*. You will then be asked for a domain name and if you are using FreeDNS also the code for the domain which can be found under *Dynamic DNS* on the FreeDNS site (the random string from "/quick cron example/" which appears after /update.php?/ and before />>/). For more details on obtaining a domain and making it accessible via dynamic DNS see the [[./faq.html][FAQ]]. You can also add a welcome message and background picture URL if you wish, although those things are optional. Typically the domain name you use will be a subdomain, such as /media.mydomainname.net/. It will need to be a domain which you have bought somewhere and own and not one of the FreeDNS subdomains, otherwise you won't be able to get a SSL/TLS certificate for it.

After the install has completed go to *Security settings* and select *Create a new Let's Encrypt certificate* and enter the domain name that you are using for Mediagoblin. If you're using the "onion only" version of the system then you don't need to do this. If the certificate is obtained successfully then you will see a congratulations message.


* Initial setup

If you have just obtained a Lets Encrypt certificate as above then go to *About* on the administrator control panel and you should see your Mediagoblin domain listed there along with an onion address. You can then navigate to your site in a browser.

Create an account and verify it by returning to the *user control panel* opening the email client and looking for the Mediagoblin verification email. It will contain a link that you should follow to activate the account.

You should repeat that for however many accounts you want on the system and then go back to the *administrator control panel*, select *App Settings* then *mediagoblin* and turn off new registrations. This will prevent millions of spam accounts from being created by internet bots.


* File formats
It's a good idea to upload videos in /webm/ format. In that case Mediagoblin will skip the transcoding step (which can take hours for videos of non-trivial length) and the whole process will be quicker. Transcoding just converts whatever file format you submit into a standard resolution and file type. On your local system you can convert a video to webm with:

#+begin_src bash
ffmpeg -i myvideo.mp4 myvideo.webm
#+end_src

Or if you are moving a video from YouTube to your own site:

#+begin_src bash
youtube-dl -f webm [my_video_url]
#+end_src
