detailed command line option docs OR deinterlacing help?

Support for HandBrake on Linux, Solaris, and other Unix-like platforms
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Post Reply
lvm
Posts: 2
Joined: Sun Nov 17, 2019 10:22 am

detailed command line option docs OR deinterlacing help?

Post by lvm »

Hello,

Were can I find a detailed command line option description? E.g. here https://handbrake.fr/docs/en/latest/cli ... rence.html it says that

Code: Select all

--comb-detect[=string]  Detect interlace artifacts in frames.
                           If not accompanied by the decomb or deinterlace
                           filters, this filter only logs the interlaced
                           frame count to the activity log.
                           If accompanied by the decomb or deinterlace
                           filters, it causes these filters to selectively
                           deinterlace only those frames where interlacing
                           is detected.
                           Presets:
                               permissive
                               fast
                           Custom Format:
                               mode=m:spatial-metric=s:motion-thresh=m:
                               spatial-thresh=s:filter-mode=f:block-thresh=b:
                               block-width=b:block-height=b:disable=d
                           Default:
                               mode=3:spatial-metric=2:motion-thresh=1:
                               spatial-thresh=1:filter-mode=2:block-thresh=40:
                               block-width=16:block-height=16
but what are the allowed values for these options and what do they mean? What is mode=3?

OR if someone just can tell me how to disable detinterlace detection and keep it always on? I am trying to encode a 1080i50fps MPEG2 .ts file into a 1080p50fps H.264 and no mater what I tried it still won't deinterlace some shots where deinterlacing it is clearly needed.

musicvid
Veteran User
Posts: 3442
Joined: Sat Jun 27, 2009 1:19 am

Re: detailed command line option docs OR deinterlacing help?

Post by musicvid »

It may be telecined.

User avatar
JohnAStebbins
HandBrake Team
Posts: 5505
Joined: Sat Feb 09, 2008 7:21 pm

Re: detailed command line option docs OR deinterlacing help?

Post by JohnAStebbins »

Code: Select all

   --comb-detect[=string]  Detect interlace artifacts in frames.
                           If not accompanied by the decomb or deinterlace
                           filters, this filter only logs the interlaced
                           frame count to the activity log.
                           If accompanied by the decomb or deinterlace
                           filters, it causes these filters to selectively
                           deinterlace only those frames where interlacing
                           is detected.
                           Presets:
                               permissive
                               fast
                           Custom Format:
                               mode=m:spatial-metric=s:motion-thresh=m:
                               spatial-thresh=s:filter-mode=f:block-thresh=b:
                               block-width=b:block-height=b:disable=d
                           Default:
                               mode=3:spatial-metric=2:motion-thresh=1:
                               spatial-thresh=1:filter-mode=2:block-thresh=40:
                               block-width=16:block-height=16
   --no-comb-detect        Disable preset comb-detect filter
You didn't look down far enough. The --no-comb-detect option help us right under --comb-detect.

lvm
Posts: 2
Joined: Sun Nov 17, 2019 10:22 am

Re: detailed command line option docs OR deinterlacing help?

Post by lvm »

I did see this option, I just assumed that if it disables the filter it disables deinterlacing, turns out, it is the other way around. Thanks!

nhyone
Bright Spark User
Posts: 248
Joined: Fri Jul 24, 2015 4:13 am

Re: detailed command line option docs OR deinterlacing help?

Post by nhyone »

Another possibility is to use the custom format and reduce block threshold from 40 to, say, 20:

Code: Select all

block-thresh=20
And increase height to, say, 32:

Code: Select all

block-height=32
No idea how well they will work. :D

User avatar
BradleyS
Moderator
Posts: 1766
Joined: Thu Aug 09, 2007 12:16 pm

Re: detailed command line option docs OR deinterlacing help?

Post by BradleyS »

The default block parameters are pretty sensitive to combing and in my testing at least, I have not found a better group of settings. If the OP is sure his content is fully interlaced, disabling interlacing detection while enabling a deinterlacing is a smart move.

musicvid
Veteran User
Posts: 3442
Joined: Sat Jun 27, 2009 1:19 am

Re: detailed command line option docs OR deinterlacing help?

Post by musicvid »

Why don't you upload an original sample to Drive or Dropbox and let us take a look at it?

nhyone
Bright Spark User
Posts: 248
Joined: Fri Jul 24, 2015 4:13 am

Re: detailed command line option docs OR deinterlacing help?

Post by nhyone »

BradleyS wrote:
Mon Nov 18, 2019 6:26 pm
The default block parameters are pretty sensitive to combing and in my testing at least, I have not found a better group of settings. If the OP is sure his content is fully interlaced, disabling interlacing detection while enabling a deinterlacing is a smart move.
Yes, I never had to adjust the options, but I encountered one (set of) video that remained interlaced and hence tried to increase detection sensitivity. (I missed the --no-decomb-detect option too.)

Although in my case, not all frames are interlaced, so I'll prefer to use --decomb-detect. I just tried --no-decomb-detect and the output is still interlaced.

Anyway, I believe the video is botched. It is transcoded from DVD to 720p H.264. I believe the upscaling made it impossible to decomb? (Since interlacing is no longer on alternate lines.)

Here's a cropped frame from the source at 100%:
interlaced_upscaled.png
You do not have the required permissions to view the files attached to this post.

User avatar
Rodeo
HandBrake Team
Posts: 12368
Joined: Tue Mar 03, 2009 8:55 pm

Re: detailed command line option docs OR deinterlacing help?

Post by Rodeo »

--no-comb-detect != --no-decomb-detect (the latter is not a HandBrake option). If you only typed it wrong on the forum but not when invoking HandBrakeCLI, then we need to see an encode log please.

nhyone
Bright Spark User
Posts: 248
Joined: Fri Jul 24, 2015 4:13 am

Re: detailed command line option docs OR deinterlacing help?

Post by nhyone »

Oops, you are right, I wrote it wrongly in the forum. Luckily, I cut-and-paste when I entered the command, so it is invoked correctly.

Default:

Code: Select all

  + size: 1280x720, pixel aspect: 1/1, display aspect: 1.78, 29.970 fps
...
[15:15:58]  * video track
[15:15:58]    + decoder: h264
[15:15:58]      + bitrate 200 kbps
[15:15:58]    + filters
[15:15:58]      + Comb Detect (mode=3:spatial-metric=2:motion-thresh=1:spatial-thresh=1:filter-mode=2:block-thresh=40:block-width=16:block-height=16)
[15:15:58]      + Decomb (mode=39)
...
[15:19:45] comb detect: heavy 37 | light 702 | uncombed 2858 | total 3597
[15:19:45] decomb: deinterlaced 37 | blended 702 | unfiltered 2858 | total 3597
[15:19:45] stream: 7050 good frames, 0 errors (0%)
...
[15:19:45] sync: got 3597 frames, 3626 expected
[15:19:45] sync: framerate min 29.970 fps, max 29.970 fps, avg 29.970 fps
With threshold 20:

Code: Select all

[15:33:38]      + Comb Detect (mode=3:spatial-metric=2:motion-thresh=1:spatial-thresh=1:filter-mode=2:block-thresh=20:block-width=16:block-height=16)
[15:33:38]      + Decomb (mode=39)
...
[15:37:31] comb detect: heavy 656 | light 1245 | uncombed 1696 | total 3597
[15:37:31] decomb: deinterlaced 656 | blended 1245 | unfiltered 1696 | total 3597
With --no-comb-detect:

Code: Select all

[10:44:43]      + Decomb (mode=7)
...
[10:48:44] decomb: deinterlaced 3597 | blended 0 | unfiltered 0 | total 3597
Updated: added framerate.
Last edited by nhyone on Wed Nov 20, 2019 3:36 am, edited 3 times in total.

