VidCoder icon indicating copy to clipboard operation
VidCoder copied to clipboard

Vidcoder is having high CPU after buying a new RTX 4090

Open sdugoten opened this issue 2 years ago • 7 comments

Problem Description

I used to have a RTX 2080 and encoding was fine using H265 NvEnc. CPU usage was around 15% or so

I recently bought a RTX 4090 and notice very high CPU usage like below (Ryzen 3950x)

image

So, I try another encoder called MediaCoder using same setting and encode with H265 NvEnc. CPU stay at around 15% as I expected

image

I wonder why such a high CPU usage after I use the new RTX 4090?

What version of VidCoder are you running?

9.9 beta

Encode Log

VC [12:11:34] VidCoder 9.9 Beta
VC [12:11:34] Starting job 1/1
VC [12:11:34]   Source path: D:\test.mp4
VC [12:11:34]   Destination path: H:\Test.mp4
VC [12:11:34]   Title: 1
VC [12:11:34]   Range: All
VC [12:11:34]   Preset: 1280H265
VC [12:11:34]   Picker: Picker 2
VC [12:11:34] Worker ready: Pipe 'VidCoderWorker.af267c66-86aa-4704-8e96-99d7a7af8ee7' is open
VC [12:11:34] Connecting to process 32216 on pipe VidCoderWorker.af267c66-86aa-4704-8e96-99d7a7af8ee7
HB [12:11:35] CPU: AMD Ryzen 9 3950X 16-Core Processor
[12:11:35]  - logical processor count: 32
[12:11:35] Intel Quick Sync Video support: no
[12:11:35] hb_scan: path=D:\test.mp4, title_index=1
udfread ERROR: ECMA 167 Volume Recognition failed
src/libbluray/disc/disc.c:333: failed opening UDF image D:\test.mp4
src/libbluray/disc/disc.c:437: error opening file BDMV\index.bdmv
src/libbluray/disc/disc.c:437: error opening file BDMV\BACKUP\index.bdmv
[12:11:35] bd: not a bd - trying as a stream/file instead
libdvdread: DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdnav: vm: vm: failed to read VIDEO_TS.IFO
[12:11:35] dvd: not a dvd - trying as a stream/file instead
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'D:\test.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.76.100
  Duration: 01:58:05.44, start: 0.000000, bitrate: 5983 kb/s
  Stream #0:0[0x1](und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 5845 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
[12:11:35] scan: decoding previews for title 1
[12:11:35] scan: audio 0x1: aac, rate=48000Hz, bitrate=127763 Unknown (AAC LC) (2.0 ch) (127 kbps)
HB [12:11:35] using container PAR 1:1
[12:11:35] scan: 10 previews, 1920x1080, 29.970 fps, autocrop = 0/0/0/0, aspect 16:9, PAR 1:1, color profile: 1-1-1, chroma location: left
[12:11:35] scan: supported video decoders: avcodec hwaccel
[12:11:35] libhb: scan thread found 1 valid title(s)
HB [12:11:36] Starting work at: Mon Jul 31 12:11:36 2023
[12:11:36] 1 job(s) to process
[12:11:36] json job:
{
  "Audio": {
    "AudioList": [
      {
        "Bitrate": 128,
        "DRC": 0,
        "Encoder": "av_aac",
        "Gain": 0,
        "Mixdown": 4,
        "NormalizeMixLevel": false,
        "Samplerate": 0,
        "Track": 0,
        "DitherMethod": 0
      }
    ],
    "CopyMask": [
      "copy:aac",
      "copy:ac3",
      "copy:eac3",
      "copy:truehd",
      "copy:dts",
      "copy:dtshd",
      "copy:mp2",
      "copy:mp3",
      "copy:flac",
      "copy:opus"
    ]
  },
  "Destination": {
    "ChapterList": [],
    "ChapterMarkers": false,
    "AlignAVStart": false,
    "File": "H:\\Test.part.mp4",
    "Mp4Options": {
      "IpodAtom": false,
      "Mp4Optimize": false
    },
    "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": 7,
        "Settings": {
          "mode": "1"
        }
      },
      {
        "ID": 14,
        "Settings": {
          "crop-bottom": "0",
          "crop-left": "0",
          "crop-right": "0",
          "crop-top": "0",
          "height": "720",
          "width": "1280"
        }
      }
    ]
  },
  "PAR": {
    "Num": 1,
    "Den": 1
  },
  "Metadata": {},
  "SequenceID": 0,
  "Source": {
    "Angle": 1,
    "Range": {
      "Type": "chapter",
      "Start": 1,
      "End": 1
    },
    "Title": 1,
    "Path": "D:\\test.mp4"
  },
  "Subtitle": {
    "Search": {
      "Burn": false,
      "Default": false,
      "Enable": false,
      "Forced": false
    },
    "SubtitleList": []
  },
  "Video": {
    "Encoder": "nvenc_h265",
    "Level": "auto",
    "MultiPass": false,
    "Turbo": false,
    "ColorMatrixCode": 0,
    "Options": "",
    "Preset": "medium",
    "Profile": "auto",
    "Quality": 27,
    "QSV": {
      "Decode": false
    },
    "HardwareDecode": 4
  }
}
[12:11:36] Starting Task: Encoding Pass
[12:11:36] work: track 1, dithering not supported by codec
[12:11:36] job configuration:
[12:11:36]  * source
[12:11:36]    + D:\test.mp4
[12:11:36]    + title 1, chapter(s) 1 to 1
[12:11:36]    + container: mov,mp4,m4a,3gp,3g2,mj2
[12:11:36]    + data rate: 5983 kbps
[12:11:36]  * destination
[12:11:36]    + H:\Test.part.mp4
[12:11:36]    + container: MPEG-4 (libavformat)
[12:11:36]  * video track
[12:11:36]    + decoder: h264 8-bit (yuv420p)
[12:11:36]      + bitrate 5845 kbps
[12:11:36]    + filters
[12:11:36]      + 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:11:36]      + Decomb (mode=39)
[12:11:36]      + Framerate Shaper (mode=1)
[12:11:36]        + frame rate: 29.970 fps -> constant 29.970 fps
[12:11:36]      + Crop and Scale (width=1280:height=720:crop-top=0:crop-bottom=0:crop-left=0:crop-right=0)
[12:11:36]        + source: 1920 * 1080, crop (0/0/0/0): 1920 * 1080, scale: 1280 * 720
[12:11:36]    + Output geometry
[12:11:36]      + storage dimensions: 1280 x 720
[12:11:36]      + pixel aspect ratio: 1 : 1
[12:11:36]      + display dimensions: 1280 x 720
[12:11:36]    + encoder: H.265 (NVEnc)
[12:11:36]      + preset:  medium
[12:11:36]      + profile: auto
[12:11:36]      + level:   auto
[12:11:36]      + quality: 27.00 (CQ)
[12:11:36]      + color profile: 1-1-1
[12:11:36]      + chroma location: left
[12:11:36]  * audio track 1
[12:11:36]    + decoder: Unknown (AAC LC) (2.0 ch) (127 kbps) (track 1, id 0x1)
[12:11:36]      + bitrate: 127 kbps, samplerate: 48000 Hz
[12:11:36]    + mixdown: Stereo
[12:11:36]    + encoder: AAC (libavcodec)
[12:11:36]      + bitrate: 128 kbps, samplerate: 48000 Hz
[12:11:36] sync: expecting 212350 video frames
[12:11:36] encavcodecInit: H.265 (Nvidia NVENC)
[12:11:36] encavcodec: encoding at rc=vbr, 27.00
[12:11:36] encavcodec: encoding with stored aspect 1/1
HB [12:11:36] sync: first pts video is 0
[12:11:36] sync: Chapter 1 at frame 1 time 0
[12:11:36] sync: first pts audio 0x1 is 0

sdugoten avatar Jul 31 '23 11:07 sdugoten

One more thing, unlike when I used my old RTX 2080, the new RTX 4090 do not even make the GPU fan turn on, it stays at 0 RPM meaning that it's not even utilizing it enough to trigger the fan turn on. It looks like it's not fully using the GPU.

On the other end, another encoder Mediacoder did trigger the GPU fan turned on .

sdugoten avatar Jul 31 '23 11:07 sdugoten

In Task Manager -> Performance, does it show Video Encode usage on the GPU section? There are some things that can cause CPU usage like audio encoding or the rescale filter that you're using.

RandomEngy avatar Aug 01 '23 05:08 RandomEngy

In Task Manager -> Performance, does it show Video Encode usage on the GPU section? There are some things that can cause CPU usage like audio encoding or the rescale filter that you're using.

I did a bit more testing, here is the comparison for same encoding setting and same video file

using XMedia Recode, H265 Nvidia at 1920

image

Using Handbrake 1.61, same setting, all filter off

image

Using Vidcoder 9.9 beta , H265 Nvidia at 1920, and I turned off all filter, and you could see significantly higher cpu

image

image

sdugoten avatar Aug 01 '23 11:08 sdugoten

Those screenshots show your GPU at 65%, 72%, 50%. Did you check the GPU tab details on the Performance monitor? Also technically the Sizing options count as a "rescale" filter if they are selected, and audio encoding can cause CPU use.

RandomEngy avatar Aug 01 '23 14:08 RandomEngy

Here are the screenshot for GPU tab for comparison. Test is done on a 1920x1080 H265 mkv file , encode into H265 1920 x 1080 mp4 with no filter for all app

XMedia Recode

variable frame rate (CPU usage 19%) image

constant frame rate (CPU usage 16%) image

Handbrake

variable frame rate (CPU usage 12%) image

Constant frame rate (CPU usage 37%) image

Vidcoder

variable frame rate (CPU usage 15%) image

constant frame rate (CPU usage 40%)

image

It seems the problem here is "Constant frame rate". It tries to do video decode on "constant frame rate" via CPU which make it higher cpu usage?

sdugoten avatar Aug 01 '23 15:08 sdugoten

One more thing, I found that using Vidcoder to encode H264 1920x1080 file into H265 1920x1080 use 10% CPU usage for variable frame rate. Constant frame rate shoot up to 40% CPU usage.

Handbrake's behavior is a bit different, encode H264 1920x1080 file into H265 1920x1080 using variable frame rate have 10% CPU usage, constant frame rate still shoot up to 30% CPU usage range.

XMedia Recode don't use CPU at all, both variable frame rate and constant frame rate , encode H264 1920x1080 file into H265 1920x1080 use 10% CPU usage.

If I use any kind of video filter (those default setting), vidcoder will shoot up to 70%+ on CPU usage

I can't find the pattern here...

sdugoten avatar Aug 01 '23 16:08 sdugoten

Probably has to do with how the framerate filter on each encoder is implemented. But all this is not surprising to me; as potentially setting a constant framerate could require frame interpolation if used on a VFR source.

RandomEngy avatar Aug 02 '23 06:08 RandomEngy