Loss of audio quality in Shotcut?

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

So what’s the difference between libopus and opus in the Codec list in Export? I imagine that libopus is FFmpeg’s recreation of opus so what’s opus on the list for?

And is Opus good for multi-channel like 5.1?

History:

  • February 2011: The Opus bitstream format neared the end of development and was tentatively frozen.

  • July 2011: Mozilla wanted to get a jump on having code to implement Opus, so the “opus” encoder began.

  • … a year goes by …

  • September 2012: The official Opus working group that defined the format released the “libopus” reference encoder.

“libopus” has had a few revisions over the years, but the underlying bitstream format for Opus hasn’t changed since 2012. FFmpeg bundles the “libopus” reference encoder. They didn’t have to write it themselves.

“libopus” is now the default Opus encoder in ffmpeg, and it is excellent. “opus” is still included, but it is considered experimental and requires a strict flag to access it. It was (is still?) also generally considered to be not as good at low bitrates.

Yes, for personal use. It supports up to 7.1. But No if the goal is playback on hardware devices or general widespread compatibility. The format is technically great for surround sound. But not many hardware players and commercial tools support it. So it all depends on whether your tools and workflow can handle it.

If encoding beyond stereo, the channel layout must be specified in the call to ffmpeg:

-filter:a aformat=channel_layouts=5.1

1 Like

Is setting the channels to 5.1 in the Shotcut export enough to make libopus 5.1?

It will be 5.1, but I haven’t tested whether the channels will be mapped to the proper places (as in, left and right won’t get swapped). Opus is based on “Vorbis order of channels” which is different from other formats, and is why a layout has to be specified to get the proper mapping. Since Shotcut is probably specifying 5.1 layout during the export, it will probably work fine. But I haven’t tested it to be sure.