Skip to content
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

How to use ProcessOptionsEncoder.ResumePos #7

Open
LAdam-ix opened this issue May 15, 2023 · 4 comments
Open

How to use ProcessOptionsEncoder.ResumePos #7

LAdam-ix opened this issue May 15, 2023 · 4 comments

Comments

@LAdam-ix
Copy link

Hello,
I'm currently using this library in my project, and I have a question regarding the functionality of the ProcessOptionsEncoder.ResumePos property and the whole stop and resuming process.

Here are the specific points I'd like to understand:

  1. Is there any other way how to pause an ongoing ProcessWorkerEncoder that runs FFMpegEncoding (created by EncodeFFmpeg()), other than calling Cancel() on it??
  2. If I have the process Canceled and have saved the last encoded frame, how can I continue encoding from this frame? Putting it in ProcessOptionsEncoder.ResumePos, when starting the EncodeFFmpeg(), didn't work, and it just started encoding from the beginning.

I'm trying to start Encoding, stop it save the data, and continue even if the app is closed, or just resume it after stoppping.
Can I achieve this functionality with this library, or is it impossible?

Thank you in advance for your assistance.

@mysteryx93
Copy link
Owner

mysteryx93 commented May 16, 2023

If you run a FFmpeg process in a command prompt, it just encodes until done. Is there any way to suspend it?

Actually...
https://stackoverflow.com/questions/71257/suspend-process-in-c-sharp

That's an option to explore. You can get the process and call Process.Suspend. I haven't tried it.

ResumePos was designed for Avisynth/VapourSynth encoding.

For FFmpeg, this might work. I'm not sure whether it will be frame-accurate though
https://stackoverflow.com/questions/49846095/how-to-skip-start-frames-with-ffmpeg

ffmpeg will try to adjust accordingly ... not sure whether "try" is reliable. I think it will be most of the times with no guarantee whatsoever.

@mysteryx93
Copy link
Owner

Also, even for Avisynth and Vapoursynth, generally the start pos has to be within the script itself; so although I don't remember exactly, it's possible that ResumePos was there only to pass to the UI, to inform that it's not a new encode.

@LAdam-ix
Copy link
Author

Thank you for your response and the information you gave me.

I have already explored the option of suspending the entire process in C# before discovering this library. However, the methods I came across either didn't work or required too much time to try out at the moment. It's a direction I intend to explore further when I have more time. Still, I also decided to ask here because I had assumed that this library already had this functionality when I saw the ResumePos property.

Regarding FFmpeg, my knowledge is little more than basics, so I will need to look more into it.
Thank you once again for your assistance and suggestions. I will continue to investigate and test to find something that will work.

@mysteryx93
Copy link
Owner

When using FFmpegSource in Avisynth, doc clearly says

May be frame accurate on good days.

So I would advise you not to rely on that. You'll get into trouble.

Pausing/resuming the process should work.

To get frame-accurate source, one option is to feed an Avisynth script into FFmpeg and read the source file using LSMashSourcee, which is frame-accurate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants