尝试将原始图像写入以下内容时出现异常ConvertLiveMedia
:
System.IO.IOException:“Канал был закрыт。
System.IO.IOException:“通道已关闭。”
var ffMpeg = new NReco.VideoConverter.FFMpegConverter();
var frame = Bitmap.FromFile("source.jpg");
var bytes = ImageToByte(frame);
using (var fs = new FileStream("output.mp4", FileMode.Create))
{
var mediaTask = ffMpeg.ConvertLiveMedia(Format.raw_video, fs, Format.mp4, new ConvertSettings()
{
});
mediaTask.Start();
for (int f = 0; f < frames; f++)
{
mediaTask.Write(bytes, 0, bytes.Length); //exception here channel was closed
}
mediaTask.Stop();
}