Jump to content

Does emby theatre provide gapless/bit perfect audio playback yet?


johnhb

Recommended Posts

I asked the same question back in 2014. Curious to know if 6 years has been enough time to implement it!? :-)

Also, does emby theatre support other essentials for hq playback like:
- refresh rate switching
- user defined audio delay compensation for different refresh rates (23/24/50/60)
- 1:1 pixel rendering?

Link to comment
Share on other sites

sooty234

If it's been that long since you used Theater, then you wouldn't know that it's using an entirely different player, mpv. It has a great many abilities. There are many advanced options you can use, but some of the things you mention are already in the UI settings.

777581209_Screenshot2021-01-03151930.jpg.79177c8391a1a497093d89ce3706dea3.jpg

  • Thanks 1
Link to comment
Share on other sites

Thanks for the swift reply - yes, funnily enough I jumped straight in and saw those settings - so far so good 🙂

Also seems blu-ray folders and dvd folders are supported? Which is pretty awesome. And Theatre supports live TV Guide (I've got a Hauppauge Quad HD)?

How about gapless playback? It's hard to tell with the non premier limitations.

If it is sample accurate gapless / bit perfect from theatre then I'll be buying a lifetime license immediately!

Link to comment
Share on other sites

sooty234

Blu-ray folders will still work, but mpv have pretty much stopped supporting DVD folders. It'll play whatever Live TV you've configured in the server. I'm pretty sure the server supports your tuner, but maybe check on that.

Gapless is there. I use a more complex config for my audio, so in my case I do sometimes hear about a 0.05 second gap. But if I remove my config, I don't hear it.

Link to comment
Share on other sites

PrincessClevage
37 minutes ago, johnhb said:

Thanks for the swift reply - yes, funnily enough I jumped straight in and saw those settings - so far so good 🙂

Also seems blu-ray folders and dvd folders are supported? Which is pretty awesome. And Theatre supports live TV Guide (I've got a Hauppauge Quad HD)?

How about gapless playback? It's hard to tell with the non premier limitations.

If it is sample accurate gapless / bit perfect from theatre then I'll be buying a lifetime license immediately!

What does gapless/bit perfect mean?

pretty sure media players have had passthrough (to receiver) ability for quite a while?

Link to comment
Share on other sites

sooty234
10 minutes ago, PrincessClevage said:

What does gapless/bit perfect mean?

pretty sure media players have had passthrough (to receiver) ability for quite a while?

An example would be if you're listening to a live music album where you have continuous sound (the crowd usually), and when progressing from one track to the next, the audio is perfectly continuous and you don't hear any space between them. Until recently, Theater didn't do this very well. But I'm listening to Pink Floyd: Pulse as I type this, and even with my complex audio config, it's continuous. The only reason I hear any kind of 'blip' is because I'm using filters, which get re-applied for each track.

Edited by sooty234
Link to comment
Share on other sites

Thanks again for the replies and hints sooty, unfortunately my tests show there's a 100 ms gap between tracks (verified with cuetools verified flac rips as well as test signals).

Also, Theater is NOT running in exclusive mode - behaviour suggests it is in shared mode despite enabling exclusive mode in the settings:
  - This is easy to see as the sample rate is not changing for different source files (with 48 kHz the output is still 44.1 - or whatever the Windows default it set to).
  - Also it's playing back through the Windows mixer because the Direct Sound APO limiter is kicking in and limiting output to -0.2 dBFS

Server says playback is direct (I guess this means no transcoding?), SPDIF output is set to allow exclusive mode.

I've tried rebooting, restarting theater, reinstalling it etc. but still the same issues. Hopefully just a bug?

Edited by johnhb
Link to comment
Share on other sites

After a bit of digging, I gather there should be a mpv config file being generated somewhere which is referenced from libmpv.js? Well this is not being created in the appdata/roaming dir so I guess this is why I'm stuck in shared mode default.

Link to comment
Share on other sites

sooty234

You can set up logging by following this.

On 12/27/2020 at 9:55 AM, sooty234 said:

To generate an mpv log, you need to make an mpv.conf and add logging to it. Be sure to name the log file you're making in the logging entry. Example: log-file="G:\mpv logs\Portable mpv log.txt"

Then you can use the same mpv.conf to add exclusive mode. I have seen that in some cases, the option in Theater doesn't work. But applying in the mpv.conf does.

Link to comment
Share on other sites

sooty234

The way mpv uses gapless mode is from a playlist, and best with setting it to yes. The default is weak. It works holding the audio device on and applying the same audio options for the first track, to all of them without resetting. Emby doesn't do this. It's feeding one track at a time, which makes the player restart for each track. I haven't checked the mpv log on this in a while. I should take a closer look at that. But this is why you're seeing that 100ms gap. It's definitely better than it was, but it still isn't implemented correctly, by the looks of it. 

  • Thanks 1
Link to comment
Share on other sites

Thank you again! That kicked it into exclusive mode and boom the bit stream is being passed completely untouched to my DAC 🙂 

So gapless 'weak' is the same as 'yes' unless the sampling frequency or bit depth changes between files? According to the docs, in the case of yes, the audio will get resampled, in the case of weak, it will stop and start the device to match the new parameters.

That aligns with what I found in playing back an album (all files same Fs and bit depth) where gapless=yes didn't make a difference.

I guess my next question - is this insurmountable? Essentially the 'transport' part of theater needs to be changed? It needs to prefetch/queue up the next file?

In the absence of a solution, is there a workaround? Can emby do cue sheets (maybe this just leads to the same problem) or could I create playlists of my live albums?

Edited by johnhb
Link to comment
Share on other sites

sooty234

I think applying gapless=yes gets overriden by theater. I haven't looked at how they're implementing this. They may just run default. 

Luke? Can you shed some light?

Link to comment
Share on other sites

Just to clarify...

Unless the default is stuck at gapless=no then I don't think this setting is going to help.

'yes' and 'weak' are exactly the same if the adjacent audio files are at the same sample rate/bit depth (probably the case for most of us just hoping for single live albums or albums with merged tracks to playback gaplessly).

From the docs:

Yes: The audio device is opened using parameters chosen for the first file played and is then kept open for gapless playback. This means that if the first file for example has a low sample rate, then the following files may get resampled to the same low sample rate, resulting in reduced sound quality. 

Weak: Normally, the audio device is kept open (using the format it was first initialized with). If the audio format the decoder output changes, the audio device is closed and reopened. This means that you will normally get gapless audio with files that were encoded using the same settings, but might not be gapless in other cases.

Guessing a bit here but as you alluded to, the issue is probably with the Emby client not fetching the next track from the server preemptievly such that the first sample (strictly, the payload of the frame or packet) of the proceeding track is available to mpv as soon as the last sample of the current track is played.

This is also mentioned in the mpv docs:

Note: This feature is implemented in a simple manner and relies on audio output device buffering to continue playback while moving from one file to another. If playback of the new file starts slowly, for example because it is played from a remote network location or because you have specified cache settings that require time for the initial cache fill, then the buffered audio may run out before playback of the new file can start.

You need two things - gapless mode on mpv (tick - and weak mode is probably the best) and sample accurate bit-streaming from the server. Maybe this comes down to emby needing a more intelligent (sample accurate) buffer/streaming mechanism, or perhaps there isn't a buffer at all in this part of the audio stack.

However, like I said, I'm guessing what's under the hood here and some (proper!) clarity and technical input from Emby would be good. 

Edited by johnhb
Link to comment
Share on other sites

sooty234

But that's what I'm talking about. If emby is feeding mpv a playlist, then it is applied. But if emby is trying to use it's own buffer and feed mpv that way, it's redundant. mpv has to use it's own buffer for gapless audio. That's why I called on Luke. I don't know how they are handling this.

Link to comment
Share on other sites

Oh I see what you mean. It wasn't clear from the mpv documentation that gapless-mode is specific to playlists.

Fingers crossed Luke can shed some light on the method. I'd like to know the prospects of ever getting this sorted or even better if a simple config hack would do it (esp. after the 7 year wait 🙂 ).

I gather the android client has gapless audio? Presumably that's a whole different av stack? Funny thing is I couldn't care less about gapless for casual listening on phones, tablets etc. just my living room setup with ET.

Edited by johnhb
Link to comment
Share on other sites

sooty234

What you could try is playing a playlist. I don't use them. If emby passes the playlist to mpv, then it should be gapless. But I suspect that the server will pass each track from the playlist, which won't work for gapless playback.

Link to comment
Share on other sites

sooty234
1 hour ago, johnhb said:

I gather the android client has gapless audio? Presumably that's a whole different av stack? Funny thing is I couldn't care less about gapless for casual listening on phones, tablets etc. just my living room setup with ET.

That seems hit and miss, depending on which app release you use. Some I have tried have gapless, others not at all.

Link to comment
Share on other sites

18 hours ago, sooty234 said:

What you could try is playing a playlist. I don't use them. If emby passes the playlist to mpv, then it should be gapless. But I suspect that the server will pass each track from the playlist, which won't work for gapless playback.

Tried a playlist. That isn't gapless either.

Tried Emby for Kodi with direct playback enabled and it's sample accurate gapless (though not surprising as it's essentially the Kodi local playback chain which has been rock solid for a while now)

Edited by johnhb
Link to comment
Share on other sites

Just a thought but, kodi works in direct mode using SMB for network shares. Does theater do the same in direct mode or does it use a streaming protocol?

Is the answer here that it needs to switch to SMB? It seems easier to manage in terms of supporting gapless.

Link to comment
Share on other sites

sooty234

Doesn't matter. mpv needs to handle it internally. That's how kodi does it too. Kodi isn't using an independent server to make a playlist. You can't compare kodi to emby. You'd have to compare kodi to mpv, as they are both independent players. Think of it like watching a YouTube playlist. They have to rely on youtube to queue up the next video. Whereas using a playlist and having direct access to the media the player can cache the next up media while still playing the current track. There's no man in the middle. 

 

Link to comment
Share on other sites

sooty234

Luke answered the question.

9 minutes ago, Luke said:

Theater is not deferring management of the play queue to mpv.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...