Skip to content

Set default value for ffmpeg threads to 1 instead of the implicit 0. #671

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

kenmcgaugh
Copy link
Contributor

When set to 0 RV's thread count will explode since it will create (num_cpus+1)(num_sources)(num_reader_threads) threads. In my test of loading 25 prores clips RV's thread count grew to 726 and consumed 10GB of memory. With this change in place, the thread count remained stable at 49 and memory used was 7.5GB.

To restore previous behaviour you can set the env var RV_MOVIEFFMPEG_ARGS="--codecThreads 0".

…When set to 0 RV's thread count will explode since it will create (num_cpus+1)*(num_sources)*(num_reader_threads) threads. To restore previous behaviour set env var RV_MOVIEFFMPEG_ARGS="-codecThreads 0".

Signed-off-by: Ken McGaugh <[email protected]>
@pbergeron-adsk
Copy link
Contributor

Discusing with Bernard, it appears that we lose realtimeness with this PR. Will need to investigate more.

@kenmcgaugh
Copy link
Contributor Author

kenmcgaugh commented Mar 14, 2025

Perhaps there could be some heuristic in place based off of the number of reader threads at least. A conservative heuristic would be to set the codec threads to the number of CPU’s minus the number of reader threads.

Would the ultimate solution to this be to make MovieFFMpeg multithreadable?

[EDIT]
Doing some more tests, I see this is a more complex issue than I thought. With lookahead caching enabled, I get much better performance keeping the codecThreads set to 1 but increasing the reader threads. But when I disable caching, the opposite is true. I'm going to remove this PR as it feels like each site needs to tune these settings themselves based off their use case.

@kenmcgaugh kenmcgaugh closed this Mar 15, 2025
@kenmcgaugh kenmcgaugh deleted the ffmpeg-threads branch March 15, 2025 22:20
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.

2 participants