Raspberry Pi speaks and shows. How I made a media center from Raspberry to replace smart TV

November 5, 2013 at 02:23 PM

Installation and xBMC setup on Raspberry Pi

  • Gadgets,
  • Working with video

About 2 months ago I bought a toy called the Raspberry Pi. I could not resist buying, as I was going to put on it an emulator of old game consoles (Sega, Dendy, etc.), which in the end did. But, in connection with a recent post on Habré about a media center for this computer, it was decided to install a media server at home.

What do we have

At the time of reading the post about the XBMC port on Raspberry, I had the board itself, the Rainbow Pibow case, the ASUS RT-N13U router, a 23 "monitor and a MacBook.

What we want to see

This router was bought sensibly, since it has a USB 2.0 connector with the ability connect hard disk. As I understand it, you can connect an external hDD to the router, make a couple of swings magic wand and this same disk will be available in the networked environment (you already understood that everything will not be so simple). The Raspberry board will need to take video and music from the NAS and play it. In addition, I would like to teach her how to download torrents to a hard drive in a router.

There was not enough of my equipment to install and work with the media server. It is advisable to connect the board to the home network without wires, in case you need to connect the set-top box in another room and not suffer from pulling the twisted pair through the apartment. You need a hard drive to store files, it must be either an external hard drive or a full-fledged network storage, but I'm not ready to shell out a large amount of money yet and settled on a USB HDD. Also, it was necessary to resolve the issue of managing the board, because connecting a full-fledged keyboard to it is rather ridiculous, given the size of the "raspberry". There is an option to control the TV remote control via HDMI-CEC, but I have a monitor, not a TV. I decided to find a miniature keyboard with a touchpad so that it would be convenient to use the media server and, if anything, it would be possible to work comfortably in other distributions.

As a result, I bought an adapter Wi-Fi ASUS N13, which is on the list of supported Raspberry devices (I found out about the list after purchase, so I was just lucky), a Seagate Backup Plus Desk 2TB USB 3.0 external hard drive, a Trust Tocamy mini keyboard and another SD card (on each card on the distribution to be able to include both raspbmc and raspbian).


All purchases cost me 5500 rubles, which is not so much in my opinion.

Installing the distribution kit and connecting the adapter

The installation itself is quite simple, and a solid wiki has been made to help users. To install the distribution kit from Mac OS X, you need to insert the memory card into the card reader, run 2 commands in the console and the image has been successfully written. Next, the memory card is inserted into the raspberry, we plug the power cord, HDMI and power cord into it. After following the instructions on the screen, we see the system start screen.


I'm sorry, the screenshot is not mine, I borrowed it from Google.

FROM wi-Fi adapter everything turned out to be quite simple too. Without removing the power cord, you need to insert the adapter into the USB connector of the board. In the interface of the distribution kit, go to the programs - Raspbmc Settings - Network Configuration. Change Network Mode to Wireless (WIFI) Network, scan networks and set a password. Perhaps "raspberry" will ask you to reboot. During reboot, you can remove network cable and the board will be connected to the Internet via wireless network.
And here's another nuance, quite often the system downloads updates (everything works for me for 2 days and downloaded updates 2 times), which is minus 10-15 minutes of watching movies. In the settings, you can turn off auto-update of the system if it annoys someone.

Installing a hard drive

I could not have imagined that there would be so many problems with this item. Yes, on the one hand, my router works with external hard drives, but it was worth two nights of dancing with a tambourine around it. Fortunately, the HDD has its own external power supply. And so, after connecting the hard drive, the router found it. A 2 terabyte USB HDD was defined in the web interface. Asus has its own functions for working with hard drives and printers, but on native firmware they work "strange", if at all. After several hours of torment, it was decided to upgrade to the adapted firmware "from Oleg". The router did not allow this voluntarily through the web muzzle and I had to use the firmware recovery utility from Asus.

On Oleg's firmware, we managed to set up an FTP server. All computers at home could see perfectly contents of hard disk via FTP, but there was nothing in the network environment. The problem turned out to be incorrect DDNS configuration. Another hour or two and the long-awaited HDD appeared on the network on all computers.

From the Raspberry side, everything was set up very easily. We go to the video - files - add a video, indicate the location of the files by clicking the browse button, in the list that opens, go to the very bottom and click on Windows network (SMB), and there we already find our shared folders. We do the same with music and photos.

Unfortunately, I was not happy for long. In the morning, I opened the web muzzle of the router to set up a torrent rocking chair (yes, there is one in the asus) and then connection errors got in. A few more hours of torment and it was decided to abandon the idea of \u200b\u200bconnecting an external drive to the router directly.

External drive uSB interface 3.0, just like my MacBook. I decided to connect the disk to it and share it to the entire network from a laptop. There was another problem here. Mac OS X since version 10.7 has SMB backwards incompatible with Windows, which puzzled me. Shared folders on the PC are visible to everyone, including the MacBook, but on the contrary, problems already appear - the PC does not see the MacBook folder. A bit of searching and a solution was found - this is the SMBUp program. Installed in 2 steps, reminded of the directx web installer in Windows. After installation, you need to select the folders that you want to share, and the program is turned on and the changes are saved when you click on the close button of the program, which also surprised me very much. In general, everything worked. All heavyweight files are now downloaded to an external drive, Raspberry takes files from it (in the settings, you need to add the media source again, using the same protocol, but in a different location).

