Page 1 of 1

FLAC playback on Android app

PostPosted: Thu Mar 15, 2012 1:55 pm
by Rovanion
When turning off transcoding to MP3 for the Android Player in subsonic, the Subsonic Android app won't play any music encoded in FLAC.

I'm running Subsonic 4.6 Ubuntu 12.04 and Subsonic 3.3 on Android 2.2.2.

Re: FLAC playback on Android app

PostPosted: Thu Mar 15, 2012 4:04 pm
by bushman4
That is correct. The android app cannot play native FLAC files.

Glenn

Re: FLAC playback on Android app

PostPosted: Thu Mar 15, 2012 5:11 pm
by GJ51
4.6 has some issues calculating the track length when transcoding, but in version 4.4 or 4.5 with the right version of ffm[eg you cand transcode flac > to ogg with phenomenal results. You get excellent fidelity at low bandwidth that lets you listen to flac recordings in you library over Android even over poor 3g connections.

I have a flac redording that is 1200 - 1500kbps that after transcoding to ogg transmits to Android at 58kbps and still sounds great. the ogg quality can be adjusted to balance quality and bandwidth so that you can reach quality levels that are virtually indistinguishable from the original yet still use bandwidth low enough to work over 3g without buffering.

Send me a PM if you'd like a demo or more details on setup.

Prliminary testing indicates that this issue has been fixed in ver 4.7.

EDIT: Confirmed, I have mp3 > ogg and flac >ogg working with 4.7 beta 1 on Android.

Re: FLAC playback on Android app

PostPosted: Thu Mar 15, 2012 9:40 pm
by Rovanion
I read in some other plans that there were plans to add native flac decoding, even that there was a commit pushed for the client and that it only had to be reviewed and accepted. How far away do you think native flac playback is?

Re: FLAC playback on Android app

PostPosted: Fri Mar 16, 2012 12:48 am
by GJ51
i haven't heard anything about it, but it would still present a major problem as native flac rips usually are very large and would consume more bandwidth than you typically get from most data connections on phones. If you're in a strong 4G area you might be OK, but even that can cause problems if you have a carrier that limits or surcharges data useage.

The beauty of ogg is that it maintains great quality but uses bandwidth very efficiently.

If you were to play a 1500kbps flac on Android over a 3G connection that is only getting 256kbps speed you'd have almost constant buffering and it would be virtually useless. Transcode that same track to ogg on your server before sending it to the phone and you can get quality that is virtually indistinguishable from the original at less than 10% of the bandwidth needed for the flac. You can easily vary the settings for ogg to balkance quality and bandwith to get the best results.

Even q5 which is exceptional quality uses only about 160 kbps and I doubt if anyone could distinguish the ogg playback from the original flac in a blind test. I usually set at q2 which is an avg. of 96kbps and it sounds great when piped over bluetooth to my car stereo when I'm on the road.

You'd be hard pressed to find a better solution for mobile listening, but if you do - please share!

http://en.wikipedia.org/wiki/Vorbis

Re: FLAC playback on Android app

PostPosted: Sat Mar 17, 2012 10:14 am
by Rovanion
Bandwidth is no issue, I'm only using WiFi for my data transfers. Ogg is absolutely fantastic indeed, but the transcoding is broken on the released version of Subsonic.

And I guess you are incredibly lucky if you manage to get good sound quality over bluetooth. It seems to depend on the two devices used but commonly you won't get much better than the quality of FM radio it seems, even with A2DP.

Anyways, Android 3.0 and forward has native flac playback so on these devices decoding flac seems to be a matter of piping the file over the OS.

Re: FLAC playback on Android app

PostPosted: Mon Mar 19, 2012 10:00 am
by crwl
FWIW, I have no trouble transcoding to Ogg Vorbis with Subsonic 4.6.

My transcoding is as follows:

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 -q3 -t %t -a %a -l %l -


(q3 is the quality setting, you might want something higher with wifi.)

Re: FLAC playback on Android app

PostPosted: Mon Mar 19, 2012 6:07 pm
by GJ51
I've had success using the ogg encoder before as well set up like you hav it, but it doesn't work with every version of ffmpeg. That's been my major problem all along; I can optimize for mobile, or optimize for video, but it's hard to get everything optimized on the same setup. Using ffmpeg on 4.6 for the ogg transcoding causes playback problems on Android ans causes the tracks to only playback about 75% of the way through. The last time I tried setting up the ogg transcoder I couldn't get the wav output into the ogg transcoder. Seeing that you're using oggenc in your transcode string, rather than oggenc2, Iwould also assume that your not on a Windows platform??


Another interesting anomaly is that I can playback video on a standard 4.6 install and get index reporting and seeking on wtv files, but later versions of ffmpeg make better use of load distribution on multicore CPU's. I then tried using the 4.6 ffmpeg on version 4.5 and lost the indexing ability.

A lot of trial and error, but each setup should be customizable to meet a user's needs. For me, right now, using 4.5 with 3 different versions of ffmpeg doing different file type transcodings has produced the best all around solution. I know Sindre is working hard resolving many of these issues for the upcoming 4.7 release. may the programming gods smile upon him. :)

Re: FLAC playback on Android app

PostPosted: Mon Mar 19, 2012 8:48 pm
by Rovanion
crwl wrote:
Convert from:
flac mp3 mp4 m4a wav wma aif aiff aac ape mpc shn


I'm absolutely going to try this out then. Just a quick note that if you're like me going over WiFi there is absolutely no need to transcode mp3 since it's accepted by the Android player and transcoding between two lossy codecs makes for an even lossier result.

EDIT: So I tried adding your settings to a new transcoding option and then enabling it for my android device and disabling the mp3 transcoding. But all I got was flacs to my phone. When mp3 transcoding is enabled the phone displays flac ยป ogg but when I have ogg transcoding enabled it only shows flac. Odd.

Re: FLAC playback on Android app

PostPosted: Mon Mar 19, 2012 9:19 pm
by GJ51
Yes that's a fact. I wish Subsonic had the ability to select different settings depending on how you're connecting. In house over wireless - N connected to gigabit lan there's certainly no need to do any transcoding to accomodate bandwidth restrictions. But when I get in tha car and travel through varying 3g signals, transcoding to ogg can make the difference between acceptable results and not having the ability to get the music to stream.

Right now I've solved the problem by having a site that transcodes to ogg for when I'm on the road, and another that doesn't for when I have good 3g or wifi. It would be great if somehow the Player definitions for mobile devices could have a seperate setup from desktop players that allowed you to select specifically defined player that use custom settings that can accomodate each environment.

Feature request time. :mrgreen:

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

I use this for mp3 > ogg

Audioffmpeg is the ffmpeg.exe from the 4.4 release.

Re: FLAC playback on Android app

PostPosted: Mon Mar 19, 2012 10:02 pm
by Rovanion
Then came this odd thing: It doesn't seem to matter what arguments I put in the mp3 transcoding field, all I ever get is 128kbps MP3. It makes no difference what the argument ofter -ab is.

ffmpeg -i %s -ab 320 -v 0 -f mp3 -

Still only outputs 128kbps mp3.

Re: FLAC playback on Android app

PostPosted: Mon Mar 19, 2012 10:30 pm
by Rovanion
And all of a sudden ogg transcoding works, because I created a symbolic link in /var/subsonic/transcode to oggenc. Why wouldn't subsonic just look in my PATH? Maybe this is really hard to do from a Java application but it seems so natural coming from a bash world.

My only issue now is that it only transcodes the first minute or so of each song. Is there some sort of storage limit in Subsonic that makes this happen?