Lastrosade sc only (#574)

* Add command line arg for sc-only

* added arg to settings.rs

* Add check and kill after split_routine()

Deletes the temporary directory, it would be better if it was never created in the first place.

* Initialize sc_only in EncodeArgs

* cargo fmt

* Integration test

* Make -s a requirement

* cargo fmt

* Add -s as requirement to sc-only via clap

* revert f7688ca

* Fix me not reading errors

* revert db4fb3b

* Cargo fmt

* Added --scenes as a requirement for --sc-only with clap

* Update wording

* Trying to fix the weird integration bug

* Revert 393b380

* Condition on test failure

* Github actions again

* Filename in actions
This commit is contained in:
Jeremy Lee Shields 2022-03-02 06:33:31 +01:00 committed by GitHub
parent da8ccf11d4
commit f5ec4891be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 0 deletions

View file

@ -222,6 +222,12 @@ jobs:
target/ci/av1an -i tt_sif.y4m -e aom --pix-format yuv420p -y -o "tt_sif.mkv" -v " --cpu-used=10 --rt --threads=4" -c mkvmerge
du -h tt_sif.mkv
- name: Testing sc-only
run: |
target/ci/av1an -i tt_sif.y4m --sc-only --sc-method fast -s "tt_sif_scenes.json"
du -h tt_sif_scenes.json
continue-on-error: true
docker:
runs-on: ubuntu-latest
steps:

View file

@ -188,6 +188,12 @@ pub struct CliOpts {
#[clap(long, possible_values = &["standard", "fast"], default_value_t = ScenecutMethod::Standard, help_heading = "SCENE DETECTION")]
pub sc_method: ScenecutMethod,
/// Run the scene detection only before exiting
///
/// Requires a scene file with --scenes.
#[clap(long, requires("scenes"), help_heading = "SCENE DETECTION")]
pub sc_only: bool,
/// Perform scene detection with this pixel format
#[clap(long, help_heading = "SCENE DETECTION")]
pub sc_pix_format: Option<Pixel>,
@ -553,6 +559,7 @@ pub fn parse_cli(args: CliOpts) -> anyhow::Result<EncodeArgs> {
scenes: args.scenes,
split_method: args.split_method,
sc_method: args.sc_method,
sc_only: args.sc_only,
sc_downscale_height: args.sc_downscale_height,
target_quality: args.target_quality,
verbosity: if args.quiet {

View file

@ -81,6 +81,7 @@ pub struct EncodeArgs {
pub split_method: SplitMethod,
pub sc_pix_format: Option<Pixel>,
pub sc_method: ScenecutMethod,
pub sc_only: bool,
pub sc_downscale_height: Option<usize>,
pub extra_splits_len: Option<usize>,
pub min_scene_len: usize,
@ -1063,6 +1064,16 @@ properly into a mkv file. Specify mkvmerge as the concatenation method by settin
let splits = self.split_routine()?;
if self.sc_only {
debug!("scene detection only");
if let Err(e) = fs::remove_dir_all(&self.temp) {
warn!("Failed to delete temp directory: {}", e);
}
exit(0);
}
let (chunk_queue, total_chunks) = self.load_or_gen_chunk_queue(splits)?;
if self.resume {