Categories
Linux open source Raspberry Pi

Creating a Raspberry Pi Squeezebox Server

If you, like me, own one or more Squeezebox players you can either choose between the service mysqueezebox.com, that streams music from the internet, or set up the Squeezebox Server on your own network. The Squeezebox Server software (aka Logitech Media Software, aka Slimserver) being free and open source software guarantees that you’ll take control of your Squeezebox players and the music that you’re streaming.

There many hardware options for the Squeezebox Server software but I decided to use the Raspberry Pi 2 that I had lying around because of it’s small footprint and massive support for the Pi. Within a couple of hours I had the Logitech Squeezebox Server up an running with my music playing.

Below I’ll show how to set up the Logitech Squeezebox Server on a Raspberry Pi in five steps. I got some important steps from the Variax Firmation website but I tested everything successfully.

Raspberry Pi 2 with a USB-harddrive connected to my network with a (yellow) ethernet cable.
Raspberry Pi 2 with a USB-harddrive connected to my network with a (yellow) ethernet cable.

Step 1: Ripping CD’s and writing them on an HDD (choosing an audio format)

For this project I used a small USB-HDD that was also lying around. I formatted the HDD. Next I collected all my music CD’s and ripped them. As ripping software I used the Asunder software on my Linux laptop but I guess that there are good alternatives (fre:ac appears to be an free and open source alternative that is also available for OSX and Windows). As audio format I choose MP3. If I buy a larger drive I’ll probably move to FLAC.

Step 2: Installing Raspberry Pi OS

Next install Raspberry Pi OS (previously called Raspbian) on the Raspberry Pi by first downloading the image and writing the image to the micro SD card using these instructions for OSX (or these instructions for Windows and Linux). I chose the Lite version of Raspberry Pi OS because I don’t need the desktop software and it makes the server as lightweight as possible. I had no problems booting the Raspberry Pi and connecting it to my network using Ethernet. To avoid potential problems connect the Pi to a monitor with an HDMI cable and make sure that it boots properly.

NOTE: If you do install the Lite version of the OS make sure to enable SSH via raspi-config. This enables you to access the Pi remotely later on.

Step 3: Mount the HDD on the Raspberry Pi

Now with Raspberry Pi OS installed I mounted the HDD that we prepared in step 1. For this first connect the HDD to the Raspberry Pi (in my case I connected the HDD through a USB port of the Raspberry Pi), login remotely and retrieve the name of the drive. To login remotely we need another computer (Windows, Linux or OSX). Open a terminal (Windows users either need to install Putty or for Windows 10 users enable the SSH client) and type:

sudo ssh pi@Raspberry_Pi_ip_address (in my case 192.168.178.69)

The default password is raspberry. Then type:

sudo fdisk -l 

Then look for the HDD that is just connected. This was /dev/sda1 in my case (but this may differ in yours). To make the files on the HDD accessible to the Raspberry Pi we need mount the drive. But before that we need to make a mounting point (in this example at ~/media/usb-drive).

sudo mkdir ~/media/usb-drive 

and mount

 sudo mount /dev/sda1 ~/media/usb-drive

You should hear some HDD activity. Now type:

cd ~/media/usb-drive && ls -l

and a list of your music should be visible.
To unmount the HDD do:

sudo umount ~/media/usb-drive
 The list of folders with albums that I ripped. In this stage I only ripped a few albums to test the system.
The list of folders with albums that I ripped. In this stage I only ripped a few albums to test the system (click to enlarge).

Step 4: Installing Logitech Media Center on the Raspberry Pi

First we need to install a library to play audio files. Since you want mp3 only do:

sudo apt-get install -y libsox-fmt-all

This installs SoX, a command line utility that, among other things, plays various types of audio files. If you want to add flac support you’ll probably need to do this

sudo apt-get install -y libsox-fmt-all libflac-dev

Now with the audio libraries in place the Logitech Media Software can be downloaded. We want the latest version which at the moment of this writing is 7.9.3.

sudo wget -O logitechmediaserver_all.deb $(wget -q -O - "http://www.mysqueezebox.com/update/?version=7.9.3&revision=1&geturl=1&os=deb")

Now install the server software with:

sudo dpkg -i logitechmediaserver_all.deb

And reboot. With all the software installed we’re ready to go.

NOTE: with a recent fresh install of both Raspberry Pi OS (formerly Raspbian) and Logitech Media Server 7.9.3 a problem occurred. Apt complained about some unmet dependencies. However after apt –fix-missing update all problems were solved and after a reboot the server worked as before.

Step 5: Working with Logitech Media Center

To enter the web interface of the Logitech Media Center on the Pi we need a computer and a browser. In the browser URL we type:

<your_Raspberry_Pi_ip_address:9000> (in my case 192.168.178.69:9000)

The Logitech Media Center is started for the first time and a script is started to set it up. Important is that the mounting point of the HDD (in my case ~/media/usb-drive) is entered. This way the Media Center is able to retrieve all the music files. This is done in the web interface by entering the path of the mounting point under Media Settings under Media Folders.

The Media Settings page of the web interface. Enter the path of the mounting point under Media Folders.
The Media Settings page of the web interface. Enter the path of the mounting point under Media Folders (click to enlarge).

The Logitech Media Server is now ready and every time the Raspberry Pi boots the Logitech Media Server is automatically started however the HDD is not automatically mounted so we need to change that. This is done by editing (with nano) the fstab system configuration file that can be found at /etc/fstab

sudo nano fstab

and add the following line

/dev/sda1 /media/usb-drive vfat& defaults 0

Save the file and exit nano. Reboot the Raspberry Pi. Now the installation is complete.

The music can be controlled from the web interface (see above), with the remote controls that come with the Squeezebox devices, with apps for Android such as this one or with iPeng for iOS. The Squeezebox Radio and the Squeezebox Boom also have controls on the device to play the music. So, plenty of options.

Webinterface of the Logitech Media Server (click to enlarge).

Step 6: Change the web interface to Material Skin (optional)

The default web interface of the Logitech Media Server looks outdated. Luckily, thanks to the plugin architecture, the server and its user interface are highly customizable. In the list of third party plugins of the default web interface you’ll find the Material Skin plugin (an excellent community effort led by CDrummond). Enable this plugin, select it and voila the web interface looks awesome.

Logitech Media Server with the beautiful Material Skin (click to enlarge).

What’s next

In a future blog entry I’ll explain how to maintain the Logitech Media Server e.g how to add music to the server remotely.

Categories
open source social

Create animated GIFs from MP4 with FFmpeg

Animated GIFs are after all these years still pretty popular. FFmpeg is a good FLOSS tool to create these animated GIFs. FFmpeg is available for Windows, Linux and OSX. A word of warning FFmpeg is a command line tool that’s very versatile but it’s not for everybody. In fact suppose this post is more for users that like to tinker a lot with their animated GIFs. Below I will explain not only how to create a animated GIF from an mpeg4 movie but I also provide instructions to improve the quality.

The basic command to create an animated GIF from a mpeg4 is:

ffmpeg -i input.mp4 output.gif

where the name of the input file is input.mp4 and output.gif is the name of the output file. Unfortunately gif images are large due to their lossless data compression. So you’ll end up with a file that’s much bigger than the original mpeg4 and probably something that exceeds the upload limit of Diaspora*, Friendica or Mastodon.

In order to reduce the size of the file we can reduce the size of the images or we can reduce the number of frames per second. To achieve this we need the following command:

ffmpeg -i input.mp4 -r 12 -s 320x180 output.gif

This command reduces the framerate to 12 per second and resizes to 320×180 pixels. For the size of the GIF make sure that the aspect ratio remains the same or the resulting GIF will be distorted.

When we look closely at the resulting GIF we clearly notice some shortcomings in the animation. This is due to the default GIF encoding in FFmpeg. Because GIFs only uses 256 colors the number of colors from the mpeg4 needs to be reduced. FFmpeg by default uses a generic palette of 256 colors that covers the widest range of content. This is in general not optimal for the specific video that you want to convert. Luckily FFmpeg allows us to create a custom palette for our specific video. To create this palette type:

ffmpeg -i input.mp4 -filter_complex "[0:v] palettegen" palette.png

When we look in the folder of our mpeg file well noice that a file ‘palette.png’ has been added. This is our newly created 256 color palette for our specific video which is generated by the palettegen filter. To use the new palette with our mpeg video type:

ffmpeg -i input.mp4 -i palette.png -r 12 -s 320x180 -filter_complex "[0:v][1:v] paletteuse" prettyOutput.gif

FFmpeg needs two input files (streams) in this case test.mp4 and our newly created palette.png. The paletteuse filter takes the two streams as input specified by [0:v] and [1:v] where v stands for video and the preceding number for the number of the stream. The output file is renamed to prettyOutput.gif to differentiate it from the earlier output.gif. The resulting video should be much … prettier. If your resulting video is still too large either reduce the frame rate or resize even further (or just reduce the length of the video of course).