Let's sum up

Raspberry Pi for me is a toy that I finally found practical use... It is quite convenient to use it as a media server: you throw files to the hard drive in one room, and look in another - a kind of SMART-TV connected to your home network. But this smart team is not without its problems.

I hope that someone found my post useful and interesting, thank you all!

Tags:

  • raspberry pi
  • media server
  • xbmc
Add tags

And so, the hardware part of the Raspberry Pi-based media center has been assembled, read all the details on its configuration and assembly in the first part of the article. The next step is to install the XBMC distribution. XBMC is an open source media center project originally designed for game console Xbox (hence the name of the project - Xbox Media Center) and currently supports multiple platforms.

There are three main options for media center distributions, Raspbmc, XBian, and OpenELEC. All of them are based on the XBMC project and are designed specifically for the Raspberry Pi, have minor differences, and in addition are supported by quite large communities. I chose OpenELEC for myself, so in the future we will consider exactly its installation and configuration.

The Raspberry Pi stores the operating system and programs on an SD card, so an SD card (or microSD for the "B +" model) is required. A 500MB card is enough to install OpenELEC, but less than 2GB is hard to find right now. And let there be a small margin just in case. It makes no sense to use a larger card, we will not store media files on it anyway, and the larger the card, the more time and disk space to create and store system backups. But the class of the card should be as high as possible.

It is best to download the latest version of the OpenELEC disk image distribution from the official website of the developers http://openelec.tv. As of February 2015 this is version 5.0.1, which changed the name "XBMC" to "Kodi". But at the time of this writing, it did not exist yet, so all further description refers to the 4th version. However, the external differences are minor. Versions 3 and below (12.x Frodo) should not be installed - there are too many glitches in them.

And so, download the distribution kit (disk image) of OpenELEC. You can write the image using the program. Insert SD (microSD) card into the card reader and connect it to the USB port of your computer. Unpack the downloaded archive with the OpenELEC image, run Win32DiskImager, select this image in it - a file with the extension .img and the SD card to which you want to write it, press the "Write" on-screen button. Wait for the burning process to complete.

You can overclock your Pi immediately. Launch Total Commander on your computer and switch to the newly recorded SD card. Instead of 2 GB, there will be a little over 100 MB, which is normal. Looking for a file config.txt and open it for editing, it is a regular text file. We will restrict ourselves to a gentle processor overclocking mode. To do this, add the following lines to the config.txt file:
arm_freq \u003d 900
core_freq \u003d 333
sdram_freq \u003d 450
over_voltage \u003d 0

There are already similar commented lines out there, just fix them and uncomment. To watch MPEG2 and DVD movies you need a license key. You can, the cost is £ 2. The dongle is hardware dependent, it is suitable only for the board, the serial number of which was specified when purchasing the dongle. What is the serial number of your board you will find out when you start OpenELEC. If the key has already been purchased, write it to the config.txt file by adding a line like this:
decode_MPG2 \u003d 0x00000000

You can also forcibly select the resolution of the TV screen, turn on the overscan mode if the image goes beyond the boundaries of the screen or, conversely, there are dark bands along the edges of the screen, and much more. How to do it, . The original article in English is located at: http://elinux.org/RPi_config.txt. However, most of the settings in the config.txt file can be done using OpenELEC tools by running the corresponding add-on. More on that later.

After editing, save the config.txt file, remove the card from the card reader and insert it into the Raspberry Pi slot. The cable from the router is already connected, the TV, of course, is also connected with an HDMI cable. You can turn on the power.

During setup, for convenience, it is advisable to connect a USB mouse to the media center. The keyboard will also be useful. Don't do anything for a few minutes, let the system download necessary additions... At the first start, a window will appear on the screen prompting you to select the interface language. Select the one you want from the list. You will then be prompted to enable SAMBA and SSH. Enable SAMBA, and SSH only if you know exactly what it is and why you need it.

We choose "System" - "Settings", there will be many items on the left side of the window that opens, you can go through all. Let's start with point "Appearance"... First of all, turn on the expert mode in the lower left corner, otherwise some of the settings will be unavailable. Then, on the Cover tab, to save resources, uncheck the Enable RSS feeds box, and leave everything else as default.

"Language settings". Choose the interface language - Russian. The country in the time zone is Russia, then the desired time zone.

"File Lists". We mark all the points here so that files can be deleted and renamed, and hidden files are visible. However, this is at your discretion.

Close the window and go to the tab "Video".

"Playback". Here, to improve the transmission of motion in the video, you need to select the item "Adjust the display frequency according to the video" and put it in the "Continuous" mode. The rest is default.

"Acceleration". Make sure hardware acceleration is enabled. Leave the settings on the other tabs of the "Video" window by default. We close the window. On "TV" we will also leave everything by default.

"Music" - turn off "Read information from tags", otherwise the names of music files may be displayed incorrectly.

Photos, Weather, Add-ons and Services can be left unchanged for now. Go to the tab "System".

"Video output". Everything is by default, just make sure the interface resolution is at its maximum. Sound output. The audio output device is HDMI, the rest is default.

"Input device". The mouse must be turned on, and in the "Peripherals" item you can configure the control of the CEC adapter. Everything is clear there. Only after any configuration changes will the console stop working. A system reboot is required, reboot with mouse control.

Internet Access, Energy Saving, Debugging, and Special Protection are default.

Close the tab and go System - OpenELEC - System... Here, make sure "Automatic Updates" is set to "manual". As new versions of the software are released, you can easily upgrade here via the Check for Updates item. On this tab, you can also make and, if necessary, restore a backup copy of the settings - "Create a system backup", "Restore backup".

On the "Services" tab, enable "Samba" and, if necessary, "SSH"; "Use Samba passwords" and "Disable SSH passwords" DO NOT check... We also turn off everything else. I did not configure "Bluetooth".

Now from the main window go System - System Information... Here you can get information about the connected drives, network connection, find out the IP address, processor temperature, view the serial number of the board, which is required to purchase an MPEG2 license key, etc.

See if the total volume of the two sections on the SD card corresponds to the full volume of the card. Perhaps it will be smaller, i.e. some of the disk space is invisible to the operating system. The fix is \u200b\u200bvery simple. Create an empty file on your computer with the name .please_resize_me... That's right, with a leading dot and underscores. You can take it from my archive - link at the end of the page. Copy this file to a USB stick, insert it into the USB port of the media center and enter the OpenELEC file manager.

Your flash drive will appear in the root directory. If the "storage" directory is not there, click "Add source" and select " Home folder". Now the "storage" directory will appear in the root, copy the file from the flash drive into it, file operations are done through context menu... Exit the file manager by clicking on the button with the house at the bottom and reboot (button at the bottom left). The entire volume of the card should now be visible.

Now you need to somehow download the media files to the connected hard drive. Better to do it before setting hard drive to the media center. Connect it to your main computer, format and copy movies, music, photos from your archive to it. It's just that it will turn out faster. OpenELEC understands all popular file systems, optimal choiceprobably NTFS.

You can share files and software local network... To do this, you need to configure a Samba server. This is a rather serious question that deserves a separate article. Here I will only mention the main points. First you need to create a configuration file samba.conf... For convenience, I am posting its working version - link at the end of the page. It needs to be unpacked from the archive and copied to a flash drive.

Go to file manager OpenELEC to the "storage" directory, then to ".config" (the dot in front of the name means that this hidden folder) and copy the samba.conf file there. There is a samba.conf.sample file. This is a sample, copy it to a flash drive just in case. If something doesn't work out, you can experiment with the settings. On the Internet, you can find many conflicting opinions about the contents of the samba.conf file.

Reboot again. Now you need to set up a local network on your Windows computer. Run Total Commander and choose instead local disk "Network". If after a short time there appears OPENELEC - you're in luck, everything works. You can copy files to a connected hard drive, although the speed is not very high - about 3 MB / sec, i.e. approximately 25 Mbps. Hard disk and flash drive are displayed in the directory OPENELEC - storage.

If there is no OPENELEC in your network environment, try turning off the media center. This must be done programmatically through the shutdown menu. Only after closing the system can you turn off the power. After waiting 1-2 minutes, turn on the power again. If OPENELEC did not appear in the network environment, you need to configure the local network on the Windows computer. The question is separate and rather complicated. I will not dwell on it, because not an expert in this. It worked for me after three hours of agony and careful study of the material Google found. However, it also included time to experiment with the contents of the samba.conf file.

Well, it remains to install the addons (s). First, let's add the Russian-language Seppius add-ons repository. Download the repository.seppius.zip file, copy it to the media center USB stick or HDD, then select System - Add-ons - Install from zip file and provide the path to this file. Another useful repository is Leopold. Similarly, download and install the xbmc.repo.leopold.zip file. Just in case, I put both of these files in the archive, the link to which is at the end of the page.

Now you can choose what interests you in the list of add-ons. The list is long, but, unfortunately, most of the add-ons are not interesting or do not work. However, there are a few things to choose from. If after successful installation when the add-on is launched, an error message appears, which means it is outdated, and its author, obviously, has lost interest in this project of his. It remains only to remove it, or try to figure it out and fix something yourself, but this is a separate topic.

From software add-ons, I recommend installing OpenELEC RPi Config of Leopold "s Add-ons - Services... With this add-on, you can edit system settings in the config.txt file. Everything is clear there, just do not set the parameter when overclocking the processor "Over_voltage" Above zero. In this case, the warranty for the board is lost. The point is not in the fact of losing the warranty, but in the fact that this can lead to damage to the board. Unless, of course, you have already played enough and you just need a reason to throw it all away ...

Another useful addition Keymap Editor - it is very convenient to configure media center control with it. This is what we will do now. As I mentioned, the Raspberry Pi supports CEC technology, which allows you to use your TV remote to control your media center. Most TVs released in recent years also support this technology.

Unfortunately, there are some problems here. Different companies call CEC technology differently. And this is not accidental, they implement it in their own way. For example, LG has SimpLink. The idea is good, but the programmers decided not to bother themselves too much and reduced the number of buttons that send codes via HDMI to a minimum. On my remote, out of 48 buttons, only 11 can be used to control HDMI-connected devices.

These are arrow buttons, OK, Exit and a few others. The rest of the buttons control the TV or display the message "Operation not available". Several buttons do not work at all in this mode. In principle, this is sufficient for standard operations, but, for example, toggle sound track film, getting deep into the menu is quite inconvenient.

