-
Notifications
You must be signed in to change notification settings - Fork 56
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
Reset MediaFile Stream position? #122
Comments
Both VideoStream and AudioStream wrappers have a |
For anyone stumbling across this: I couldn't find the |
I'm pretty sure you can save a reference to the video FileStream(or any stream) and directly call the seek function of the stream. What I ended up doing was essentially wrapping a System.IO.FileStream videoStream = System.IO.File.Open("video.mp4", System.IO.FileMode.Open);
FFMediaToolkit.Decoding.MediaFile VideoFile = MediaFile.Open(SourceStream);
// Seek in the "stream"...
videoStream.Seek(0, System.IO.SeekOrigin.Begin); |
@tottaka @Saalvage glad you guys have found some workarounds, I'm surprised the built-in Regardless, I think that the former of those suggested would be considered the "best practice" for FFMediaToolkit. This is because FFmpeg uses its own internal caches and buffers to keep track of a container's various streams and how they flow through your application. I fear that manually seeking the I'm sure FFmpeg's developer docs have some guidance about this as well, as seeking streams is a very common and well-defined operation. Traditionally I've seen it done via Cheers! |
Thank you very much for the insights! The only mystery that remains is that of |
Hi, is it possible to reset the media file video and audio streams back to beginning once they reach the end? For example to make the video loop back to the beginning once all frames have been consumed.
I tried TryGetFrame with the timestamp of the beginning of the video, but that doesn't seem to "reset the internal stream" if there even is one.
Do I have to just call
MediaFile.Open
again or is there a better method of doing this?The text was updated successfully, but these errors were encountered: