Skip to content
This repository has been archived by the owner on Jan 7, 2023. It is now read-only.

I have been unable to get mfxh264enc to work on Windows #169

Open
kwende opened this issue Apr 12, 2019 · 5 comments
Open

I have been unable to get mfxh264enc to work on Windows #169

kwende opened this issue Apr 12, 2019 · 5 comments

Comments

@kwende
Copy link

kwende commented Apr 12, 2019

Update: I'm on Windows 10, 64-bit. The processor is an Intel Core i7-6700K @ 4Ghz.

I successfully built and installed the gstreamer plugins following the instructions laid out here. When I try any of the examples from https://github.com/intel/gstreamer-media-SDK/blob/topic_linux_and_window/README.USAGE that involve mfxh264enc, however, they fail. I'm able to get the following to play just fine:

.\gst-launch-1.0.exe videotestsrc ! mfxsink

And I'm able to get the following (and many other non-Media-SDK-based things) to work (notice how I'm not using media sdk):

.\gst-launch-1.0.exe videotestsrc is-live=true ! openh264enc ! rtph264pay ! rtph264depay ! decodebin ! autovideosink

Replacing the encoder in the above command like this:

.\gst-launch-1.0.exe videotestsrc is-live=true ! mfxh264enc ! rtph264pay ! rtph264depay ! decodebin ! autovideosink

Fails. I notice the following when I set the GST_DEBUG level to 4 or higher:

0:00:00.243975000 8740 000001EC81B1F140 ERROR mfx gstmfxencoder.c:1202:gst_mfx_encoder_prepare: Unsupported video params -3
0:00:00.253680000 8740 000001EC81B1F140 ERROR mfx gstmfxencoder.c:1304:gst_mfx_encoder_start: Error initializing the MFX video encoder -15
0:00:00.280482000 8740 000001EC81B1F140 ERROR mfxencode gstmfxenc.c:436:gst_mfxenc_handle_frame: failed to encode frame 0 (status -3)
0:00:00.290568000 8740 000001EC81B1F140 WARN basesrc gstbasesrc.c:3064:gst_base_src_loop: error: Internal data stream error.
0:00:00.300483000 8740 000001EC81B1F140 WARN basesrc gstbasesrc.c:3064:gst_base_src_loop: error: streaming stopped, reason error (-5)
0:00:00.312413000 8740 000001EC81B1F140 WARN typefind gsttypefindelement.c:988:gst_type_find_element_chain_do_typefinding: error: Stream doesn't contain enough data.

This error presents itself time and time again (the same output). For example, if I try a sample from the Wiki (adapted to work for videotestsrc):

.\gst-launch-1.0.exe videotestsrc ! mfxh264enc ! 'video/x-h264, stream-format=byte-stream, profile=baseline' ! rtph264pay pt=96 ! udpsink port=3001

Same or similar output is noticed, and it fails:

0:00:09.932835000 7740 000002B930BBDE00 ERROR mfx gstmfxencoder.c:1202:gst_mfx_encoder_prepare: Unsupported video params -3
0:00:09.942275000 7740 000002B930BBDE00 ERROR mfx gstmfxencoder.c:1304:gst_mfx_encoder_start: Error initializing the MFX video encoder -15
0:00:09.950899000 7740 000002B930BBDE00 ERROR mfxencode gstmfxenc.c:436:gst_mfxenc_handle_frame: failed to encode frame 0 (status -3)
0:00:09.966414000 7740 000002B930BBDE00 WARN basesrc gstbasesrc.c:3064:gst_base_src_loop: error: Internal data stream error.
0:00:09.992535000 7740 000002B930BBDE00 WARN basesrc gstbasesrc.c:3064:gst_base_src_loop: error: streaming stopped, reason error (-5)

Any thoughts? We would really like to use this framework to optimize gstreamer, but we are using Windows and thus far have been unable to get the encoder we need to work.

@kwende
Copy link
Author

kwende commented Apr 26, 2019

I think there's a bug in the code for these plugins. If you comment/remove the following from gstmfxencoder.c:

  if (MFX_CODEC_AVC == priv->profile.codec) {
#if MSDK_CHECK_VERSION(1,25)
    if (GST_MFX_CHECK_RUNTIME_VERSION (priv->aggregator, 1, 25)) {
      priv->extmfp.Header.BufferId = MFX_EXTBUFF_MULTI_FRAME_PARAM;
      priv->extmfp.Header.BufferSz = sizeof (priv->extmfp);
	  priv->extmfp.MFMode = priv->multiframe_mode;
      priv->extparam_internal[priv->params.NumExtParam++] =
        (mfxExtBuffer *) & priv->extmfp;
    }
#endif
  }

Then the encoder works just fine for me. However, leaving it in, I get the errors above. Has this feature been deprecated in later versions of the SDK and perhaps this code isn't taking that into account?

My SDK version is 1.27. It looks like this code is checking for 1.25 and greater.

@ishmael1985
Copy link
Contributor

@kwende good catch, this code I believe works only for Linux and not Windows, this is the multi-frame encode option for Skylake platforms.

@kwende
Copy link
Author

kwende commented May 3, 2019

@ishmael1985 , I can do a fix and make a pull request if you'd like.

Also: I've got another problem I'm going to open an issue about today, perhaps momentarily. I'm heavily using this on Windows and so possibly encountering things others are not.

@pauldotknopf
Copy link

I just ran into this as well, removing the code you mentioned did indeed fix it.

Thanks!

@kwende, what else are you running into?

@ishmael1985
Copy link
Contributor

Guess I will clean this up.

ishmael1985 added a commit to ishmael1985/gstreamer-media-SDK that referenced this issue Jul 26, 2019
ishmael1985 added a commit to ishmael1985/gstreamer-media-SDK that referenced this issue Jul 26, 2019
ishmael1985 added a commit to ishmael1985/gstreamer-media-SDK that referenced this issue Jul 26, 2019
ishmael1985 added a commit to ishmael1985/gstreamer-media-SDK that referenced this issue Jul 30, 2019
ishmael1985 added a commit to ishmael1985/gstreamer-media-SDK that referenced this issue Jul 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants