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

Showing the ffmpeg command #29

Open
tomchor opened this issue Oct 28, 2020 · 5 comments
Open

Showing the ffmpeg command #29

tomchor opened this issue Oct 28, 2020 · 5 comments

Comments

@tomchor
Copy link
Contributor

tomchor commented Oct 28, 2020

I think it would be nice to have the option of printing the resulting ffmpeg command that xmovie issues. I just went through a situation where all the images were generated but ffmpeg failed. The figures were still there (and they took a long time to generate), but I still had to re-do them all on my second try. Having the ffmpeg command would have saved me the trouble. I could have just issued the command in the terminal.

Thanks!

@jbusecke
Copy link
Owner

Thats a great idea. We should definitely do that.

@jbusecke
Copy link
Owner

Actually could you try running the movie creation with verbose=True. I think that already does a similar thing.

@tomchor
Copy link
Contributor Author

tomchor commented Oct 28, 2020

That's a good point. I missed that option.
However, I get an error when that option is activated:

TypeError                                 Traceback (most recent call last)
~/ML6mov.py in <module>
     41     gif_palette=False,
     42     gif_resolution_factor=0.5,
---> 43     gif_framerate=10,
     44 )
     45 

~/miniconda3/envs/p37/lib/python3.7/site-packages/xmovie/core.py in save(self, filename, remove_frames, remove_movie, progress, verbose, overwrite_existing, framerate, ffmpeg_options, gif_palette, gif_resolution_factor, gif_framerate)
    462             verbose=verbose,
    463             framerate=framerate,
--> 464             ffmpeg_options=ffmpeg_options,
    465         )
    466 

~/miniconda3/envs/p37/lib/python3.7/site-packages/xmovie/core.py in write_movie(sourcefolder, moviename, frame_pattern, remove_frames, verbose, ffmpeg_options, framerate)
    209         sourcefolder, moviename, framerate, frame_pattern, ffmpeg_options
    210     )
--> 211     p = _check_ffmpeg_execute(command, verbose=verbose)
    212 
    213     print("Movie created at %s" % (moviename))

~/miniconda3/envs/p37/lib/python3.7/site-packages/xmovie/core.py in _check_ffmpeg_execute(command, verbose)
    134     else:
    135         try:
--> 136             p = _execute_command(command, verbose=verbose)
    137             return p
    138         except RuntimeError:

~/miniconda3/envs/p37/lib/python3.7/site-packages/xmovie/core.py in _execute_command(command, verbose, error)
    116             if out_check != "":
    117                 # only display 10 lines, this cant be that hard?
--> 118                 sys.stdout.write(out)
    119                 sys.stdout.flush()
    120     else:

TypeError: write() argument must be str, not bytes

@brianmapes
Copy link

I had the same issue -- lots of frames created, but ffmpeg was not installed, so had to run it again (slow).
Could ffmpeg be made a conda dependency so it is installed automatically?
Anyway, it works: so mainly, thanks!

@jbusecke
Copy link
Owner

Hi @brianmapes, sorry for the long response time. I think a conda-forge feedstock would be a great addition. I opened a separate issue for this (#37), since it is technically not related to the original topic?

I was just looking through the codebase and it might also be helpful to check for an existing ffmpeg version before saving out all those frames?

I think this should be a rather easy fix (moving these lines into the class setup?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants