Jump to content

why is Emby transcoding this?


justinrh

Recommended Posts

justinrh

I converted a DVD to MP4 via Handbrake.  When I play the video on my !super Roku, it transcodes (at least for a minute or so).  Plex doesn't seem to run the CPU at all for either stream.

1) Why would it transcode in both cases?  It looks like the Roku can't natively handle AAC.
2) Why does it transcode (crank up the CPU) for only a little while?

Here are the logs:

*-remux log (AAC audio track selected)

                           Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m), 720x462 [SAR 32:27 DAR 1280:693], 1342 kb/s, Level 31, 23.98 fps, 23.98 tbr, 90k tbn, 180k tbc (default)
19:06:01.855     Metadata:
19:06:01.855       creation_time   : 2020-12-09T00:23:18.000000Z
19:06:01.855       handler_name    : VideoHandler
19:06:01.855     Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 384 kb/s (default)
19:06:01.855     Metadata:
19:06:01.855       creation_time   : 2020-12-09T00:23:18.000000Z
19:06:01.855       handler_name    : Surround
19:06:01.855     Stream #0:2(eng): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 448 kb/s
19:06:01.855     Metadata:
19:06:01.855       creation_time   : 2020-12-09T00:23:18.000000Z
19:06:01.855       handler_name    : Surround
19:06:01.855     Side data:
19:06:01.855       audio service type: main
19:06:01.855     Stream #0:3(eng): Data: bin_data (text / 0x74786574)
19:06:01.855     Metadata:
19:06:01.855       creation_time   : 2020-12-09T00:23:18.000000Z
19:06:01.855       handler_name    : SubtitleHandler
19:06:01.855 Stream mapping:
19:06:01.855   Stream #0:0 -> #0:0 (copy)
19:06:01.855   Stream #0:1 -> #0:1 (aac (native) -> ac3 (native))
19:06:01.855 Press [q] to stop, [?] for help
19:06:01.855 Output #0, segment, to 'R:\Emby\transcoding-temp\ED65C8_%d.ts':
19:06:01.855   Metadata:
19:06:01.855     encoder         : Lavf58.35.100
19:06:01.855     Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m), 720x462 [SAR 32:27 DAR 1280:693], q=2-31, 1342 kb/s, Level 31, 23.98 fps, 23.98 tbr, 90k tbn, 90k tbc (default)
19:06:01.855     Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1, fltp, 384 kb/s (default)
19:06:01.855     Metadata:
19:06:01.855       encoder         : Lavc58.62.100 ac3
19:06:01.886 [segment @ 000001fc66973500] Opening 'R:\Emby\transcoding-temp\ED65C8.m3u8.tmp' for writing

 

*-directstream (AC3 audio stream selected)

19:01:15.855 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'D:\media\DVDs\Home Alone.mp4':
19:01:15.855   Metadata:
19:01:15.855     major_brand     : mp42
19:01:15.855     minor_version   : 512
19:01:15.855     compatible_brands: isomiso2avc1mp41
19:01:15.855     creation_time   : 2020-12-09T00:23:18.000000Z
19:01:15.855     encoder         : HandBrake 1.3.3 2020061300
19:01:15.855   Duration: 01:42:50.62, start: 0.000000, bitrate: 2184 kb/s
19:01:15.855     Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m), 720x462 [SAR 32:27 DAR 1280:693], 1342 kb/s, Level 31, 23.98 fps, 23.98 tbr, 90k tbn, 180k tbc (default)
19:01:15.855     Metadata:
19:01:15.855       creation_time   : 2020-12-09T00:23:18.000000Z
19:01:15.855       handler_name    : VideoHandler
19:01:15.855     Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 384 kb/s (default)
19:01:15.855     Metadata:

19:01:15.855       creation_time   : 2020-12-09T00:23:18.000000Z
19:01:15.855       handler_name    : Surround
19:01:15.871     Stream #0:2(eng): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 448 kb/s
19:01:15.871     Metadata:
19:01:15.871       creation_time   : 2020-12-09T00:23:18.000000Z
19:01:15.871       handler_name    : Surround
19:01:15.871     Side data:
19:01:15.871       audio service type: main
19:01:15.871     Stream #0:3(eng): Data: bin_data (text / 0x74786574)
19:01:15.871     Metadata:
19:01:15.871       creation_time   : 2020-12-09T00:23:18.000000Z
19:01:15.871       handler_name    : SubtitleHandler
19:01:15.871 Output #0, segment, to 'R:\Emby\transcoding-temp\962CA7_%d.ts':
19:01:15.871   Metadata:
19:01:15.871     encoder         : Lavf58.35.100
19:01:15.871     Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m), 720x462 [SAR 32:27 DAR 1280:693], q=2-31, 1342 kb/s, Level 31, 23.98 fps, 23.98 tbr, 90k tbn, 90k tbc (default)
19:01:15.871     Stream #0:1(eng): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
19:01:15.871     Side data:
19:01:15.871       audio service type: main
19:01:15.871 Stream mapping:
19:01:15.871   Stream #0:0 -> #0:0 (copy)
19:01:15.871   Stream #0:2 -> #0:1 (copy)
19:01:15.871 Press [q] to stop, [?] for help
19:01:15.871 [segment @ 000002721387a200] Opening 'R:\Emby\transcoding-temp\962CA7.m3u8.tmp' for writing

 

ffmpeg-directstream-8b7dadea-d498-47ab-bc2b-44549dd05495_1.txtffmpeg-remux-22de2427-50cb-4fe0-b011-b43cc8357bcc_1.txt

Edited by justinrh
add logs, add Plex note
Link to comment
Share on other sites

Happy2Play

Please provide the ffmpeg logs

Nerd Stats should tell you why also.

AAC issue

Multichannel AAC is not supported on all Roku models. Roku TVs, Roku 4, and Roku Ultra set-top-boxes support multichannel decode to PCM stereo.

Stream copy is not transcoding but yes the server needs a place to store the segemented media for this different method.

 

If you do not enable Transcode throttling, Emby will transcode the entire item.  Where throttling will transcode about 2 minutes of playback pauses and transcode as needed to keep up with playback.

 

Moving to Roku Section.

Edited by Happy2Play
  • Like 1
Link to comment
Share on other sites

Rokus that support aac will still turn 5.1 aac into stereo.

So Emby transcodes 5.1 aac in order to preserve the 5.1 channel data.

Stereo aac won't trigger transcoding.

 

Edited by roaku
  • Like 1
Link to comment
Share on other sites

justinrh

First, I forgot to mention that Plex doesn't run the CPU at all, so I'm wondering what the difference is.

Okay lets say that AAC has to be transcoded, but why do the TS segments need to be created?  Can the audio stream not be transcoded separate from the video stream?

But, for the AC3 stream FFMpeg still kicks off - why?  What is it doing?

Link to comment
Share on other sites

Happy2Play

Need to see the ffmpeg logs. 

But when any track needs converted they will be repackaged as Emby is not sending tracks to the player they are still being packaged in a container.  So all repackaging will be usually a ts container.  But a dev may/will have to explain it properly.

Link to comment
Share on other sites

justinrh

I added the logs to the OP.

I have to clarify my statement about Plex - it will run the CPU about 2% for the AAC stream, compared to the 35% for Emby.

I'd still like to know why the transcode for the AC3 stream.  I might think it is because it is 5.1 but I don't see in the logs that there is any transcode happening.  It is showing that both the video and the AC3 audio stream is being copied, right?  Why copy both streams and not just send it on to the device?

Link to comment
Share on other sites

Happy2Play
6&TranscodeReasons=SecondaryAudioNotSupported

@speechlescan you explain the secondary audio issue on this Roku?

  • Like 1
Link to comment
Share on other sites

Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 384 kb/s (default)

The Roku will not keep surround with AAC 5.1. To keep surround sound we must transcode to AC3 Dolby.

If you want this to direct play you must go to to Settings >> Playback >> Convert Multi-channel AAC and set this option in the app to NO. Once you have done this it will no longer transcode AAC 5.1 but play it in AAC 2.0. To get to settings go to the COG at the top of the screen. You can also press * on some screens to get to settings.

Let us know if this solves the problem. Happy Holidays. :)

Secondary Audio means when you choose other than the first track. Older Roku units such as Roku 3 do not support Secondary Audio. If the AAC track is a secondary track it will need to use ffmpeg and HLS to repackage to get the other tracks available.

Edited by speechles
  • Like 1
Link to comment
Share on other sites

justinrh

@speechles I presume you mean the settings in the Roku app, but the only audio setting there says to use the Emby web app, but I couldn't find any audio settings in the web app, either.

In this video, the first track is AAC, secondary is AC3.  Should the app have chosen the AC3 by default?

Edited by justinrh
Link to comment
Share on other sites

32 minutes ago, justinrh said:

@speechles I presume you mean the settings in the Roku app, but the only audio setting there says to use the Emby web app, but I couldn't find any audio settings in the web app, either.

In this video, the first track is AAC, secondary is AC3.  Should the app have chosen the AC3 by default?

The Roku will choose the AAC track if there are no other defaults and it direct plays. Because it is the first track. You can then choose the Dolby track with Emby. Emby will remember the track and if the Secondary Audio is not supported will copy both streams and deliver this as a container swap (directstream). Once ffmpeg takes over the Roku stops being "dumb" and Emby smartens it up.

