Raspberry Pi: Media Center




OTT


There are 4K devices to choose from:
  • the Chromecast Ultra
    • Marvell Armada 1500 Mini Plus 88DE3009 chip
    • 256MB of RAM
    • 802.11 b/g/n/ac Wi-Fi
    • The Chromecast acts as a bridge between your mobile or laptop and the TV. As such, most mainstream apps on both Android and iOS are Chromecast-compatible. A lack of support for Amazon Video. Chromecasts do not offer an on-screen interface. They’ll simply mirror your phone, tablet, or computer screen on the TV.
  • the Apple TV 4K
  • Apple A10X Fusion processor. A lack of support for Amazon Video.
  • the Roku Ultra
  • Roku is the most content-flexible set-top streaming box on the market. Roku devices run Roku OS. There’s an on-screen interface with channels, a store, a settings menu, and search functionality. According to Roku’s literature, there are more than 500,000 channels you can install on your device. Of course, a large percentage of these aren’t worth the time of day, but you’ll be able to find all big hitters like Spotify, Hulu, Sling, Netflix, Amazon Video, and so on.
  • the Amazon Fire TV 4K

Kodi


Kodi (formerly XBMC) is a free and open source media player application developed by the XBMC/Kodi Foundation, a non-profit technology consortium. Kodi is available for multiple operating-systems and hardware platforms, featuring a 10-foot user interface for use with televisions and remote controls. It allows users to play and view most videos, music, podcasts, and other digital media files from local and network storage media and the internet.

Given that the app is open source, there are thousands of add-ons to choose from. Some of the best Kodi add-ons are entirely legal (such as YouTube, Hulu, and Spotify), while others are most definitely illegal.

Kodi even has an official repository for add-ons. Every single one of the add-ons you will find in it is entirely legal to download and use. All Add-Ons can be installed via the application itself and they will automatically update as new versions are released. It is kind of like an "App Store" for Kodi.

Kodi add-ons are typically written in python however there are exceptions depending on the add-on type. Detailed help pages on add-on development can be found.

HOW-TO:Install Kodi on Raspberry Pi


Install Packages for Raspbian



sudo apt-get update
sudo apt-get install kodi


To install RTMP Input and InputStream Adaptive:

apt-cache search kodi
sudo apt-get install kodi-inputstream-adaptive kodi-inputstream-rtmp

Kodi on Raspbian requires a minimum of 160 MB of RAM dedicated to the GPU to function properly!
This can be done by running "raspi-config" -> "Advanced Options" -> "Memory Split" -> 160.
If you have a RPi 2/3, the recommended is 256 MB of RAM for the GPU.
Adding "gpu_mem=256" to the config.txt may play 1080p smoothly.
"gpu_mem" sets the memory split between the CPU and GPU; the CPU gets the remaining memory. Minimum value is 16; maximum value is 192, 448, or 944, depending on whether you are using a 256M, 512MB, or 1024MB Pi. The default value is 64

Also, Kodi on Raspbian by default, doesn't play some video codecs like VP6, VP8, MJPEG, Theora, etc, so to be able to play this codecs, you need to go to "raspi-config" -> "Interfacing Options" -> "Camera" -> Enable.


1080p issues:
- Enabling inputstream.adaptive, 1080p and 4K videos can be (theoretically) played
- Inside inputstream.adaptive you should set minimum bitrate around 10000000 to make videos played at 4K; may be Kodi will have some buffering/decoding issues depending on your pc configuration. If you experience such issues, by setting maximum resolution to 1080p and stream selection to Auto, inputstream adaptive should play videos at 1080p maximum
- The fact that some videos are played at 720p is related to DRM (Digital Rights Management) of the resolutions at 1080p (and above) that can not be actually ciphered by the add-ons in Kodi


Software







4K capability


