Lossless Export, same as source

I don’t understand. What’s wrong with letting LosslessCut be 100 frames early, then trim out those 100 frames when the clip is added to the Shotcut timeline? The final video is going to be re-encoded anyway, so it doesn’t hurt to trim in Shotcut.

Here’s the math that some other programs use to determine what export settings will generate a same-size file:

Let’s say the source video is one hour long and 1.0 GB in size for round numbers.

Convert hour to seconds: 1 h * 60 min * 60 sec = 3,600 sec

Convert GB to bits: 1.0 GB * 1,000 MB * 1,000 KB * 1,000 bytes * 8 bits = 8,000,000,000 bits

Divide bits by seconds to get total file data rate: 8,000,000,000 bits / 3,600 sec = 2,222,222 bits/sec

This is the total data rate of video and audio together.

Now let’s assume the audio was stored as stereo 448kbps per channel AC-3. The total data rate for audio becomes 448 kbps * 1,000 bits * 2 channels = 896,000 bits/sec. Subtract this from the total file data rate of 2,222,222 bps to get a remainder of 1,326,222 bps dedicated to video.

Source file statistics so far:

Video: 1.3 Mbps
Audio: 448 kbps per channel

These numbers can sometimes be found directly in a file properties page, like in Windows Explorer right-click Properties.

With these numbers, we can now set our values on the advanced Export page to have Shotcut create a file with the same size as the original. There are two ways to do this:

  1. On the Codec tab, use Average Bitrate rate control and set the video bitrate to the number above.
  2. On the Codec tab, use Constrained VBR with the video bitrate set to the number above, the buffer size set to whatever creates one second of buffer, and quality at 68%.

For both, use GOP at 240 and B-frames at 8 to help get the smallest resulting file size.

And naturally, set the Audio tab to whatever audio settings were used by the source.

Now, the exported file will be very close in size to the original. If the source file was a stream capture or a DVD/Blu-ray rip, then the quality will be similar (assuming the same codec is used), since those sources tend to be constant bitrate encodings just like our encoding.

Quality and size are opposing goals. More quality requires more size. Less size requires less quality.

Recent films are streamed or encoded to Blu-ray using pretty high constant bitrates. High quality streams are 6 GB per hour and Blu-ray maxes at around 17 GB per hour. I don’t think most people would classify these files as small.

Particularly with streaming, there are lower-quality settings available, usually around 1 GB per hour, but playback on a large TV reveals noticeable quality differences.

Regardless, the key difference is those mediums use Constant bitrate instead of Variable bitrate (the Shotcut default). If a Constant bitrate video is analyzed closely, the quality takes a very noticeable drop in scenes that have lots of movement where the data rate can’t keep up with all the changes in the image. Smearing, blockiness, banding, etc are readily visible if doing a freeze frame, but not so visible if frames flash by at real-time. These compression algorithms are aware of what the human eye can detect and they know the eye can’t study detail when objects are moving fast on the screen. Codecs save bitrate by allowing more artefacts to appear in areas the eye can’t study in time.

However, Variable bitrate mode (the Shotcut default) is not constrained to a bitrate like a physical Blu-ray disk that’s spinning and has an implied maximum bitrate due to the motor’s top speed. Variable bitrate is allowed to take all the disk space it needs to encode at a given quality target.

Summary: If the goal is to keep generational loss to a minimum, then VBR at a visually lossless setting like 64-68% is the way to go. If the goal is to be “good enough” and retain the same file size, then Average Bitrate is probably a better way to go.

The beauty of Shotcut and these codecs is that they can be customized exactly to a project’s needs. It’s an enormous amount of control given to the user that isn’t offered by a lot of other programs.

I’m guessing that you’re referring to the Export tab that determines what area of Shotcut is being exported. It’s possible to export directly from the Source window to do a direct transcode of a video without creating a timeline for it. This does not borrow export settings from the source file. Export settings are still set the same as with a timeline project.