Skip to content

Multithreading chafa#72

Merged
Notenlish merged 11 commits intomainfrom
multithreading-chafa
Jan 20, 2026
Merged

Multithreading chafa#72
Notenlish merged 11 commits intomainfrom
multithreading-chafa

Conversation

@Notenlish
Copy link
Owner

@Notenlish Notenlish commented Jan 20, 2026

On my VM it gives roughly a 3x speed improvement for caching
Using a threadpoolexecutor, for each frame a thread is used (for chafa and some simple data processing).
ffmpeg is still singlethreaded
ffmpeg is set to extract jpg instead of png now.
a new argument called --quality was added
its between 2(high quality) and 10(low quality)
this should provide significant performance improvement at no visible ascii output loss.

@Notenlish
Copy link
Owner Author

To further increase performance we can pipe the frames directly to chafa but trying to do it multithreaded would be a bit complicated

could try doing single threaded ffmpeg -> pipe image to chafa --> write frame to folder
could even add a --stream mode where anifetch doesnt wait for all the files to be cached and simply shows the frames as they appear. that would be cool.

@Notenlish
Copy link
Owner Author

It seems to me that when centered this PR crops the first and last rows of the chafa output.

These are from this PR:

Screenshot from 2026-01-20 15-30-19 Screenshot from 2026-01-20 15-30-09

these are from main:

Screenshot from 2026-01-20 15-32-56 Screenshot from 2026-01-20 15-33-24

@Notenlish
Copy link
Owner Author

fixed it, the issue was with the HEIGHT variable not being updated in main thread

@Notenlish Notenlish merged commit 22fb975 into main Jan 20, 2026
1 check passed
@Notenlish Notenlish deleted the multithreading-chafa branch January 20, 2026 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant