dajuric / dot-imaging

Minimalistic .NET imaging portable platform
313 stars 37 forks source link

VideoWriter - Video files with broken or missing index #20

Open fidanken opened 5 years ago

fidanken commented 5 years ago

Video files are generated with broken or missing index (VLC message), independently by the video codec. To isolate the problem the very basic sequence of calls is:

cameraCapture = new CameraCapture(1); String name = @"C:\Users\fidanken\Documents\dotImaging.avi"; VideoCodec videoCodec = new VideoCodec("UserSelection"); cameraCapture.Open(); go = true; await GoAsync();

private async Task GoAsync()
{    
    while (go)
    {
    frameIImage = await cameraCapture.ReadAsync(); //reads stream asynchronously
    await videoWriter.WriteAsync(frameIImage);    
    }      
}

go = false; videoWriter.Close(); videoWriter.Dispose();

It seems to me that somehow, when calling Close() and/or Dispose() (I tried multiple combinations), the files are not correctly closed.

Thank You for any help