-1

can u help me with regex in FFMpegConverter?

I have a bitmaps a saving them like it:

 foreach (Bitmap printscreen in printscreeny)
  {
    printscreen.Save(Path.GetTempPath()  + guid +"_"+ i);
    i++;
  }

then I want to convert them by NReco videoConverter but dont know how to write regex part to describe path.

I have it like it:

 videoConverter.ConvertMedia(Path.GetTempPath()  + guid + "_"+" *%d.bmp", null,"test.mp4", null, convertSettings);

Thanks

1 Answers1

0

One way to do this would be to keep track of the files in a list:

private List<string> unconvertedFiles = new List<string>();

Then you can add the file paths to this list when you save them:

// Save files
foreach (Bitmap printscreen in printscreeny)
{
    var path = Path.Combine(Path.GetTempPath(), Guid.NewGuid() + ".bmp");
    printscreen.Save(path);

    // Add this path to our list for converting
    unconvertedFiles.Add(path);
}

And now later, when you want to process the files, you can just get the paths from your list (and remove them from the list when you're done):

// Process files
foreach (var path in unconvertedFiles.ToList())
{
    videoConverter.ConvertMedia(path, null, "test.mp4", null, convertSettings);

    // Remove it from our list so we don't process it again
    unconvertedFiles.Remove(path);
}
Rufus L
  • 36,127
  • 5
  • 30
  • 43
  • ok, but its not what I want. I have sequence of bitmaps in list, or on hdd and want make from them one video file. Same like here: https://stackoverflow.com/questions/37865475/nreco-video-converter-make-video-from-image-sequence – Vít Hněvkovský May 23 '18 at 07:00