FLAC->OGG Transcode playback problem in Android app

Need help? Post your questions here.

Moderator: moderators

FLAC->OGG Transcode playback problem in Android app

Postby rage4order » Wed Oct 03, 2012 2:21 am

Hi folks, about 95% of my music library is encoded in FLAC format and I've been trying to set up transcoding to OGG/Vorbis on my server for playback on my Android phone (Galaxy Nexus) through the Subsonic app, however I am not able to get it working quite right. The transcoding works, however the problem I'm having is as follows:
1) the first song begins to stream after a few kbytes are cached up
2) the music continues to play while the rest of the track is still being downloaded.
3) once the full track is downloaded the playback stops and there is an exception logged in the app's logcat output....

I/AudioService( 356): AudioFocus requestAudioFocus() from android.media.AudioManager@41b2c988
I/AudioService( 356): AudioFocus abandonAudioFocus() from android.media.AudioManager@41b2c988
E/MediaPlayer( 2892): error (1, -1004)
E/MediaPlayer( 2892): Error (1,-1004)
W/DownloadServiceImpl( 2892): Media player error: java.lang.Exception: MediaPlayer error: 1 (-1004)
W/DownloadServiceImpl( 2892): java.lang.Exception: MediaPlayer error: 1 (-1004)
W/DownloadServiceImpl( 2892): at net.sourceforge.subsonic.androidapp.service.DownloadServiceImpl$1.onError(DownloadServiceImpl.java:120)

4) at this point, I can restart the track again and it will play all the way through, but needless to say, that's not exactly streaming. :)

I am using the suggested transcode line that I found on the wiki page, i.e.:

ffmpeg -i %s -acodec libvorbis -ab %bk -f ogg -

I was seeing this problem with 4.6 and after I upgraded to the latest release 4.7, it's still happening. I should note that I don't have this problem if I use the FLAC->mp3 transcoding*, only with OGG, however I'd prefer to use OGG since it handles low bitrates better than MP3, IMHO.

I know there are other folks here who are doing this so could you please share your secret sauce to getting this working? Ideally, I'd like the transcoded OGG's that end up on the phone to have the music metadata so that the tracks can also be played via the Google Play Music app at a later time, but that's not a must-have. Right now, I just want to get it working correctly.



* - there is another problem with transcoding to MP3, where the music pauses briefly during the caching of the first track in the playlist, but that's outside the scope of this post.
rage4order
 
Posts: 33
Joined: Mon Jun 29, 2009 8:58 pm

Re: FLAC->OGG Transcode playback problem in Android app

Postby GJ51 » Wed Oct 03, 2012 3:12 am

Gary J

http://bios-mods.com
http://www.maplegrovepartners.com
http://theaverageguy.tv/category/tagpodcasts/cyberfrontiers/
User avatar
GJ51
 
Posts: 3492
Joined: Wed Oct 20, 2010 11:58 pm
Location: Western New York

Re: FLAC->OGG Transcode playback problem in Android app

Postby rage4order » Wed Oct 03, 2012 4:06 am

I appreciate the link, unfortunately the download link provided in that post for the ffmpeg from version 4.4 is for Windows machines and I'm running Linux. So, I went and downloaded the Linux Subsonic 4.4 archive from Sourceforge but unfortunately it doesn't contain the ffmpeg binary in it. I also tried stozher's transcoding settings suggested in the post and the result was the same, so I'm still stuck. I'm thinking that the Subsonic app for Android might just have a bug in it, but I'm still hoping for some sort of workaround (besides just using MP3).
rage4order
 
Posts: 33
Joined: Mon Jun 29, 2009 8:58 pm

Re: FLAC->OGG Transcode playback problem in Android app

Postby GJ51 » Wed Oct 03, 2012 4:25 am

Did you try the latest ffmpeg build for Linux?

http://ffmpeg.org/

I don't have a lot of flac files, but the ones I do have work fine on my setup and on my Android phone, but getting it working wasn't exactly easy.

Wish I had a better answer for you, but I do think the latest releases from ffmpeg.org might have a chance with the right transcode string.
Gary J

http://bios-mods.com
http://www.maplegrovepartners.com
http://theaverageguy.tv/category/tagpodcasts/cyberfrontiers/
User avatar
GJ51
 
Posts: 3492
Joined: Wed Oct 20, 2010 11:58 pm
Location: Western New York

Re: FLAC->OGG Transcode playback problem in Android app

Postby crwl » Mon Oct 08, 2012 11:10 am

Here's how I stream Ogg Vorbis files to my Android phone, works for me:

(note that I don't use ffmpeg for encoding)

Name: all->ogg
Convert from: flac mp3 mp4 m4a wav wma aif aiff aac ape mpc shn
Convert to: ogg
Step 1: ffmpeg -i %s -v 0 -f wav -
Step 2: oggenc -Q -b %b -t %t -a %a -l %l -
crwl
 
Posts: 7
Joined: Thu Jul 08, 2010 7:54 am

Re: FLAC->OGG Transcode playback problem in Android app

Postby rage4order » Mon Oct 08, 2012 3:56 pm

Your configuration works a little better for me, but still not right. Using your 2 step transcoding process, what happens now is that the first track starts to play, but when the complete track is finished downloading (caching) it restarts playback from the beginning. :-(

At this point, I'm convinced that this problem is just a manifestation of the same issues that others are discussing in this thread:
viewtopic.php?f=2&t=4109 The only difference is that using OGG instead of MP3 seems to amplify the problems. k00zk0's post on page 10 in that thread sounds like the most logical explanation of the issue. I went and looked at the DownloadServiceImpl.java source code, and it seems like that is indeed the problem.

What's especially frustrating is that I'm experiencing this on a GSM Galaxy Nexus running bone stock Jelly Bean firmware from Google, so effectively, this is a developer phone. If there's one device where this shouldn't be an issue, it's this.

I wish Sindre would chime in on this, alas he's probably already aware of these issues.
rage4order
 
Posts: 33
Joined: Mon Jun 29, 2009 8:58 pm

Re: FLAC->OGG Transcode playback problem in Android app

Postby GJ51 » Mon Oct 08, 2012 4:11 pm

Jelly Bean may be the problem as the app has not yet been verified to run on JB and previous Android upgrades have been known to require that the app be upgraded. This is the second report I've seen that indicates a problem with the app on JB.

I'm sure it will eventually be fixed, but we don't know when yet. There are at least 2 other developers here in the forums that are developing their own Android apps, one is Dsub and I don't know if the other has a name, but you could try contacting them to see if they have tested their work for JB compatibility to see if they can help until the official Android app is updated. I know that Sindre also uses the GSM Nexus for Android development, so I would guess that he's probably working on that very issue, but he hasn't provided much information lately. The app was only recently updated to update it to ICS compatibility.

HTH
Gary J

http://bios-mods.com
http://www.maplegrovepartners.com
http://theaverageguy.tv/category/tagpodcasts/cyberfrontiers/
User avatar
GJ51
 
Posts: 3492
Joined: Wed Oct 20, 2010 11:58 pm
Location: Western New York

Re: FLAC->OGG Transcode playback problem in Android app

Postby Gray Mouser » Wed Oct 31, 2012 4:54 am

I have grief with flac --> ogg too. I have tried every transcoding setup posted on the wiki, and although they "work" there are a substantial number of files that terminate before the song is actually over -- perhaps at the 95% mark or so.

This is frustrating.

I should think that a substantial % of users of the app rip to flac, and of that a substantial % prefer ogg to mp3.

Why on earth is this such a difficult thing to implement properly? And why does the web player not even support ogg?
Gray Mouser
 
Posts: 7
Joined: Mon Oct 22, 2012 3:40 am

Re: FLAC->OGG Transcode playback problem in Android app

Postby GJ51 » Wed Oct 31, 2012 10:13 am

Mine works fine.

ffmpeg -v 0 -i %s -f ogg -vn -acodec libvorbis -ar 44100 -aq 6 -ac 2 -map_meta_data 0:0 -

If you still have a problem with this string, search for Audioffmpeg and download the file and follow the setup instructions I've posted previously.

HTH
Gary J

http://bios-mods.com
http://www.maplegrovepartners.com
http://theaverageguy.tv/category/tagpodcasts/cyberfrontiers/
User avatar
GJ51
 
Posts: 3492
Joined: Wed Oct 20, 2010 11:58 pm
Location: Western New York

Re: FLAC->OGG Transcode playback problem in Android app

Postby rage4order » Wed Oct 31, 2012 7:37 pm

We already determinted that transcoding is not the problem, it's the broken playback in the Android app that's causing these issues. It happens when transcoding to MP3 as well, but it's just not as severe in that case. When MP3 is the target, then the Android app will pause playback for brief periods of time while it's caching the 1st track even though it already has plenty of audio data to play. When the target is OGG/Vorbis, the problem is much worse. In my case, the track will start playing as it's caching, and then it will restart from the very beginning again after the full track is cached. Furthermore, it will not play the entire track either, but just cut off in middle of it. When this happens, I know that the entire transcoded OGG file actually made it to the phone. Looking into the /sdcard/subsonic/music/<artist>/<album> directory, I can see two copies of the song, both full transcodes, one of them with .partial and one with .complete in the name. Looking at the Java source of the of the app, I can see that it starts downloading the transcoded file with the word 'partial' in its name, and after it completes it's supposed to rename it to complete, restart playback on the complete file and delete the partial file. This is clearly not working as intended with OGG/Voribis encoded files. I really wish Sindre would fix this, especially now that he's asking for people to pay for the app to remove the advertising.
rage4order
 
Posts: 33
Joined: Mon Jun 29, 2009 8:58 pm

Re: FLAC->OGG Transcode playback problem in Android app

Postby rage4order » Wed Oct 31, 2012 8:57 pm

I went ahead and filed a bug report on this, hopefully Sindre will see it at some point.

http://sourceforge.net/p/subsonic/bugs/64/
rage4order
 
Posts: 33
Joined: Mon Jun 29, 2009 8:58 pm

Re: Re: FLAC->OGG Transcode playback problem in Android app

Postby hyatari » Wed Nov 21, 2012 2:01 am

rage4order wrote:I went ahead and filed a bug report on this, hopefully Sindre will see it at some point.

http://sourceforge.net/p/subsonic/bugs/64/


It appears this issue is either too big of a pain in the ass to deal with or there just aren't enough people with galaxy nexi out there using subsonic to demand much attention. I'm guessing that as more and more people are using nexus devices you will start seeing more complaints. My theory is that when subsonic can't cache to an external SD card it doesn't work properly regardless of the transcoding setting. Seems as though people with a gs3 had to force subsonic to save the files to their external SD card or they'd get stuttering issues etc. The nexus lines popularity is on the rise and they aren't going to be using SD cards so its really in the best interest of the developer of subsonic to fix this issue.
hyatari
 
Posts: 53
Joined: Thu Jan 28, 2010 11:56 pm

Re: FLAC->OGG Transcode playback problem in Android app

Postby daneren2005 » Wed Nov 21, 2012 3:49 am

I have looked at that issue as well and personally I just couldn't reproduce it. It is ridiculously hard to fix something you can't actively debug.
Developer of DSub for Android
daneren2005
 
Posts: 1709
Joined: Fri Jul 06, 2012 7:52 pm

Re: FLAC->OGG Transcode playback problem in Android app

Postby GJ51 » Wed Nov 21, 2012 4:30 am

I've looked at this many times. I only see this behavior when I'm on a Jelly Bean rom. It also isn't limited to ogg transcoding. My GSIII does the same thing with mp3's playing without any transcoding. At home on wifi with tons of bandwidth makes no difference, the first track begins briefly, then pauses and restarts from the beginning then never finishes properly but jumps to the second track a little more than half way through the first track.

I've tested both ogg and mp3 playback on both roms and my GS3 has no issues on an ICS rom. Refalsh to JB and bingo - the problem is there.

Throughout the history of the Android app, every upgrade to the OS has required that the app be updated. I find it a bit odd that upgrading the OS keeps breaking the app, but I'm not an app dev, so I don't know what all is involved. It just seems a bit odd that an OS upgrade would require an app upgrade every time.

Seems a bit of a poor strategy by either the OS devs, the app dev, or both.

There were issues regarding track length estimation in ver 4.6 that I thought were resolved in 4.7. It might be interesting to do a test install of ver 4.5, which was exceptionally stable for music playback, and see how the app interacts.

Maybe some night when I'm bored.
Gary J

http://bios-mods.com
http://www.maplegrovepartners.com
http://theaverageguy.tv/category/tagpodcasts/cyberfrontiers/
User avatar
GJ51
 
Posts: 3492
Joined: Wed Oct 20, 2010 11:58 pm
Location: Western New York

Re: FLAC->OGG Transcode playback problem in Android app

Postby daneren2005 » Wed Nov 21, 2012 6:03 am

Anyone able to get any of this behavior on an Atrix, HTC One X, or Nexus 7 with any special roms? That's unfortunately all I have atm :?
Developer of DSub for Android
daneren2005
 
Posts: 1709
Joined: Fri Jul 06, 2012 7:52 pm

Next

Return to Help

Who is online

Users browsing this forum: No registered users and 12 guests