Skip to content
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

Fix GPU h264_nvenc encoding not working. #2121

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions moviepy/video/io/ffmpeg_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,14 @@ def __init__(
]
if audiofile is not None:
cmd.extend(["-i", audiofile, "-acodec", "copy"])
cmd.extend(["-vcodec", codec, "-preset", preset])

if (codec == "h264_nvenc") :
cmd.extend(["-c:v", codec])
else :
cmd.extend(["-vcodec", codec])

cmd.extend(["-preset", preset])

if ffmpeg_params is not None:
cmd.extend(ffmpeg_params)
if bitrate is not None:
Expand All @@ -129,8 +136,9 @@ def __init__(
if threads is not None:
cmd.extend(["-threads", str(threads)])

if (codec == "libx264") and (size[0] % 2 == 0) and (size[1] % 2 == 0):
if (codec == "libx264" or codec == "h264_nvenc") and (size[0] % 2 == 0) and (size[1] % 2 == 0):
cmd.extend(["-pix_fmt", "yuv420p"])

cmd.extend([filename])

popen_params = cross_platform_popen_params(
Expand Down
Loading