Skip to content

Commit

Permalink
added -pix_fmt yuv420p to ffmpeg args if codec is libx264
Browse files Browse the repository at this point in the history
  • Loading branch information
chunder committed Mar 26, 2014
1 parent 011047f commit d107e6b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions moviepy/video/io/ffmpeg_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,22 @@ def __init__(self, filename, size, fps, codec="libx264",
bitrate=None, withmask=False):

self.filename = filename
cmd = [ FFMPEG_BINARY, '-y',
cmd = (
[ FFMPEG_BINARY, '-y',
"-f", 'rawvideo',
"-vcodec","rawvideo",
'-s', "%dx%d"%(size[0],size[1]),
'-pix_fmt', "rgba" if withmask else "rgb24",
'-r', "%.02f"%fps,
'-i', '-', '-an',
'-vcodec', codec] + (
['-b',bitrate] if (bitrate!=None) else []) + [
'-r', "%d"%fps,
filename ]
'-vcodec', codec]
+ (['-b',bitrate] if (bitrate!=None) else [])

# http://trac.ffmpeg.org/ticket/658
+ (['-pix_fmt', 'yuv420p'] if (codec == 'libx264') else [])

+ [ '-r', "%d"%fps, filename ]
)

self.proc = sp.Popen(cmd,stdin=sp.PIPE, stderr=sp.PIPE)
self.proc.stderr.close()
Expand Down

1 comment on commit d107e6b

@Zulko
Copy link

@Zulko Zulko commented on d107e6b Mar 28, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey,

I just had a request from another user for exactly this feature (apparently). Could you make a merge request ?
Thanks in advance !

Please sign in to comment.