lisamelton / video_transcoding

Tools to transcode, inspect and convert videos.
MIT License
2.39k stars 160 forks source link

Proposal to change default surround audio format and bitrate #270

Open lisamelton opened 5 years ago

lisamelton commented 5 years ago

Proposal to change default surround audio format and bitrate

Let me just cut to the chase...:) I propose that the default 5.1 surround audio format and bitrate of transcode-video be changed from Dolby Digital (AC-3) at 640 Kbps to Dolby Digital Plus (DD+ or E-AC-3) at 384 Kbps.

What!?

It is inevitable that our default surround audio format and bitrate will change. The only question is when. And I want to do that sooner rather than later.

Please remember that I'm only proposing that we change the default. Not to somehow disallow AC-3 at 640 Kbps. I'm not completely insane. :)

AC-3 is an ancient audio compression format, even older than MP3. Achieving transparency with it requires using close to its maximum bitrate of 640 Kbps. And that bitrate is more that 10% of our target video bitrate for 1080p content. That's just crazy.

What's even crazier is when you consider that, by default, each surround track is duplicated, i.e. transcode-video creates two output tracks, one in 5.1 AC-3 track at 640 Kbps and one in stereo AAC track at 160 Kbps. And that's a combined bitrate of over 13% of our 1080p target.

While this strategy is "portable," it has never been a good way to achieve my original "smaller" goal for the project. :/

So, our audio footprint needs to get smaller. And wouldn't it be nice if we could do that and improve quality at the same time?

I had hoped that we could transition to multichannel AAC audio since HandBrake and FFmpeg can already create 7.1 channels with it. But, other than desktop PCs, native 5.1 AAC support is only available on some Android-based devices while 7.1 support is essentially non-existant. :(

And it's clear that the PC, mobile device, TV and home theater industries are now supporting DD+ decoding or passthrough pretty much everywhere. In fact, that transition has already happened. So DD+ it is.

It's also clear that streaming services prefer DD+ as their surround format. In fact, Netflix uses DD+ exclusively for surround audio. They won't even serve up AC-3.

Which means those media files with surround audio that you "acquired" from your Uncle Torrance (you know who I mean!) are in DD+ format. :)

Why is DD+ so popular? Because you can get as good or even better quality with DD+ at half the bitrate of AC-3.

Did you know that all the streaming services use 5.1 DD+ at only 192 Kbps as their default, stepping up to 384 Kbps if you have a better connection and sometimes 640 Kbps if you have bandwith for video at 10 Mbps or more?

Here are the (more or less merged) surround bitrate guidelines from Apple and Roku for AC-3 and DD+:

Channels AC-3 DD+
5.1 (surround) 384 Kbps 192 Kbps
7.1 (surround) - 384 Kbps
Nominally 16 (with Dolby Atmos) - 384-768 Kbps

Obviously the other reason for DD+'s popularity is Dolby Atmos support, which is unavailable in AC-3.

Anyway, DD+ at 384 Kbps seems to be the sweet spot, the best compromise between size and quality. And my own testing confirms that. It sounds just as good or better than AC-3 at 640 Kbps to me.

In fact, if I re-transcode a DD+ track at 384 Kbps to AC-3 at 640 Kbps, I'm hard pressed to tell the difference between that and an original AC-3 track at 640 Kbps. Which means I'm not even worried about any possible dynamic re-transcoding by my Plex Media Server.

Here's how I would describe this proposed change within the built-in --help output of transcode-video:

    --ac3-encoder ac3|eac3
                    set AC-3 audio encoder (default: eac3)
    --ac3-bitrate 384|448|640|768|1536
                    set AC-3 surround audio bitrate
                      (default for ac3: 640; default for eac3: 384)

So, to get the current behavior, only --ac3-encoder ac3 would be required on the command line. Thus making the transition easier.

Please try to create some audio yourself with DD+ at 384 Kbps and see how it sounds. I tested on multiple stereo and surround systems as well as high-quality stereo headphones using passthrough and even dynamic re-transcoding by Plex or explicit re-transcoding at the command line.

I would love to hear from @samhutchins, @JMoVS, @khaosx, @klogg416, @rhapsodians, @damorrison, @vr8hub, @dkoenig01, @ericcardenas, @arikalish, @RodBrown1988, @chrispoole643, @elliotclowes and anyone else from our various audio threads over the years or elsewhere about this proposal. Thanks!

klogg416 commented 5 years ago

@donmelton I have been maxed out for about 10 hours with transcode-video --avbr --audio-width all=surround --ac3-encoder eac3, I am already on the proposed page.

Two thumbs up from me.

lisamelton commented 5 years ago

@klogg416 Thanks for the quick feedback! Nothing like re-transcoding your entire video collection every month, is it? :) BTW, the current default bitrate when using eac3 will be 640 Kbps, but it's not like that will somehow sound bad.

khaosx commented 5 years ago

@donmelton If we want to do a couple of test transcodes to see what this is going to sound like, are we good with using @klogg416's --ac3-encoder eac3 --ac3-bitrate 384 or is there some other special sauce we need to add?

Also...damn guys, what's your average frame rate and library size? We keep mentioning re-encoding libraries and I'm here like "Yeah, unless I tear down my ESX box and boot it with Linux, I can do about 15 movies in the 12 hours I'm not using my system. And even if I do that, I can only run 3 encodes at once on the server!"

klogg416 commented 5 years ago

Huh, so it is. I am not going to lie to you, continuing to add the same 10% more data for even better eac3 is totally fine with me. Pretty much all my source files are FLAC versions of some HD surround encode, and the idea of better eac3 for the same price I have been paying all along sits well. It wasn't so long ago that I was just using --copy-audio and adding 50% to the file size... :-|

Similar to how when you find an improved way to squeeze more quality out of the video encode at the same target bitrate, you keep the bitrate the same and take the quality instead of aiming for a the old quality at a lower rate, I am not sweating the ~500 megs a movie if the quality improves over what I have been doing already.

That said, my very quick "listening test" with eac3 @ 640 sounded great. If 384 kbps sounds better than normal ac3, cool, but also the paragraph above. :-)

klogg416 commented 5 years ago

@khaosx Today I have been averaging a little over 50 fps, and only encode 1 file at a time. I have never done (maybe once very early on?) a full library re-encode. My current library is a mess of encodes with different versions of transcode-video, changing philosophies (mine and Don's), and evolving technical preference and expectations. And I have started to make some of the full fat source files available without transcoding; since I was storing them anyway, not having 2 copies saved me space for movies that I know will only ever be watched on the "big TV".

The exercise today was driven by a long process of seeing significant improvements and knowing the time to re-encode was approaching. This morning's release felt like a good time. I'll probably do 20-30 movies and see how I feel, started with kids ones which get a lot of iPad time, will work up to some of my movies last.

@donmelton is a masochist, I can't speak to his monthly acrobatics.

damorrison commented 5 years ago

I need to do some tests with eac3 as I know my Sonos doesn’t do anything other than ac3.

However, I’ve read that it’s possible my Samsung tv might downmix eac3 to ac3 automatically if I ask it which would be great. It might also just convert it to PCM though.

I’ve also read that eac3 is backward compatible to ac3 but I’m less inclined to believe that as I don’t understand how it could be.

Also, Is there loss in sound quality going from a 5.1 ac3 to a 5.1 eac3 as that’s what my whole library is in at the moment, and I won’t be reripping anything anytime soon.

I’ll have to run some tests in an eac3 source to see what my Sonos does with it, but I’m away until the end of the week

On Sun, 10 Mar 2019 at 23:26, Kyle notifications@github.com wrote:

Huh, so it is. I am not going to lie to you, continuing to add the same 10% more data for even better eac3 is totally fine with me. Pretty much all my source files are FLAC versions of some HD surround encode, and the idea of better eac3 for the same price I have been paying all along sits well. It wasn't so long ago that I was just using --copy-audio and adding 50% to the file size... :-|

Similar to how when you find an improved way to squeeze more quality out of the video encode at the same target bitrate, you keep the bitrate the same and take the quality instead of aiming for a the old quality at a lower rate, I am not sweating the ~500 megs a movie if the quality improves over what I have been doing already.

That said, my very quick "listening test" with eac3 @ 640 sounded great. If 384 kbps sounds better than normal ac3, cool, but also the paragraph above. :-)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/donmelton/video_transcoding/issues/270#issuecomment-471364997, or mute the thread https://github.com/notifications/unsubscribe-auth/AAYJDfDLZy0Zb5To3uZMF_yu3XgY2nwpks5vVZSegaJpZM4bngRh .

