FFMpegCore icon indicating copy to clipboard operation
FFMpegCore copied to clipboard

i need help

Open try2020-code opened this issue 7 months ago • 0 comments

I spent a day researching reading frame by frame from video file.mp4 into memory for processing, but without any results. I need help.

` public static void Test() {

 int index = 0;
 using (var ms = new MemoryStream())
 {
     var parms = FFMpegArguments
       .FromFileInput(@"C:\Users\1\Desktop\name.mp4")
       .OutputToPipe(new StreamPipeSink(ms), options => options
         .ForceFormat("rawvideo")
         .WithVideoCodec(VideoCodec.Png)
         //.Resize(new Size(Config.JpgWidthLarge, Config.JpgHeightLarge))
         //.WithCustomArgument("-vf fps=1 -update 1")
         .WithCustomArgument("-vf fps=1/1 -update 1")
       );

     parms.NotifyOnProgress(o =>
      {
          Debug.WriteLine(o);
          try
          {
              if (ms.Length > 0)
              {
                  // ms.Position = 0;
                  // var bitmap = SKBitmap.Decode(ms);
                  // var bitmap = Image.Load(ms);
                  // using (var bitmap = Image.Load(ms))
                  Debug.WriteLine($"num {index++}");

                  // Modify bitmap here

                  // Save the bitmap

                  //using (var stream = new FileStream(@$"C:\Users\1\source\repos\AiMovie\... t_{index++}.png", FileMode.Create))
                  //{
                  //   
                  //    var pngData = bitmap.Encode(SKEncodedImageFormat.Png, 100);  
                  //    pngData.SaveTo(stream);
                  // 
                  //    pngData.SaveTo(stream);
                  //}


                  //ms.Position = 0;
                  // ms.SetLength(0);

              }
          }
          catch (Exception e)
          {
              //ms.SetLength(0);
              Console.WriteLine("err");
          }
      })
      .ProcessSynchronously();
     //.ProcessAsynchronously();
 }

} `

i try anythion

try2020-code avatar Jul 03 '24 05:07 try2020-code