Changing the format in a Media Player freezes the playback

I’m trying to get a video feed from a webcam playing in Unreal. These are the formats that I can see in the Media Player info tab.

Player: WmfMedia

Play Rates
    Thinned: 1,0
    Unthinned: 1,0, 0,0

Capabilities
    Scrubbing: No
    Seeking: No

Stream 0
	Type: Video
	Format 0
		Codec: YUY2
		Frame Rate: 15 fps
		Frame Rate Range: 15 - 15 fps
		Dimensions: 3840 x 2160
	Format 1
		Codec: YUY2
		Frame Rate: 10 fps
		Frame Rate Range: 10 - 10 fps
		Dimensions: 3840 x 2160
	Format 2
		Codec: YUY2
		Frame Rate: 5 fps
		Frame Rate Range: 5 - 5 fps
		Dimensions: 3840 x 2160
	Format 3
		Codec: YUY2
		Frame Rate: 1 fps
		Frame Rate Range: 1 - 1 fps
		possibly a still image stream (may not work)
		likely an unsupported still image stream
	Format 4
		Codec: YUY2
		Frame Rate: 30 fps
		Frame Rate Range: 30 - 30 fps
		Dimensions: 1920 x 1080
	Format 5
		Codec: YUY2
		Frame Rate: 50 fps
		Frame Rate Range: 50 - 50 fps
		Dimensions: 1920 x 1080
	Format 6
		Codec: YUY2
		Frame Rate: 15 fps
		Frame Rate Range: 15 - 15 fps
		Dimensions: 1920 x 1080
	Format 7
		Codec: YUY2
		Frame Rate: 1 fps
		Frame Rate Range: 1 - 1 fps
		possibly a still image stream (may not work)
		likely an unsupported still image stream
	Format 8
		Codec: YUY2
		Frame Rate: 90.0001 fps
		Frame Rate Range: 90.0001 - 90.0001 fps
		Dimensions: 1280 x 720
	Format 9
		Codec: YUY2
		Frame Rate: 60 fps
		Frame Rate Range: 60 - 60 fps
		Dimensions: 1280 x 720
	Format 10
		Codec: YUY2
		Frame Rate: 30 fps
		Frame Rate Range: 30 - 30 fps
		Dimensions: 1280 x 720
	Format 11
		Codec: YUY2
		Frame Rate: 15 fps
		Frame Rate Range: 15 - 15 fps
		Dimensions: 1280 x 720
	Format 12
		Codec: YUY2
		Frame Rate: 1 fps
		Frame Rate Range: 1 - 1 fps
		possibly a still image stream (may not work)
		likely an unsupported still image stream

The Playback Options only show 9 though.

The problem I’m having is that, no matter what I do, it always just picks the first one in the list. So 3840 x 2160 at 15fps in my case. I really want to use 1280x720 at 90fps, but when I switch to that format in the Playback Options, the video feed just freezes. I’ve tried with another webcam, a standard Logitech one, and it behaves exactly the same.

I thought that maybe it was just the preview video in the Media Player UI acting up, so I made a Blueprint to switch it there. But no matter which format index I pick, it always selects what looks like index 0 from the list, 3840 x 2160 at 15fps.

I verified that the Return Value of the Set Track Format node returns true. I’ve also verified that these other formats work outside of Unreal. OBS player is able to switch without issues, as well as a Pythonscript using cv2. I also managed to get it working just fine in Unity. So I’m pretty sure it’s not a hardware issues, but something Unreal does wrong. I just don’t know what.

Does anyone know why this is happening? Any insight would be helpful.

This seems to be an issue in 5.5 and 5.4. When I went back to 5.3.2, everything basically works. There are some quirks, still, but I’m able to start a level and change to a different format.

I did have to bump the delay to a couple of seconds before changing the format to make sure there was a videostream coming in before wanting to change it.

Just to update, 5.6 suffers from the same issue. It behaves the same as 5.4 and 5.5

The solution to this is to add 0.5 delay after using “open url” or “open source” so that it will first open source and then apply the format. This works for me in 5.4.4

the ordering issue rafhan found (delay after open before touching format) is real with WMF because format negotiation happens asynchronously once the source opens; setting player rate or format while the graph is still building stalls the session. two additions from the media framework side:

  1. the freeze mechanism: WMF sources report capabilities in stages. immediately after open url, the streams exist but their negotiated media types may still be settling; a set format call in that window can deadlock the presentation clock, which shows as a frozen frame with playback state running. the 0.5s delay works because it lets the opened event fire first. more robust than a blind delay: bind to the on media opened event delegate and only apply format changes from there.
  2. webcam specifics: WMF capture uses the device’s negotiated format (your YUY2 3840x stream); requesting a different frame rate or resolution than the device’s negotiated type often cannot be honored mid-stream. if the goal is a lower-cost capture, pick a device mode the info tab lists, or configure the device before open. mid-stream format switches on capture sources are the least supported operation in the whole media stack.
  3. if this is for live feed rendering, consider the alternative paths: a media texture fed by the capture directly (no player rate manipulation), or the webcam and mixed reality plugins that handle device modes at open time.
  4. general hygiene for the freeze class of bug: any player operation (rate, format, seek) after open belongs behind on media opened, and rate changes additionally want the supported rates from the info tab (thinned/unthinned), otherwise the graph silently stalls. wrap open, wait opened, apply settings as your standard sequence and the freeze disappears across sources, not just webcams.