-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get thumbnail as byte array from stdout #62
base: master
Are you sure you want to change the base?
Conversation
} while (lastRead > 0); | ||
|
||
this.thumbnailByteArray = ms.ToArray(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not try reading from baseStream
all in one go?
byte[] buffer = new byte[baseStream.Length];
baseStream.Read(buffer, 0, buffer.Length);
this.thumbnailByteArray = buffer;
Only reason I could think as to why it wouldn't work is if baseStream.CanSeek
is false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd copied a code snippet. In light of your comments I've changed how the file stream is copied to the memory stream. Thanks.
Correct me if I'm wrong, but according to your change, the image file will still be created on hard drive. |
No, a file isn't created on the hard drive. |
This can resolve the issue #110 |
I've added a method GetThumbnail that doesn't have an outputFile parameter but instead returns a byte array. This byte array is the result of the thumbnail being piped out from FFmpeg.