Closed IanButterworth closed 2 years ago
Turns out it also helps encoding, but to a lesser extent.. only halves the time.. :)
julia> imgstack = map(_->rand(UInt8, 1000,1000), 1:1000);
julia> @time VideoIO.save("vid.mp4", imgstack, thread_count = 1);
3.999581 seconds (30.01 M allocations: 610.917 MiB, 2.31% gc time)
julia> @time VideoIO.save("vid.mp4", imgstack); # defaults to thread_count = Threads.nthreads() == 6
2.025728 seconds (30.01 M allocations: 610.917 MiB, 4.35% gc time)
github appears to have broken this branch and renamed it to a new branch called IB/decode_threading
with capital initials. I'm no longer able to push here so I just opened #332 to replace this
I had assumed that ffmpeg/h.264 automatically handled multithreading, but it seems not to be the case. The small change in this PR is based on https://stackoverflow.com/questions/43251612/ffmpeg-how-to-use-multithreading
I propose that the default is set to
Threads.nthreads()
but that users can tune it as they wish.Master
This PR
Where
Threads.nthreads() == 16
Saves about 1 minute (6 -> 5 mins on ubuntu) in CI with only 2 threads