Can't play H264 video created with ffmpeg libx264 library with Maui Community MediaElement

47 Views Asked by At

In my .NET MAUI project I want to play a video with the Maui Community Toolkit MediaElement that I've created with ffmpeg.

Video's that I've created with the following arguments (using the mpeg4 codec) can be played without any issue with the MediaElement:

ffmpeg -framerate {preferredFrameRate} -i {OutputImgPath} -c:v mpeg4 -r {preferredFrameRate} {OutputVideoPath}

However, I prefer to use the ffmpeg libx264 library for better quality;

ffmpeg -framerate {preferredFrameRate} -i {OutputImgPath} -c:v libx264 -r {preferredFrameRate} {OutputVideoPath}

Video's that I've created with libx264 in ffmpeg cannot be played with MediaElement. The MediaElement displays the error: Video could not be decoded.

enter image description here

I can play the video in VLC without issue. The video contains no sound. If I check the codec information in VLC I can see the following info:

enter image description here

I'm not sure if this is a limitation of the MediaElement or something else. It's not a big dealbreaker for me to use another codec, however, I was curious if there was a way to play video's that support more codecs in .NET Maui. Thank you for your help.I'm using CommunityToolkit.Maui.MediaElement 3.1.0.

0

There are 0 best solutions below