tsquillario / Jamstash

HTML5 Music Streamer for Subsonic
http://jamstash.com
273 stars 88 forks source link

Please add support for Opus in Jamstash #131

Open ripdog opened 10 years ago

ripdog commented 10 years ago

Opus is a perfect fit for streaming via subsonic, but unfortunately software support is a bit lacking. Luckily, firefox supports it natively, and so does Jplayer.

I set up opus transcoding in subsonic, and it works fine, when I take stream URLs and access them in firefox. For whatever reason, though, it seems to download ~20kb of the stream, then ditch it and start a new download that does nothing - though I may be misinterpreting what I'm seeing on the dev tools network tab.

I took the 20kb that is downloaded, and after base64 decoding it, it does indeed have an OGG header, and my opusenc command line visible. It appears the download is simply cut off for some reason.

So, after playing around with manually resending the requests for the stream, the problem with the second request is that it has a range request. I guess the transcoding setup can't handle this, and so nothing comes through at all. Just need to find out why the download is cut off.

Jamstash appears to believe it is playing, the play/pause button stays as if it is playing and the page title continues scrolling.

My transcoding settings:

From: ogg mp3 oga aac m4a wav wma aif aiff ape mpc shn

TO: oga (opus fails similiarly)

Decode: ffmpeg -i %s -ab %bk -v 0 -f wav -

Encode: opusenc --quiet --bitrate 52 --downmix-stereo --title %t --album %l --artist %a - -

If you want, I'll be happy to give you access to my server to test, if you don't wanna bother changing your transcodes.

Thanks!

ripdog commented 10 years ago

Jplayer's opus support works fine, I stuck my subsonic stream URL into http://jplayer.org/latest/demo-01/ and it played fine.

tsquillario commented 10 years ago

Make me an account on your server to test. tsquillario [at] gmail.com

ripdog commented 10 years ago

Have you had a chance to have a bash at this?

tsquillario commented 10 years ago

Yea, I looked at it a few times. Everything seems to be configured correctly but I can't figure out why it isn't working! I'm able to do FLAC > MP3 transcoding and directly play .ogg files without transcoding. Not sure why your method isn't working.

ghost commented 7 years ago

Ping, has anyone tried this with the current version?

RomanHargrave commented 7 years ago

I'm having this issue with Opus streaming and am wholly confused as to why subsonic, or rather web browsers, seem allergic to everything but MP3 and FLAC streams.

If I give it (subsonic) Opus encoded audio in a WebM stream, it plays for a few seconds and gets confused about the file length and then gives up. Jamstash doesn't like this at all.

If I give it (subsonic or jamstash) opus encoded audio in an Ogg stream, nothing happens.

If I give DSub opus audio in an ogg stream, it's more than happy, since it justs feeds the stream to android MediaPlayer.

Obviously, my encoding pipeline works, but what the hell is going on in the browser. I'm going to jump to the "HTML5" audio API, since it's javascript and I hate javascript.

ae-g-i-s commented 6 years ago

Just a little input, since I just (unsucessfully) tried to get this working in the current git version and a relatively new Chrome. Had to sift through the code of Libresonic (Subsonic fork, but I'm pretty sure this part was not modified) and Jamstash to get the following insights:

Since the following is not really relevant for the average user, the short Summary: Opus playback does not work in Chrome because Subsonic is broken and Chrome doesn't handle it too well.


Here's a few excerpts from mpv's log that should explain what's going on...

Be advised that while this log shows the nginx reverse proxy, I also verified that this is not the source of the error (by repeating the request locally on the Libresonic server against the internal port with a specified range, which forces it to send the Content-Range header).

So in short, the Subsonic server is broken in the sense that it returns wrong Content-Length/Content-Range headers and then doesn't deliver the data. Note that the estimateContentLength parameter for stream.view is not set to true in my request (you just can't see that in the log above because I redacted the parameters).

I haven't debugged the issue enough to know whether this is a shortcoming of Subsonic or Tomcat itself, though I'd guess it's the former (since transcoding is specific to Subsonic).