Skip to content

Feature Request: Expose FFmpeg Hardware Acceleration via User-Friendly API #2394

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

Open
zeeshanghazanfar97 opened this issue Mar 9, 2025 · 1 comment
Labels
feature-request Request for a new feature or additional functionality.

Comments

@zeeshanghazanfar97
Copy link

Description

I’d like to propose adding a user-friendly API to expose FFmpeg’s hardware acceleration options (e.g., NVENC, VAAPI, AMF) for video encoding. Currently, the FFMPEG_VideoWriter class internally allows passing extra FFmpeg parameters via ffmpeg_params, but this is not easily accessible to users.

🔹 Proposed Changes

  • Expose hardware acceleration options in a user-friendly way, rather than requiring users to manually pass ffmpeg_params.
  • Add a use_gpu flag in write_videofile(), which automatically configures hardware acceleration if supported.
clip.write_videofile("output.mp4", use_gpu=True, gpu_backend="cuda", codec="h264_nvenc")
  • Improve documentation to guide users on available GPU-accelerated codecs.

🛠 Implementation Plan

I’ve found that FFMPEG_VideoWriter already supports passing extra FFmpeg parameters:

if ffmpeg_params is not None:
    cmd.extend(ffmpeg_params)

However, this is not well-documented or easy to use. I’d be happy to work on exposing this feature properly if the maintainers are open to it. Let me know if this aligns with MoviePy’s roadmap! 🚀

📌 References

Would love to hear your thoughts! 😊

@zeeshanghazanfar97 zeeshanghazanfar97 added the feature-request Request for a new feature or additional functionality. label Mar 9, 2025
@fahmad480
Copy link

Hey! Thanks for opening this feature request, I think it's a great idea. BUMP UP ⬆️⬆️⬆️

Just wondering, how exactly are you using CUDA with ffmpeg_params? I tried adding ["-vcodec", "h264_nvenc"] in the write_videofile() function, but when I check Task Manager (on Windows), my GPU usage stays really low, like 0–2%. Am I missing something?

Would appreciate any tips!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for a new feature or additional functionality.
Projects
None yet
Development

No branches or pull requests

2 participants