Retaining Film Grain

General questions or discussion about HandBrake, Video and/or audio transcoding, trends etc.
Post Reply
SirWindsorCornez
Posts: 3
Joined: Mon Mar 15, 2021 12:19 pm

Retaining Film Grain

Post by SirWindsorCornez »

I can't get Handbrake to retain film grain. It looks like it dodges it from the video metadata since the encoded video is as detailed as the master file, but doesn't have any grain at all. I've tried VP9, h265 and h264 in various different presets. h265 and h264 both tuned to "Grain" with "Slow" preset and Quality slider at 13. Master file is 4K DNxHR HQX 10 bit. When I render the video from Resolve with Resolve's own h265 rendered it does retain the grain, so what's up with that?

Win10 Enterprise
HandBrake version 1.3.1
mduell
Veteran User
Posts: 8187
Joined: Sat Apr 21, 2007 8:54 pm

Re: Retaining Film Grain

Post by mduell »

Since this relates to a specific problem with a specific encode, post your encoding log.
rollin_eng
Veteran User
Posts: 4840
Joined: Wed May 04, 2011 11:06 pm

Re: Retaining Film Grain

Post by rollin_eng »

Could you please post your HB logs, instructions can be found here:

https://handbrake.fr/docs/en/latest/hel ... y-log.html
SirWindsorCornez
Posts: 3
Joined: Mon Mar 15, 2021 12:19 pm

Re: Retaining Film Grain

Post by SirWindsorCornez »

Ah, sure. I reviewed the log and didn't see anything to do with the problem, then again I don't understand 100% of it. Anyway, here's the most previous one. I used QuickTime DNxHR encode before, now I changed to MXF OP1A, which solved the problem. So I guess Handbrake doesn't read QuickTime DNxHR format properly?

Code: Select all

HandBrake 1.3.1 (2020010400)
OS: Microsoft Windows NT 10.0.18363.0
CPU: Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
Ram: 32702 MB, 
GPU Information:
  NVIDIA GeForce RTX 2060 - 27.21.14.6140
Screen: 3840x2160
Temp Dir: C:\Users\Seppochu\AppData\Local\Temp\
Install Dir: C:\Program Files\HandBrake
Data Dir: C:\Users\Seppochu\AppData\Roaming\HandBrake

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


# Starting Encode ...

[01.44.52] base preset: WebHQ1 (Modified)
[13:44:52] hb_init: starting libhb thread
[13:44:52] Starting work at: Wed Mar 17 13:44:52 2021
[13:44:52] 1 job(s) to process
[13:44:52] json job:
{
  "Audio": {
    "AudioList": [
      {
        "Bitrate": 320,
        "DRC": 0.0,
        "Encoder": "av_aac",
        "Gain": 0.0,
        "Mixdown": 4,
        "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": [
      {
        "Name": "Chapter 1"
      }
    ],
    "ChapterMarkers": true,
    "AlignAVStart": true,
    "File": "D:\\Videos\\Helpompaamv Masterfile-1.m4v",
    "Mp4Options": {
      "IpodAtom": false,
      "Mp4Optimize": true
    },
    "Mux": "mp4"
  },
  "Filters": {
    "FilterList": [
      {
        "ID": 12,
        "Settings": {
          "crop-bottom": "0",
          "crop-left": "0",
          "crop-right": "122",
          "crop-top": "0",
          "height": "2160",
          "width": "3974"
        }
      },
      {
        "ID": 6,
        "Settings": {
          "mode": "2",
          "rate": "27000000/1125000"
        }
      }
    ]
  },
  "PAR": {
    "Num": 1,
    "Den": 1
  },
  "Metadata": {},
  "SequenceID": 0,
  "Source": {
    "Angle": 1,
    "Range": {
      "Type": "chapter",
      "Start": 1,
      "End": 1
    },
    "Title": 1,
    "Path": "T:\\TUG Backup\\Pidemmät projektit\\Iivanainen\\Video Projects\\Helpompaa - Musiikkivideo\\Render\\HelpompaaMV_MasterFile.mxf"
  },
  "Subtitle": {
    "Search": {
      "Burn": true,
      "Default": false,
      "Enable": true,
      "Forced": true
    },
    "SubtitleList": []
  },
  "Video": {
    "Encoder": "x265",
    "Level": "5.1",
    "TwoPass": false,
    "Turbo": false,
    "ColorMatrixCode": 0,
    "Options": "",
    "Preset": "fast",
    "Profile": "main",
    "Quality": 20.0,
    "Tune": "grain",
    "QSV": {
      "Decode": false,
      "AsyncDepth": 0
    }
  }
}
[13:44:52] CPU: Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
[13:44:52]  - Intel microarchitecture Kaby Lake
[13:44:52]  - logical processor count: 12
[13:44:52] Intel Quick Sync Video support: no
[13:44:52] hb_scan: path=T:\TUG Backup\Pidemmät projektit\Iivanainen\Video Projects\Helpompaa - Musiikkivideo\Render\HelpompaaMV_MasterFile.mxf, title_index=1
src/libbluray/disc/disc.c:323: failed opening UDF image T:\TUG Backup\Pidemmät projektit\Iivanainen\Video Projects\Helpompaa - Musiikkivideo\Render\HelpompaaMV_MasterFile.mxf
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(T:\TUG Backup\Pidemmät projektit\Iivanainen\Video Projects\Helpompaa - Musiikkivideo\Render\HelpompaaMV_MasterFile.mxf\) failed
[13:44:52] 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
[13:44:52] dvd: not a dvd - trying as a stream/file instead
Input #0, mxf, from 'T:\TUG Backup\Pidemmät projektit\Iivanainen\Video Projects\Helpompaa - Musiikkivideo\Render\HelpompaaMV_MasterFile.mxf':
  Metadata:
    operational_pattern_ul: 060e2b34.04010101.0d010201.01010900
    project_name    : Jyrki Iivanainen - Helpompaa MV
    uid             : d1325f28-eae0-8247-9be4-55878d2bbb0b
    generation_uid  : 57635bcb-acab-f44e-9fd1-007716593015
    company_name    : Blackmagic Design
    product_name    : DaVinci Resolve
    product_version : 17.1.0
    product_uid     : 057cd849-178a-4b88-b4c7-825af8761b34
    modification_date: 2021-03-17T11:30:36.300000Z
    application_platform: DaVinci Resolve
    material_package_umid: 0x060A2B340101010501010D43130000006051E85C04820000060E2B347F7F2A80
    material_package_name: HelpompaaMV_MasterFile
    timecode        : 01:00:00:00
  Duration: 00:04:00.33, start: 0.000000, bitrate: 748106 kb/s
    Stream #0:0: Video: dnxhd (DNXHR HQX), yuv422p10le(bt709/unknown/unknown, progressive), 4096x2160, SAR 1:1 DAR 256:135, 24 fps, 24 tbr, 24 tbn, 24 tbc
    Metadata:
      file_package_umid: 0x060A2B340101010501010D43130000006051E85C04830000060E2B347F7F2A80
      file_package_name: HelpompaaMV_MasterFile
      track_name      : HelpompaaMV_MasterFile_v1
    Stream #0:1: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
    Metadata:
      file_package_umid: 0x060A2B340101010501010D43130000006051E85C04830000060E2B347F7F2A80
      file_package_name: HelpompaaMV_MasterFile
      track_name      : HelpompaaMV_MasterFile
[13:44:52] scan: decoding previews for title 1
[13:44:52] scan: audio 0x1: pcm_s16le, rate=48000Hz, bitrate=1536000 Unknown (pcm_s16le) (2.0 ch) (1536 kbps)
[13:44:56] scan: 10 previews, 4096x2160, 24.000 fps, autocrop = 0/0/0/122, aspect 1.90:1, PAR 1:1
[13:44:56] libhb: scan thread found 1 valid title(s)
[13:44:56] Skipping subtitle scan.  No suitable subtitle tracks.
[13:44:56] Starting Task: Encoding Pass
[13:44:56] work: only 1 chapter, disabling chapter markers
[13:44:56] job configuration:
[13:44:56]  * source
[13:44:56]    + T:\TUG Backup\Pidemmät projektit\Iivanainen\Video Projects\Helpompaa - Musiikkivideo\Render\HelpompaaMV_MasterFile.mxf
[13:44:56]    + title 1, chapter(s) 1 to 1
[13:44:56]    + container: mxf
[13:44:56]    + data rate: 748106 kbps
[13:44:56]  * destination
[13:44:56]    + D:\Videos\Helpompaamv Masterfile-1.m4v
[13:44:56]    + container: MPEG-4 (libavformat)
[13:44:56]      + optimized for HTTP streaming (fast start)
[13:44:56]      + align initial A/V stream timestamps
[13:44:56]  * video track
[13:44:56]    + decoder: dnxhd
[13:44:56]    + filters
[13:44:56]      + Framerate Shaper (mode=2:rate=27000000/1125000)
[13:44:56]        + frame rate: 24.000 fps -> peak rate limited to 24.000 fps
[13:44:56]      + Crop and Scale (width=3974:height=2160:crop-top=0:crop-bottom=0:crop-left=0:crop-right=122)
[13:44:56]        + source: 4096 * 2160, crop (0/0/0/122): 3974 * 2160, scale: 3974 * 2160
[13:44:56]    + Output geometry
[13:44:56]      + storage dimensions: 3974 x 2160
[13:44:56]      + pixel aspect ratio: 1 : 1
[13:44:56]      + display dimensions: 3974 x 2160
[13:44:56]    + encoder: H.265 (libx265)
[13:44:56]      + preset:  fast
[13:44:56]      + tune:    grain
[13:44:56]      + profile: main
[13:44:56]      + level:   5.1
[13:44:56]      + quality: 20.00 (RF)
[13:44:56]      + color profile: 1-1-1
[13:44:56]  * audio track 1
[13:44:56]    + decoder: Unknown (pcm_s16le) (2.0 ch) (1536 kbps) (track 1, id 0x1)
[13:44:56]      + bitrate: 1536 kbps, samplerate: 48000 Hz
[13:44:56]    + mixdown: Stereo
[13:44:56]    + dither: none
[13:44:56]    + encoder: AAC (libavcodec)
[13:44:56]      + bitrate: 320 kbps, samplerate: 48000 Hz
[13:44:56] sync: expecting 5767 video frames
x265 [info]: HEVC encoder version 3.2.1+1-b5c86a64bbbe
x265 [info]: build info [Windows][GCC 9.2.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
x265 [warning]: Specifying a decoder level with constant rate factor rate-control requires
x265 [warning]: enabling VBV with vbv-bufsize=160000kb vbv-maxrate=160000kbps. VBV outputs are non-deterministic!
x265 [info]: Main profile, Level-5.1 (High tier)
x265 [info]: Thread pool created using 12 threads
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 3 / wpp(34 rows)
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 2
x265 [info]: Keyframe min / max / scenecut / bias: 24 / 240 / 40 / 5.00
x265 [info]: Lookahead / bframes / badapt        : 15 / 4 / 0
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 3 / on / on
x265 [info]: Rate Control / qCompress            : CRF-20.0 / 0.60
x265 [info]: VBV/HRD buffer / max-rate / init    : 160000 / 160000 / 0.900
x265 [info]: tools: rd=2 psy-rd=4.00 signhide tmvp fast-intra
x265 [info]: tools: strong-intra-smoothing lslices=8 deblock
[13:44:57] sync: first pts video is 0
[13:44:57] sync: "Chapter 1" (1) at frame 1 time 0
[13:44:57] sync: first pts audio 0x1 is 0
[14:14:28] reader: done. 1 scr changes
[14:14:42] work: average encoding speed for job is 3.226856 fps
[14:14:42] vfr: 5768 frames output, 0 dropped and 0 duped for CFR/PFR
[14:14:42] vfr: lost time: 0 (0 frames)
[14:14:42] vfr: gained time: 0 (0 frames) (0 not accounted for)
[14:14:42] pcm_s16le-decoder done: 5768 frames, 0 decoder errors
[14:14:42] dnxhd-decoder done: 5768 frames, 0 decoder errors
[14:14:42] sync: got 5768 frames, 5767 expected
[14:14:42] sync: framerate min 24.000 fps, max 24.000 fps, avg 24.000 fps
x265 [info]: frame I:     49, Avg QP:19.72  kb/s: 70043.03
x265 [info]: frame P:   1157, Avg QP:20.99  kb/s: 51229.59
x265 [info]: frame B:   4562, Avg QP:21.04  kb/s: 49036.62
x265 [info]: Weighted P-Frames: Y:9.6% UV:0.7%
x265 [info]: consecutive B-frames: 4.1% 0.6% 1.2% 1.2% 92.9%
encoded 5768 frames in 1785.90s (3.23 fps), 49654.96 kb/s, Avg QP:21.02
[14:14:43] mux: track 0, 5768 frames, 1491740791 bytes, 49647.12 kbps, fifo 256
[14:14:43] mux: track 1, 11266 frames, 9584300 bytes, 318.98 kbps, fifo 512
[14:14:43] Finished work at: Wed Mar 17 14:14:43 2021
[14:14:43] libhb: work result = 0

# Encode Completed ...

rollin_eng
Veteran User
Posts: 4840
Joined: Wed May 04, 2011 11:06 pm

Re: Retaining Film Grain

Post by rollin_eng »

What happens if you don’t use the tune grain?
Deleted User 11865

Re: Retaining Film Grain

Post by Deleted User 11865 »

SirWindsorCornez wrote: Wed Mar 17, 2021 12:17 pmAnyway, here's the most previous one. I used QuickTime DNxHR encode before, now I changed to MXF OP1A, which solved the problem.
That's a bit weird, do you have short samples (30 seconds or less) you can upload somewhere (same source, with a DNxHR vs. the other intermediate codec)?
SirWindsorCornez
Posts: 3
Joined: Mon Mar 15, 2021 12:19 pm

Re: Retaining Film Grain

Post by SirWindsorCornez »

Rodeo wrote: Wed Mar 17, 2021 8:21 pm
SirWindsorCornez wrote: Wed Mar 17, 2021 12:17 pmAnyway, here's the most previous one. I used QuickTime DNxHR encode before, now I changed to MXF OP1A, which solved the problem.
That's a bit weird, do you have short samples (30 seconds or less) you can upload somewhere (same source, with a DNxHR vs. the other intermediate codec)?
I was gonna do the test, but I can't reproduce this problem anymore. I changed nothing yet now I'm not missing the grain anymore. I've already deleted the failed footage. I guess this problem solved itself lol, just can't understand why or how. I mean, I tried multiple different presets on HandBrake and it wasn't able to keep the grain in the QuickTime DNxHR footage at all, no matter what, till I rendered the project in MXF OP1A DNxHR with the same exact settings. Resolve render must have mixed up something in the meta, because the QT master file did have the grain when played but after encoding to h265/VP9/h264 it was lost.

If I happen to bump into this problem again, I'll make samples and copy the log. Weird.
mduell
Veteran User
Posts: 8187
Joined: Sat Apr 21, 2007 8:54 pm

Re: Retaining Film Grain

Post by mduell »

Fairly certainly you changed the encode settings, or the input file wasn't what you thought it was.

That's why we have to see logs, users can't reliably articulate what they actually did.
Post Reply