For some operations, LG programmers decided for some reason to use the successive pressing of two buttons. To display the context menu, press "Stop", and then "Play", to return to home screen - "Stop", "Pause". But most of the remote control buttons are not used ... And there is nothing you can do about it. In the TV menu, you can only enable or disable SimpLink.

Fortunately, in XBMC, the same button can perform different functions in each window, so you can tweak a few things. To do this, run the installed add-on Keymap Editor from the main menu "Programs". How to work with it is intuitive, but first you need to familiarize yourself with the file structure keyboard.xmlwhich is stored on the SD card in the catalog /storage/.xbmc/userdata/keymaps/.

The file name can actually be anything, the main thing is that the extension is xml... The add-on simply helps to create and edit this file, which overrides the default functionality for the control buttons. The topic is also separate and extensive, not everything is immediately clear and understandable, you will have to experiment. Detailed information by the file structure you can find and.

Finally, everything is set up, we make a backup copy of the system files just in case (System - OpenELEC - System - Create System Backup) and copy the created file from the directory / storage / backup to HDD or flash drive. This file can be used to restore all settings made after reinstalling or installing a new version of OpenELEC. To restore system settings, the file must be located in the directory / storage / backup.

Unfortunately, restoring settings can be done correctly only within the same version - 4th, 5th, etc. Those. no problem upgrading from 4.0 to 4.2, but errors may occur when upgrading from 4.2 to 5.0. In this case, obviously, the setting will have to be repeated manually. It does not hurt to save the image of the SD card using Win32DiskImager to a file with the extension .imgso that in case of some global system failures, you do not have to repeat the entire setup. The saved image file can be zipped to save disk space.

Now the whole initiative is in your hands. Watch movies, slide shows, listen to music. But remember, the Raspberry Pi is a computer, not a player. This means that “pressed the button and watch” it will not work. You will have to use your head, you will also need straight arms ... On the other hand, if something does not work or does not work as it should, there are many ways to solve the problem. First of all, you need to look to see if someone has already found a solution. New versions of OpenELEC come out quite often - several updates appear during the year, i.e. the project is actively developing and all errors are gradually eliminated.

The media center supports quite a few video formats, these are H.264, XviD, DivX, MPEG2 in MKV, AVI, DVD containers. With a complete list of supported formats you can.

What are the disadvantages of a Raspberry Pi media center? The main disadvantage is that it takes a very long time to get to the desired media file on the Internet. There are no delays when viewing, but the search and selection of what you want to watch takes not seconds, but 1-2 minutes. There are also quite a few broken links. There's nothing you can do about it ...

The menu is not always displayed correctly DVD discs... In general, DVD is a very complex container with a lot of documented and undocumented opportunities... That said, the Raspberry Pi's main movie plays well at all times.

Over time, I discovered another drawback. If there is any error in the media file, playback stops and the player falls out into the menu. It is possible to watch the film to the end only by restarting its viewing and manually rewinding it beyond the point of error. In general, error handling is the weakest point in any program.

The question may arise as to whether the Raspberry Pi supports the new H.265 video codec. At the time of this writing, this is exactly the same as in most other media players, i.e. no way. But when there is a real need to watch H.265 encoded movies, there may be a Raspberry Pi 2, 3 ... or something similar. Let's just replace the board of our microcomputer with something more perfect.

Of course, I did not talk about all the capabilities of the media center on the Raspberry Pi. Something, probably, seemed not entirely clear, I would like more pictures. But in order to tell about everything in detail, you need to write a book, it is impossible to describe everything on one page of the site. The names of the windows and their contents in newer versions of OpenElec may differ slightly from my description. If something is not clear or does not work out - ask Google for help.

What?: Raspberry Pi 3 - the next generation of the popular microcomputer
Where?: On Gearbest - on sale
Additionally
: Expansion cards, accessories and sensors for this platform are on


The Raspberry Pi family of low-cost compact single board computers hit the market a few years ago and have since won acclaim from DIY enthusiasts around the world. Earlier this year, it was announced that cumulative sales exceeded eight million devices, and the number of publications about them on the Internet is incalculable. So this article is, in a sense, another “drop in the bucket”.


However, tell us about your own experience with new version microPC still want to. We hope that this material will be useful to those readers who are not yet familiar with this platform. Additional information can be found at various developer resources and DIY projects sites (for example).


The Raspberry Pi 3 version, the last of the "full-size" versions, was announced earlier this year. It retains the basic features of its predecessor, including board dimensions, interfaces, number and location of I / O ports. So it will be compatible with previously developed for the Raspberry Pi 2 cases, displays, cameras, expansion boards and other components.

The scope of delivery is traditionally minimal - the cardboard box contains only a board in an antistatic bag and a couple of pieces of paper. So to start the device, you will need some additional elements, in particular a power supply with microUSB output and 5V 2A parameters, a microSD memory card, a monitor and a keyboard.


The appearance of the board has not changed. It is not easy to distinguish it from its predecessor without careful consideration, if you do not know which angle to look at. The dimensions of the board are 5.6x8.5 cm ("kretite" format), and the maximum height is determined by the dual USB ports (slightly less than 2 cm). On the front side we see the main processor, Ethernet controller chip and USB hub, main slots and ports. FROM back side board is a chip random access memory and a slot for memory cards.


The key difference from its predecessor is the SoC used - now it is a 64-bit quad-core BCM2837 chip, the cores of which have the ARM Cortex-A53 architecture and operate at a nominal frequency of 1.2 GHz (in the standard OS distribution, the frequency is reduced to 600 MHz without load). In case of work with high load, it is recommended to install a heatsink on it, which is often sold complete with a case and a power supply. The processor also houses a graphics controller that supports the OpenGL ES 2.0 API and can decode popular video formats (in particular H.264, but not H.265). The second, also quite relevant in our opinion, update is the integration of Wi-Fi controllers (one antenna, 2.4 GHz, 802.11b / g / n, up to 150 Mbps) and Bluetooth 4.1 on the board. The presence of a built-in wireless network controller makes it more convenient to implement scenarios with a network connection, for example, Automation Miniserver On the other hand, the use of a compact antenna (without the ability to regularly install another, external one) clearly does not contribute to high speed and range of operation.


The amount of RAM has not changed and everything is also 1 GB. The software must be written to a memory card, there is no own flash here. The computer has an HDMI output (supports resolutions up to FullHD and even slightly higher), composite video output and stereo audio output (there is no audio input, additional equipment is required to implement it), four USB 2.0 ports, 10/100 Mbps wired network controller, a GPIO port for 40 pins (if you connect something to it, note that 3.3 V levels are used), proprietary connectors for the camera and display, and a microUSB port for power supply. There is no power switch in the system, as well as a built-in clock with its own backup battery.
A lot of information is presented on the Internet about the comparative performance of the third and second versions of a computer, and given the differences in SoC described above, it is quite expected that the new generation is faster in tasks related to computing on the processor. On the other hand, it is hotter and consumes more power under load, but does not provide a dramatically new level of performance. We can say that both devices are capable of solving the same problems.


The main OS for this platform is the Debian-based Raspbian distribution. You can install it using special program NOOBS or simply by writing an image of the operating system to a memory card.


But of course the product is compatible with a wide range of operating systems, including various flavors of Linux (including Gentoo and Ubuntu) and Windows 10 IoT Core. To solve certain problems on the network, you can find ready-made specialized projects of distributions, but no one bothers you to use the device simply as a universal multifunctional Linux computer. So finding a suitable option for your level of training is likely not difficult.


Generally, similar solutions, are designed mainly for the DIY segment and use in various "homemade" projects. It makes no sense to describe all the thousands, if not hundreds of thousands of options. It should be noted that the range here is very wide. Some users will be comfortable in command line Linux, others will be intimidated by the process of writing a finished image to a memory card. Therefore, how exactly the microcomputer will be used will depend mainly on your personal experience, desire to "dig deep" and, of course, fantasy.


You can start with fairly simple scripts that do not require deep programming knowledge and extensive experience with a soldering iron. Perhaps the most popular minicomputer use case worth paying attention to is the media player implementation. First of all, let us note that such a solution is quite competitive with ready-made products in terms of cost, convenience and capabilities. However, there are several things to consider in this case. Firstly, we are talking only about video with a resolution up to FullHD inclusive, and the codecs can be represented by the most common today H.264 (AVC), as well as MPEG2 and VC1.




Note that the last two options in the basic package are decoded only by software, and to enable hardware decoding, you will need to purchase a special license. At the same time, the processor power is quite enough for MPEG2, but you can't see VC1 in FullHD without a hardware decoder. Well, there are certainly no problems with music and photos in terms of performance.


To store your media library, you can connect USB drives to your computer, but the scenario for working with a network drive seems more interesting. The speed of the (wired) network will be sufficient even for BD-remixes.


Of the ready-made media center kits, four are the most famous:, and. The first three are focused on working with the popular HTPC shell and generally look the same from a user point of view, and the third is an extended client for the OpenELEC version. If the theme is new to you, you can get acquainted with the capabilities of Kodi by installing it as an application on your desktop or laptop.


A separate group can be divided into projects focused on high-quality music reproduction solutions. From a software point of view, they usually consist of a server part on a microcomputer and a client to control it on mobile device or in a browser. At the same time, specialized expansion cards or DACs are used directly for audio output, providing the required level of quality.


The process of launching solutions for media centers is simplified as much as possible - for OpenELEC and OSMC you download a ready-made OS image from the site and record it special utility to a memory card (a large volume is not needed here, I would recommend 2 or 4 GB Class10), Xbian and Rasplex, in addition to this, offers and own program to initialize the memory card and write an OS image to it.



After that, you install the card in the Raspberry Pi, connect HDMI, network, keyboard and mouse (may be required at the initial stage of configuration) and turn on the power. Further, depending on the distribution kit, you may be offered a wizard for setting some basic parameters (for example, computer name, network connection, etc.).


An important issue is the way to control the player. There are several options here, except for the keyboard + mouse, which is not very convenient in this case. First, there are dedicated apps for smartphones and tablets. Secondly, for some TV models you can try HDMI CEC - control from a standard TV remote control via HDMI. Thirdly, you can brace yourself and add one detail to the Raspberry Pi - an IR receiver on three wires - and take any standard remote control from household appliances. Personally for me last way most convenient.


Even if you are not friends with a soldering iron, there is nothing complicated about it. You need to buy a special receiver chip (up to 100 rubles in an expensive store in Moscow), three wires and connect everything according to the diagram to the microcomputer. Here are links to several materials

The essence of the problem

There are several ways to stuff a TV with multimedia functionality. You can buy a so-called smart TV. However, today manufacturers are asking for serious money for such options, without offering anything striking the consciousness. You can buy a media player, but then you will come across either some exotic firmware from the manufacturer, or with Android, and there is little pleasant in this. In addition, although flash-based Android computers have become relatively popular, their quality is not very high - especially often users complain about poor Wi-Fi and lack of Ethernet (which is unacceptable for viewing HD content). Therefore, until now, enthusiasts preferred to assemble their own HTPC from a mini-ITX motherboard and install XBMC on it. But you want to put something quiet and small in the living room, right? This is where the Raspberry Pi comes in.

It would seem that RPi was developed as an educational tool and a toy for hardware enthusiasts from the world of robotics, what have media players to do with it? Nevertheless, many use the baby for this very purpose, and for good reason. The computer is based on the Broadcom BCM2835 chip, which was originally developed as a multimedia solution (if you don’t believe, you can read on. According to the developers, the processor power is not high and is at the level of the Pentium II 300, but the graphics processor was a success - you probably read about that how Raspberry is played in Quake 3. The manufacturer compares its power with the first Xbox. In general, it is no coincidence that exactly the same chipset is used in the popular foreign player Roku and a number of other similar products. The video chip supports hardware decoding h264, as well as MPEG-codecs. 2 and VC-1. True, the last two codecs require a paid license, you will have to pay 170 rubles. An unpleasant omission - there is no hardware support for the DTS audio codec (despite the fact that the Raspberry developers have already written the necessary code, it is not yet possible to agree on a license). search makes it clear that the DTS decoder, in principle, is rarely found in small players. If you do not have a TV but or a receiver that could decode itself, it is easy to Google a solution for audio transcoding. Spoiler alert: it's better to search for content from AC3.

The goodies don't end there. The Raspberry has a feature that any nettop and the vast majority of media players can envy - it's support for CEC (Consumer Electronics Control) technology. This is a specification for HDMI that allows you to use a TV remote control to control connected devices. Most TVs released in the last couple of years support this technology, but each manufacturer calls it differently. In the case of my Philips it is EasyLink, Samsung has Anynet +, Sony has BRAVIA Link / Sync and so on.

In addition to HDMI, analog video and audio outputs are also supported. Hardly anyone needs analog video in our context, but the situation with analog audio is still unpleasant. The fact is that due to errors in the firmware at the time of this writing, the sound quality is disgusting: for example, a powerful click is emitted at the beginning and end of each track (the only way out is to use gapless playback or buy an audio card with a USB interface).

Another drawback is related to the USB implementation. In fact, two ports and an Ethernet adapter are hung on one controller in the Raspberry. Therefore, the media player cannot be used to download torrents - the network will constantly fight with the disk in control of the bandwidth, because of which everything will slow down, and the device will not be able to consistently download at full speed. Nevertheless, as we will now be able to see, the developer community was able to offer something that more than compensates for the described shortcomings.

What is required

As you know, there is nothing in the Raspberry Pi bundle except the computer itself, so it's worth mentioning a simple fact right away: our media player won't cost $ 35. At least because you should consider shipping. By the way, in Moscow there are several online stores selling Raspberry - there it will cost about 2,400 rubles, but you can get it within a couple of days, not several weeks. In addition, along with delivery, even a purchase from official distributors will most likely result in close money, moreover, with additional hemorrhoids (and considerable). In general, I recommend turning to the services of intermediaries - they are easy to find in Yandex.Market. The most crucial moment is the choice of a power supply. The RPi can theoretically use almost any charger from a smartphone or tablet with a microUSB connector, but in practice, only a 5 volt and at least 1 amp adapter will work. If the adapter does not give the declared result, the Raspberry will become unstable. A list of user-tested adapters can be found on the semi-official wiki. Personally, I used a charger from an HTC smartphone.

Another important point is the SD card. Basically, my Transcend 10th class card for 32 gigabytes cost 800 rubles, which is relatively inexpensive. For our application, 4 gigabytes is enough, but I do not recommend taking a lower class - this will affect the responsiveness of the interface and overall performance. In addition, it should be admitted that SD cards are not designed for such a load, so it is better to take something from a well-known manufacturer. However, you can use a USB flash drive as the main section, but you still need a card to download.

I also advise you to spend money on the case (from dealers it will cost 400 rubles). Of course, this way our media player will lose its “geeky” image, but the board will be protected. At the very least, you need to take into account that when connecting and disconnecting cables and flash drives, it is quite possible to unsuccessfully rest your finger on some part of the naked RPi and break something there.

We also need some kind of file storage. Connecting a hard drive, in my opinion, is pretty pointless. First, the Raspberry will most likely not be able to power an external hard drive via USB and will have to look for an option with an additional power supply. Secondly, as already mentioned, RPi will not be able to simultaneously be both a media player and a torrent download. Any NAS works best. Taking this opportunity, I advise the Kirkwood platform, which works great under ArchLinux, without any optware.

Additional accessories. The remote control can be dealt with in different ways. The simplest thing is to use the TV remote control. If for some reason this does not work, then you can buy a dedicated HTPC remote with a USB receiver. Alternatively, you can build an IR receiver and connect it to the GPIO connector - this is for DIY enthusiasts. And finally, the most functional solution is to put the remote control on a smartphone or tablet. An official remote from XBMC is available for Android, as well as the excellent Yatse. With it, for example, you can send links to YouTube and other popular hosting sites to XBMC, select files from the library directly, and use the on-screen keyboard.

Wi-Fi adapters should be discussed separately. Strictly speaking, if you're going to watch 1080p, it's better to use a wire, since USB adapters usually don't pull the speed you need. But if you are not so picky or if pulling the cable is not an option, choose any of the tested adapters (again, do not forget to look at the wiki). I use TP-LINK TL-WN725N, which cost me 270 rubles and wound up completely without a file. And if the file ball works not on Samba, but on NFS, then with varying degrees of success you can watch 1080p.

Thus, my configuration cost a little less than 4 thousand rubles.

Platform selection

There are three main distributions: Raspbmc, XBian, and. The latter is fundamentally different in this case - it is a traditional distribution kit for embedded systems, so working with it resembles alternative firmware for routers. The choice of additional software is limited, and poking around in the insides will not be very comfortable. On the other hand, it is a more stable solution.

The choice between Raspbmc and XBian is more complicated. Both are full-fledged distributions, both have similar functionality, but differ in philosophy. Raspbmc is a neatly built XBMC on top of Raspbian, from which all unnecessary has been thrown out. XBian is a project that focuses on the bleeding edge, resulting in individual package modifications relative to the standard Raspbian. I advise you to try both, but personally I chose Raspbmc - an older project that also uses the Raspbian package base, maintained by a huge community.

Installing and configuring Raspbmc

Everything here is painfully straightforward. A special installer is available for Windows users. For * nix and OS X users, a simple Python script is available:

Curl -O http://svn.stmlabs.com/svn/raspbmc/testing/installers/python/install.py chmod + x install.py

During installation, several options are available: you can choose to install on a USB flash drive (with a bootable partition on the card) and register the network settings. The latter is worth paying attention to if you plan to use Wi-Fi. The fact is that the installation itself will be carried out completely autonomously: as soon as you insert the finished card into the Raspberry and connect the machine to the power supply, the system will connect to the server and start downloading required files and configure. In about twenty minutes you will have the complete system and the XBMC start screen. At the first start, the system will slow down noticeably - the fact is that at this stage standard plugins will be loaded in the background. Therefore, it is better to wait another fifteen minutes before taking any further steps. And after that, the fun begins.

Let's talk a little about what to look out for in a freshly installed XBMC. By default, a utility is available in the applications section for setting Raspberry-specific settings, Raspbmc Settings. This is where network settings, update options and much more are set.

Pay attention to the processor overclocking parameters. As you know, RPi can be overclocked to 1 gigahertz, and, according to the developers, this will not harm the chip. However, the operation of the card can be unstable in this case, and at maximum overclocking it is very likely that the data integrity will be violated and the system will simply stop loading. We'll have to reinstall everything. To avoid this, it is better to use more gentle overclocking modes or install the system on a USB flash drive.

Otherwise, working with XBMC is pretty obvious. The procedures for installing plugins, adding files to libraries and choosing settings, I think, is not worth describing. Let's move on to more interesting things.

Getting under the hood: some interesting media center tricks
AirPlay to XBMC

AirPlay is a standard for streaming audio and video to Apple devices. The latest version of XBMC has added initial support for this technology, but is disabled by default. To enable it, go to System -\u003e Services -\u003e Airplay. Now you can transfer music from apple devices in this way. Video also works, but extremely unstable. Android users can use DoubleTwist for AirPlay.

Additional plugin sources

By default, only one repository is enabled in XBMC. To add a third-party, as a rule, you just need to slip the corresponding file. For example, there is a Seppius repository specializing in add-ons for Russian-language content - its file can be. Alas, the quality of many addons is not great, but you can find something interesting.

We remove unnecessary

For the next tricks, you need to return to Raspbmc Settings and look at the services section: System Configuration -\u003e Service Management. First, we need cron. Secondly, in most cases, you can disable the Samba server and FTP, although this, of course, will not free up much resources. Next, let's connect to our media center via SSH. Login - pi, password - raspberry.

As already mentioned, using Raspberry with XBMC running (and indeed) to download torrents is a thankless task. Nevertheless, if you do not want to install a NAS, you can go for some tricks. Flexget is a system that can automate torrent search, queue up for Transmission and do it all via cron. Thus, you can start searching for episodes at night. Installation is simple:

Sudo apt-get install python-pip sudo pip install flexget sudo easy_install transmissionrpc

One could write about FlexGet capabilities huge article... It can be used to set any distribution parameters, including quality, size, release group. An interesting integration with IMDB is available: if you add a movie to the watchlist on the service, FlexGet will add it in turn and go looking for it as soon as possible. Those interested should pay attention to the official cookbook and configuration examples. If desired, the system can be constantly expanded with additional rules, getting more and more intelligent rocking chair. However, FlexGet, with its YAML config, is the Emacs of the rocking world, and in order to use it, you need to be ready to read the documentation (although it's not that difficult). A simpler solution is, but this tool has much less possibilities.

Beets

When you withdraw music player on big screen, clumsy tags and lack of cover begin to noticeably annoy. For such cases, beets have been invented - as the author calls it, an audio library organization tool for obsessed audiophiles. The program is based on the rather popular and powerful mutagen library, often used in such scenarios. Installation proceeds in a similar way to what we did with FlexGet:

Sudo apt-get install python-pip sudo pip install beets

After that, you need to carry out the initial configuration. Let's create the necessary files:

Mkdir -p ~ / .config / beets touch ~ / .config / beets / config.yaml mkdir -p ~ / .data / beets / touch ~ / .data / beets / musiclibrary.blb nano ~ / .config / beets / config .yaml

The basic config can be done, for example, like this:

Directory: / media / HD / Music / # path to library library: ~ / .data / beets / musiclibrary.blb import: move: yes copy: no

In this case, beets will write all changes directly to files, and not copy files with new tags to a separate folder. Follow the documentation for further options. According to the author, there are "approximately 6 million" configuration options. Finally, in order to start writing tags, you can bluntly type in:

Beet import / media / HD / Music /

I warn you right away: by default, the process is manual. The system polls MusicBrainz for each album, ranks the options and presents them to the user. Therefore, please be patient and time. You can explore the automation options, there are a lot of them.

MPD

Alas, the built-in XBMC functionality for working with music leaves much to be desired. The plugin is very slow and it takes a very long time to update the library. Better to delegate the task to MPD - a very advanced musical solution well known to hardcore unixoids. MPD is a real music server. His department will maintain the media library. If you don't feel like tagging, you can also leave the search for art and lyrics at the mercy of MPD. In turn, a plugin is available in XBMC that allows you to connect to MPD. In the same way, any device in the house can connect to your server - for example, an excellent MPDroid player is available for Android.

Let's install our server and make the simplest configuration:

Sudo apt-get install mpd cp /usr/share/doc/mpd/mpdconf.example ~ / .mpdconf mkdir -p ~ / .mpd / playlists touch ~ / .mpd / (database, log, pid, state) nano ~ / .mpdconf

Let's indicate the created service files in the config. To do this, you need to change the following lines:

Music_directory "/ media / HD / Music" playlist_directory "/home/USER/.mpd/playlists" db_file "/home/USER/.mpd/database" log_file "/home/USER/.mpd/log" pid_file "/ home / USER / .mpd / pid "state_file" /home/USER/.mpd/state "

Once you're done, you can test it by typing mpd in the console. Then enter the settings into the XBMC plugin.

More articles on RPi

Theme - Raspberry Pi. We interviewed Eben Upton, one of the creators of RPi, and made a video surveillance system based on a mini-computer and a spy bookmark that can quietly collect data from the studied network.

One of the most popular uses for the Raspberry Pi 2 is as a media center. By installing Kodi on raspberries, you can get all the benefits of SmartTV with an intuitive interface for a small cost.

Kodi, formerly known as XBMC Media Center, is open source, cross-platform software. Its comfortable graphical interface allows the user to view videos, photos, listen to podcasts and music from hard drive, local network and the Internet. The project is run by the non-profit XBMC Foundation and is developed by volunteers from around the world. Since its inception in 2003, more than 500 software developers have participated in the development of this program, of which about 60 developers on a regular basis. More than 200 translators have made the entertainment center accessible in 72 languages. Kodi was originally created as a media center for the first generation of Xbox game consoles (no longer supported), but now you can find a native build for all popular operating systems: Android, Linux, Mac OS X, iOS and Windows, which run on most modern processor architectures.

On Raspberry Pi 2, Kodi Media Center can be installed in two ways:

1. The first way is to install it as a standalone OS. Following, we install on the raspberry OpenELEC, which, in fact, is the same Kodi. This OS can be installed as a single or additional. The advantage of this method is that the entertainment center can start automatically when power is supplied to the Raspberry Pi without requiring additional gestures.

2. The second way is to install it on Raspbian linux or whatever operating system your RPi2 runs under as an application. To do this, enter in the terminal:
sudo apt-get install kodi

After installation, we launch the entertainment center with the command:
sudo kodi

The advantage of this method is that you do not need to reboot RPi2 under another OS when required. additional features... It will be enough to exit the program and continue using Raspbian.

Before using the software, we will do a few settings:

  • let's change the language to Russian.
  • install the repository with Russian-language resources.

To change the language, go to System -\u003e Settings -\u003e Appearance -\u003e International
Change the language and keyboard layout.

By default, Kodi comes with a preinstalled repository with a large number of English-language applications. One of the most popular Russian-language XBMC plugins - seppius can be downloaded. To install, download the zip file of the plugin and drop it onto a USB flash drive (if we install it in OpenELEC) or download it anywhere under Raspbian.
We launch the Kodi media center.
Go to Settings -\u003e Add-ons -\u003e Install from ZIP file
We select our file.

Now you can add Russian-language resources to our media center. In addition to seppius, there are many Russian-language repositories. The hardest part is finding a convenient source in the repository itself. Advice! If you find good app in the repository, add it to your favorites, so that later you don't remember where it was so convenient to watch movies.

Did you like the article? To share with friends: