Commit graph

66 commits

Author SHA1 Message Date
DataHoarder a33040fd85
Added --one-shot-resume for distributed Av1an usage 2022-07-02 00:05:42 +02:00
redzic dfdc2c6703
Fix clippy warnings (#639) 2022-06-20 19:53:07 +00:00
redzic edc6acd657
Do not call parse_encoded_frames in first pass (#637)
* Do not call parse_encoded_frames in first pass

* Remove now redundant checks in aom/vpx parsing

* Fix/add notes in tests
2022-06-05 20:17:57 +00:00
Y0ba b8272ae22d
Don't panic if ffmpeg fails to count frames (#634)
* Don't panic if ffmpeg fails to count frames

* Fix formatting
2022-06-05 18:59:50 +00:00
Josh Holmer fe585ac24c
Use std::available_parallelism instead of num_cpus (#633)
* Explicitly set minimum rust version

* Use std::available_parallelism instead of num_cpus
2022-05-21 08:55:43 +00:00
Josh Holmer 460fa3c105
Improve selection of HDR content (#632)
Currently this only applies to grain synth generation,
but the prior implementation of HDR detection only looked at the props
on the input video. Those may not necessarily be set correctly even if
the user is encoding to HDR, so we want to prioritize looking at the
encoder params, then fallback to checking the input if the user has not
set a transfer characteristic on the encoder.
2022-05-16 18:26:14 +00:00
Josh Holmer fa738555c8
Log video info at the start of encode (#629) 2022-05-11 17:52:24 +00:00
redzic 270b3ba3cb
Consolidate import style in rustfmt.toml (#619) 2022-04-20 20:24:55 +00:00
Josh Holmer 55df40362b
Error and retry chunk if frame count mismatches (#612)
I can't think of a situation where someone would want this issue to be
ignored, so we should treat it as any other encoder error and perform 3
retries, then exit if it continues to fail. This probably indicates some
kind of issue with decoding or applying filters to that chunk.
2022-04-17 03:51:23 +00:00
redzic bd9a1fa9c2
Fix extra splits and zones handling with split method none (#607)
* Fix extra splits and zones handling with split method none

* Fix clippy warning
2022-04-03 20:23:47 +00:00
Josh Holmer 84d46bb40c
Add zones support (#598)
* Add zones support

Currently implemented:
- Overriding the selected encoder & number of passes
- Overriding or adding video params
- Overriding photon noise setting
- Overriding min/max scene length

Closes #267

* Error if zoned encoder does not support output pixel format

* Fix crash if zones change number of passes

* Set passes to 1 for zones with rt mode
2022-03-28 15:23:08 +00:00
redzic 9242b036d0
Remove writes to memory in sse4.1 parsing code, fix edge case (#588) 2022-03-11 19:21:12 +00:00
Jeremy Lee Shields f5ec4891be
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
2022-03-02 05:33:31 +00:00
redzic 6634bc77f8
Update to ffmpeg 5.0 (#575)
* Update to ffmpeg 5.0
2022-02-22 22:17:37 +02:00
Josh Holmer 88ed5a131a
Warn about slowness when using "select" chunk method (#560)
Partially addresses #559
2022-01-28 15:16:09 +00:00
Josh Holmer 5b2b4fbbb9
Display chunk index instead of worker index in verbose mode (#550)
* Display chunk index instead of worker index in verbose mode

The chunk index would be much more useful for users who are using
verbose mode. Worker index is easily derived from counting the lines,
and is not particularly useful.

* Pass padding around instead of recalculating it

* Add assert and comment

Co-authored-by: Redzic <yusufredzic@gmail.com>
2022-01-19 01:42:41 +00:00
Josh Holmer 351d19accb
Rework log levels to be more useful (#546)
- Update log levels so that the log file contains more verbose
  information by default, while leaving the stderr progress indicator
  relatively uncluttered
- Explicitly set the log level to `error` for all dependencies
- rav1e scenechange info has been moved to `--log-level trace`
- Avoid outputting colors if stderr is not a tty
- Fix a crash when using `--quiet`
2022-01-18 23:20:01 +00:00
Zen ff1aaded35
Encoder mode/rate check (#532)
* Encoder mode/rate check

* Tweak

Co-authored-by: Redzic <yusufredzic@gmail.com>
2022-01-16 04:28:37 +00:00
redzic a3eea86652
Fix mkvmerge concat (#523) 2022-01-11 06:17:46 +00:00
redzic 38c1db6c0d
Display possible vspipe errors when ffmpeg pipe is present (#519)
* Display possible errors vspipe when ffmpeg pipe is present

* Fix clippy warnings
2022-01-07 23:03:39 +00:00
redzic d752884242
Fix mkvmerge resuming (#504) 2022-01-03 21:25:39 +00:00
Zen a9c321c99a
Automatic tiling for default settings (#498) 2022-01-03 19:47:31 +00:00
Josh Holmer bd2f9456d1
Fix several TODOs (#496)
* Return results instead of panicking in Input methods

* Remove an already-completed TODO

* Move done file init to initialize
2022-01-02 19:28:01 +00:00
Josh Holmer dc2d3ebdab
Add a CLI option for changing chunk order (#493)
People have been requesting this because the default chunk order tends
to skew toward underestimating the final filesize. Longest first is kept
as the default because it provides the best performance.
2022-01-02 05:49:47 +00:00
Josh Holmer 03244e0877
Add option to generate film grain tables for aomenc (#485) 2022-01-01 21:13:03 +00:00
redzic 14a2b2e09c
Reduce length of mkvmerge command (#482)
* Reduce length of mkvmerge command

* Canonicalize encode_dir
2022-01-01 00:04:08 +00:00
Josh Holmer 78b3395dda
Fix more clippy lints (#476) 2021-12-29 20:30:10 +00:00
redzic fb3f38fab7
Remove overhead at the start and in between scene detection and encoding (#473)
This commit mainly changes the behavior in 2 ways:

1. We now get the frame count and do scene detection in parallel. Initially, only the number of processed frames are shown, and the percentage stays at 100%, and the total frame count is 0. When the actual frame count is available, the progress bar is updated to reflect that. This can help I/O bound situations where the source is very large and the frame count takes a long time to calculate.
2. We also generate the vapoursynth cache in parallel with the scene detection and calculating the frame count. This eliminates the pause between scene detection and actual encoding (if vspipe finishes generating the cache in time, which will be the case 99% of the time, and it will still reduce the overhead in the very unlikely case that it hasn't finished yet).

Also fixes bug where vapoursynth input wouldn't work if you specified anything other than lsmash or ffms2 for the chunk method.
2021-12-25 07:34:06 +00:00
redzic 702e73f724
Automatically set one-pass mode if --rt was specified (#462) 2021-12-22 05:09:25 +00:00
Josh Holmer 519bd0504e Merge branch 'unstable' 2021-12-15 15:03:21 -05:00
Josh Holmer 2be2c79ca7
Retry chunk without TPL if a TPL-related crash occurs (#444)
aomenc has had a history of crashes related to TPL on certain
chunks, particularly in videos with less motion, such as animated
content. This commit enables a workaround to retry a chunk with TPL
disabled if such a crash is detected. Although there is some amount of
psychovisual quality loss with TPL disabled, this is preferable to being
unable to complete the encode.
2021-12-14 17:17:07 -06:00
redzic 6f46ef8531
Replace last regex with hand written parser (#441)
* Replace panic with error return

* Replace last regex with hand written parser

* Update dependencies

* Fix clippy warnings

* Adjust idx check

* More idiomatic rust
2021-12-10 01:23:24 -06:00
Josh Holmer 28ab3b406a Add kbps and final file size estimates to progress bar (#439)
* Add kbps and final file size estimates to progress bar

This looks at the size of each chunk when it completes and saves that
size in kilobytes into the done.json file. For backwards compatibility
for encodes resumed from an earlier version of av1an, if the done.json
does not contain the chunk size, then on resume, av1an will lookup the
size of that chunk. The estimates on the progress bar also handle
resumes and chunk crashes gracefully.

* Include audio size in estimates
2021-12-09 12:29:15 -06:00
Josh Holmer 8268cb417a Fix another clippy lint (#437) 2021-12-09 12:29:15 -06:00
Redzic 724452c805 Add optional --sc-pix-format argument
This argument optionally allows the scene detection to run on a
different pixel format, which allows you to for example run 8-bit scene
detection on a 10-bit source, which can be much faster.

This option is unstable because ideally we would instead have this
take the bit depth as an integer instead, as we do not want to allow any arbitrary
pixel format for scene detection. Also, it would waste some CPU time
converting from 4:4:4 to 4:2:0 for example considering that we only
consider the luma plane for scene detection, so ideally we'd have some
code to automatically pick a format that would avoid useless conversions
based on the desired bit depth.
2021-12-09 12:15:08 -06:00
Josh Holmer 07710cb088
Fix another clippy lint (#437) 2021-12-09 09:33:48 -06:00
Redzic cdf277eeaf Reduce codesize of construct_target_quality_command
- `x.to_string()` generates much more code than `format!("{}", x)`,
  so we should prefer `format!`. There are other ways to further
  reduce the codesize of construct_target_quality_command, but
  they are much more complicated, so they are reserved for a
  future PR.

- Update dependencies.
2021-12-01 21:02:48 -06:00
Redzic 69633b18a8 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.
2021-12-01 18:28:48 -06:00
redzic fc33d24b89
Add --max-tries argument to set maximum chunk restarts (#433) 2021-11-28 18:38:01 -06:00
Redzic 3abed09a58 Fix incorrect usage of .get(0) for multi progress bar 2021-11-25 13:27:01 -06:00
Redzic 9dec1d681d Resume from initial frames rather than subtract total frame count 2021-11-25 13:07:21 -06:00
Redzic d843bd190f Subtract encoded frames from progress bar on chunk restarts 2021-11-25 13:07:21 -06:00
Josh Holmer b3bc876e3a
Fix all clippy warnings as of latest stable rustc (#431)
I kind of wish that we wouldn't use clippy::pedantic and
clippy::nursery, as the number of `allow` lints at the top of src/lib.rs
is becoming quite absurd. However, I at least wanted to clear out the
large set of warnings being issued, regardless of that discussion.
2021-11-25 13:05:24 -06:00
redzic 9897290f65 Ensure that ffms2/lsmash exists if specified 2021-11-23 08:01:43 -06:00
redzic 9d6b1157ca
Display the stderr of the ffmpeg pipe when available (#423)
We should ideally still display both the stderr of the source pipe and
the ffmpeg filter pipe, but this should be good enough for the vast
majority of cases as displaying the stderr of both pipes requires a
slightly larger change.
2021-11-20 17:25:13 -06:00
redzic e25172b5d7 Perform input pixel format check only once
Previously, the pixel format of the input file was checked every time
a chunk was started. Now, we just get the pixel format once at the
beginning and reuse it for all chunks.
2021-11-20 12:55:50 -06:00
redzic 08f0584569 Fix some clippy warnings 2021-11-20 12:08:11 -06:00
redzic 5a23cc3565
Implement SSE4.1/SSSE3 SIMD-accelerated frame parsing for aomenc/vpxenc (#419)
The SSE4.1/SSSE3 implementation of the parsing routines for
aomenc/vpxenc outperform the old regex by a factor of about 5000x
(3.5 μs vs. 0.7 ns to parse a single line on a Zen 1 1950x).

The idea is to eventually remove regex as a dependency entirely,
especially since there is an open PR to indicatif that speeds up the
template expansion (which replaces regexes with hand-written parsing).
2021-11-20 10:35:31 -06:00
redzic 48e69be774
Bump missing resume file messages down to INFO (#417) 2021-11-19 08:59:12 -06:00
redzic c6e020ea93
Improve error handling for concatenation (#414)
* Log the command used for concat (activated with log level `debug`)
  (the command along with process output is logged again at log level
  `error` if the command failed, regardless of `--log-level`)
* Replace some unwraps with `Result`s
* Add more `with_context()`s
2021-11-18 19:31:19 -06:00