-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Clip::subclip vs ffmpeg_extract_subclip? #235
Comments
clip.subclip is just a view of a clip. In moviepy the frames from a video file clip are decoded to raw (so that you can actually work with them) and then reencoded at write time. ffmpeg_extract_sublip does not decode the frame if it is not necessary. If you just need to extract |
Ah I see. So I understand the difference in implementation, but it seems the output is pretty much the same - so shouldn't moviepy just use the faster implementation? Or are there cases where ffmpeg_extract_subclip won't work but Clip::subclip will? Update: Immediately after I submitted this, I realized that Clip::subclip isn't necessarily based on a file. However, perhaps we could overwrite VideoFileClip::subclip with ffmpeg_extract_subclip? |
If you want to apply a filter, like "black and white" or "blur", you need to have the frames decoded, fo ffmpeg_extract_subclip won't do the trick. |
Okay, I see, that makes sense. Perhaps we should add a note to VideoFileClip::subclip saying that users may want to look at ffmpeg_extract_subclip? But maybe others easily realized this - it just took me a while because I was trying to use Clip::subclip and then immediately write to disk, when ffmpeg_extract_subclip would be faster in that case. At any rate, moviepy is super useful, thanks! I've been writing dumb helper functions to call ffmpeg for some time, and it's nice to no longer have to do that. |
Also have a look at imageio, it wraps ffmpeg and is "closer to the metal" than moviepy in some aspects. |
Thanks! I think imageio may be a little too low level for my needs. I still think it would be neat to mention ffmpeg_extract_subclip in VideoFileClip::subclip documentation, and I can submit a PR if that's useful. Closing this issue for now. |
It seems Clip::subclip is significantly slower than ffmpeg_extract_subclip. Is there a reason the former doesn't simply call the latter?
The text was updated successfully, but these errors were encountered: