Monday 7 March 2016

Raspberry Pi 3 Enabling Analog Audio in omxplayerGUI - and avoiding the KODI shutdown problem.

Since the first release the Raspberry Pi has been used as a Media Centre, and the extra performance of the Pi 3B means more of them will be used that way.  But a media centre outputs sound and the Pi 3 and Raspbian have some problems in that area.

UPDATED

The best video playback on Raspberry Pi is achieved using omxplayer, and in Raspbian Jessie, omxplayer defaults to playing audio through HDMI if an HDMI cable is plugged in.  Of course if you are using a HDMI cable for video, you will get HDMI sound.  Changing the output by right clicking the Volume (speaker) icon on the panel will not change this for omxplayer, although it does for most other players.

If you are opening omxplayer from the command line, you can output through the Analog jack on your Raspberry Pi by typing

omxplayer -o local filename.mp4    

And in this example it would play the file filename.mp4 with the sound through the Analog jack.

However if you happen to be using the fastest browser available for Raspberry Pi, this will not work, because kweb uses omxplayerGUI.  And omxplayerGUI does not have a button to select the audio output.

What kweb does have though is a very detailed Configuration system accessed by clicking the 'Home' button.  I wasted a week trying to get sound working by adding it in various forms to each of the places where omxplayer arguments can be placed.

Once at the Home page,  clicking the  Settings button will open a page with lots of places to tweak the program.

Scroll down about 1/3 of the page and you will find a heading:
GENERAL OMXPLAYER AUDIO VIDEO OPTIONS. arguments.

To switch the audio output in omxplayerGUI from HDMI to ANALOG or back again you need to click the Settings button and scroll down the page to:

There are four headings with a text box below them to enter argumentsWhat kweb does have though is a very detailed Configuration system accessed by clicking the 'Home' button.  I wasted a week trying to get sound working by adding it in various forms to each of the places where omxplayer arguments can be placed.

Once at the Home page,  clicking the  Settings button will open a page with lots of places to tweak the program.

Scroll down about 1/3 of the page and you will find a heading:
GENERAL OMXPLAYER AUDIO VIDEO OPTIONS. to send to omxplayer.
Each part of an argument MUST BE On A SEPARATE LINE.   So to enter   -o local  You would enter it like this in each box.

-o
local

These are the places you need to enter it:
NOTE!!   Click the SAVE button next to each box after you add the lines.
The first three settings are about 1/3 down the page under the heading:

GENERAL OMXPLAYER AUDIO VIDEO OPTIONS.
omxoptions (video player)
omxaudiooptions (audio player)
omx_livetv_options (video player, special settings for live TV streams)

The last is near the bottom of the page under the heading:
ONLINE VIDEO OPTIONS
youtube_omxoptions (video player, used for web video)

To return your omxplayerGUI output to HDMI, simply open Settings again and chenge the entries under each heading to:

-o HDMI

NOTE!  
In the Settings page there is an option to create 'Presets'.
I will write more about these in a few days.  For now I'll mention tat once you have made any special changes to the Settings of kweb and omxplayerGUI, you can save the state of those settings and kweb will create buttons so you can apply them quickly with a mouse clisk.

So you can change the above settings for Analog and create a Preset for Analog audio, then change them back and create a Preset for HDMI audio and simply click the appropriate button to swap output modes.

Presets can easily be created for quick access to various other functions.


Some videos will not play in omxplayer, but do play in KODI.  However KODI has a problem.   Choosing 'EXIT' from the KODI menu leaves you with a blank screen and the risk of corrupting your bootable micro SD card if you simply unplug the power.


So what to do about it.

Quitting KODI.
FORGET about the 'Exit'  option that is supposed to take you back to the desktop.
Choose 'Power Off' - to get out of KODI and turn the system off.
Choose 'REBOOT'  - if you plan to use Raspbian again.

I use omxplayerGUI for just about all of my video playing needs, except where I want to loop a video or a playlist.  In that case I simply open KODI.

2 comments:

  1. Hanging out for a South Australian meat pi with sauce Ross.
    It's not all a bowl of cherry pi up here you know. :-)

    ReplyDelete
    Replies
    1. Right now I would like to be somewhere exotic Julian.

      Delete