User avatar
BradleyS
Moderator
Posts: 1766
Joined: Thu Aug 09, 2007 12:16 pm

Re: detailed command line option docs OR deinterlacing help?

Post by BradleyS »

Yikes, that's a lot of unfiltered frames for the defaults, which are pretty sensitive. Are you sure the content isn't mixed interlaced and progressive, or telecined ?

nhyone
Bright Spark User
Posts: 248
Joined: Fri Jul 24, 2015 4:13 am

Re: detailed command line option docs OR deinterlacing help?

Post by nhyone »

BradleyS wrote:
Wed Nov 20, 2019 1:31 am
Yikes, that's a lot of unfiltered frames for the defaults, which are pretty sensitive. Are you sure the content isn't mixed interlaced and progressive, or telecined ?
The original conversion from DVD to H.264 was not deinterlaced. But that's not the stopper. I believe upscaling from 480px to 720px made it impossible for decomb to work? I assume decomb looks purely at alternate lines. That line structure is lost after upscaling.

This is an old TVB TV show. I think it is interlaced. When I get my hands on the original DVDs in a couple of weeks time, I'll see if the source can be decombed nicely. :D (I would think so.)

User avatar
Rodeo
HandBrake Team
Posts: 12368
Joined: Tue Mar 03, 2009 8:55 pm

Re: detailed command line option docs OR deinterlacing help?

Post by Rodeo »

Decomb obviously runs before crop and scale… or if it doesn't, then a bug has been introduced.

User avatar
Rodeo
HandBrake Team
Posts: 12368
Joined: Tue Mar 03, 2009 8:55 pm

Re: detailed command line option docs OR deinterlacing help?

Post by Rodeo »

Oh wait, you upscaled the source (without deinterlacing) before feeding it to HandBrake and are now attempting to decomb an already-upscaled source? That's a big no-no, indeed.

User avatar
Rodeo
HandBrake Team
Posts: 12368
Joined: Tue Mar 03, 2009 8:55 pm

Re: detailed command line option docs OR deinterlacing help?

Post by Rodeo »

You will need to go back to the original source.

nhyone
Bright Spark User
Posts: 248
Joined: Fri Jul 24, 2015 4:13 am

Re: detailed command line option docs OR deinterlacing help?

Post by nhyone »

Just for testing, I encoded the 720p video to 480p at CRF 16, then transcode it again to 480p at CRF 22 with decomb. It works -- the output is deinterlaced.

Code: Select all

  + size: 628x480, pixel aspect: 470/471, display aspect: 1.31, 29.970 fps
...
[12:47:18]  * video track
[12:47:18]    + decoder: h264
[12:47:18]    + filters
[12:47:18]      + Comb Detect (mode=3:spatial-metric=2:motion-thresh=1:spatial-thresh=1:filter-mode=2:block-thresh=40:block-width=16:block-height=16)
[12:47:18]      + Decomb (mode=39)
...
[12:48:30] comb detect: heavy 2431 | light 161 | uncombed 1005 | total 3597
[12:48:30] decomb: deinterlaced 2431 | blended 161 | unfiltered 1005 | total 3597

Cropped frame after 720p to 480p at 100% (should be same frame as earlier post):
roch83_cropped_480p.png

Cropped frame after 480p to 480p w/ decomb at 100%:
roch83_cropped_480p_decomb.png
You do not have the required permissions to view the files attached to this post.

musicvid
Veteran User
Posts: 3442
Joined: Sat Jun 27, 2009 1:19 am

Re: detailed command line option docs OR deinterlacing help?

Post by musicvid »

I do not think you will be unbaking that cake.

User avatar
Rodeo
HandBrake Team
Posts: 12368
Joined: Tue Mar 03, 2009 8:55 pm

Re: detailed command line option docs OR deinterlacing help?

Post by Rodeo »

Rodeo wrote:
Wed Nov 20, 2019 3:24 pm
You will need to go back to the original source.
Really, you'll get better results, even though at least your workaround is producing acceptable results.

Post Reply