The capability profile on the Roku is built differently on each Roku device depending on what is returned when the device is queried. This makes it much easier for users because your device is telling us what is supported and we are just listening to the device. The Roku is doing this correctly 98% of the time. The other 2% we have to work-around issues particular to each model number.

No the app will not choose to transcode by default. We want to directplay as much as possible. This is why the Dolby AC3 audio is not chosen first because your model has problems with secondary audio which would cause a transcode. It will choose the AAC audio even though it is 5.1 because it can direct play and your Roku device will reduce this down internally (downmix on device) to PCM 2.0.

There is indeed a setting in the Emby Roku app settings. Settings >> Playback >> Convert Multi-Channel AAC and set this to YES. If you do not see the option in playback you must scroll down. There is more than you can see.

If that setting had been YES it would then choose the Dolby/AC3 by default instead of the AAC since it has to transcode anyways. It will notice you can support surround and instead choose the Dolby AC3.

Does this answer your questions? Feel free to ask more. We want you happy. Happy Holidays. ^_^

Edited by speechles
Link to comment
Share on other sites

justinrh
23 hours ago, speechles said:

If that setting had been YES it would then choose the Dolby/AC3 by default instead of the AAC since it has to transcode anyways. It will notice you can support surround and instead choose the Dolby AC3.

Sorry - I don't quite get it yet.  Are you saying that Emby would have to transcode either AAC or the AC3 stream?  You said above that AAC 5.1 will be downmixed to 2.0 by the Roku (no transcode needed, right?), then here you say that it will choose AC3 over AAC since the device natively supports it (no transcode also, right?).

first stream = AAC
second stream = AC3

You keep talking as if AAC is the second stream (I think).  I see several contradictions in your responses.  I hope I'm just missing something.

Link to comment
Share on other sites

It will use the first track since it is AAC if you direct play. It will also downmix on the device to AAC 2.0 if you leave the option to "Convert Multi-Channel AAC" to NO. If this is set to YES it will convert to AC3 and keep surround sound. Convert = use Emby server to transcode the audio. Roku cannot play back Multi-Channel AAC Audio.

  • Like 1
Link to comment
Share on other sites

Happy2Play
On 12/9/2020 at 6:33 PM, justinrh said:

Should the app have chosen the AC3 by default?

What Roku model do you have?

Some models do not support multiple audio tracks from my understanding.

 

Link to comment
Share on other sites

justinrh
6 minutes ago, Happy2Play said:

What Roku model do you have?

Some models do not support multiple audio tracks from my understanding.

 

2710X.  I see the multiple streams in the app UI.

Link to comment
Share on other sites

26 minutes ago, Happy2Play said:

What Roku model do you have?

Some models do not support multiple audio tracks from my understanding.

 

It isn't that they do not support multiple audio tracks. Every Roku supports all audio tracks when using Emby. But some Roku models cannot use secondary audio tracks when direct playing. We are aware of which models there are for the most part. Those models which do not support secondary audio are based on the Roku 3 and earlier. For these models when you choose the Dolby AC3 audio track it may have to transcode (directstream - copy video/audio) so that it can produce an HLS stream. When using HLS we can control the playback better and smarten up the Roku when it cannot do certain things.

But at the same time the Roku must detect support for Dolby AC3 to even get that far. We query the Roku what it supports and it replies back to each request for each audio codec if it is supported and if so how many channels are supported maximum. Once we get all that information we build the profile. That profile includes checking for the secondary audio support.

  

18 minutes ago, justinrh said:

2710X.  I see the multiple streams in the app UI.

 

The Roku1 is based on the older (2013 era) devices such as the Roku3. Sort of a slower Roku3 and with even less RAM. It is over 7 years old. Time has not been kind to it. But it does still work and if you are satisfied with its limitations it is all you need. Know this though...a new 2019 (they have no new 2020 Roku express) Roku express (found around $25 right now) is much faster and more capable than an old Roku1.

 

2019 Roku Express HD w/1080P ($21.99 USD) @ https://www.walmart.com/ip/Roku-Express-HD-Streaming-Media-Player/120569644
( NO voice search, NO Wifi direct remote, NO private listening headphone jack )

2019 Roku Express HD+ w/1080P ($39.99 USD) @ https://www.roku.com/en-ca/products/roku-express-plus
( YES voice search, YES Wifi direct remote, YES private listening headphone jack )

Edited by speechles
Link to comment
Share on other sites

Happy2Play
6 minutes ago, justinrh said:

2710X.  I see the multiple streams in the app UI.

Yes you will see all available tracks but your device can not direct play that track so the server repackages it with ffmpeg and direct streams it instead of direct playing it. 

I am pretty sure all Roku 3 and older models are not capable of direct playing secondary audio.

 

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