Commit graph

67 commits

Author SHA1 Message Date
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
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
34d991d06d
Delegate chunk starts/finishes to debug log level, other logging changes (#412)
* Rename `--logging` to `--log-file` (`-l` shorthand still works)
* Introduce new `--log-level` option to set the log level filter

This change makes `--verbose` not log chunk starts and finishes, and
that information is not logged in the log file either unless
`--log-level=debug` is set. By default, `--log-level` is set to `info`.

The `debug` log level also logs the rav1e scenechange decision info
for each frame.
2021-11-18 14:06:50 -06:00
redzic
fdef1f4a2d
Use dimmed colors instead of fixed xterm 256 colors (#411) 2021-11-18 08:27:51 -06:00
redzic
db5e569f9d
Adjust CLI output to be more colorful (#407)
* Adjust verbose progress style for workers

* Also add `-y` flag to overwrite output file without confirmation

* Update dependencies

* Fix compilation on older versions of rustc
2021-11-17 23:01:46 -06:00
redzic
f94c65f992
Improve logging (especially with --verbose) (#404)
* Improve logging (especially with `--verbose`)

Much more information is now logged when using `--verbose` (all INFO
messages), and the output is also much cleaner.

The issue of logs being hidden while the progress bar is active
because of conflicting ANSI escape codes has been completely fixed, and
no more undesirable hacks are required to correctly display the
set_thread_affinity warning message correctly, for example. This has
been achieved by using indicatif's `println` function instead of just
printing to stderr directly.

flexi_logger has been moved to av1an-cli as it should be, since a
logging framework that actually prints things and handles log level
filtering is not the responsibility of the core library. However, the
actual progress bar code with indicatif still lives in av1an-core for
now.

* Make `--quiet` conflict with `--verbose`

* Fix resuming and improve error handling slightly
2021-11-17 10:57:08 +02:00
redzic
637314e7f1
Fix compilation on macos (#403) 2021-11-16 03:42:41 +02:00
redzic
98bb4cc4b6
Allow setting thread affinity for each worker (#402)
Introduces a new command line option called `--set-thread-affinity=n`,
where `n` specifies the number of threads to assign to each worker.

We use the `affinity` crate instead of the `nix` crate directly to
get abstractions for Windows and Linux.
2021-11-16 00:15:26 +02:00
redzic
754c1192fe
Always copy subtitles and all audio tracks (#400)
* Always copy subtitles and all audio tracks

Require mkvmerge for x265

* cargo update

* Fix concat if audio file does not exist

* Use stable rustc in Docker, do not compile VVC

* Use old Docker image for now which works with vapoursynth

* Fix tests.yml

* Use mkvmerge for tests

* Add mkvtoolnix as a dependency in tests.yml
2021-11-07 14:20:12 +02:00
Zen
a874dec452 av1an 0.2.0 release 2021-10-31 22:56:47 +02:00
redzic
c16f6a2730
Fix vergen for release again (#394) 2021-10-31 22:51:10 +02:00
Zen
5c8a99879f bump av1an-cli version 2021-09-12 22:26:42 +03:00
redzic
eb1047aa30
Fix vergen for release (#393) 2021-10-31 22:20:38 +02:00
Zen
782f74982b Bump version 2021-09-11 21:24:58 +03:00
redzic
e2451684b8
Refactor: Better ffmpeg pipe handling + more info in --version (#389)
* Refactor: Better ffmpeg pipe handling + more info in --version

* Update dependencies
* Better documentation in `--help`
* Include git commit hash and more info in `--version`
* Add `-k` as shorthand for `--keep`
* Do not pass `ffmpeg_pipe` around everywhere
* Use macro to generate encoder bit depth functions
* Fix documentation in README

* Fix some clippy warnings
2021-10-30 14:49:26 +03:00
Josh Holmer
c8547c7c9b
Changes for rav1e's hybrid scene detection update (#381) 2021-10-14 02:04:11 +03:00
redzic
3147a942a7
Reduce piping overhead to encoder in certain situations (#379)
Previously, we always piped the chunk method into FFmpeg
to apply filters and convert the pixel format, but this
just adds unnecessary overhead if there is no FFmpeg filter
specified and if the pixel format of the source and encode
are the same. So, in that situation, we now pipe the chunk
method directly into the encoder instead. This should
nicely speed things up a bit (and possibly reduce memory
consumption).

Additionally, `--pix-format` is now verified using the FFmpeg
API when the CLI args are parsed, making it impossible to
accidentally specify an incorrect format. Previously, there
were no checks at all, so if you specified the wrong format it
would just fail during the encoding process with no obvious
indication of the root cause.

This does not apply to vapoursynth input for now, as that
would be slightly more complicated since it has a different
API for getting the pixel format.
2021-10-13 05:21:55 +03:00
redzic
e9ef27f524
Perform startup check before confirming output file overwrite (#377) 2021-10-09 14:07:21 +03:00
redzic
f5c3b3c85a
Fix many clippy warnings, many small code style changes (#375) 2021-10-05 20:08:18 +03:00
redzic
2b534e14c9
Refactor into Input type for handling vapoursynth input (#374)
* Refactor into `Input` type for handling vapoursynth input

Fixes several issues, namely `--vmaf` not working on vapoursynth input
as well as unifying the VMAF interface, which also results in
`--vmaf-threads` being passed correctly to `--vmaf`, which is massively
faster now as a result. If `--vmaf-threads` is not specified, then
the number of detected CPU threads is used for `--vmaf`.

Additionally, VMAF plots are rendered as SVGs now, which also removes
some dependencies since we don't use the bitmap backend at all anymore.

* Small cleanup: more consistent usage of `as_path`
2021-10-04 19:22:08 +03:00
Josh Holmer
657810d162
Allow disabling extra splits by setting to 0 (#371) 2021-10-03 20:06:38 +03:00
redzic
962f880764
Fix confirmation prompt (#361) 2021-09-17 21:07:35 +03:00
Josh Holmer
21817fe581
Add new scenechange method (#358)
This leaves the default at medium, which is an improved version
of the current scenecut detection method.
The fast method has also been improved from its previous version.
The slow method is a completely new implementation, which has
been shown to be more accurate, but is also about 15% slower.

This also removes the av-scenechange-fast split method,
in favor of making a separate CLI option for --sc-method,
which can be set to "fast", "medium", or "slow".

This also adds a CLI option for scenecut downscaling,
which can be specified by providing a maximum height e.g.
--sc-downscale-height 720 to downscale any input which is
above 720p to 720p for scenecut detection.
This will avoid upscaling anything below 720p, because that
would just slow down scenecut detection for no benefit.
2021-09-15 00:04:15 +03:00
redzic
f268d19641
Refactor: Remove parking_lot::Mutex from multi progress bar, rework mkvmerge concatenation implementation (#354)
- This removes the `parking_lot::Mutex` wrapping the multi progress bar, as it was not actually necessary. This also removes `parking_lot` as a dependency, as it is unused now.

- Rework the implementation of `mkvmerge` concatenation to not perform any unnecessary UTF-8 validation or allocations. This requires an algorithm to specify chunks with a '+' in between, but without a trailing '+', without later removing arguments (as the API of `std::process:Command` does not support this). This does not change the behavior of `-c mkvmerge` in any way, however.

- Also fix some miscellaneous clippy warnings.
2021-09-04 23:45:47 +03:00
Zen
906beb65f3 declutter lib.rs + prettify imports 2021-09-03 22:01:11 +03:00
Zen
72cdd15b51 change av1an-cli structure, bump to 0.1.1 2021-08-31 14:22:15 +03:00
redzic
d0b27f9b73
Add output file confirmation prompt, improve error handling slightly (#349) 2021-08-31 12:36:31 +03:00
Zen
f98431900f av1an-cli dependencies 2021-08-30 16:15:26 +03:00
Zen
2b842e8c5a License corrections 2021-08-30 16:04:27 +03:00
Zen
0a9b664fdd fix versions 2021-08-30 15:54:53 +03:00
Zen
d48d3c92b4 add descriptions to av1an-cli, av1an-core 2021-08-30 15:53:31 +03:00
redzic
14574f17d1
Remove other unused dependencies (#347) 2021-08-29 19:29:03 +03:00
Zen
8cf8e7a62f format toml for release 2021-08-29 18:53:56 +03:00
redzic
cebbee90d4
Refactoring, allow compiling with Rust 1.53 (#346)
Switch back to an old version of sysinfo, as 0.20 requires 1.54 to compile it, which is too new for MSYS2. Many minor simplifications.

We also switch to structopt for now instead of the beta release of clap, as clap officially recommends to not use the beta yet, and it caused some problems when compiling on Windows or with an older compiler.

Some minor changes:

- The `decow_strings` function has been removed, and we deal with `Cow<str>` properly now.
- The `remove_patterns` function now takes a mutable reference to a `Vec<String>` instead of copying one and modifing it to reduce complexity and overhead.
- The structs used to serialize the VMAF json result have been renamed to `VmafResult`, `Metrics`, and `VmafScore` (they were previously `Foo`, `Bar`, and `Baz`)
- Using an enum instead of a string as the argument to `log_probes` for better type safety and less overhead
- `frame_check_output` now warns if there is a mismatch, and the message has been updated to be more clear that a frame mismatch has occurred
- Several other small changes
2021-08-29 18:25:57 +03:00
Tatsuyuki Ishi
f08628df2f
Replace some panics with Err returns (#341)
* av1an-core: replace some panics with Err returns
* av1an-cli: use anyhow::Result as the return type of main
2021-08-22 07:35:24 +03:00
redzic
5f9fa28f5d
Integrate av1an-scene-detection into av1an-core, fix some clippy warnings, update dependencies (#336) 2021-08-19 22:27:46 +03:00
Josh Holmer
a8a6642b22
Add a fast scenecut method option (#335)
Selectable with `--split-method av-scenechange-fast`.
The fast method enables downscaling the video before scene detection,
and uses av-scenechange's fast mode, which is similar to pyscenedetect.
This also removes the downscaling from the normal scenecut mode,
since downscaling does affect accuracy of the scene detection.
2021-08-19 18:44:24 +03:00
Zen
ba3295885c removed --webm flag 2021-08-16 20:17:33 +03:00
Zen
c47e19bead Check validity of output file path 2021-08-06 19:06:39 +03:00
redzic
bf1b6e98b8
Better logging, integrate av1an-pyo3 into av1an-core (#314)
Implements more robust logging via flexi_logger. This replaces the old
logging implementation, and is also more ergonomic, since macros from the
`log` crate are now used instead of `format!` directly. Now, warnings
and errors are also logged to stderr, in addition to the log file.

This also removes av1an-pyo3, and integrates the code into av1an-core.

Concatenation with FFmpeg is now handled on Windows differently than
other platforms through conditional compilation. FFmpeg seems to need
double backslashes in the concat file, so this is explicitly handled
in the Windows build now. Also, the spinner is now disabled on Windows
builds since the default command prompt cannot display the characters
correctly.
2021-07-25 10:31:54 +03:00
redzic
4ef9bdaa8a
More idiomatic Rust, add Cargo.lock to the repo (#313)
Previously, we represented quantizer values as an owned `String` for
constructing various encoder commands, which is much slower and less
robust than representing the quantizer as an integral value. This has
been updated to represent the `q` and `n_threads` both as a `usize`, and
only convert to a `String` for formatting as needed.

Furthermore, several struct fields containing paths have been updated to
use a `PathBuf` or `&Path` instead of a `String`. These are the first
steps required to supporting non-UTF8 filenames on Windows and
Unix-based operating systems.

`run_vmaf_on_chunk`'s function signature has been update to take generic
arguments that satisfy `AsRef<Path>`, which allows the caller to save
themselves from creating a new `Path` if the original argument was a
`String`, for example.

* Do not represent the concatenation method as a string
* Fix pedantic clippy warnings
* Remove Cargo.lock from .gitignore
* Fix startup_check for ivf concatenation
* Add doc comment to `Args` for better help generation in Clap
* Use Display impl instead of directly using str::From for `Encoder` and `ConcatMethod`
* Do not unwrap the result of killing child processes
* Assert that VMAF calculation was successful
* Use more idiomatic Rust
2021-07-24 20:09:21 +03:00
Josh Holmer
772eddd103
Add --verbose flag to show worker progress bars (#311) 2021-07-20 05:05:18 +03:00
redzic
0b7391c434
Fix some clippy warnings, use enums instead of strings (#309) 2021-07-19 05:04:08 +03:00
redzic
25f2eba75e
Fix default audio parameters (#306) 2021-07-19 03:49:01 +03:00
redzic
2b2138da5f
Remove all remaining Python code (#302) 2021-07-19 01:52:05 +03:00
Zen
a53ca400b7 Remove pyscene detectect 2021-07-12 23:14:42 +03:00
Zen
5b07da10cb Remove ffmpeg scenedetection 2021-07-12 07:05:43 +03:00
redzic
3e30b31499
Add av-scenechange as the new and default scene detector (#292)
* Fix clippy warnings, run `cargo fmt`
* Add clippy::needless_pass_by_value lint to av1an-core
* Add av-scenechange as the new and default scene detector
2021-07-12 06:08:37 +03:00
Luigi311
308e97047e
Add probe slow, add devcontainer, update readme (#289)
* Dockerfile: Update copy with chown, seperate copy requirements from all
* Add probe-slow support
* README: Update readme with new rust cli options
* Dockerfile: Hide av1an venv
* Add devcontainer
* Action: Add baseline-select
2021-07-09 19:32:47 +03:00
Zen
928562b401 removed no check 2021-07-01 10:38:00 +03:00