-
Notifications
You must be signed in to change notification settings - Fork 38
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
Error when saving movie file #61
Comments
Hi @ognancy4life, thanks for raising this issue and sorry for the long wait. Could you post the version of ffmpeg that you are using? |
Thanks for the reply, @jbusecke ! Here ya go: |
Ughhh this is indeed a bit convoluted to debug. Can you try to set |
I think this error is just raised in this part of the code which is responsible for the printing the stdout to the notebook... |
Same as above but with RuntimeError Traceback (most recent call last) ~/opt/anaconda3/lib/python3.8/site-packages/xmovie/core.py in _execute_command(command, verbose, error) RuntimeError: Command ffmpeg -r 15 -i "output/frame_%05d.png" -y -c:v libx264 -preset veryslow -crf 10 -pix_fmt yuv420p -r 15 "output/" failed During handling of the above exception, another exception occurred: RuntimeError Traceback (most recent call last) ~/opt/anaconda3/lib/python3.8/site-packages/xmovie/core.py in save(self, filename, remove_frames, remove_movie, progress, verbose, overwrite_existing, parallel, parallel_compute_kwargs, framerate, ffmpeg_options, gif_palette, gif_resolution_factor, gif_framerate) ~/opt/anaconda3/lib/python3.8/site-packages/xmovie/core.py in combine_frames_into_movie(sourcefolder, moviename, frame_pattern, remove_frames, verbose, ffmpeg_options, framerate) ~/opt/anaconda3/lib/python3.8/site-packages/xmovie/core.py in _check_ffmpeg_execute(command, verbose) RuntimeError: Something has gone wrong. Use |
Lol, that isnt the most helpful advice, huh? Can you try to run |
Can you pass an explicit string instead of `output_dir + 'SLA2019_Saildrone_movie.mp4' to test? |
(base) MacBook-Pro-2:Saildrone_python williams$ ffmpeg -r 15 -i "output/frame_%05d.png" -y -c:v libx264 -preset veryslow -crf 10 -pix_fmt yuv420p -r 15 "output/" |
And: mov = Movie( mov.save( 100%
|
This suggests to me that there is something incompatible with the version of ffmpeg you have installed. Could you try to install a new version via conda/mamba?
|
OK, I installed that version of ffmpeg and ran it a few ways:
So, it's working but with an error. Thanks and let me know if you want me to try anything else to help diagnose the issue! |
Ooof that is frustrating, sorry. These were all run with 'verbose=True'? I think this is then purely an issue with printing the ffmpeg output to the notebook, since 2.-4. produce a video.
|
No worries here! Thanks for your help! I am running this in a notebook so it's fine, I can just skip past the error. Would this type of error interrupt a .py script if someone were running that way? |
Good question. I dont thing so? But that would need some testing. |
I'm getting an error when I try to save my xmovie file. The frames are showing up in the output_dir where they're supposed to, but the final save doesn't work. I do have ffmpeg installed and have used it successfully for other things.
mov = Movie(
SSH.sla.sel(
longitude=slice(0,150),
time=slice("2019-05-01", "2019-08-2")),
cmap='RdBu',
vmin=-.3, vmax=.3,
levels=41,
plotmethod='contourf',
extend='both'
)
mov.preview(30) # To preview a specific frame
mov.save(
output_dir + 'SLA2019_Saildrone_movie.mp4',
progress=True,
overwrite_existing=True,
verbose=True
)
! rm output_dir + frame_*.png
Yields the following error:
ValueError Traceback (most recent call last)
/var/folders/77/krt31b_92xg9grw6m3r25r380000mn/T/ipykernel_53094/1418684609.py in
11 )
12 mov.preview(30) # To preview a specific frame
---> 13 mov.save(
14 output_dir + 'SLA2019_Saildrone_movie.mp4',
15 progress=True,
~/opt/anaconda3/lib/python3.8/site-packages/xmovie/core.py in save(self, filename, remove_frames, remove_movie, progress, verbose, overwrite_existing, parallel, parallel_compute_kwargs, framerate, ffmpeg_options, gif_palette, gif_resolution_factor, gif_framerate)
522
523 # Create movie
--> 524 combine_frames_into_movie(
525 dirname,
526 moviefile,
~/opt/anaconda3/lib/python3.8/site-packages/xmovie/core.py in combine_frames_into_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))
~/opt/anaconda3/lib/python3.8/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:
~/opt/anaconda3/lib/python3.8/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:
~/opt/anaconda3/lib/python3.8/site-packages/ipykernel/iostream.py in write(self, string)
499
500 if not isinstance(string, str):
--> 501 raise ValueError(
502 "TypeError: write() argument must be str, not {type(string)}"
503 )
ValueError: TypeError: write() argument must be str, not {type(string)}
The text was updated successfully, but these errors were encountered: