Summary
Given a partially completed encode that:
- Was encoded using h264 in the Matroska container
- Was cut short by manually stopping FFmpeg by typing 'q' in the console
...what are the ways to resume encoding this file, preferably by appending the extant file?
Details
I have some large encoding projects that I do that can take up to a week of encoding in some cases. In ideal circumstances, the computer doing the encoding can stay on, uninterrupted and left to do the work. In realistic situations though, sometimes that computer needs to stop encoding and be shut off or restarted for a multitude of reasons. Because of this, I'm looking for a way to make encoding using FFmpeg on that computer more "bullet-proof" by anticipating possible interruptions and having a way to use FFmpeg by itself to pick up where it left off later.
What I'm Doing Now
When this happens, I recover what I can of the encoded file, examine it in video editing software, find a good splicing point, then use AviSynth to create a script that will start encoding a new segment where the previous one left off. I then use other software to trim the existing encode so that the splice will be seamless, then use FFmpeg's demuxer to combine the individual h264 segments later into a completed file.
This is all a lot of manual work that can be very slow that I'd like to avoid if there exists a more automated solution.
Ideas
Segmenting: This seems like the most promising solution, but there are gaps I'm not sure how to fill. This answer seems to cover a lot of it. You can tell FFmpeg to output segments, broken up at I-Frames at rough intervals, that can be remuxed later. What I don't know from looking at that answer and at FFmpeg's documentation is how I would start encoding again at a specific segment. It seems like there might be a way to give FFmpeg a file that tells it where each segment should start via frame or timecode, but how do I make it start somewhere in the middle of that list?
This option is not ideal, however, in that I will need to effectively have double the space of the resultant encode (which will frequently be in the 100s of gigabytes in size) available since I will need to mux the segments into a single file. It would be nice if I could somehow cleanly cut off an ongoing encode and have FFmpeg reopen that file and continue where it left off.
Virtual Machines: This has the potential to work since I could just freeze the machine's state before a restart, but all of my encoding space exists on network-attached storage, which I'm not sure will work in the context of a virtual machine being suspended and resumed, since the VM doesn't actually control the drives.