Loss of audio quality in Shotcut?

That’s a very good point though. I didn’t realize that. Thanks for bringing it up.

So is AC-3 just all around superior to AAC? Is the only thing that AAC is good for is that it’s the codec that some devices uses and sites like youtube?

Are these issues you mentioned for AAC even worse on MP3? Is MP3 still preferable over AAC for something?

1 Like

It’s more of an economics question than anything. AC-3 is gentler about modifying the source for the sake of better compression. Here’s the tradeoff:

Delivery services like iTunes and YouTube want the data rate as low as possible for a “good enough” sound because they pay for network bandwidth. So, at 128kbps and lower, AAC can sound better than AC-3 in many cases. (“Sounds better” doesn’t imply it “measures better” on a graph.) The abrasive reduction of AAC helps the “meat” of the sound fit into the tiny 128kbps allocated to it. Meanwhile, AC-3 isn’t as aggressive about shaving the “inaudible” range, which leaves the overall sound (meaning the recognizable core elements) to be compromised to fit the 128kbps cap.

However, as soon as a decent bitrate is given to both codecs, AC-3 pulls ahead for a clear win. The transition is somewhere between 256 and 384kbps. But no delivery service wants to pay 2x to 3x the network bandwidth price for a quality difference that the average consumer wearing ear pods in traffic will never notice.

Regarding compatibility, AC-3 is older than AAC and baked into a lot of standards. If a device supports AAC, there is a 99.9% chance it also supports AC-3.

Here’s where the economics get dumb, though. Opus is arguably better than all of them (AC-3, AAC, MP3). Even YouTube uses Opus for its high-quality VP9 encodings. However, Opus can’t be put in an MP4 container, so a lot of applications won’t use it. What’s dumb is that Opus fits in a Matroska container just fine, and Matroska is free and open source too. So we would think that every penny-pinching corporation (read: Apple) would be all over MKV+Opus for audio delivery. But nope. And I have no idea why not, except for “Not Invented Here Syndrome”.

MP3, being older than AAC, has a less sophisticated and gentler psychoacoustic model than AAC. Given sufficient bitrate, MP3 will actually sound better than AAC. At low bitrates, AAC probably wins again.

For high-quality audio encoding in FFmpeg, this wiki is a gold mine of information:
Encode/HighQualityAudio – FFmpeg

Basically, the popularity of AAC comes down to “make it sound good enough that nobody complains about music at 128kbps”. The popularity is forced down from service providers dodging network fees rather than forced up from consumers demanding quality. Simple as that. “Audiophile quality” was never a design target of AAC regardless of what the marketing department says.

Also regarding forced-down popularity… I could be wrong about this, but I recall thinking that AAC enabled some newfangled digital rights management options that gave service providers more control over distribution than AC-3 did. Obviously, the providers would opt for AAC over AC-3 to protect their cash flow. I’ve never used those options in my encodes, so I’m not familiar with all those details.

5 Likes

I think you may have answered your own question.

As I recall, when iTunes first came out and was all the rage, the big advantage it had was an aggressive implementation of digital right management. This enabled Apple to get content that owners of the digital rights would not sell, for streaming and similar, to anyone else.

It is even possible that Apple is locked into contracts that prevent it from supporting codecs that cannot support DRM.

1 Like

That makes sense for iTunes. But last time I checked, the built-in Music app (which is supposed to play music from SD cards holding user-loaded material) does not support Opus either. What I don’t understand is why Apple doesn’t support Opus for material outside of iTunes that has no way of hurting their income stream or distribution contracts.

1 Like

I’m just doing the same cui bono analysis I did for a three-letter agency years ago. I could be wrong.

The huge firms that make all of their money on DRM want Opus to die.

Apple wants to stay friends with the huge firms that control 90%+ of the worlds DR.

A “gentlemen’s agreement”.

1 Like

Thanks for the heads up. Answer is yes:

source: Importing audio streams from videos? - Cockos Incorporated Forums

Seems like AVIDemux has to join the chain of programs for my purpose.

Related to this, is there any way to passthrough the audio in Shotcut?
maybe by changing some command in the export preset?

1 Like

Pass through is not supported
https://shotcut.org/FAQ/#how-do-i-cut-or-trim-a-clip-without-encoding-or-transcoding-it

1 Like

Thank you for the reply.

Possibly. There are two alternatives if you want to avoid a new tool:

  • Your original workflow was 95% perfect. It’s still possible to edit audio in Reaper, export as WAV/PCM instead of AAC, import audio into Shotcut, edit video in Shotcut, then do the final export from Shotcut. This method doesn’t involve any new tools at all.

  • If you prefer to edit audio in Reaper by matching it to the video exported from Shotcut, then it’s possible to use ffmpeg instead of avidemux. ffmpeg comes bundled with Shotcut, so there’s nothing extra to install. A command that would work for your scenario is:

