feat: Implement seamless log merging for x264/x265 encoders#1198
Open
Miralia wants to merge 5 commits into
Open
feat: Implement seamless log merging for x264/x265 encoders#1198Miralia wants to merge 5 commits into
Miralia wants to merge 5 commits into
Conversation
Adds functionality to intercept, parse, and merge per-chunk encoder logs into a single, comprehensive log file upon encoding completion.
Key features:
- **Automatic Log Merging**: Synthesizes a unified log file from individual chunk logs, preserving the order and integrity of frame data.
- **Encoder Support**: Native support for x264 and x265 (including variants), parsing I/P/B frame statistics, QP, and bitrate/size metrics.
- **Smart Filtering**: Intercepts stderr to filter out progress bar noise while whitelisting critical frame statistics for storage.
- **Summary Generation**: Auto-calculates final encoding statistics (Global FPS, Average Bitrate, Total Duration) based on aggregated chunk data.
- **Configurable Output**: Defaults to generating a {output}.log file, or respects the user-specified log path.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1198 +/- ##
==========================================
- Coverage 62.76% 60.97% -1.79%
==========================================
Files 23 24 +1
Lines 7310 7606 +296
==========================================
+ Hits 4588 4638 +50
- Misses 2722 2968 +246 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
shssoichiro
reviewed
Feb 1, 2026
| Arc, | ||
| }, | ||
| thread::available_parallelism, | ||
| // thread::available_parallelism, |
Member
There was a problem hiding this comment.
We should remove these lines rather than leaving them in commented out. (line 17 as well)
shssoichiro
reviewed
Feb 1, 2026
| progress_file.write_all(serde_json::to_string(get_done())?.as_bytes())?; | ||
|
|
||
| if let Some(ref audio_output) = audio_output { | ||
| // Line 405 in original |
Member
There was a problem hiding this comment.
I don't think this comment is very useful, let's either improve or remove it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR introduces a robust log merging mechanism for x264 and x265 (including variants) encoders. It intercepts per-chunk log output, filters irrelevant progress noise, and synthesizes a complete, standards-compliant log file at the end of the encoding process.
Motivation
Currently, chunked encoding in Av1an fragments encoder logs, making it impossible to analyze post-encode statistics (QP distribution, frame type usage, bitrate variability) for the entire video. Users relying on these logs for quality verification currently have no way to get a unified view.
Key Changes
frame [IPB]:,encodedstats) to separate valuable data from progress bar noise.frame X:...Avg QP/QP:) instead of fragile punctuation checks. This ensures compatibility across different encoder versions and builds (e.g., standard x265 vs. Mod-by-Patman) and handles format variations gracefully.{output_file}.logadjacent to the target video.How to test
av1an -i input.mkv -e x265 -v " --log-level info" -o output.mkvoutput.mkv.logis created.Checklist