Loss of audio quality in Shotcut?

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?


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

Shotcut (or rather the MLT engine) does set a channel layout that defaults to the most sensible for the number of channels (mono for 1, stereo for 2, and 5.1 for 6).

1 Like

@shotcut, @Austin

Exporting Opus out of Shotcut defaults to 16 bits. How do I get it to export to 24 bits or 32 bits? Youtube’s Opus encodes are 32 bits.

When I export using the “WebM VP9” preset, the Opus stream is fltp format which is 32-bit. What steps are you doing to produce 16-bit?

If you’re referring to swresample messages in the log, those usually mean it is doing rate conversion on an input file, which is a separate issue than the bit depth that’s actually being exported.

If you want to force 32-bit for sure, add this line to Export > Advanced > Other:
(without the “p” on the end)

1 Like

Custom preset. Here’s what’s written for the audio in the preset box:

It’s in matroska if that matters.

Thanks. Is there 24 bit for Opus just to know?

I don’t see a “p”. :upside_down_face:

“fltp” (the format name) vs “flt” (the option)


I’ve just tested a matroska container with libopus (32bit) upload to YT. I’m a complete noob to this but what is the advantage here if YT re-encodes to Opus regardless of initial codec used in the export anyhow?

Not supported by ffmpeg at least.

ffmpeg -h encoder=libopus

The supported formats are s16 and flt.

The advantage is audio that’s exported with greater dynamic range and more detailed quality. If a project has 24-bit audio sources but is exported as 16-bit, a lot of information is unrecoverably lost during export.

As for codec choice, the stakes are a lot lower if all codecs are given enough bitrate to reach transparency. However, if the export bitrate is lower than the transparency rate, then Opus will provide better detailed audio in that constrained bitrate than other formats would. So it provides better sounding audio to YouTube, which will make a better sounding transcode.

The other advantage is that transcoding Opus to Opus will usually sound better than transcoding other lossy codecs to Opus. This is because Opus to Opus has alignment in the details that are thrown away to reduce bitrate, which leaves fewer parts of the spectrum impacted. But, for example, if an AAC export reduces one part of the spectrum while YouTube’s transcode to Opus reduces another part of the spectrum (by nature of these being different reduction algorithms), then there is a cumulative loss effect that is usually more easily detected by the human ear.

As expected, sending lossless audio like WAV or FLAC or ALAC to YouTube will of course produce better quality than sending Opus audio. Opus is a good option when there are bitrate limits that prevent lossless masters.


Bookmarked and will be my new workflow

@Austin, what do you type to export FLAC and ALAC as 32-bit?

Good question, as this can be easily misleading… :grinning_face_with_smiling_eyes:

ffmpeg -h encoder=flac

Encoder flac [FLAC (Free Lossless Audio Codec)]:
General capabilities: delay small
Threading capabilities: none
Supported sample formats: s16 s32

ffmpeg -h encoder=alac

Encoder alac [ALAC (Apple Lossless Audio Codec)]:
General capabilities: small
Threading capabilities: none
Supported sample formats: s32p s16p
Supported channel layouts: mono stereo 3.0 4.0 5.0 5.1 6.1(back) 7.1(wide)

At first glance, the answer would be sample_fmt=s32 for FLAC and sample_fmt=s32p for ALAC. However, these represent the FFmpeg internal processing space, not the bit depth written to the actual file.

These messages appear in the conversion logs:

ffmpeg -i input.wav -sample_fmt s32 output.flac
[flac @ 0x744e2c0] encoding as 24 bits-per-sample

ffmpeg -i input.wav -vn -c:a alac -sample_fmt s32p output.mov
[alac @ 0x6a31500] encoding as 24 bits-per-sample

FLAC and ALAC both write 24-bit files to disk despite data being processed in 32-bit.

See also:

Also from the FLAC file format specification: https://xiph.org/flac/format.html

METADATA_BLOCK_STREAMINFO: (bits per sample)-1. FLAC supports from 4 to 32 bits per sample. Currently the reference encoder and decoders only support up to 24 bits per sample.

So basically, FLAC and ALAC don’t do 32-bit. They only go as high as 24-bit?

So if I had a 32-bit audio source and I wanted to archive it I would have to accept that data will be lost when archiving it in FLAC or ALAC.

So what to do? Is WAV the only option to save lossless at 32-bit? WAV has a file size limit so then you would have to break them up in multiple WAV files for one audio source to save it at 32-bit?

Is there no compressed lossless audio codec option for 32-bit?

For now, yes.

The FLAC and ALAC file formats allow up to 32-bit integer (but not float).