Further reading:
http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
https://engineering.giphy.com/how-to-make-gifs-with-ffmpeg/

Categories
open source social

FLOSS tools to create a forum or community

Introduction

With the demise of G+ a lot of community owners are suddenly looking for a new home. Since a lot of G+ users despise FaceBook (and rightfully so) other social networks are mentioned. The problem with a lot of these networks is that they are centralized and proprietary making the users depending on the whims of the owner of the network. Below I summerize the FLOSS options for people interested in setting up a community. This is not an exhaustive list. I encountered these options after discussions often on G+ and I experimented with some of these options during the last couple of months.

Self-hosted or not

An important decisions is whether or not to host the forum or community yourself. If you want to host it yourself you’ll keep full control of the server however the maintenance is considerably more labor-intensive than with a non-selfhosted solution. You also need to install the software on a server and configure it.

Friendica (self-hosting possible)

Both are macroblogging social media networks that offer the possibility to create a forum. The UI of Friendica doesn’t look very modern but the functionality needed to use and maintain a forum is all there. Click this link to see an example of what a Friendica forum looks like. If you want to create a forum on a existing server please note that the administrator of this server can place limits to the forum e.g the number of participant or the number of forums that can be created by one account. Be aware that you’re a guest on someone else’s server.

A practical example. In the German town of Zwenkau the citizens are provided with a community platform, the Zwenkauer Flaschenpost, for online communication and discussion between citizens. This is all done with a standard Friendica install on a server. If you want to read more here is a link.

Movim (self-hosting possible)

Movim is social platform that let you share and chat. Movim is build on top of the XMPP communication protocol. A strength of Movim is that is federates and that everyone with a XMPP account (e.g Jabber) can connect. Once you’ve created an account it’s very easy to create a community. The UI looks modern but some community admin features are missing (or I couldn’t find them). As an example as an owner I couldn’t ban someone from the community. On the other hand I found Movim community the easiest to set up (in a non-selfhosted environment). This is a link to my Movim community. Also a word of warning if you create a forum on an existing server be aware that you’re a guest of that server and that restriction may be applicable.

I recently wrote a more lengthy post about the chat capabilities of Movim.

Mastodon (self-hosting possible)

Mastodon is a microblog social network that has a TweetDeck like interface. I was hesitant to add it to this list because the UI and the dynamic experience differ from a classical forum where the same post remains in the viewport for days or weeks. However when joining the right instance (=server) or create one yourself it may very well become a great dedicated community. Here is a link to mastodon.art an instance where artists can show their artwork.

Flarum (only self-hosting)

Open source forum software that is currently in beta. Nice, modern UI. I’ve read some concerns about the beta status and the stability of Flarum. If you want to see what the interface looks like here is a link. Here is a link to a guide how to install Flarum.

NodeBB (self-hosting possible)

Open source forum software with a modern UI. You can either self host for free or use a NodeBB hosting plan that comes with a price tag. Here is a link to the source of NodeBB. You can check the interface yourself on this website.

phpBB (self-hosting possible)

Forum software based on the PHP programming language. I know phpBB mainly because it’s used on the FreeCAD forum, a place that I visit sometimes. phpBB is feature rich and from a user perspective it’s a joy to use. The documentation about this forum software can be found here. Here is a link to the source code.

Discourse (self-hosting possible)

Discourse discussion management software with a modern UI. It can either be self-hosted or Discourse can host for you. The latter which is clearly the business model of Discourse comes at price tag. If you want to see what Discourse looks like take a look at the discussion forum of Diaspora*or Tom’s 3D community. Here is a link to the source code and another to the install guide.

Last updated: 02 November 2021

Categories
open source PC

How to rip a DVD

Why in this day and age of Netflix one would be interested in how to rip a DVD? More and more people are using Netflix or an other video streaming service to watch movies and TV series. What most people don’t know is that Netflix is trampling user rights. Not only does Netflix use digital rights management (DRM) they also mine huge amounts of data from the users. This data is not only used to improve the service it can also be provided to third parties like law enforcement and other businesses for promotional ‘services’ . If you don’t believe me you can read it in the privacy statement of Netflix.

Unfortunately the’re very little legal alternatives that respect the user rights. DVD’s are an option but most of current DVD’s have strong DRM in place. Luckily this DRM can be removed with relatively simple means. Without the DRM the user can watch the content the way he/she prefers.

In this post I’ll explain what you need to remove the DRM from DVD’s and copy the movie or TV series to OpenELEC or LibreELEC or any other system with Kodi e.g in your living room.

Use original DVD’s

Don’t use pirated DVD’s. Let’s stick to what is legal. DVD’s are cheap and second hand DVD’s are even cheaper. For a few dollars/euros you can buy the best movies on DVD. Most DVD’s are protected with DRM and some publishers like Disney take severe measurements to prevent the user from making a copy for their own use. This is where Handbrake comes in.

Handbrake

Handbrake can, among other thing, read DVD’s and convert the content to e.g mpeg4 files. These mpeg4 files can than be stored on the HDD of a device of your liking and played with any media player. To be able to decrypt DRM protected DVD’s (see above) also a free/libre DVD playback library libdvdcss is needed. This article explains how to install this on Windows and OSX. And this article explains how libdvdcss works.

Screenshot of Handbrake
A screenshot of Handbrake. Handbrake reads a DVD and write the content to an mpeg4 file.

Handbrake tip

I was struggling to burn the subtitles into the media file that I created from a DVD. This is what eventually worked for me. When a DVD is opened and scanned, go to the subtitles tab, choose the preferred language and uncheck the Forced Only box while leaving the burned in box checked. That’s it. Now press the Start button to start encoding and your file should contain the burned-in subtitles with the language that you choose.

Under the Subtitles tab, select a language, keep the Forced On unchecked and Burned In checked.

MetaZ or MetaX

MetaZ is a metadata editor but the beauty is that it uses the title of the movie or the TV series to retrieve metadata from The Movie Database (TMDb) and adds this metadata to the rip file we just made with HandBrake. Unfortunately MetaZ only runs on OSX while MetaX only runs on Windows. Of course we can use VLC for GNU/Linux but the user has to add the metadata manually which is a pain in the butt.

Screenshot of MetaZ. With MetaZ you can add meta-data to a video file.

Kodi, OpenELEC, LibreELEC

Eventually you want to be able to play the video files that you ripped from the DVD’s. There are many free/libre software  choices but perhaps the most popular is Kodi.  Kodi is mediaplayer software that runs on about every media file you’ll throw at it. It is available for GNU/Linux, Windows and OSX. OpenELEC and LibreELEC take this a step further because they’re Linux based operating systems with the sole purpose to run Kodi.

Click here if you want about my experience with OpenELEC.

I hope this information has helped you to rip your DVD’s and start watching them on the device of your own liking. If you have any questions about this topic feel free to send me an email. Now if you excuse me I have a nice classic movie to watch.

Categories
open source social

Diaspora*, an alternative social network for GooglePlus

Why an alternative social network

Three weeks ago I wrote an article about the demise of G+ and I defined four criteria for an alternative social network. Based on these criteria I choose three social networks, Mastodon, MeWe and Diaspora* and signed up on them and promised to write about my experience with these three.

I will not write any further about MeWe since I already deleted the account after one week and wrote a post about it. So that leaves Mastodon and Diaspora*. This blog post is about my experience with Diaspora*.

Screenshot of the Diaspora* interface. Not flashy but very functional and fast.

What is Diaspora*

The shortest way to describe Diaspora* is it being a Facebook clone however this doesn’t do justice to Diaspora*. Although the user interface of Diaspora* has similarities with Facebook the network couldn’t be more different, kind of an anti-Facebook. First of all Diaspora* is free and open source software while Facebook is proprietary and Diaspora* is distributed while Facebook is centralized. The latter means that while Facebook is owned by a single entity that controls the entire network and it’s users Diaspora* has no owner and thus can never be controlled by a single organization or person. Instead Diaspora* consists of many servers (or pods) that have their own administrator. These servers are are all interconnected (or federated). Without going into details about how this works exactly being distributed has other notable advantages from a user point of view.

  • First of all Diaspora* doesn’t have ads  (it worth to note that some centralized social networks like G+ and MeWe also don’t have ads).
  • Diaspora* can’t be closed or sold.
  • There is no ‘built-in’ data-mining. While it can’t be excluded that some rogue administrator will use your data there is no ‘Diaspora* business model’ that would encourage this. Meaning that your privacy is better protected.

Working with Diaspora*

