Increase speed by parallel execution
See original GitHub issueWe can speed up the process if we do all three steps at the same time - first ffmpeg
process creates sound and images (sound should be in some sort of streaming container), python stuff does it’s job frame by frame and feeds those frames to the second ffmpeg
. This shouldn’t be too hard to implement with pipes.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Computing Speed: Parallel Processing - Science 2.0
There is a common misconception when assessing computers in suggesting that parallel processing increases speed. This simply isn't true.
Read more >Improving Performance with Parallel Computing - MathWorks
Factors That Affect Speed. Some factors may affect the speed of execution of parallel processing: Parallel overhead. There is overhead in calling parfor...
Read more >Speed-up your codes by parallel computing in Python (codes ...
Parallel computing is a way of diving the tasks into all the processes available on the system and achieve speed ups.
Read more >Speed Up Your Code: Parallel Processing with multidplyr
Parallelizing code can drastically improve speed on multi-core machines. It makes the most sense in situations involving many iterative ...
Read more >increasing the speed of computation or parallel processing
In cluster computing you gotta do your own adjustments for parallel computing. You can find those adjustment relatively from help or any manual....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That’s true, and I definitely think this would help more for really long videos. It might even work on livestreamed videos! (Although… that doesn’t really make sense since the timeline is cut.) Anyway, I’ll definitely work on piping the processes together when I get some free time again.
(One thing to note is that the python stuff (analyzing the audio) happens much faster than ffmpeg. So as the parallelized code is running, there will essentially be the two ffmpeg processes churning away, and the Python process waiting for 95% of the time.)
@carykh
In response to live-streaming:
As an aside to write speed, I think the benefit to a purely in memeory implementation is that you could then stitch in memory instead of offloading to ffmpeg. I’m going to rewrite this in go, I’m pretty sure you could then preform this live with a reasonable buffer instead of having to parse then restitch to view. A buffer would allow the process to run in a way where audio and video is preprocessed a few seconds ahead, since the video doesn’t care about what happened before and after u could apply an algorithm as such:
Define i = 0 Calculate avg audio output for given chunk X (a predetermined Length of audio equal to 1 frame) If X avg audio value < threshold Then Remove audio (doesn’t seem to be needed at 20x)
If i++ % 20 == 0 Then Added frame to video buffer End if
Else Apply same logic as above but keep audio, speed up audio for given frame, if the frame % speed up multiplyier is 0 then add frame to buffer but regardless add the sped up audio to buffer. End else
The advantages of this approach is it doesn’t have to look ahead and the image/audio can be separated into two streams and never has to be encoded (unless being saved but it looks like you have that logic down). Another advantage to this approach is it has no disk write ops which will bottle beck unlike stated above. Hard drives have limited write speed, writing a ton of images is going to take time. I don’t u derstand why there are other comments stating that wouldn’t be the case, any modern cpu is going to be able to rip through images faster than they can be written.