locked
Low quality H.265 encoding RRS feed

  • Question

  • Related SO question: this.

    The ICodecAPI properties of the HEVC encoder do not seem to work. I'm trying to encode video with MF H.265, and no matter what I try, the quality is always lower than the same-settings video procuded by non MF encoders, like what VideoPad uses (say, ffmpeg) at the same 4000 bitrate.

    Videopad produces this video of a swimming boy. My app produces this video. The sky in my app is clearly worse at a 6K bitrate, where the VideoPad is at 1K.

    https://docs.microsoft.com/en-us/windows/win32/medfound/h-265---hevc-video-encoder : does that link describe successfully the parameters of the H.265 encoder? Quality vs speed does not work. Quality when setting eAVEncCommonRateControlMode_Quality does not work. 


    if (true)
        {
            VARIANT v = {};
            v.vt = VT_BOOL;
            v.boolVal  = VARIANT_FALSE;
            ca->SetValue(&CODECAPI_AVLowLatencyMode, &v);
    
        }
        if (true)
        {
            VARIANT v = {};
            v.vt = VT_UI4;
            v.ulVal = 100;
            hr = ca->SetValue(&CODECAPI_AVEncCommonQualityVsSpeed, &v);
        }
    
        if (true)
        {
            VARIANT v = {};
            v.vt = VT_UI4;
            v.ulVal = eAVEncCommonRateControlMode_Quality;
            ca->SetValue(&CODECAPI_AVEncCommonRateControlMode, &v);
            if (true)
            {
                VARIANT v = {};
                v.vt = VT_UI4;
                v.ulVal = 100;
                ca->SetValue(&CODECAPI_AVEncCommonQuality, &v);
            }
        }

    I also added the MF_MT_MPEG2_LEVEL  and the MF_MT_VIDEO_PROFILE , no luck. Same quality and same encoding speed (very fast).

    What am I missing?


    Michael



    • Edited by WindowsNT Monday, January 20, 2020 3:40 PM
    Monday, January 20, 2020 3:39 PM

All replies

  • Hello WindowsNT,

    Could you use Windows Hardware Lab Kit and Windows HLK Supplemental Test Content to test to see if it can reproduce this issue?

    Refer to "H265 Encode Quality related tests" and "Hardware decoder driver recommendations - Nvidia".

    Best regards,

    Rita


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Tuesday, January 21, 2020 6:09 AM
  • Hello WindowsNT,

    Has this issue solved? Feel free let me know if you have any concern.

    Best regards,

    Rita


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, February 12, 2020 2:17 AM
  • Hello Rita,

    Generally, Software encoding using MF is bad. Even my new NVidia card (GeForce 1650) would encode it good with H.265 Media Foundation interface but it doesn't accept all configuration, for example, the Speed Vs Quality ratio is fixed to 22, no matter what I set in the ICodecAPI.

    Using libx265 and ffmpeg's hevc_nvenc solves my problems because it uses directly the CUDA api. It seems that media foundation support for all this (very important encoding) stuff is fundamentally broken. 


    Michael

    Wednesday, February 12, 2020 7:35 PM