ffmpeg -i "VideoFromShotcut.mp4" -i "AudioFromReaper.wav" -map 0:v -map 1:a -map_metadata 1 -map_chapters 1 -c:v copy -c:a ac3 -b:a 640k "RemuxedMovie.mp4"

This command takes only the video from stream #0 (the first -i file), only the audio from stream #1 (the second -i file), preserves video with no re-encoding (-c:v copy), compresses audio with AC-3 640kbps (-c:a ac3 -b:a 640k), and puts the result in RemuxedMovie.mp4.

ffmpeg.exe can be found in the Shotcut installation folder.

Thanks for getting back to me. In fact I wanted to avoid a new tool.

This could be the solution:

It is not important for me to edit audio in Reaper by matching the exported video from Shotcut, the original unedited video is all that’s needed for this.

Just to be sure, workflow should be now:

  1. Edit audio (with unedited video as guide) in Reaper, export audiofile only (as WAV, sample rate 44100)

  2. Edit video in Shotcut, then import WAV file on seperate audio track (audio track from video → muted)

  3. Final export from Shotcut
    audio settings:
    sample rate: 44100
    codec: ac3
    rate control: avarage bitrate
    bitrate: 448kb/s

Correct?

One more question:

When a video (post editing) has been exported from Shotcut once, and will be loaded again in Shotcut just for matching with a new audio track (with no further video editing), will the video quality be affected when rendered a second time?

Just wanted to confirm that it worked in the way as stated above, audio sounds like it should be!

Thanks Austin and all of you guys for the great support :+1:

1 Like

Assuming the source files are 44100, then yes. The important thing is to have the same sample rate from source to export.

If there is any chance the MP4 file will be saved to a USB stick and plugged into a TV or Blu-ray player for viewing, then 448 is a good choice. If the video is going to YouTube only, then 640 offers a little more quality buffer for surviving another generation of transcoding by YouTube.

Depends on the format of the first export. If it was lossy like H.264 or H.265 or VP9 or AV1, then yes, quality would be significantly affected. If the first export was an intermediate format like ProRes 422 HQ or DNxHR HQ, or a lossless format like Huffyuv or Ut Video, then no, quality would not be affected.

However, why would the exported video be brought back in? Why not reopen the original project file and add new audio tracks to it? Zero generational loss and minimal export time.

Glad you finally got the results you were looking for.

1 Like

Honestly, because I had to apply a workaround for a small problem when using two specific Shotcut filters in a row. Probably a beginner’s mistake, and actually a bit off topic. I would have to post pictures to illustrate. I don’t want to break the forum rules, can I post it here in this thread?

I doubt anyone would complain about rules. However, a separate topic might be good just in case an interesting solution pops up that warrants its own discussion and solution.

1 Like

Emil, check out Ben Espanto’s tutorial on “chaptering”: https://www.youtube.com/watch?v=RmMV6kJVRp8

This approach was super helpful to me to allow me to apply a series of effects and combine videos … without re-encoding each time and losing quality.

Austin, thank you for the excellent information on audio codecs! I knew some of this in bits and pieces, but I feel like my understanding has taken a giant leap forward by reading your responses in this thread.

1 Like

Just to be clear, it was FFMPEG’s version of E-AC3 that had this problem and not Dolby’s?

Thanks a lot for this tip because I wasn’t aware. :smiley: So basically whenever possible use Opus rather than AC-3?

Is that also the reason why the big proprietary video editors like Premiere Pro, Final Cut and Resolve don’t accept matroska?

Correct. Dolby works fine.

That would be my strategy, although it often requires a Matroska container. Opus can’t be put into MOV or MP4, which can be a limiting factor for some workflows and programs. Technically, ffmpeg can cram Opus into MP4, but a lot of media players will be like “Wuuuuhhh” and nothing will play.

I wish I understood all their decisions, but I don’t. There’s probably a money trail that traces back to the patent pools on those formats in there somewhere. The format designers have to recover R&D costs somehow, and make a modest 1,000,000% return on investment.

1 Like

Big money.

Either the format designers, or the powers-that-be who coordinate with big commercial codec designers to inseparable entwine DRM into the codecs (Digital Rights Management, not our friend here. :laughing:)

Then there is power.
Imagine a world where all of the news is videos which have been edited by the same products and powers that produce CGI for commercial movies. Imagine such a world where the only video editing software was that which comes from big commercial houses, with a license that requires an eavesdropping internet connection back to “those who protect your wellbeing”.

Within the past year I was involved in a project using Shotcut to produce videos for four coordinated local law enforcement agencies (who were coordinating with the state Attorney General but not with the Governor), to produce videos about choreographed violence at political events. The project was shut down by…

Power. Control of codec licenses, control of video editing software licenses to enforce the licensing of codecs, control of video editing, control of information, control of “the truth”.
Power.

1 Like