unosquare / ffmediaelement

FFME: The Advanced WPF MediaElement (based on FFmpeg)
https://unosquare.github.io/ffmediaelement/
Other
1.18k stars 244 forks source link

How to get media properties before source is loaded into the FFME mediaelement #398

Closed manity42 closed 5 years ago

manity42 commented 5 years ago

Issue Title (How to get media properties before source is loaded into the FFME mediaelement*)

I have a small app that loads and plays a media file. But i need to get the media duration, and start time and frame rate before the file is opened in the player. So i have done this to load that data i need.

Unosquare.FFME.Library.FFmpegDirectory = @"C:\FFMPEG\x86\"; Unosquare.FFME.Library.FFmpegLoadModeFlags = FFmpegLoadMode.FullFeatures; Library.LoadFFmpeg();

List mediaInfoList = new List(); mediaInfoList.Clear(); mediaInfoList.Add(Library.RetrieveMediaInfo(@"D:\Videos\HDVideo1.mp4")); mediaInfoList.Add(Library.RetrieveMediaInfo(@"D:\Videos\HDVideo2.mp4")); mediaInfoList.Add(Library.RetrieveMediaInfo(@"D:\Videos\HDVideo3.mp4")); mediaInfoList.Add(Library.RetrieveMediaInfo(@"D:\Videos\HDVideo4.mp4"));

// process data

mediaInfoList.Clear(); mediaInfoList = null;

Question is

  1. is it ok to do this and load the ffmpeg libs this way before any videos are loaded in the player. Do i need to watch out for or dispose of anything before allowing the player to load videos after doing this ?

Any advice appreciated.

thanks

Issue Categories

Version Information

Ocimandias commented 5 years ago

Dear manity42, You could use the FFME.MediaEngine.RetrieveMediaInfo(fullmediapath) function to load detailed data from the footage. Hope this helps

mariodivece commented 5 years ago

I suggest you serialize the metadata of the media file and load it when needed. When you load the video, simply overwrite the metadata. Closing since this is outside the scope of this project.