unosquare/ffmediaelement

DecoderParams Not Working

Opened this issue · 1 comments

Yoojs2 commented

Issue Categories

  • Bug
  • Feature Request
  • Question
  • Not sure

Version Information

  • NuGet Package 4.4.350
  • Build From Master branch, Commit Enter commit id. Example: 704c482
  • Build from Branch Name, Commit Enter commit id. Example: 704c482

Sample Code

C#

MediaElement.MediaOpening += (sender, e) =>
{
    if (e.Options.VideoStream is StreamInfo videoStream)
    {
        var videoCodec = e.Options.VideoStream?.CodecName ?? "Unknown";
        var audioCodec = e.Options.AudioStream?.CodecName ?? "Unknown";

        e.Options.DecoderParams["colorspace"] = "bt470bg";
        //e.Options.DecoderParams["colorspace"] = "rgb";       
        //e.Options.DecoderParams["color_range"] = "tv";
        
    }
};

As shown in the code above, I am trying to change the color tone of the video using DecoderParams, but there is no change in the color tone.

The Media Element of FFme shows a different color tone compared to other video players.

I found that using VideoFilter, as shown in the code below, produces almost the same color tone as other video players:

C#

e.Options.VideoFilter = "scale=in_color_matrix=bt709:out_color_matrix=bt601";

However, to utilize FFme's fast frame seeking feature, I need a different method for adjusting the color tone rather than using post-processing.

I believe using DecoderParams might work, but despite trying all the options from the official FFmpeg documentation, there is no change in color tone.

Options I tried:

colorspace

‘rgb’ sRGB
‘bt709’ bt709
‘bt470bg’ bt601
‘smpte170m’ smpte170
‘smpte240m’ smpte240
‘bt2020_ncl’ bt2020

Is there something wrong with how I am using DecoderParams?
Additionally, if there is another way to adjust the color range by setting options before decoding, please let me know.

I look forward to your response.

Thank you.

Could you post an ffplay command-line that correctly passes these decoder parameters and gives the expected result?