Jump to content

Why is flac shown as Direct play on the server?


koopa8840

Recommended Posts

koopa8840

It is my understanding that Roku supports FLAC, so I am unsure as to why Emby is transcoding some FLAC files and creating duplicates of these transcodes. As you can see in the screenshots, the first tracks, excluding Counting Crows, are not doubled. The Cranberries jumps from track 15 to 18, in the transcode files, and Creed track 13 is not doubled. Creed and Cranberries were only played once. I added Counting Crows, the entire album to further test, and only played the first track. The track has been doubled, as you can see in the screenshot. I don't understand why this happening, to begin with, but only on certain tracks. I noticed this the other day, with 2 albums by the same artist, and discovered Album 1 was transcoded, but Album 2 was not. Both albums are the same specs. Let me know what else I need to provide.

 

Thanks.

transcode_temp1.png

transcode_temp2.png

embyserver.txt

Edited by koopa8840
Link to comment
Share on other sites

When playing through the /universal endpoint for music which allows much faster playback to start you must give the server your capabilities and let it decide best how to serve you. If we decide in application how to best serve the user the audio for the music it would not know all the server settings for that user and create a slowdown on the application before it could start to adjust for these as we pull them from the server. The server can instantly know all these and provide a stream immediately without sending us anything else but that stream URL using the /universal endpoint. We just give it ID to play and it gives us a stream URL.

 

FLAC is supported for Direct Play on the Roku but there were issues in the Roku accepting the stream. That is why you see it has two is because this is where the fallback occurs and it transcodes to MP3. You can check this for yourself inside those ffmpeg logs that were created exactly what is going on. We do not have "stats for nerds" available for Audio in the Roku application yet. We do plan on getting there but there are other missing parts with greater priority. You would use the ffmpeg logs to see exactly why this is transcoding. Usually it is because the device rejected the codec inside the container Emby tried to serve it.

 

We may need to run a bunch of files (different codec/container combinations) through this to see if firmware OS10 has changed any of this behavior. But the double ffmpeg logs are likely it was transcoding FLAC->FLAC because it needs the TS container. Then when that fails it does not know why. It has to assume the FLAC has some bad sections or the Roku doesn't like that particular FLAC at that particular point and maybe it should transcode to get it to play correctly.. so shifts to FLAC->MP3 inside TS and resumes playback at that exact point. You hear a slight drop of audio and back it comes. That should be what you see and hear happening.

Edited by speechles
Link to comment
Share on other sites

koopa8840
53 minutes ago, speechles said:

When playing through the /universal endpoint for music which allows much faster playback to start you must give the server your capabilities and let it decide best how to serve you. If we decide in application how to best serve the user the audio for the music it would not know all the server settings for that user and create a slowdown on the application before it could start to adjust for these as we pull them from the server. The server can instantly know all these and provide a stream immediately without sending us anything else but that stream URL using the /universal endpoint. We just give it ID to play and it gives us a stream URL.

 

FLAC is supported for Direct Play on the Roku but there were issues in the Roku accepting the stream. That is why you see it has two is because this is where the fallback occurs and it transcodes to MP3. You can check this for yourself inside those ffmpeg logs that were created exactly what is going on. We do not have "stats for nerds" available for Audio in the Roku application yet. We do plan on getting there but there are other missing parts with greater priority. You would use the ffmpeg logs to see exactly why this is transcoding. Usually it is because the device rejected the codec inside the container Emby tried to serve it.

 

We may need to run a bunch of files (different codec/container combinations) through this to see if firmware OS10 has changed any of this behavior. But the double ffmpeg logs are likely it was transcoding FLAC->FLAC because it needs the TS container. Then when that fails it does not know why. It has to assume the FLAC has some bad sections or the Roku doesn't like that particular FLAC at that particular point and maybe it should transcode to get it to play correctly.. so shifts to FLAC->MP3 inside TS and resumes playback at that exact point. You hear a slight drop of audio and back it comes. That should be what you see and hear happening.

Here are the 2 log files for the files in the screenshot. This file was played only once. I looked at them and, to me, it appears they are being transcoded into 320kbit mp3s and nothing more. I looked at Roku's developer streaming info, and it seems FLAC is a supported streaming container, but not adaptive bit streaming. I could be misunderstanding what I was reading.

Screenshot 2021-06-05 144417.png

ffmpeg-transcode-8a944f77-7458-4f2f-a4a2-50d9a97ca78e_1.txt ffmpeg-transcode-a1feae29-d11c-4f25-b819-a1095a9643fb_1.txt

Link to comment
Share on other sites

koopa8840

Since streaming a WAV, to Roku, is possible with no transcoding, is it possible to set Emby to transcode FLAC to WAV instead of mp3 for Roku?

Link to comment
Share on other sites

23 hours ago, koopa8840 said:

Since streaming a WAV, to Roku, is possible with no transcoding, is it possible to set Emby to transcode FLAC to WAV instead of mp3 for Roku?

We'd have to see if it supports wav with the HLS protocol, which is what we use when transcoding. That's really the question.

Link to comment
Share on other sites

koopa8840
8 minutes ago, Luke said:

We'd have to see if it supports wav with the HLS protocol, which is what we use when transcoding. That's really the question.

I did convert a FLAC to WAV, put it in a test folder, started the Roku and played the WAV with no playback issues. All I know, is on my end and don't quite understand, why two 320kbit mp3 files are being created for each FLAC. However, it would be great, since a transcode is required, to convert the FLACs to WAVs as to keep the lossless format. Thanks for taking the time.

Link to comment
Share on other sites

15 hours ago, koopa8840 said:

I did convert a FLAC to WAV, put it in a test folder, started the Roku and played the WAV with no playback issues

It was probably direct playing it, correct?  That would be a different delivery method than us transcoding on the fly (which requires us to use HLS).  So that is the main question.

Or, you could actually convert these to WAV...

Link to comment
Share on other sites

koopa8840
7 hours ago, ebr said:

It was probably direct playing it, correct?  That would be a different delivery method than us transcoding on the fly (which requires us to use HLS).  So that is the main question.

Or, you could actually convert these to WAV...

Correct. I don't know how the file play works with Roku. I'm reporting what I am trying out. However, the question as to why are there two files being created, has yet to be answered. Not all FLACs are being transcoded twice. Also, from what I am seeing, the FLAC is being converted to a single, sometimes two, mp3 files and then being played as in 'direct playing'. I don't know if the dashboard is not displaying correctly, but it is what I am seeing. So if this is correct, in the FLAC being converted and then the mp3 is being played direct playing, then why can't the user have the option to have the conversion to WAV (or a supported lossless format such as ALAC), to keep the lossless format, and being the direct playing? I could be completely confused, but so far there has been no explanation. Instead, so far, I'm basically told to convert my FLAC collection to WAV... I'm not trying to be difficult, but I want to understand.

As you can see in the screenshots. Beastie Boys track 1, 3, 7 and 8 there is only one mp3 each, whereas the other tracks have two mp3s. You can see MC Lyte track 1 has been converted to two mp3s and the dashboard is displaying 'direct playing', not streaming. 

Screenshot 2021-06-07 145551.png

Screenshot 2021-06-07 145621.png

Screenshot 2021-06-07 151711.png

Edited by koopa8840
Link to comment
Share on other sites

17 hours ago, koopa8840 said:

So if this is correct, in the FLAC being converted and then the mp3 is being played direct playing

No, that should not be what is happening I don't think.  Are any ffmpeg logs generated?

Link to comment
Share on other sites

koopa8840
3 minutes ago, ebr said:

No, that should not be what is happening I don't think.  Are any ffmpeg logs generated?

I posted some logs earlier in the thread. I can post if you need them. Just tell me what you need.

I really appreciate you addressing/looking into it.

Link to comment
Share on other sites

Okay, you were actually right.  At this time we are converting to mp3 and playing that over http.  We'll have to experiment with a higher quality conversion in a future beta cycle.  It may be possible (I just did a quick test on my Ultra and it worked).

  • Like 1
Link to comment
Share on other sites

  • 1 month later...
Happy2Play

Why is flac shown as Direct play on the server?

18:39:14.486 Stream mapping:
18:39:14.486   Stream #0:0 -> #0:0 (flac (native) -> mp3 (libmp3lame))

flac.jpg.fac6dad5a1c44c6741e05342b45edba4.jpg

Link to comment
Share on other sites

11 hours ago, Happy2Play said:

Why is flac shown as Direct play on the server?

It is because of the way we are transcoding it. The whole file is being converted and then played and this fools the server into thinking it is direct play.

Link to comment
Share on other sites

  • 2 weeks later...
koopa8840
On 8/6/2021 at 10:58 AM, Luke said:

This should be improved with the next update to our Roku app. Thanks.

What will be improved? Removing the misleading "direct playing" status, when a user plays a FLAC file or supporting direct play of FLAC on Roku?  And when? If the Release Notes for Roku thread is any indication, by its July 2, 2019 date and no other dates, then not anytime soon. The latest beta, not sure when it was released (hopefully not in 2019), forces conversion. 🙄

Link to comment
Share on other sites

@koopa8840 Apologies you were left with hope and we abandoned you. There is a fix and it will correct this for other codecs too. Apologies we were not more forth coming. In the future we will work better to give you more information.

Reference #1136: [AudioPlayer] Full support for direct playback with fallback

Link to comment
Share on other sites

Happy2Play
1 hour ago, koopa8840 said:

If the Release Notes for Roku thread is any indication, by its July 2, 2019 date and no other dates, then not anytime soon. The latest beta, not sure when it was released (hopefully not in 2019), forces conversion. 

Yes the topic dates are deceiving as the ADMIN edited post does not reflect it has be edited.  So these release note topics really have no date released context.

Link to comment
Share on other sites

koopa8840
3 hours ago, speechles said:

@koopa8840 Apologies you were left with hope and we abandoned you. There is a fix and it will correct this for other codecs too. Apologies we were not more forth coming. In the future we will work better to give you more information.

Reference #1136: [AudioPlayer] Full support for direct playback with fallback

It's just a little frustrating when "direct playing of WAV" has been a feature since 3.0.175, and now at version 4.0+ we're still forced to deal with a lossless to lossy conversion. I tired DLNA, but to this day I still can't connect. So in order to play my music collection I had to purchase another program to allow FLAC direct play. It is what it is....

Link to comment
Share on other sites

  • 2 weeks later...
koopa8840
On 8/6/2021 at 10:58 AM, Luke said:

This should be improved with the next update to our Roku app. Thanks.

It's been 3 months and a couple beta updates have been released. So, which "next" update are you referring to; beta or stable release? Also, could dates be added behind the version number, so we know when a beta or stable version was released?

Link to comment
Share on other sites

koopa8840

For some reason I can't edit my post. It was suppose to state "it's been 3 months since I reported this and 2 weeks since Luke said this." Another beta was released and FLAC -> MP3 is still being done.

Link to comment
Share on other sites

Happy2Play

Yes still get the same results in server 4.7.0.9 and client 4.0.35.

Link to comment
Share on other sites

koopa8840

After more reading, I would like to point out that Emby's Knowledge Base states FLAC is direct play. The page was "Modified on: Wed, 22 Apr, 2020 at 8:48 AM" and here Emby is still forcing conversion even though the KB states differently. A person can't even get consistent info. 🤦‍♂️  

image.png.fb3fd3572b26bfa2447299ea303d74f1.png

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...