Difference between revisions of "Android"

From MythTV Official Wiki
Jump to: navigation, search
(Add AudoTrack information)
(More AudioTrack information)
Line 49: Line 49:
 
=== Audio ===
 
=== Audio ===
 
Audio options for android are OpenSLES and AudioTrack. OpenSLES only supports stereo output, although you may be able to get digital pass-through to work. AudioTrack supports all digital output formats that are supported by your android device. AudioTrack reverts to stereo when using time stretch. Note AudioTrack is only available on MythTV frontend version 31 and above. Currently Version 31 can be used with mythbackend prior versions.
 
Audio options for android are OpenSLES and AudioTrack. OpenSLES only supports stereo output, although you may be able to get digital pass-through to work. AudioTrack supports all digital output formats that are supported by your android device. AudioTrack reverts to stereo when using time stretch. Note AudioTrack is only available on MythTV frontend version 31 and above. Currently Version 31 can be used with mythbackend prior versions.
 +
 +
If the audio stutters, try increasing the value in Video -> Playback -> Advanced ->Audio read ahead.
  
 
==== Digital Audio ====
 
==== Digital Audio ====

Revision as of 21:24, 21 June 2019


Overview

There are many Android TV devices now available. Mythfrontend now has support, as from version 30, for Android and Android TV devices. The NVidia Shield works well with MythTV. Hopefully we will test and get feedback on other devices and include the results here.

Devices

Device Comments
NVidia Shield TV Good support. MythTV has been optimized for this device.
4K videos can be played, but are scaled down to 1920x1080, even on 4K displays and TVs.
Amazon Fire TV stick Fair support. Video is jerky, some people are not worried by that.
4K is not supported.
It requires an amazon.com login. For more information see #Amazon Fire TV Stick (not 4K)
Amazon Fire TV stick 4K Good support.
4K does not work with MythTV on this device at this time.
It requires an amazon.com login. For more information see #Amazon Fire TV Stick 4K

Operating System

The Android package supports Android version 5.0 (Lollipop) or later. It comes in 32 bit and 64 bit packages. For NVidia Shield, the 64 bit package is recommended.

Setup on Android

First you need to have a MythTV backend set up on your local network. The Android device will function as a remote frontend. It is best to use a wired connection, rather than wifi, especially if you are playing High Definition content.

MythFrontend is not available in the play store at this time. You can download a package or build it yourself. To build it yourself see instructions at https://github.com/MythTV/packaging/tree/master/android.

Download the package (apk file) from https://dl.bintray.com/bennettpeter/generic/ . There is a directory for each version (Currently only version 30) and under that directories for 32 bit and 64 bit versions. For NVidia Shield select the 64 bit one.

There are various ways of installing the apk on Android. If you have a browser on your android device you can simply download to there and let it install. You can also use a variety of Android apps to do this. However I recommend using adb as follows:

  1. Enable installation of apps from unknown sources.
  2. Enable developer options on your android device as described in https://developer.android.com/studio/debug/dev-options.
  3. Enable USB Debugging in your android device. This will also enable debugging via the network (wifi or ethernet).
  4. Install adb on your Linux (or windows) computer. On Linux you can use your distribution package manager to install adb. On other environments, or if your distribution does not have adb, find it at https://developer.android.com/studio/releases/platform-tools.
  5. Find the ip address of your android device, either from the device itself or from your router. I recommend you set a reserved address in your router so that your device always gets the same ip address.
  6. On your computer, connect to the android device:
    adb connect ip_address
  7. On your computer, run the command to install:
    adb install -r package.apk
  8. After installation, if you do not see the application on the front screen, run it from the apps list in settings. After that it should show in your favorites.

If you previously installed a debug mythfrontend package or one signed by a different certificate, you will get an error. In that case you have to uninstall and reinstall mythfrontend.

Frontend Identifier

When you install mythfrontend an identifier is created for your frontend, in the format android-xxxxx where xxxxx is a random string of hexadecimal numbers. If you ever uninstall and reinstall mythfrontend, a different set will be created. This means your settings in the database will need to be recreated. You can avoid this problem by setting a custom id in the frontend. In Setup -> General -> Database Configuration ->Use Custom Identifier. Enter a name for the frontend here. Exit and restart for the setting to take effect. Any settings previously created for that name will be used after a restart.

Video Playback Profile

The "Mediacodec Normal" profile is best for most cases. For a high-powered system such as a Shield, the OpenGL profiles can also be used if you have problems with Mediacodec, but in many cases they will impose too high a load and the playback will stutter.

Audio

Audio options for android are OpenSLES and AudioTrack. OpenSLES only supports stereo output, although you may be able to get digital pass-through to work. AudioTrack supports all digital output formats that are supported by your android device. AudioTrack reverts to stereo when using time stretch. Note AudioTrack is only available on MythTV frontend version 31 and above. Currently Version 31 can be used with mythbackend prior versions.

