Jump to content

FLAC Transcode


Recommended Posts

koopa8840
Posted (edited)

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 post
Share on other sites
speechles
Posted (edited)

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 post
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 post
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 post
Share on other sites
Luke
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 post
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 post
Share on other sites
ebr
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 post
Share on other sites
koopa8840
Posted (edited)
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 post
Share on other sites
ebr
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 post
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 post
Share on other sites
ebr

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
  • Thanks 1
Link to post
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...