lisamelton / other_video_transcoding

Other tools to transcode videos.
MIT License
544 stars 25 forks source link

Lower default target bitrates #89

Closed lisamelton closed 3 years ago

lisamelton commented 3 years ago

My plan for the next version of other-transcode is to lower default target bitrates in order to significantly reduce the size of transcoded output at the risk of a slight reduction in perceived quality.

AVC/H.264 video:

Resolution old new
1080p (Blu-ray video) 8000 Kbps 6000 Kbps
720p 4000 Kbps 3000 Kbps
480p (DVD video) 2000 Kbps 1500 Kbps

HEVC video:

Resolution old new
2160p (4K video) 12000 Kbps 8000 Kbps
1080p (Blu-ray video) 6000 Kbps 4000 Kbps
720p 3000 Kbps 2000 Kbps
480p (DVD video) 1500 Kbps 1000 Kbps

Dolby Digital Plus (Enhanced AC-3) audio:

Channels old new
Surround 640 Kbps 384 Kbps
Stereo 256 Kbps 192 Kbps
Mono 128 Kbps 96 Kbps

Note: There will be no changes to default target bitrates for Dolby Digital (AC-3) and AAC audio formats.

Other changes in other-transcode will include:

As of now, none of these changes has been pushed to the source hosted on GitHub. Until those changes are live or the next version of other-transcode is released, you can easily try the lower target bitrates using existing options.

For AVC/H.264 video, add this to your command line:

--target 1080p=6000 --target 720p=3000 --target 480p=1500 

For HEVC video:

--hevc --target 2160p=8000 --target 1080p=4000 --target 720p=2000 --target 480p=1000 

For Dolby Digital Plus (Enhanced AC-3) audio:

--all-eac3 --surround-bitrate 384 --stereo-bitrate 192

Please let me know what you think. Thanks.

khaosx commented 3 years ago

I've been testing these settings for a couple of days now. The reduced bitrate still sounds great on my TV's, as well as in my theater. At this point, I've transcoded about 22 movies and I've been happy enough with the results that they're my new standard settings. If anyone has any questions, I'm happy to answer as best I can.

weaverm commented 3 years ago

Do you have any examples of movies where one might consider bumping the bitrate higher than the new default is warranted? What about examples where the new defaults really shine?

I ask because as a Mac user, making a 10-bit HEVC is a deliberate, overnight act for me. It was the movie The Edge of Seventeen that really drove me to learn about color banding, h.265, and all of that. Once I figured it out, I was pleased with the results, despite the 14,720 seconds it took to get there. The output from current bitrates is a known quantity for me. A couple of good examples are worth encoding both ways to see if I can tell the difference.

As another example, I set the target to 3000 when I was transcoding my blu-rays of Rick and Morty. One could probably even get away with even smaller bitrates for it. I understand that lower bitrates are often imperceptible.

lisamelton commented 3 years ago

@weaverm I haven't seen any examples yet where a higher target bitrate is warranted. And I've transcoded over 800 videos using the new defaults, including difficult titles like "Saving Private Ryan (1998)."

One example where the lower defaults shine is a title like "Blade Runner 2049 (2017)" since it literally looks identical to the higher bitrate version. Seriously, I can't tell the difference.

And, yes, you can certainly lower your targets even more and still get good results, especially for animated films. For HEVC, I've transcoded dozens of 1080p videos at 2500 Kbps and they still look great. I wouldn't go much lower than that with hardware encoders though.

lisamelton commented 3 years ago

The implementation of this feature has now been pushed to the source hosted here on GitHub so you can download other-transcode and try it out before it's released.

weaverm commented 3 years ago

I encoded Blade Runner 2049 last night using a target of 4000. other-transcode --hevc --x265 --mp4 --target 4000 --main-audio 5 /path/Blade\ Runner\ 2049.mkv After watching the first 15-ish minutes, I can't tell a difference, at least on my 27" iMac screen. I doubt I will see a difference on my OLED either.

An interesting side note. According to the logs, my original encode took 18,096 seconds at an average fps of 13.02. The target 4000 encode took 15,666 seconds at an average fps of 15.04. The roughly 40 minutes of wall clock time saved is unexpected.

lisamelton commented 3 years ago

@weaverm Thanks for testing! 👍

The performance increase you're seeing is due to 1) less output I/O and 2) less calculation to fit the target bitrate.

BTW, there is no need to specify both --hevc and --x265. Using the x265 software encoder automatically selects HEVC output.

lisamelton commented 3 years ago

I've just released version 0.7.0 with this change.

vasuvasu commented 3 years ago

@donmelton What're the audio passthru thresholds? I just upgraded to 0.8.0, and had an input file that had a 768 Kbps eac3 source track and it still copies, even if I set --eac3 --surround-bitrate 384.

I don't mind it copying, but was curious if it's looking for a threshold to consider transcoding audio?

lisamelton commented 3 years ago

@vasuvasu There is no default limit on the passthrough bitrate for surround audio in AC-3 or DD+ (E-AC-3) format. However, you can easily change that with the --limit-ac3-surround option. The --help more text reads:

    --limit-ac3-surround
                    don't copy surround audio in AC-3 format
                      when orginal bitrate is above transcoding bitrate

Does that answer your question?

vasuvasu commented 3 years ago

hmm I'm confused. The input track is in 768Kbps eac3 (DD+) so there's no old school AC-3 involved anywhere, so that --limit-ac3-surround option wouldn't apply in this situation right?.

If I just set --eac3 then the 768Kbps eac3 track is copied, not converted down to the new lower default of 384Kbps, as mentioned in this thread and the changelog.

If I'm more explicit and say --eac3 --surround-bitrate 384 then it still copies the 768Kbps track.

I'm confused about where the new 384Kbps eac3 default comes into play then?

vasuvasu commented 3 years ago

ok never mind, I was reading --limit-ac3-surround and it's description literally so I thought it had no applicability here since I was in an eac3 setting. I just tried it and now it's doing what I expect, so this applies to ac3 and eac3.

So will an input file with eac3 track always get copied by default, but the 384Kbps transcode kicks in when it's a file with a DTS track?

lisamelton commented 3 years ago

@vasuvasu Yes, the--limit-ac3-surround option applies to both AC-3 and DD+ (E-AC-3) formats. My apologies for the confusion, but DD+ is technically AC-3, just an enhanced version.

An audio track is always transcoded when its format or bitrate are outside the default or user-augmented parameters. Which, by default, means that DTS, DTS HD, TrueHD, PCM, etc. are always transcoded.