-- Kind regards, Dave

klogg416 commented 5 years ago

@damorrison @khaosx

as that’s what my whole library is in at the moment, and I won’t be reripping anything anytime soon.

I definitely did sit down once and completely re-rip every single movie because I hadn't follow the readme and ripped to FLAC the first time. And it was limiting my options. So I don't always re-encode, but occasionally I have to correct and touch a lot of plastic discs.

lisamelton commented 5 years ago

@khaosx Yeah, just add --ac3-encoder eac3 --ac3-bitrate 384 to your command line. I should have mentioned that in the proposal. D'oh! Sorry about that.

Right now I only have 730 movies and TV episodes that I (re-)transcode because I'm the process of re-ripping the other half of my library to get lossless audio. I'm sure it'll easily be over 1,000 titles soon. :)

I use --avbr --quick so the average speed of my transcoding is about 60 FPS (and between 45 to 75 FPS) on my five year-old iMac. So I can easily get 10-15 titles done while I sleep.

@klogg416 Congratulations! Your audio still sounds great. :) Seriously, you should try a few experiments at 384 Kbps to see if you can hear the difference. Noisy "superhero" movies work well as test subjects.

My library is currently a mix, too. But eventually it gets homogenized to a single method.

And then I start re-transcoding everything again. :)

@donmelton is a masochist, I can't speak to his monthly acrobatics.

So freakin' true, my friend. :)

lisamelton commented 5 years ago

@damorrison If your ripped movies already contain AC-3 (rather than lossless) surround audio tracks, then I would just copy them to your transcoded files. That's the default behavior of transcode-video anyway and what I do.

Supposedly, DD+ can be easily converted/transcoded to AC-3, but it's not done like taking the DTS core from a DTS-HD audio track. It really does have to be transcoded, but, again supposedly, there's less "loss" moving from DD+ to AC-3 than from other formats.

Let me know what you find out about your Sonos and your Samsung TV!

klogg416 commented 5 years ago

@damorrison One thing to check with your Samsung TV is if surround sound is passed to the Sonos at all, if that is important to you. Both of my Samsung's will take a surround signal over HDMI and pass 2.0 stereo sound out of the optical SPDIF port to the receiver.

From the manual:

  • The receiver will work when you have properly connected the optical in jack of the receiver to the DIGITAL AUDIO OUT (OPTICAL) jack of the TV.
  • When the source is a digital component such as a DVD and is connected to the TV via HDMI, only 2 channel sound will be heard from the receiver.
khaosx commented 5 years ago

OK, I feel a little better then. :)

I started last July-ish re-ripping and encoding the entire library of movies. I don't particularly care about TV shows being in uniform format (with the exception of Doctor Who, The Walking Dead, Game of thrones, and my collection of The Three Stooges), so I've never done a full rerip there. Prior to that, I spent 2 years with just raw mkv rips on the server...watching as 50TB dropped to 3TB free, and that's when I came back into the fold with Don.

By the way... anyone who is re-ripping. For the love of all that's holy, grab the subs. You may not need them now, but you will eventually! I also store every single rip on portable USB drives that get stored in my safe. I will NOT be re-ripping again, ever.

@donmelton I crossed the 1000 movie mark last Wednesday with Kurosawa's Seven Samurai. I didn't plan it, but it happened to line up nicely.

