HandBrake

From miki
Jump to navigation Jump to search

HandBrake is a powerful, yet easy to use video encoder for Linux.

Links

Tips

Encode a DVD title

  • Click Source.
  • Select DVD to encode, and select folder VIDEO_TS (don't open it), and click OK.

Benchmarks

  • Movie: Bad Teacher
  • All Audio.
  • All Subtitles.
Version PC CPU Freq S/C/T Encoder Preset Level Quality Encoding speed Video bitrate track0 (video) size Comment
Xenial zacxl0005 i5-4300U 1.90GHz 1/2/4 H.264 veryfast 4.0 20 (RF) 135.4 fps 983.24 kb/s 658 MB No decomb
Zesty zacxl0005 i5-4300U 1.90GHz 1/2/4 H.264 fast 3.1 20 (RF) 50.4 fps 1174.29 kb/s 786 MB Fast
Zesty kraken X5650 2.67GHz 2/6/6 H.264 fast 3.1 20 (RF) 163.9 fps 1151.50 kb/s 771 MB Fast
Zesty kraken X5650 2.67GHz 2/6/12 H.264 fast 3.1 20 (RF) 177.9 fps 1151.50 kb/s 771 MB Fast
Zesty kraken X5650 2.67GHz 2/6/12 H.264 veryfast 4.0 22 (RF) 332.8 fps 654.67 kb/s 438 MB Very fast, No decomb
Zesty kraken X5650 2.67GHz 2/6/12 H.264 veryfast 4.0 22 (RF) 351.0 fps 660.70 kb/s 442 MB Very fast
Zesty kraken X5650 2.67GHz 2/6/12 H.264 veryfast 4.0 20 (RF) 332.9 fps 952.46 kb/s 637 MB Legacy normal (No decomb default)
Zesty kraken X5650 2.67GHz 2/6/12 H.265 fast auto 20 (RF) 41.8 fps 706.52 kb/s 473 MB Legacy normal (No decomb default)
  • S/C/T: Socket(s), Core per Socket, Thred per Socket.

Best settings for DVD

Some interesting links:

  • Doesn't use CQ but VFR bitrate, which is not recommended by handbrake. I'll use CQ and check the resulting bitrate, and reencode if too high / low. Recommended bitrate here is 1800-2200.

Notes

Notes:

  • Asking google (handbrake best settings for dvd, etc).
  • H265 doesn't seem to bring lot of advantage over H264, because H265 is mainly for highres video, which DVD isn't. H265 is much much slower however.

Handbrake presets:

  • HQ 576p25 Surround: H.264, RF:18, Peak Framerate, Constant Quality, Preset slow, Tune none, Profile high, Level 3.1.
  • SuperHQ 576p25 Surround: H.264, RF:16, Peak Framerate, Constant Quality, Preset veryslow, Tune none, Profile high, Level 3.1, more settings ref=5:bframes=5.

Using:

  • Starting from HQ 576p25.
  • Set Tune to film.
  • Set Filters, Deblock, to Light (and tune medium); denoise filter to HQDN3D, preset medium. Interlace detection to Default, Deinterlace to Decomb.
  • Audio, select all language, in auto passthrough.
  • Subtitles, all subtitles, no burn in.
  • Bench: Bad Teacher, x264, denoise, deblock, decomb: 96.99 / 95.70 fps, 2357MB, 1672kbps. But strange artefacts in generic (around statue, also around the text in generic).
  • Bench: Bad Teacher, x264, decomb, RF 18, slow: 81.93 fps, 2511 MB, 1881 kbps. Better output, but bigger and slower.
  • Bench: Bad Teacher, x264, decomb, denoise medium, RF 18, slow: 97.36 fps, 2206MB, 1445kbps, pretty much same quality as "decomb", but smaller and faster...
  • Bench: Bad Teacher, x264, decomb, denoise light , RF 18, slow: 93.07 fps, 2266MB, 1536kbps.
  • Bench: Bad Teacher, x264, decomb, denoise light , lapsharplightfilm, RF 18, slow: 83.07 fps, 2394MB, 1726kbps.
  • Bench: Bad Teacher, x264, decomb, denoise light , RF 20, slow: 108.46 fps, 1954MB, 1070kbps.
  • Bench: Bad Teacher, x264, decomb, denoise medium, RF 16, slow: 86.15 fps, 2629MB, 2077kbps.
  • Bench: Bad Teacher, x264, decomb, denoise medium, RF 18, slower: 64.24 fps, 2213MB, 1456kbps,
  • Bench: Bad Teacher, x264, decomb, denoise medium, 2-pass CBR 1800: 90.83+95.99 fps, 2443MB, 1800kbps,
  • Bench: Bad Teacher, x264, decomb, denoise medium, 2-pass CBR 1800 turbo 1st pass: 252.61+97.87 fps, 2442MB, 1800kbps,
  • Bench: Bad Teacher, x265, decomb, denoise light , RF 20, slow: 23.62 fps, 1743MB, 754kbps.
  • Bench: Bad Teacher, x265, decomb, denoise light , RF 20, medium: 42.97 fps, 1688MB, 672kbps.
  • Bench Final Cut, decomb, denois light, RF 18, slow, audio AAC 192: 73.59fps, 2238MB, 3103kbps. Audio very soft.
  • Bench Final Cut, decomb, denois medium, RF 18, slow, audio AC3 passthrough 192: 78.35fps, 2001MB, 2734kbps.
  • Bench Final Cut, decomb, denois medium, RF 20, slow, audio AC3 passthrough 192, dimension 720x576, ratio 1.66:1: 89.06fps, 1418MB, 1821kbps.

Template to try:

  • DVD x264
  • DVD x264, RF 19.
  • DVD x264, RF 18.
  • DVD x264 + AAC conversion (BUG ? When selecting AAC, it seems the gain is set to -20DB in Track List although it shows 0 in the Track selection, make sure to correct it)
  • DVD x265
  • DVD x265, RF 19.

Issues:

  • DVD 'Thor the Dark World' - HB picked the wrong main title. Must check that the picked title is correct.
  • When selected AAC conversion, there is gain -20db although it show 0db. Make sure it is set to 0db.

Things to try:

Subtitles

  • Which subtitle choose?
  • All of them, but assuming they can be displayed correctly.
  • Subtitle seems to be "VOBSUB".
  • Make a test on Plex on Shield.
  • Make a test on Plex on Chrome.
  • Make a test with VLC.
  • Make a test with mplayer.

Audio

  • Which audio track to choose?
  • VO + French
  • Should we take Dutch if available?
  • Which codec to use?
  • Ideally passthrough is best, but if AC3, it cannot directplay on Shield TV, which is a bit annoying.
  • If transcoding to AAC, audio is very soft. Should we use dynamic range? Should we normalize loudness?
  • AAC is greatly superior to AC3. AAC is transparent for 5.1ch at 320kb, for 2.0ch at 128kb.
  • If transcoding,
  • make sure there is no negative audio gain (note there is a bug in HB that by default set the gain to -20db). Better leave the gain at 0db.
  • select same mixdown as source.

Video - aspect ratio

Note:

  • 16:9 = 1.77:1 = 1024 x 576 = 1920 x 1080 (assuming square pixels).
  • 16.7:9 = 1.85:1 = 1024 x 552.
  • 4:3 = 12:9 = 1.33:1 = 1024 x 768 = 1920 x 1440 (assuming square pixels).
  • Pixel Aspect Ratio (PAR)
  • This is the pixel ratio to use when displaying an image.
  • 1:1 means the stored image assume square pixels.
  • 64:45 is the pixel ratio to use to change a 720x576 image into a 16:9 image 1024x576 (we have 720 / 45 * 64 = 1024)
  • 720x576 is an image with ratio 5:4 assuming square pixel, but it becomes 16:9 assuming pixel ratio 64:45.
  • To be displayed on a monitor with square pixels, then the 720x576 image must be stretched to 1024x576 image to preserved the final image ratio 16:9.
  • With 720x576 image,
  • a 16:15 PAR gives an image aspect ratio of 4:3.
  • a 64:45 PAR gives an image aspect ratio of 16:9.
  • Which aspect ratio?
  • DVD PAL is always 720x576, but handbrake automatically crops to remove black edges.
  • So resulting image cannot simply be panned to fit say 1920x1080 (16:9) display. The best fit must respect the desired aspect ratio.
  • In addition, some DVD does not document the aspect ratio correctly.
  • Ask Google to get correct a/r (final cut dvd aspect ratio, bad teacher dvd aspect ratio).
  • For handbrake, we have to define:
  • Storage geometry, the size of the encoded image, which is the size of the source after cropping.
  • Display geometry, the size of the image to be displayed on screen, which is the size of the source after cropping.
  • Examples
  • DVD Final Cut, 1998
  • Internet lookup: release ratio is 1.66:1.
  • This seems like a bad DVD rip. Viewing the DVD shows an image ratio of 4:3.
  • HB detects an issue with PAR: Video PAR 16:15 (ie. 4:3 image) != conainer PAR 64:45 (ie. 16:9 image). It defaults back to 16:9
  • HB detects image as 720x576 with 12/14/14/10 autocrop, ie. 694x552, image 16:9, PAR 64:45.
  • To correct the image ratio, we remove all crop (to keep the bar / pillar, which seem to be intended), and set the display geometry to 956 x 576.
  • DVD Bad Teacher, 2011
  • Internet look-up: movie aspect ration is 1.85:1.
  • HB detects image as 720x576 with 12/12/0/0 autocrop, ie. 720x552, image 16:9 PAR 64:45.
  • HB sets encode size at 720x552, and display size at 1024x552, with standard PAR 64:45, which gives the correct ratio 16.7:1, aka 1.85:1.

Plex Tests

Media:

  • x264 with AC3
  • x264 with AC3 with VOBSUB subtitles
  • x264 with AAC
  • x264 with AAC with VOBSUB subtitles
  • x265
  • x265 with VOBSUB subtitles

Plex Server:

  • Only trying ShieldTV

Plex Player:

  • Plex in Chrome.
  • Plex Add On in Kodi on ShieldTV.
  • Plex APp on ShieldTV.

Things to check:

  • Quality
  • Direct Play, Direct Stream or transcoding?
  • If transcoding, video or audio, or both?
  • Delay to start playing.

Things to try:

  • Plex Web -> Quality -> Uncheck 'Use Recommended settings', and make sure 'Maximum' is selected.

General Issues on Plex App:

  • Bad video AR when disabling HDMI passthrough (likely due to bad transcoding.)
  • AAC audio seems softer than AC3, although it should be the same.

Results:

  • Bad Teacher - H264 / AC3 5.1 (plex version: 480p, 2Mbps)
  • Plex on Chrome (Debian Buster): transcode AV (quality loss), showing 1Mbps on server.
  • ... but we can set the quality in the player: settings -> quality -> original! When doing so: Direct V (pixel same), transcode A, with 2Mbps showing on server.
  • Changing subtitles when playing: no delay.
  • Plex App on ShieldTV: Direct AV, 32s delay to start playing / resuming.
But with HDMI audio passthrough disabled: Direct V / Transcode A. Transcode reason: AC-3 audio is not supported by the device. Also video AR changed to 4:3 although Display Mode is still Letterbox. But only 8s to start playing!!! Audio also softer because AAC likely.
  • Plex Kodi on ShieldTV: '.
  • same + VOBSUB
  • Plex on Chrome (Debian Buster): transcode AV (quality loss).
  • Plex App on ShieldTV: Direct AV, 32s delay to start playing / resuming.
But with HDMI audio passthrough disabled: Transcode V / Transcode A. Transcode reason: AC-3 audio is not supported by the device. Video AR is normal. But only 8s to start playing!!! Audio also softer because AAC likely.
... tried a second time with HDMI audio disabled: Direct V / Transcode A. 8s to start playing. Video AR is again 4:3. So it seems Direct V loses the video AR, while Transcode V keeps AR.
  • Plex Kodi on ShieldTV: '.
  • Bad Teacher - H264 / AAC 5.1 (plex version: 480p, 1.8Mbps)
  • Plex on Chrome (Debian Buster): Direct AV (pixel same).
  • Plex App on ShieldTV: Direct AV, 32s delay to start playing / resuming. Audio is softer than AC3
same with HDMI audio passthrough disabled.
  • Plex Kodi on ShieldTV: '.
  • same + VOBSUB
  • Plex on Chrome (Debian Buster): Direct Audio, Transcode Video (slight quality loss), showing 2Mbps on server, client says 'Convert (Maximum), 1.8Mbps'.
  • Plex App on ShieldTV: Direct AV, 32s delay to play from start.
same with HDMI audio passthrough disabled.
  • Plex Kodi on ShieldTV: '.
  • Bad Teacher - HEVC / AC3 5.1 (plex version: 480p, 1.6Mbps)
  • Plex on Chrome (Debian Buster): Transcode AV (slight quality loss), showing 3 Mbps on server.
  • Plex App on ShieldTV: Direct AV. Video AR ok. Startup 32s.
But with HDMI audio passthrough disabled: Direct V / Transcode A. Bad video AR 4:3. Startup only 8s.
  • Plex Kodi on ShieldTV: '.
  • same + VOBSUB
  • Plex on Chrome (Debian Buster): Transcode AV (slight quality loss), showing 3 Mbps on server, client says 'Convert (Maximum), 1.6Mbps'.
  • Plex App on ShieldTV: Direct AV. Video AR ok. Startup 32s.
But with HDMI audio passthrough disabled: Direct V / Transcode A. Bad video AR 4:3. Startup only 8s.
  • Plex Kodi on ShieldTV: '.
  • Brave H264 / AC3 5.1 (SD, 2.6Mbps )
  • Plex App on ShieldTV: DirectAV. Same with VOBSUB.
  • Brave H264 / AAC 5.1 (SD, 1.9Mbps )
  • Plex App on ShieldTV: DirectAV. Same with VOBSUB.
  • Brave HEVC / AAC 5.1 (SD, 1.6Mbps )
  • Plex App on ShieldTV: DirectAV. Same with VOBSUB.

Plex Tests - other videos

THese are test results with videos not produced by HandBrake:

  • Interstellar - .MP4 - H264 / AAC stereo
  • Plex App on Shield: Direct AV, 8s delay only. Also with External SRT.
  • Plex Kodi on Shield: Direct *Play* AV. 3s max delay.