You can make the Pi run at 4k display resolution at 15Hz if you want to. It is a REAL 4K resolution desktop, not a scaled up 1080p.
The H264 decoder will not run at 4K, that maxes out at just over 1080p((920x1080).


disable_overscan=1

hdmi_ignore_edid=0xa5000080
hdmi_group=2
hdmi_mode=87
hdmi_cvt 3840 2160 24

config_hdmi_boost=7

framebuffer_width=3840
framebuffer_height=2160
max_framebuffer_width=3840
max_framebuffer_height=2160
hdmi_pixel_freq_limit=400000000



Introduction to OpenMAX on the Raspberry Pi



What is OpenMAX


OpenMAX is an abstraction layer that provides APIs accessing the hardware .

In the case of the Raspberry Pi that would be Broadcom’s MMAL (Multi-Media Abstraction Layer API).

OpenMAX therefore allows a (sort of) portable implementation of software that utilizes such hardware.

References:

omxplayer


omxplayer (built for XBMC/Kodi) is a video player that works directly with the hardware.

  • Play HD Youtube from the Raspberry Pi Command Line
  • Now the omxplayer doesn’t currently support youtube URLs for video playback so we need a tool youtube-dl to extract the video resource link from youtube. youtube-dl is a command-line program to download videos from YouTube.com and a few more sites. It requires the Python interpreter. To install youtube-dl for all UNIX users (Linux, OS X, etc.), type:
    
    sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
    sudo chmod a+rx /usr/local/bin/youtube-dl
    
    
    you can simply play a Youtube video with:
    
    omxplayer `youtube-dl -f bestvideo -g youtube-video-page-here`
    
    
    '-g' asks youtube-dl to print only the URL of the video stream. '-f' asks youtube-dl to download the best video-only format.


How does OpenMAX work


OpenMAX provides an abstraction over hardware that is capable to perform operations with multi media (audio, images and video).
Hardware can only be in one state at a time, many commands can only be issued if the corresponding hardware is in a specific state.
Every hardware capability resembles a component in OpenMAX. You can get an overview over all the components provided by Broadcom in the git repository of the Raspberry Pi Foundation:

 raspberrypi/firmware/tree/master/documentation/ilcomponents

Components can be seen as mathematical functions that has an input(s) and/or output(s).

Also each component can be assigned to one of four domains: Audio, Image, Video and Other.
For ex., you pass the raw image stream to the input port and get an h.264 encoded stream on the output.

What is MMAL?


MMAL (Multimedia Abstraction Layer) is a C library designed by Broadcom for use with the Videocore IV GPU found on the Raspberry Pi. MMAL exposes an API allowing developers to take images and record video from their Raspberry Pi which is easier to understand and consume.
MMAL introduces the concept of "Components" - virtual resources which are able to produce and manipulate image data. Components are constructed manually by the user when required.
A list of components featured in MMAL:
  • Camera
  • The camera component is a virtual representation of the camera module attached to the Raspberry Pi. This component has the ability to capture still images, video and also render textual outputs to the Pi display.
  • Encoders / Decoders
  • MMAL allows for image encoders/decoders and video encoders/decoders to be constructed within the pipeline which allow an end user to manipulate the image data.
  • Renderers
  • There are two main renderers which are found natively in MMAL: Null sink and video.
  • Resizer
  • A resizer component, as the name suggests, has the ability to alter the width/height of image frames.
  • Splitter
  • The splitter component exclusively connects to the video output port of the camera component.
A Port in MMAL is responsible for receiving/transmitting image data, and also for connecting components together. A connection is constructed between an output port and the input port of a Downstream Component. The Camera component can be featured with 3 output ports: Still, Video and Preview.
Buffer headers in MMAL are the entities that hold a reference to the image data being passed through your pipeline. It reference a pointer to the beginning of the image data so that the memory for the data can be allocated outside of MMAL.

Multi-Media Abstraction Layer (MMAL)


MMAL (Multi-Media Abstraction Layer) is a framework which is used to provide a host-side, simple and relatively low-level interface to multimedia components running on VideoCore. It also provides a component interface so that new components can be easily created and integrated into the framework.
There is no requirement that all the components be running on VideoCore, MMAL doesn't put any restriction on where components live. Some components which can be run on both host-side or VideoCore (e.g. the splitter component).





留言

熱門文章