Anbu Mani

Anbu Mani

  • 145
  • 12.4k
  • 2.3m

Xamarin Android Spliting Video Frames Return Null Values

Jul 15 2017 6:35 AM
Hi Friends Am using Below Code for Video to Frame Split up,I took the Video in 5Sec afterthat am converted 90 Frames ,but my out was return after 21st Frames to Null Values only..Please Help me..Thanks to Advance...
 
Android.Net.Uri videoUri = data.Data; 
MediaMetadataRetriever media = new MediaMetadataRetriever();
media
.SetDataSource(this, videoUri);
MediaPlayer mp = MediaPlayer.Create(this, videoUri);
long durata_millisec = mp.Duration; List<Android.Graphics.Bitmap> frames;
frames
= new List<Android.Graphics.Bitmap>();
Bitmap bmFrame;
for
(int i = 47777; i < durata_millisec * 1000; i += 47777)
{
bmFrame
= media.GetFrameAtTime(i, MediaMetadataRetriever.OptionClosestSync);
frames
.Add(bmFrame);
}