Meanwhile, back at the point: Don, I'm going to do some test encodes tonight and an A/B test tomorrow. I'll withhold comment until then, but I suspect that it's going to be a thumbs up from me.

klogg416 commented 5 years ago

@khaosx I am just going to leave this here. Recommended.

khaosx commented 5 years ago

@klogg416 Thanks man! I look forward to watching it after I finally get the kids down. Stupid time change.

lisamelton commented 5 years ago

@khaosx Oh yes, grab the subtitles when you rip!

Ripping over 1,000 titles means you definitely have some kind of evil habit now. :)

And thanks for testing! I look forward to your opinion!

@klogg416 That's an awesome video! I'll be watching after dinner tonight. Thanks!

khaosx commented 5 years ago

Ripping over 1,000 titles means you definitely have some kind of evil habit now. :)

It's been there for a while, man. I started this nonsense when you still had the whole thing in BASH because Andy and Rene made you their pick of the week on Macbreak Weekly. It's not at all a stretch to say that you are the only reason I can do more than Hello World in BASH :)

lisamelton commented 5 years ago

@khaosx Oh god. I've corrupted yet another soul. :)

klogg416 commented 5 years ago

I started this nonsense when you still had the whole thing in BASH

Same, but it was Vector 22 with Rene. Still BASH though.

khaosx commented 5 years ago

One of us...one of us...one of us...

klogg416 commented 5 years ago

@khaosx @donmelton

On the off chance that either of you hasn't burned through the entire Every Frame a Painting channel, twice, and you should, then I have one more piece of homework to assign. Jackie Chan - How to Do Action Comedy. It will ruin you on modern action movies, but totally worth it.

lisamelton commented 5 years ago

@klogg416 @khaosx The funny thing is that --avbr is actually me "resurrecting" that original ratecontrol system I described in that podcast with Rene. :)

lisamelton commented 5 years ago

@klogg416 No, I haven't seen everything on that channel. And that's great! Thanks, again! More after dinner video time tonight. :)

klogg416 commented 5 years ago

@donmelton

The funny thing is that --avbr is actually me "resurrecting" that original ratecontrol system I described in that podcast with Rene. :)

Now I need to decide if I am going to watch another movie tonight, do the nostalgia podcast trip, or A/B test audio. It definitely isn't going to be A/B test, but lists should always have 3 elements...

khaosx commented 5 years ago

@klogg416 If you want the whole script, I'll DM you the gist address for it. Not going to pollute Don's issues list with it (we really need that wiki!), but you might find some useful tidbits. I'm khaosx in your twitter followers.

lisamelton commented 5 years ago

@khaosx @klogg416 Not only do we really need that Wiki, but I was thinking a Slack or Discord channel would be great. Which would you prefer and I can set one up for all of us this week?

khaosx commented 5 years ago

@donmelton I vote slack, but I'm ok with either.

This is your way of saying "Khaosx, you talk too damn much", isn't it?

lisamelton commented 5 years ago

@khaosx LOL! No, it's because I talk too damn much. :)

klogg416 commented 5 years ago

@khaosx followed.

3 followers (and two who aren’t bots!), look at me showing off.

lisamelton commented 5 years ago

@khaosx @khaosx I've already followed both of you on Twitter, right? If not, I can rectify that now.

lisamelton commented 5 years ago

And anyone else on this long-ass thread, too!

khaosx commented 5 years ago

@khaosx @khaosx I've already followed both of you on Twitter, right? If not, I can rectify that now.

That's a negative, boss!

klogg416 commented 5 years ago

@donmelton I vote for Slack because I use it already, but I am ameniable to kicking the tires on discord too. Whatever the majority wants.

lisamelton commented 5 years ago

@khaosx What's your Twitter handle? Just "@khaosx?"

lisamelton commented 5 years ago

@khaosx @klogg416 I would vote for Slack as well since I'm running that all the time anyway. :) But let's wait to hear from the rest of the crew.

khaosx commented 5 years ago

@khaosx What's your Twitter handle? Just "@khaosx?"

Yep. That's me.

lisamelton commented 5 years ago

@khaosx Followed! And you have a lovely significant other, sir.

khaosx commented 5 years ago

@khaosx Followed! And you have a lovely significant other, sir.

She blushed and said "Doh!". And then said "Can you please sign off and come watch this show?".

G'night folks!

lisamelton commented 5 years ago

@khaosx G'night! :)

klogg416 commented 5 years ago

@khaosx have a good one, thanks for the gist.

skj-dev commented 5 years ago

@donmelton

I was thinking a Slack or Discord channel would be great. Which would you prefer and I can set one up for all of us this week?

I'm cool with Slack. I too am running it all the time anyway. 😸

lisamelton commented 5 years ago

@ttyS0 Great! That's four of us now. :) Y'all seemed like a Slack crowd anyway knowing some of your professions.

RodBrown1988 commented 5 years ago

👍 from me. I definitely agree with your reasoning, and can’t see why this would be an issue. I’ll admit I haven’t tested this yet, but I plan to a little later today.

I sense a lot of these small advances are just a matter of time, both on the video and audio front, waiting for support for settings to flow through and gain critical mass. This one seems ready to go.

lisamelton commented 5 years ago

@RodBrown1988 Thanks for the feedback and the testing! Let me know what you think of it when you do.

Yeah, this technology is ready for deployment.

vr8hub commented 5 years ago

Good grief, don't you people take a day off?

I have no opinion about the change, mainly because I don't know enough yet to say one way or the other. And I am not nearly (yet?) as into "hey, let's re-transcode everything this weekend" as the rest of the group.

(Although I've used these scripts, at least occasionally, since the bash(!) days, I was a silent stalker until a month or so ago. As I've noted already, some of the first words to me were "use the defaults, they're great!". And then we've spent the last month changing all of the defaults. I'm just waiting for the dust to settle. :) )

I would probably lean towards Slack, but I have no strong feelings one way or the other.

The Kurosawa and Chan videos were great, mainly because they involve watching Kurosawa's work and Chan for 8 minutes each. I'm good with anything that involves that.

lisamelton commented 5 years ago

@vr8hub I'm retired, so I never take a day off. :)

Hang around with all of us long enough and we'll make you crazy enough to wear out your CPU transcoding!

And you're right, we keep changing the defaults. It's all my fault, really. I just can't leave well enough alone.

I think that's five or six votes for Slack now. And none for Discord. Interesting. I think the only group chat I do on Discord is my World of Warcraft guild. Everything else is on Slack. Of course, I like to record podcasts with Discord. Because otherwise I would have to use Skype. And nobody wants that.

Yes! The Kurosawa and Chan videos were great! For exactly those reasons. It also reminded me that I don't have near enough of their films in my video collection. Dammit. :)

RodBrown1988 commented 5 years ago

@donmelton I don’t think this is really an issue. This is iteratively improving a great thing to be an even better thing. It’s not like our previous transcodes are any worse off.

The problem is for us masochists, we hold ourselves to a high standard, and ever seek to make things more perfect. We suffer so others benefit! 🤣

lisamelton commented 5 years ago

@RodBrown1988 LOL! That's the spirit! :)

RodBrown1988 commented 5 years ago

@donmelton I vote for Slack too. Would compliment work and additional side projects I have.

lisamelton commented 5 years ago

@RodBrown1988 Apparently Slack is even more popular than I thought. Thanks.

RodBrown1988 commented 5 years ago

From my testing, can't tell a difference. My ears aren't perfect but +1 from me.

chrispoole643 commented 5 years ago

Change sounds good to me. I've long had my scripts set to use AAC only for 2ch sources, and otherwise just copy the source AC3, or convert to AC3... does the job for me.

If I were to switch to using DD+ for >2ch audio, my main consideration is where it works... I use Plex, with the server on an RPi3. Usually watch on the Plex Apple TV app, sometimes Plex for iOS. AC3 works fine here (from the RPi3, even 1080p), because it just pushes the raw bits across with no transcoding. If DD+ can do that also, I'd happily switch.

Oh, and Slack sounds great!