Encoded video terrible color and sharpness

HandBrake for Windows support
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
retry
Posts: 3
Joined: Sun May 31, 2020 10:37 pm

Encoded video terrible color and sharpness

Post by retry »

Description of problem or question:

I'm trying to compress a video taken with an android phone in 1080p using OpenCamera app. No matter what settings I try, I find the color faded and large loss of detail/sharpness. I tried various Q values. I tried the software x264 codec as well as the Intel and Nvidia based ones. There is no difference in the color saturation/sharpness.

I tried to manually force the color settings with manual settings:
colorprim=smpte170m:transfer=smpte170m:colormatrix=smpte170m
colorprim=bt709:transfer=bt709:colormatrix=bt709

These things made no difference whatsoever.



HandBrake version (e.g., 1.0.0):

1.3.2 (2020050300)


Operating system and version (e.g., Ubuntu 16.04 LTS, macOS 10.13 High Sierra, Windows 10 Creators Update):

Windows 10 Home 1903


HandBrake Activity Log ***required*** (see How-to get an activity log)

Code: Select all

HandBrake 1.3.2 (2020050300)
OS: Microsoft Windows NT 10.0.18362.0
CPU: Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Ram: 16234 MB, 
GPU Information:
  Intel(R) UHD Graphics 630 - 23.20.16.5018
  NVIDIA GeForce GTX 1060 - 26.21.14.4294
Screen: 1920x1080
Temp Dir: R:\Temp\
Install Dir: C:\Program Files\HandBrake
Data Dir: C:\Users\user\AppData\Roaming\HandBrake

-------------------------------------------


# Starting Encode ...

[06:32:30] base preset: Custom Ytube 720p30
[18:32:30] hb_init: starting libhb thread
[18:32:30] Starting work at: Sun May 31 18:32:30 2020
[18:32:30] 1 job(s) to process
[18:32:30] json job:
{
  "Audio": {
    "AudioList": [
      {
        "DRC": 0.0,
        "Encoder": "copy:aac",
        "Gain": 0.0,
        "Mixdown": -1,
        "NormalizeMixLevel": false,
        "Samplerate": 48000,
        "Track": 0,
        "DitherMethod": 0
      }
    ],
    "CopyMask": [
      "copy:aac",
      "copy:ac3",
      "copy:dtshd",
      "copy:dts",
      "copy:eac3",
      "copy:flac",
      "copy:mp3",
      "copy:truehd"
    ],
    "FallbackEncoder": "ac3"
  },
  "Destination": {
    "ChapterList": [],
    "ChapterMarkers": false,
    "AlignAVStart": true,
    "File": "R:\\Vid_20190923_112543-1.mp4",
    "Mp4Options": {
      "IpodAtom": false,
      "Mp4Optimize": true
    },
    "Mux": "av_mp4"
  },
  "Filters": {
    "FilterList": [
      {
        "ID": 4,
        "Settings": {
          "mode": "7"
        }
      },
      {
        "ID": 3,
        "Settings": {
          "block-height": "16",
          "block-thresh": "40",
          "block-width": "16",
          "filter-mode": "2",
          "mode": "3",
          "motion-thresh": "1",
          "spatial-metric": "2",
          "spatial-thresh": "1"
        }
      },
      {
        "ID": 12,
        "Settings": {
          "crop-bottom": "0",
          "crop-left": "0",
          "crop-right": "0",
          "crop-top": "0",
          "height": "1920",
          "width": "1080"
        }
      },
      {
        "ID": 6,
        "Settings": {
          "mode": "0"
        }
      }
    ]
  },
  "PAR": {
    "Num": 1,
    "Den": 1
  },
  "Metadata": {},
  "SequenceID": 0,
  "Source": {
    "Angle": 1,
    "Range": {
      "Type": "chapter",
      "Start": 1,
      "End": 1
    },
    "Title": 1,
    "Path": "D:\\Desktop\\Phones\\LeEcoPro3\\VID_20190923_112543.mp4"
  },
  "Subtitle": {
    "Search": {
      "Burn": false,
      "Default": false,
      "Enable": false,
      "Forced": false
    },
    "SubtitleList": []
  },
  "Video": {
    "Encoder": "qsv_h264",
    "Level": "auto",
    "TwoPass": false,
    "Turbo": false,
    "ColorMatrixCode": 0,
    "Options": "",
    "Preset": "balanced",
    "Profile": "auto",
    "Quality": 25.0,
    "QSV": {
      "Decode": false,
      "AsyncDepth": 0
    }
  }
}
[18:32:30] CPU: Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
[18:32:30]  - Intel microarchitecture Kaby Lake
[18:32:30]  - logical processor count: 12
[18:32:30] Intel Quick Sync Video support: yes
[18:32:30]  - Intel Media SDK hardware: API 1.26 (minimum: 1.3)
[18:32:30]  - H.264 encoder: yes
[18:32:30]     - preferred implementation: hardware (any) via D3D11
[18:32:30]     - capabilities (hardware):  breftype icq+la+i+downs vsinfo opt1 opt2+mbbrc+extbrc+trellis+ib_adapt+nmpslice
[18:32:30]  - H.265 encoder: yes (8bit: yes, 10bit: yes)
[18:32:30]     - preferred implementation: hardware (any) via D3D11
[18:32:30]     - capabilities (hardware):  bpyramid icq vsinfo opt1
[18:32:30] hb_scan: path=D:\Desktop\Phones\LeEcoPro3\VID_20190923_112543.mp4, title_index=1
udfread ERROR: ECMA 167 Volume Recognition failed
src/libbluray/disc/disc.c:323: failed opening UDF image D:\Desktop\Phones\LeEcoPro3\VID_20190923_112543.mp4
src/libbluray/disc/disc.c:424: error opening file BDMV\index.bdmv
src/libbluray/disc/disc.c:424: error opening file BDMV\BACKUP\index.bdmv
src/libbluray/bluray.c:2585: nav_get_title_list(D:\Desktop\Phones\LeEcoPro3\VID_20190923_112543.mp4\) failed
[18:32:30] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 6.0.1
libdvdread: Encrypted DVD support unavailable.
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: failed to read VIDEO_TS.IFO
[18:32:30] dvd: not a dvd - trying as a stream/file instead
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'D:\Desktop\Phones\LeEcoPro3\VID_20190923_112543.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2019-09-23T15:26:46.000000Z
    com.android.version: 9
    com.android.manufacturer: LeEco
    com.android.model: LEX727
  Duration: 00:01:01.40, start: 0.000000, bitrate: 33073 kb/s
    Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuvj420p(pc, smpte170m), 1920x1080, 32944 kb/s, SAR 1:1 DAR 16:9, 29.82 fps, 30 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      rotate          : 90
      creation_time   : 2019-09-23T15:26:46.000000Z
      handler_name    : VideoHandle
    Side data:
      displaymatrix: rotation of -90.00 degrees
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 96 kb/s (default)
    Metadata:
      creation_time   : 2019-09-23T15:26:46.000000Z
      handler_name    : SoundHandle
[18:32:31] scan: decoding previews for title 1
[18:32:31] scan: audio 0x1: aac, rate=48000Hz, bitrate=96020 English (AAC LC) (1.0 ch) (96 kbps)
[18:32:31] Auto-Rotating video 270 degrees
[18:32:31] scan: 10 previews, 1080x1920, 29.825 fps, autocrop = 0/0/0/0, aspect 1:1.78, PAR 1:1
[18:32:31] scan: supported video decoders: avcodec qsv
[18:32:31] Title is likely interlaced or telecined (9 out of 10 previews). You should do something about that.
[18:32:31] libhb: scan thread found 1 valid title(s)
[18:32:31] Starting Task: Encoding Pass
[18:32:31] Skipping vfr filter
[18:32:31] Skipping crop/scale filter
[18:32:31] job configuration:
[18:32:31]  * source
[18:32:31]    + D:\Desktop\Phones\LeEcoPro3\VID_20190923_112543.mp4
[18:32:31]    + title 1, chapter(s) 1 to 1
[18:32:31]    + container: mov,mp4,m4a,3gp,3g2,mj2
[18:32:31]    + data rate: 33073 kbps
[18:32:31]  * destination
[18:32:31]    + R:\Vid_20190923_112543-1.mp4
[18:32:31]    + container: MPEG-4 (libavformat)
[18:32:31]      + optimized for HTTP streaming (fast start)
[18:32:31]      + align initial A/V stream timestamps
[18:32:31]  * video track
[18:32:31]    + decoder: h264
[18:32:31]      + bitrate 32944 kbps
[18:32:31]    + filters
[18:32:31]      + 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)
[18:32:31]      + Decomb (mode=39)
[18:32:31]    + Output geometry
[18:32:31]      + storage dimensions: 1080 x 1920
[18:32:31]      + pixel aspect ratio: 1 : 1
[18:32:31]      + display dimensions: 1080 x 1920
[18:32:31]    + encoder: H.264 (Intel Media SDK)
[18:32:31]      + preset:  balanced
[18:32:31]      + profile: auto
[18:32:31]      + level:   auto
[18:32:31]      + quality: 25.00 (ICQ)
[18:32:31]      + color profile: 6-6-6
[18:32:31]  * audio track 1
[18:32:31]    + decoder: English (AAC LC) (1.0 ch) (96 kbps) (track 1, id 0x1)
[18:32:31]      + bitrate: 96 kbps, samplerate: 48000 Hz
[18:32:31]    + AAC Passthru
[18:32:31] sync: expecting 1831 video frames
[18:32:31] encqsvInit: using encode-only path
[18:32:31] encqsvInit: H.264/AVC High profile @ level 4.0
[18:32:31] encqsvInit: TargetUsage 4 AsyncDepth 3
[18:32:31] encqsvInit: GopRefDist 3 GopPicSize 30 NumRefFrame 1
[18:32:31] encqsvInit: BFramesMax 2 BRefType off
[18:32:31] encqsvInit: RateControlMethod ICQ ICQQuality 25
[18:32:31] Auto-Rotating video 270 degrees
[18:32:31] sync: first pts video is 0
[18:32:31] sync: Chapter 1 at frame 1 time 0
[18:32:31] sync: first pts audio 0x1 is 0
[18:32:32] qsv_enc_init: using 'hardware (1) via D3D11' implementation, API: 1.26
[18:32:52] reader: done. 1 scr changes
[18:32:53] work: average encoding speed for job is 85.222298 fps
[18:32:53] comb detect: heavy 1814 | light 14 | uncombed 2 | total 1830
[18:32:53] decomb: deinterlaced 1814 | blended 14 | unfiltered 2 | total 1830
[18:32:53] aac-decoder done: 2878 frames, 0 decoder errors
[18:32:53] h264-decoder done: 1830 frames, 0 decoder errors
[18:32:53] sync: got 1830 frames, 1831 expected
[18:32:53] sync: framerate min 14.980 fps, max 30.519 fps, avg 29.819 fps
[18:32:53] mux: track 0, 1830 frames, 203703525 bytes, 26530.08 kbps, fifo 128
[18:32:53] mux: track 1, 2878 frames, 736928 bytes, 95.98 kbps, fifo 256
[18:32:53] Finished work at: Sun May 31 18:32:53 2020
[18:32:53] libhb: work result = 0

# Encode Completed ...
Deleted User 13735

Re: Encoded video terrible color and sharpness

Post by Deleted User 13735 »

The problem may be in your source. It looks like QSV h264 at CQ25. Not a terribly good place to start, and encoding can never make it better.
retry
Posts: 3
Joined: Sun May 31, 2020 10:37 pm

Re: Encoded video terrible color and sharpness

Post by retry »

No you're mistaken. The source has around 30Mbps sample rate. Q25 is what I was trying to compress to. But whether I did Q20 or lower just made the file size larger with absolutely no noticeable quality changes. This is really not a Q setting issue. It's color space and I need to know what advanced flags to pass to handbrake to fix this.

Look at the source stream in the log:

Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuvj420p(pc, smpte170m), 1920x1080, 32944 kb/s, SAR 1:1 DAR 16:9, 29.82 fps, 30 tbr, 90k tbn, 180k tbc (default)
Deleted User 13735

Re: Encoded video terrible color and sharpness

Post by Deleted User 13735 »

It's ok to think I'm mistaken but I've run the quality metrics using QSV in controlled tests.

Try software x264 at RF20 or QSV at CQ12, in which case your files will be larger than with x264.
retry
Posts: 3
Joined: Sun May 31, 2020 10:37 pm

Re: Encoded video terrible color and sharpness

Post by retry »

Your whole first response was asinine and your last response was even LESS helpful. But I bet you felt cool typing it. The SOURCE is high quality 1080p with great detail. Anyway I found the solution: avidemux didn't wash out colors and details at all. Now I have a great copy compressed to 33% of the source, and you can't tell at all even zoomed to 200%.
Deleted User 11865

Re: Encoded video terrible color and sharpness

Post by Deleted User 11865 »

Oh, I thought the fix was in 1.3.2 already. Shows how I'm not following development closely enough lately :(
User avatar
BradleyS
Moderator
Posts: 1860
Joined: Thu Aug 09, 2007 12:16 pm

Re: Encoded video terrible color and sharpness

Post by BradleyS »

Will be in 1.3.3 which we plan on releasing very soon now.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

Re: Encoded video terrible color and sharpness

Post by JohnAStebbins »

Issue 2561 was fixed in 1.3.2 and is the only one that should affect this particular encode. Issue 2859 should only be triggered when crop/scale and one of our other filters are both enabled. The encode in the posted log does not crop or scale.

So if a nightly build fixes this, I would be a bit confused :? (which is why I didn't point it out myself)
gonzo1019
Posts: 4
Joined: Wed Jun 03, 2020 4:16 pm

Re: Encoded video terrible color and sharpness

Post by gonzo1019 »

If the source is good I would disable and filters and use hevc 265 10 bit video encoder and main 10 in the encoder profile and use rf 24 and constant frame rate. Remove anything in the box below like customizations. Make sure you use medium to slow to make sure compression is good.

Hope this works for you
gonzo1019
Posts: 4
Joined: Wed Jun 03, 2020 4:16 pm

Re: Encoded video terrible color and sharpness

Post by gonzo1019 »

Another trick you can use is to learn how to use MKVTOOLNIX to extract the audio from the original file and encode the file with just video in handbrake. Later after the encode is finished which will be a lot quicker.... you can add the audio file back in in MKVTOOLNIX. This procedure allows handbrake to do its job quicker and with less strain on your computer. You will also see double to triple the frame rate
Navvie
Novice
Posts: 67
Joined: Sun Mar 27, 2011 10:19 pm

Re: Encoded video terrible color and sharpness

Post by Navvie »

It's not a problem I experience, but the description of it is so similar to the two Issues on git hub I figures it must be related.

The fix says "filters (decomb, denoise, detelecine, lapsharp, nlmeans, unsharp) were all setting color_range to the source color_range after it had already been converted in decavcodec."

And the encode log above does says it's being decombed.

Anyway, if it can't be that then it's my mistake. I'm not reading the log correctly or understanding the full-range bug correctly. Apologies.
Deleted User 13735

Re: Encoded video terrible color and sharpness

Post by Deleted User 13735 »

retry wrote: Mon Jun 01, 2020 8:25 pm Your whole first response was asinine and your last response was even LESS helpful. But I bet you felt cool typing it. The SOURCE is high quality 1080p with great detail. Anyway I found the solution: avidemux didn't wash out colors and details at all. Now I have a great copy compressed to 33% of the source, and you can't tell at all even zoomed to 200%.
Yes I did, but I "felt even cooler" having the opportunity to repeat my quantitative tests just for your benefit, using your settings to illustrate my concerns about your source quality, and to introduce the idea to you that encoders are not equal at a given bitrate, nor are Q metrics transferable across encoders. Your source is relatively horrid. Oh, your personal insult has been noted and reported.
Attachments
x264qsv.png
x264qsv.png (11.76 KiB) Viewed 883 times
Post Reply