Get the frame count from done.json when resuming
ffmpeg takes a long time to get the frame count for some sources, and it can be much faster to get it from done.json when resuming instead of recalculating it every time encoding is resumed.
This commit is contained in:
parent
fc33d24b89
commit
69633b18a8
|
@ -469,8 +469,6 @@ pub fn parse_cli(args: CliOpts) -> anyhow::Result<EncodeArgs> {
|
|||
}
|
||||
}
|
||||
|
||||
encode_args.frames = encode_args.input.frames();
|
||||
|
||||
Ok(encode_args)
|
||||
}
|
||||
|
||||
|
|
|
@ -857,11 +857,11 @@ properly into a mkv file. Specify mkvmerge as the concatenation method by settin
|
|||
pub fn encode_file(&mut self) -> anyhow::Result<()> {
|
||||
let done_path = Path::new(&self.temp).join("done.json");
|
||||
|
||||
let splits = self.split_routine()?;
|
||||
|
||||
// TODO move this to `initialize`?
|
||||
let initial_frames = if self.resume && done_path.exists() {
|
||||
let done = fs::read_to_string(done_path)?;
|
||||
let done: DoneJson = serde_json::from_str(&done)?;
|
||||
self.frames = done.frames.load(atomic::Ordering::Relaxed);
|
||||
init_done(done);
|
||||
|
||||
get_done()
|
||||
|
@ -870,6 +870,7 @@ properly into a mkv file. Specify mkvmerge as the concatenation method by settin
|
|||
.map(|ref_multi| *ref_multi.value())
|
||||
.sum()
|
||||
} else {
|
||||
self.frames = self.input.frames();
|
||||
init_done(DoneJson {
|
||||
frames: AtomicUsize::new(self.frames),
|
||||
done: DashMap::new(),
|
||||
|
@ -882,6 +883,8 @@ properly into a mkv file. Specify mkvmerge as the concatenation method by settin
|
|||
0
|
||||
};
|
||||
|
||||
let splits = self.split_routine()?;
|
||||
|
||||
let chunk_queue = self.load_or_gen_chunk_queue(splits)?;
|
||||
|
||||
if self.resume {
|
||||
|
|
Loading…
Reference in a new issue