Nav links

Wednesday, 6 June 2018

Workaround for silent music in Google Play Music on Android Auto

Huawei phones have various known issues running Android Auto. For my Huawei P10 Lite running Nougat Android Auto runs perfectly except for Google Play Music (GPM). When I attempt to play music it indicates that it is playing, and the progress bar moves, but no sound comes out. Other podcast and music apps mostly work fine, and GPM works fine when not in Android Auto.

For some months I have been using a workaround of running a third-party equaliser app, but this has never been entirely successful, and recently seemed to rarely work. Instead, I came up with a solution which works all the time, and as a bonus gets around the annoyance that GPM in Android Auto does not let you browse your music - you can only select specific albums or songs using voice input.

Firstly, I downloaded some music from Google Play Music as mp3 files onto my phone, and used Rocket Player in Android Auto to attempt to play it. Some music worked, and some failed with the same silent progress as GPM.

Using FFmpeg I re-encoded one of those failing tracks to an mp3 with a different bitrate. This still failed in Rocket Player. I then re-encoded that initial mp3 as an ogg file. Though less common than mp3, ogg files are well supported these days. This ogg file worked perfectly.

My solution is to convert all mp3 files to ogg format, and play them using Rocket Player. In Windows this conversion can be done, for all files in all subfolders, in one line using FFmpeg. From the command prompt run the following:
REM Recursively convert mp3 to ogg, including tags, skipping existing ogg files
for /R %f in ("*.mp3") do (ffmpeg.exe -n -i "%~f" -map a "%~pf%~nf.ogg")

This keeps all mp3 tags, such as title, artist and cover art intact. The map parameter is required to ensure that ogg file only contains an audio stream. Without the parameter it will also have a video stream, which will cause the file to be unreadable by most players. The n parameter lets you run the command repeatedly, skipping any files it has already converted. Further explanation about the %~ batch options can be found in Windows Batch Scripting.

Android should read the cover art from within the ogg file, but if you have trouble you can extract the image and copy it into the ogg's folder on the phone. The extraction command is:
REM Store cover art as file
ffmpeg -n -i "My Song.mp3" -an -vcodec copy cover.jpg

As a final note, I already had some files on my PC as wma files, so I copied those directly to my phone. Initially their cover art did not show. This was because those images were stored as hidden files, and not copied across. In Windows Explorer Folder Options | View | Advance settings I needed to untick Hide protected operating system files to make those files visible, and then copy them.

I now have all of my music working flawlessly in Android Auto. I can select it using voice commands, or I or my passenger can browse the collection visually.

This solves the problem for music, but podcasts are a separate matter. I have found that certain podcasts, such as Freakonomics and Stephen Fry’s Great Leap Years exhibit the same silent symptom. Luckily, they can more easily be fixed. Most podcast players offer some form of audio enhancement, such as altering the speed of the podcast, or boosting its volume. Utilising one of these will cure the problem.

Update (14 July 2018)
Another option which avoids the need to convert files is to enable replay gain in Rocket Player. To unlock this option you need to either enable advertisements or pay for Rocket Player Premium. Then go to Settings | Sound | Replay Gain, and pick either Album or Track Gain. In theory Rocket Player's built-in equalizer should have worked as well, but it did not.