Really dumb copy-pasting of extract_scene.py and scene.py from master to get what I want. Not sure what's going on here.

This commit is contained in:
Grant Sanderson
2018-02-26 19:07:57 -08:00
parent ae41269d36
commit ec610a9152
2 changed files with 5 additions and 12 deletions

View File

@ -18,7 +18,6 @@ from camera import Camera
HELP_MESSAGE = """ HELP_MESSAGE = """
Usage: Usage:
python extract_scene.py <module> [<scene name>] python extract_scene.py <module> [<scene name>]
-p preview in low quality -p preview in low quality
-s show and save picture of last frame -s show and save picture of last frame
-w write result to file [this is default if nothing else is stated] -w write result to file [this is default if nothing else is stated]
@ -35,7 +34,6 @@ SCENE_NOT_FOUND_MESSAGE = """
CHOOSE_NUMBER_MESSAGE = """ CHOOSE_NUMBER_MESSAGE = """
Choose number corresponding to desired scene/arguments. Choose number corresponding to desired scene/arguments.
(Use comma separated list for multiple entries) (Use comma separated list for multiple entries)
Choice(s): """ Choice(s): """
INVALID_NUMBER_MESSAGE = "Fine then, if you don't want to give a valid number I'll just quit" INVALID_NUMBER_MESSAGE = "Fine then, if you don't want to give a valid number I'll just quit"
@ -95,6 +93,7 @@ def get_configuration():
"save_pngs" : args.save_pngs, "save_pngs" : args.save_pngs,
#If -t is passed in (for transparent), this will be RGBA #If -t is passed in (for transparent), this will be RGBA
"saved_image_mode": "RGBA" if args.transparent else "RGB", "saved_image_mode": "RGBA" if args.transparent else "RGB",
"movie_file_extension" : ".mov" if args.transparent else ".mp4",
"quiet" : args.quiet or args.write_all, "quiet" : args.quiet or args.write_all,
"ignore_waits" : args.preview, "ignore_waits" : args.preview,
"write_all" : args.write_all, "write_all" : args.write_all,
@ -237,6 +236,7 @@ def main():
"write_to_movie", "write_to_movie",
"output_directory", "output_directory",
"save_pngs", "save_pngs",
"movie_file_extension",
"start_at_animation_number", "start_at_animation_number",
"end_at_animation_number", "end_at_animation_number",
] ]
@ -260,4 +260,4 @@ def main():
if __name__ == "__main__": if __name__ == "__main__":
main() main()

View File

@ -82,7 +82,7 @@ class Scene(Container):
def setup(self): def setup(self):
""" """
This is meant to be implement by any scenes which This is meant to be implement by any scenes which
are commonly subclassed, and have some common setup are comonly subclassed, and have some common setup
involved before the construct method is called. involved before the construct method is called.
""" """
pass pass
@ -366,7 +366,6 @@ class Scene(Container):
Each arg can either be an animation, or a mobject method Each arg can either be an animation, or a mobject method
followed by that methods arguments (and potentially follow followed by that methods arguments (and potentially follow
by a dict of kwargs for that method). by a dict of kwargs for that method).
This animation list is built by going through the args list, This animation list is built by going through the args list,
and each animation is simply added, but when a mobject method and each animation is simply added, but when a mobject method
s hit, a MoveToTarget animation is built using the args that s hit, a MoveToTarget animation is built using the args that
@ -387,7 +386,7 @@ class Scene(Container):
animations.pop() animations.pop()
#method should already have target then. #method should already have target then.
else: else:
mobject.target = mobject.deepcopy() mobject.generate_target()
# #
if len(state["method_args"]) > 0 and isinstance(state["method_args"][-1], dict): if len(state["method_args"]) > 0 and isinstance(state["method_args"][-1], dict):
method_kwargs = state["method_args"].pop() method_kwargs = state["method_args"].pop()
@ -578,17 +577,12 @@ class Scene(Container):
FFMPEG_BIN, FFMPEG_BIN,
'-y', # overwrite output file if it exists '-y', # overwrite output file if it exists
'-f', 'rawvideo', '-f', 'rawvideo',
'-vcodec','rawvideo',
'-s', '%dx%d'%(width, height), # size of one frame '-s', '%dx%d'%(width, height), # size of one frame
'-pix_fmt', 'rgba', '-pix_fmt', 'rgba',
'-r', str(fps), # frames per second '-r', str(fps), # frames per second
'-i', '-', # The imput comes from a pipe '-i', '-', # The imput comes from a pipe
'-an', # Tells FFMPEG not to expect any audio '-an', # Tells FFMPEG not to expect any audio
'-vcodec', 'mpeg',
'-c:v', 'libx264',
'-pix_fmt', 'yuv420p',
'-loglevel', 'error', '-loglevel', 'error',
temp_file_path,
] ]
if self.movie_file_extension == ".mov": if self.movie_file_extension == ".mov":
# This is if the background of the exported video # This is if the background of the exported video
@ -624,4 +618,3 @@ class EndSceneEarlyException(Exception):