[FFmpeg-user] Resuming ffmpeg encode after interrupt

Moritz Barsnick barsnick at gmx.net
Fri Jun 9 10:25:59 EEST 2017


On Thu, Jun 08, 2017 at 21:24:52 -0600, JD wrote:
> So, instead of restarting from the very beginning, is there a way to resume
> the encode based on the size of the output file?
> I  mean that ffmpeg should be able to know the time offset of the very
> last frame encoded. Is this true?

Well, for most common codecs, it isn't just about frame for frame.
Codec compression often refers to frames before and after, and there
are calculations going on all along (e.g. for average bitrate) which
would be lost. That said, one *could* probably come up with codec
implementations which can become largely stateless at some point,
needing to remember or recover only a few parameters (HW encoders
*probably* work that way), but I don't know about actual cut-points.
These implementations may or may not exist, but it's just not that
easy. And ffmpeg isn't capable of keeping its encoding state, as far as
I know. (Intra-only codecs may be different, as each frame is encoded
for itself. But you still need to know about metadata, syncing with
audio, and so on. Video only: You can just continue and attach where
you left off.)

> I am not an audio video guru. I am just thinking out loud to try to
> clarify my question.

What you are trying to do it to suspend and resume a process which
needs to actually *go away* inbetween. There do exist methods for that,
often called "checkpointing" (or "checkpoint/restore"). For Linux, the
tool "criu" comes to mind:

https://criu.org/

The tool is maintained and is actually supposed to work quite well. I
haven't used it in many years though.

Your use case is described here:
https://criu.org/Usage_scenarios#Snapshots_of_apps

I think you need to scan the docs and the Wiki for understanding how to
use it. Please do let us know how it works for you!

Cheers,
Moritz


More information about the ffmpeg-user mailing list