How to get Gapless playback in Android, possibly others.

Tutorials, tips and tricks.

Moderator: moderators

How to get Gapless playback in Android, possibly others.

Postby ccandreva » Wed Apr 20, 2011 4:56 pm

I've found a simple way to get gapless playback in the Android player: Simply transcode to ogg instead of MP3. In theory, this should work for any playback device that supports the ogg format.

This works well for me since most of my collection is in FLAC format on the server. Obviously transcoding MP3 to ogg will have losses. However, assuming you have a FLAC collection, you just need to set up a flac to ogg transcoder. I used a single stage of:
Code: Select all
oggenc --quiet --quality=9 -o - %s

This also required oggenc to be installed and symlinked from the subsonic/transcode directory (at least on Linux, I can't say about Windows).

I've tested by CD rips of Led Zeppelin I and Pink Floyd The Wall so far, and they are playing gapless.
User avatar
ccandreva
 
Posts: 104
Joined: Fri May 28, 2010 8:22 pm

Postby Exrace » Sat Apr 30, 2011 12:30 pm

That would be a great option to add to the normal release. Listening to The Wall without gapless makes me think my brain has skipped. :)

Is this only supported with ogg format as far as you know?
Exrace
 
Posts: 218
Joined: Thu Nov 11, 2010 5:02 am

Postby ccandreva » Mon May 02, 2011 3:13 pm

I didn't try anything else. I had seen comments that MP3 didn't support gapless but ogg and flac did, and decided to see what happened. I found it interesting that the player already supported gapless, if the format supported it also.
User avatar
ccandreva
 
Posts: 104
Joined: Fri May 28, 2010 8:22 pm

Postby filefly » Fri Jun 03, 2011 4:51 am

This works fantastically! On windows, the Vorbis encoder is already installed with Subsonic, but it's called "oggenc2.exe". Make sure you change this in the command line posted above - other than that, worked without a hitch! Thank you, thank you, thank you!
filefly
 
Posts: 1
Joined: Fri Jun 03, 2011 4:48 am

Postby tenzip » Thu Jun 30, 2011 1:03 am

Yep, this worked a treat. As the previous poster said, the command line should be "oggenc2 . . .", not "oggenc . . ."

It is nice to have gapless.
User avatar
tenzip
 
Posts: 16
Joined: Wed Jun 15, 2011 4:45 am
Location: Lincoln, NE, USA

More info?

Postby jensonc » Sat Jul 09, 2011 6:52 pm

By 'gapless', do you mean the buffering gaps that occur when not enough of the song has buffered so it has to stop 1-3 times during the song to kind of catch up? I have added a transcoder with the oggenc2 command and have disabled all other transcoding options, but I don't think it's working. But I think I may be having buffer issues because of a slow 3G connection (Verizon is teh suck) and the "gaps" I'm hearing in my songs are different than the 'gapless' that you guys are referring to. Any thoughts?

It would be nice to find out how to customize the piece of code in the subsonic Android App that dictates when a song starts playing, for example:

"after song has downloaded x% of song, start playing it"

Perhaps I'll create a new post just for this reason :) Cheers guys
jensonc
 
Posts: 17
Joined: Mon Mar 21, 2011 7:08 pm

Re: More info?

Postby tenzip » Sat Jul 09, 2011 7:20 pm

jensonc wrote:By 'gapless', do you mean the buffering gaps that occur when not enough of the song has buffered so it has to stop 1-3 times during the song to kind of catch up?


No, that's not it. I also wish the Android app had an "adjustable" buffer before it started playing the first song. Although I beg to differ about Verizon's service. At least we don't have to suffer under the burden of AT&T's crappy service. Look for the silver lining, donchaknow?

The gapless I'm talking about is the gap between songs, or, rather, the lack of gap. Some albums have one song transition to another with no gap/silence/pause. The classic example used by many is Pink Floyd - Dark Side of the Moon.

The gap caused when this is ripped to MP3 tracks is annoying and disconcerting. There is a definite, very noticeable pause, and then abrupt resumed playback. Like, (and here I assume you are of an age to know whereof I speak), dropping the needle on the record in the middle of the song.

When you rip to .ogg, the gap (while still there, at least in my Android app), is much, much reduced. Almost unnoticeable.
User avatar
tenzip
 
Posts: 16
Joined: Wed Jun 15, 2011 4:45 am
Location: Lincoln, NE, USA

Re: How to get Gapless playback in Android, possibly others.

Postby alienbob » Sun Feb 10, 2013 2:47 pm

This also required oggenc to be installed and symlinked from the subsonic/transcode directory (at least on Linux, I can't say about Windows).


For those of you (like me) who are quite unfamiliar with a lot of this linuxy magic this is what I did to get it working on my CentOS (Gigapros) server:

Code: Select all
yum install vorbis-tools
ln -s /usr/bin/oggenc /var/subsonic/transcode/oggenc


Simple really but might save you 20 mins of hunting around for the various commands 8)
alienbob
 
Posts: 6
Joined: Sun Sep 02, 2012 7:22 pm

Re: How to get Gapless playback in Android, possibly others.

Postby rubbersoul » Sun Feb 10, 2013 4:28 pm

thanks for reviving this thread, i had no idea about this workaround.

i have installed the vorbis tools, added the symlink, changed the transcoding rules to do flac > ogg and removed flac > mp3. it seems to be transcoding correctly to ogg, but the playback is definitely not gapless. i'm using dsub at the moment, anyone confirm it is working with that app or should it not matter?
rubbersoul
 
Posts: 127
Joined: Thu Aug 18, 2011 2:27 pm

Re: How to get Gapless playback in Android, possibly others.

Postby alienbob » Sun Feb 10, 2013 5:53 pm

I've not quite managed to get to the point at which I can confirm it's gapless or not, I'm struggling with getting the entire track to play all the way through, a problem that has been reported on here before on Android devices!

Just setup a Windows VM running 4.4 and this encoding testing it on my Samsung Galaxy S i9000 running CM's Jellybean and my no-name brand tablet that runs Gingerbread I get this:

on the I9000:

i) Playback jumps to the end of the playing track once the download to the phone has been completed
ii) Not gapless

On the tablet

i) Not gapless

So playback jumping appears to be something to do with JB and it doesn't solve the gapless. On my travels to find encoding from flac to ogg I found this combo:

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


which I've just tried out on both. This fixes the track skipping problem and the gap between tracks is much reduced, not gone but much better.

On my 4.6 version, both problems exist with both encoding strings, so next an upgrade of the 4.4 to 4.7 and see if there is any improvement....
alienbob
 
Posts: 6
Joined: Sun Sep 02, 2012 7:22 pm

Re: How to get Gapless playback in Android, possibly others.

Postby alienbob » Sun Feb 10, 2013 6:35 pm

4.7 installed and using the transcode string "oggenc --quiet --quality=9 -o - %s" I get:

I9000 (CM 4.1.2)

i) Skips tracks after downloading :(
ii) Gap is very much less noticeable, almost acceptable :)

Tablet (Gingerbread)

i) No skipping :)
ii)Gap is very much less noticeable, almost acceptable :)

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

I9000 (CM 4.1.2)

i) No skipping :)
ii)Gap is very much less noticeable, almost acceptable :)

Tablet (Gingerbread)

i) No skipping :)
ii)Gap is very much less noticeable, almost acceptable :)

In each test I cleared the tracks from the cache and cleared the playlist before refreshing the library. Now, will these results port to my Linux box I wonder?

Could somebody explain what on Earth most of that string means, in particular I would be interested to know if you can define the quality?
alienbob
 
Posts: 6
Joined: Sun Sep 02, 2012 7:22 pm


Return to Tutorials

Who is online

Users browsing this forum: No registered users and 11 guests