Being a user of G+ for several years I admit it took a little time to get used to the Diaspora* interface. Central is the ‘Stream’, a single column of posts of your contacts (followers in G+) and the hashtags (e.g #Linux) that you follow. Next is ‘My Activity’ which lists all posts that you liked, shared or commented on but also the posts that you wrote yourself. Lastly there is ‘Public activity’ that shows all public posts from the Diaspora* community. This also shows nudity or even porn but, as I noticed so far, this was always tagged with #nsfw which stands for ‘not suitable for work’. These #nsfw posts are not shown until the users clicks to open it. I think this is good solution to protect the user without censorship.

Conversations on Diaspora* are good and in-depth although it takes time to identify good contacts. After two weeks I have 29 contacts (on January 9 it was 50) of which half turns out to be what I consider good. Diaspora* provides the user with a good tool to ignore a contacts for instance if he or she turns out to be spammer. Diaspora* also allows for a private chat with an established contact which can be very handy.

Diaspora* doesn’t have the G+ equivalent of communities, a group of users sharing posts about a certain topic, and collections, a single users sharing posts about a single topic. These communities and collections can’t be mimicked by combined tags and aspects.

Conclusion

Diaspora* is, after Mastodon, the second biggest distributed social networks with the about 660.000 user accounts. Still a dwarf compared to Facebook but I’m not interested in the total number of users. I’m interested in the quality of the conversation and this is good, in fact it’s very good. People are mostly knowledgeable and helpful which guarantees meaningful chats. Just what I’m looking for.

I still prefer the G+ interface with multiple columns over the one column stream in Diaspora* because it saves a lot of scrolling however this seems like nitpicking. Overall the user interface of Diaspora* is straight forward and easy to work with.

The user has good control of the streams of information although I would have preferred the user to be able to combine tags and aspects. The reason for this is I want to be able to follow someone on certain topics instead of all his or her posts.

Diaspora* works surprisingly good on low-end machines. This is probably due to the minimal user interface. I consider this a big plus since I have a very old Thinkpad laptop that I use regularly.

Yes, my family and friends are not on Diaspora* but I don’t care about that in fact is a plus. I’d rather see them face to face anyway.

In conclusion Diaspora* starts to grow on me. I had a slow start with it but I’m gradually beginning to experience the strength of this well established and stable social network. I found Diaspora* very easy to use a plus that is not to be underestimated. The content that’s being shared is valuable and the conversations are excellent. For me that’s what counts when it comes to social networks.


EDIT: Diaspora* users can choose between a couple of Android apps. I choose Dandelior (which is the same app from the same developer as Dandelion) and I like it. Dandelior and Dandelion for Android can be downloaded from F-Droid.

EDIT: Diaspora* uses Markdown to format text making it an excellent choice for macro-blogging. Markdown appears to be more powerful than the editing features of G+. This and the single column stream are making Diaspora* an excellent choice for macro-blogging.

Categories
Linux open source PC

DIY streaming media box: building it.

Building the streaming media box consists of a hardware and a software part. Building the hardware is relatively easy. With these modern PC components you can’t do much wrong. First I inserted the 4Gb DDR3 memory into the motherboard. In my earlier post on this topic I mentioned that I already had a MSI mini-ITX motherboard and a processor (Celeron G1610) from my sons PC that I upgraded earlier. With the motherboard ready, I removed the power supply from the LC-1410mi case. The motherboard fitted nicely over the six elevated mounting points in the LC-1410mi.

When I inserted the power supply I noticed that it blocks the PCI slot on the far side of the motherboard something I hadn’t that seen coming (see image below). I therefore was unable to use the PCI Wi-Fi card that I had. I decided to use a USB Wi-Fi stick that I already had. It is not as elegant as the card but it works.

Next I connected all cables from the power supply and the case to the motherboard. When you do this for the first time it can be intimidating because of all the different connectors on the motherboard. Luckily cases and motherboard generally come with descriptions of all these different cables and connectors. I connected the 128Gb SanDisk SSD to the motherboard SATA port with SATA cable and to the power supply. The 2,5 inch SSD didn’t fit into the bracket that comes with the LC-1410mi. I had to improvise to get the SSD into the case.

With all hardware built-in and connected I decided to test the system. I connected a monitor, keyboard and mouse and booted the streaming media box in the making. Since the SSD was still empty I was only able to enter the motherboard boot-menu (on MSI press F11 to enter the boot-menu while booting). This is sufficient to test the hardware and all the connections. The whole system appeared to be functioning okay.