However, the FLAC and ALAC encoders available in FFmpeg only write up to 24-bit integer. Same for the FLAC and ALACconvert reference encoders. So we are limited by the code implementations, not by the actual file format specifications. There is hope that the code could be updated to support 32-bit in the future.

Yes. However, this is usually not a big deal.

A 24-bit file has 144 dB of dynamic range, which goes well under the noise floor of most digital to analog converters. The extra precision from 24-bit to 32-bit is currently undetectable to the human ear (due to DAC limits), which is why major labels generally don’t waste disk space delivering music in 32-bit format to consumers.

The 32-bit space is generally used as a processing safeguard during mixdown so that multiple 24-bit tracks can be summed together without the risk of clipping. Then this “overloaded” file can be shared between DAWs or effects processors without introducing any distortion. However, by the time final dynamic compression has contained the signal to a good-sounding range, it will fit within 144 dB and then it can be exported as a 24-bit master with no loss. Mathematically, it’s possible for the 32-bit file to have more audio data than a 24-bit file. But in reality, few DACs could reproduce that data in any meaningful way. (And you would probably go deaf if one did.)

Assuming your 32-bit sources are finalized material and not some mid-project “overloaded” dumps, there shouldn’t be any meaningful loss from saving the files as 24-bit. But as always, do binary comparisons or blind A/B/X tests to verify.

The 4GB limit has spun off at least four extensions to the WAV format. Here’s a brief description of them so you can pick and choose as needed to fit your acquisition, editing, and playback tools:

Sony Wave64

Shotcut settings: Format=w64, Codec=pcm_s24le
FFmpeg command line: ffmpeg -i in.wav -c:a pcm_s24le -f w64 -y out.wav
Format specification: https://www.ambisonia.com/Members/mleese/sony_wave64.pdf/sony_wave64.pdf
Note: Using pcm_s32le (integer) or pcm_f32le (float) still gets written to disk as 24-bit integer.
Note: Supported by most DAWs like Cubase, Reaper, etc

RF64 (EBU Tech 3306)

Shotcut settings: Format=wav, Codec=pcm_s24le, Other: rf64=auto
FFmpeg command line: ffmpeg -i in.wav -c:a pcm_s24le -rf64 auto -f wav -y out.wav
Format specification: https://tech.ebu.ch/docs/tech/tech3306v1_1.pdf
Note: Using pcm_s32le (integer) or pcm_f32le (float) still gets written to disk as 24-bit integer.
Note: Successor to Sony Wave64. Also recognized by most DAWs.

BW64 (ITU-R BS.2088)

Shotcut settings: not available in FFmpeg
FFmpeg command line: FFmpeg can read but not write
Format specification: https://www.itu.int/dms_pubrec/itu-r/rec/bs/R-REC-BS.2088-1-201910-I!!PDF-E.pdf
Note: Successor to RF64. But it’s relatively new and still gaining support in a lot of audio tools.


Shotcut settings: Format=wv, Codec=wavpack, Other: compression_level=4
FFmpeg command line: ffmpeg -i in.wav -c:a wavpack -compression_level 4 -f wv -y out.wv
Note: Using s32p or fltp still gets written to disk as 24-bit integer.
Note: The format and extension is WV not WAV.
Note: Compression is lossless and is basically the same as running the Wave source through WinZip. All algorithms used are open source and royalty-free.
Note: Compression level description: WavPack User Documentation
Note: Compression level comparison: Wavpack vs FFMPEG Wavpack
Note: FFmpeg muxer details: FFmpeg Codecs Documentation
Note: FLAC at compression_level=12 will have significantly faster runtime and smaller file size output compared to WavPack.

Through FFmpeg/Shotcut at 32-bit… not to my knowledge.

If you’re willing to step outside of FFmpeg, then WavPack can do compressed 32-bit in both float and integer. It has a surprising amount of commercial DAW support, too.

For archiving or scripting, download WavPack as a standalone executable at its home page and run it against your audio files similar to an FFmpeg command line conversion:


Regarding the still-prevalent RF64 format to get around the 4GB file size limit… someone might ask if adding rf64=auto to the Other tab of every WAV-based Shotcut export preset is a good idea. I would think it is. Files under 4GB will retain the usual WAV structure. Files over 4GB will have their headers rewritten to the RF64 structure. It’s a good way to make sure the exported audio is compliant and playable, especially when 5.1 surround sound explodes the file size. Otherwise, FFmpeg will write data beyond 4GB that will be inaccessible to some other audio programs.

1 Like

This topic was automatically closed after 90 days. New replies are no longer allowed.