If the audio stutters, try increasing the value in Video -> Playback -> Advanced ->Audio read ahead.

Digital Audio

This may work with OpenSLES, but OpenSLES does not officially support it and your results may vary. This is officially supported using AudioTrack.

If you have a sound system that can decode AC3, DTS, etc., digital audio can be passed through. To pass through digital audio, go into settings -> Display and Sound -> Advanced -> Surround Sound on the Android device, and select "Always" or "Automatic". Also go to setting -> Display and Sound -> Advanced -> Fixed volume and turn it on. Then go into MythTV Setup -> Audio -> Digital Audio Capabilities, and select the types of pass-through desired.

If you want to use multi-channel PCM, disable the "Stereo PCM Only" setting in audio -> Advanced.

Also, if you are using a Shield, go to settings -> Display and Sound -> Advanced -> Play comfort noise on HDMI and turn it off.

Remote Control

Android TV devices normally come with a remote. However you will need to setup your remote keys to activate appropriate actions in the frontend. Do this with Frontend Setup -> Edit Keys. Many actions will already work in the frontend, such as exit, arrow keys. There may be other remote keys that do not work as you expect. You can map keys to any action desired.

For limited remotes (i.e. remotes with very few buttons) such as the NVidia Shield remote, there are some new features designed to help.

  • Long Press. You can set up to 16 keys to have two actions, a normal action that occurs when a key is pressed and a "long press" action for when the key is held down for a second. In Edit Keys you can add any keys you wish to context Long Press. Note that keys added here will lose any auto-repeat capability they have, so it is not advisable to set arrow keys to long press because that will slow down your browsing through lists of recordings, etc. After setting Long Press to a key, you have to exit Edit Keys and go in again before you can assign long press of that key to an action. I recommend you set Long Press Enter to Global Menu. This will mean you can always get to a menu, if your remote does not feature a Menu button.
  • OSD Navigation. In the TV Playback context there is a new action called OSDNAVIGATION. If you assign a key to this, then upon pressing that key during playback you will get an on screen navigation pane with the ability to jump, pause, fast forward, etc. We recommend you set the Enter button (normally a big button in the middle of the arrow navigation on the remote) to OSD Navigation.
  • Recording Groups. In the recording playback screen you normally have to use FWD and REW buttons to choose between recording groups. It can also be done using the Change Group Filter menu. In case there are no FWD and REW buttons on your remote, you can use the arrow keys to change group. To enable this you need to go into frontend setup -> Video -> Playback -> View Recordings -> Recording Groups and enable Change Recording Group using the arrow keys. This may require a change to the theme to work correctly. The MythCenter and Steppes Themes support this, others may not. Once you have changed the setting and installed a suitable theme, in the Watch Recordings page you can left arrow once or twice to get the list of recording groups focused, then navigate to the one you want. Then down arrow to get to the list of recording in that group.

On Nvidia Shield you can plug in a USB remote that simulates a keyboard, such as the Ortek remote, or even an actual keyboard.

CEC

Some android TV devices include CEC support. This does not use the MythTV built in CEC support, but acts like a generic remote that simulates a keyboard. You can use your TV remote to control MythTV. Assign actions to keys using the Edit Keys settings, including Long Press if needed.

Operation

MythTV operation is the same as on other environments when using a remote or a keyboard to control it.

When exiting MythTV I recommend that you use the return button and reply to the Exit MythTV prompt. If you use the Android Home button, MythTV is killed, your place is not saved. MythTV may prevent your backend from shutting down. It may not recover quickly when brought to the front again. This may be improved in future.

If you install MythTV on a phone or a tablet, you may want to use the touch screen to control it. The touch screen support is rudimentary. See MythTV on Android for some information on gestures that can be used.

Device Specific Tips

NVidia Shield

Recommended Settings

Set these in Mythfrontend

Audio Setup Value
Audio -> Audio output device OpenSLES:
Audio -> Digital Audio Capabilities See note below
Audio -> Speaker Configuration Select the appropriate setting for your system.
Audio -> Upconvert Stereo Unchecked

If you select any of the Digital Audio Capabilities, you need to set the Surround Sound option in Android settings to "Always".

Also go to settings -> Display and Sound -> Advanced -> Play comfort noise on HDMI and turn it off.

Setup -> Video -> Playback Value
Advanced Playback Settings ->
Enable new timestamp based playback speed (AVSync2)
checked
Advanced Playback Settings -> Allow YV12 unchecked
Advanced Playback Settings -> Allow UYVY checked
Add a new playback profile shield
shield -> Add New Entry Add two new entries
First entry -> Video Formats mpeg2video
First entry -> Decoder standard
First entry -> Max CPUs 4
First entry -> Video renderer opengl
First entry -> Primary deinterlacer Linear Blend (2x, HW-GL)
First entry -> Fallback deinterlacer Linear Blend (HW-GL)
Second entry -> Video Formats (blank)
Second entry -> Decoder Android MediaCodec decoder
Second entry -> Max CPUs 4
Second entry -> Video renderer opengl
Second entry -> Primary deinterlacer Linear Blend (2x, HW-GL)
Second entry -> Fallback deinterlacer Linear Blend (HW-GL)

Performance

You can use YV12 or UYVY playback. YV12 causes a green line at the bottom and right of the screen when the video is scaled. Avoid this by disabling YV12.

MPEG2 decoding suffers from pixellation when playing content from many USA TV stations. Avoid this by using standard decoder for MPEG2.

Deinterlace

The shield automatically deinterlaces content that is played using mediacodec decoder.

Amazon Fire TV Stick (not 4K)

This applies to the fire stick, not necessarily the 4K fire stick. The information may apply to other devices as well.

Recommended Settings

Set these in Mythfrontend.

Audio Setup Value
Audio -> Audio output device OpenSLES:
Audio -> Digital Audio Capabilities All unchecked
Audio -> Speaker Configuration Stereo
Audio -> Upconvert Stereo Unchecked

You may be able to use digital audio passthrough. This has not been tested.

Setup -> Video -> Playback Value
Advanced Playback Settings ->
Enable new timestamp based playback speed (AVSync2)
checked
Advanced Playback Settings -> Allow YV12 checked
Add a new playback profile firestick
firestick -> Add New Entry Add two new entries
First entry -> Video Formats mpeg2video
First entry -> Decoder standard
First entry -> Max CPUs 4
First entry -> Video renderer opengl
First entry -> Primary deinterlacer Linear Blend (HW-GL)
First entry -> Fallback deinterlacer Linear Blend (HW-GL)
Second entry -> Video Formats (blank)
Second entry -> Decoder Android MediaCodec decoder
Second entry -> Max CPUs 4
Second entry -> Video renderer opengl
Second entry -> Primary deinterlacer Linear Blend (HW-GL)
Second entry -> Fallback deinterlacer Linear Blend (HW-GL)

Internet Connection

To enable the device you need an internet connection and an amazon.com account.

If you subsequently operate without an internet connection, the home page will not display. It will only display a message to say it cannot reach amazon. In this situation, you can launch mythfrontend by selecting settings, applications, manage installed applications, mythfrontend. From there you can launch mythfrontend.

Performance

Video is somewhat jerky due to a limitation on how many frames per second can be played. For best results enable AVSync2.

You should enable YV12 playback (Mythfrontend -> Setup -> Video -> Playback -> Advanced Playback Settings -> Allow YV12). If you have YV12 disabled it will use UYVY and that setting causes a loss of resolution on the right hand side of the screen.

Deinterlace

Mediacodec on the fire stick does not detect interlaced content, and so the deinterlacer is not used. However software decoding of MPEG2 is fast enough. You can create a customized profile that uses software decoding for MPEG2 and mediacodec for others. This assumes that only MPEG2 video is interlaced.

Amazon Fire TV Stick 4K

Recommended Settings

Set these in Mythfrontend.

Audio Setup Value
Audio -> Audio output device OpenSLES:
Audio -> Digital Audio Capabilities All unchecked
Audio -> Speaker Configuration Stereo
Audio -> Upconvert Stereo Unchecked

You may be able to use digital audio passthrough. This has not been tested.

Setup -> Video -> Playback Value
Advanced Playback Settings ->
Enable new timestamp based playback speed (AVSync2)
checked
Advanced Playback Settings -> Allow YV12 checked
Advanced Playback Settings -> Extra stage checked
Add a new playback profile firestick
firestick -> Add New Entry Add two new entries
First entry -> Video Formats mpeg2video
First entry -> Decoder standard
First entry -> Max CPUs 4
First entry -> Video renderer opengl
First entry -> Primary deinterlacer Linear Blend (HW-GL)
First entry -> Fallback deinterlacer Linear Blend (HW-GL)
Second entry -> Video Formats (blank)
Second entry -> Decoder Android MediaCodec decoder
Second entry -> Max CPUs 4
Second entry -> Video renderer opengl
Second entry -> Primary deinterlacer Linear Blend (HW-GL)
Second entry -> Fallback deinterlacer Linear Blend (HW-GL)

Internet Connection

To enable the device you need an internet connection and an amazon.com account.

If you subsequently operate without an internet connection, the home page will not display. It will only display a message to say it cannot reach amazon. In this situation, you can launch mythfrontend by selecting settings, applications, manage installed applications, mythfrontend. From there you can launch mythfrontend.

Performance

You can use either YV12 or UYVY, whichever seems better to you. If you use UVYV you have to enable Extra Stage, otherwise you may see a blank screen instead of playback.

MPEG2 playback with mediacodec does not wprk, so you have to create a profile that uses standard decoding for MPEG2.