tum-pbs / PhiFlow

A differentiable PDE solving framework for machine learning
MIT License
1.39k stars 189 forks source link

ffmpeg error #133

Closed sjtuytc closed 1 year ago

sjtuytc commented 1 year ago

Hi, what ffmpeg version are you using? I encounter an error when running fluids_tutorial.ipynb:

MovieWriter stderr: [libopenh264 @ 0x55f80688b3c0] Incorrect library version loaded Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height


BrokenPipeError Traceback (most recent call last) File ~/zelinzhao/software/conda/envs/large-scale-nerf/lib/python3.9/site-packages/matplotlib/animation.py:233, in AbstractMovieWriter.saving(self, fig, outfile, dpi, *args, **kwargs) 232 try: --> 233 yield self 234 finally:

File ~/zelinzhao/software/conda/envs/large-scale-nerf/lib/python3.9/site-packages/matplotlib/animation.py:1107, in Animation.save(self, filename, writer, fps, dpi, codec, bitrate, extra_args, metadata, extra_anim, savefig_kwargs, progress_callback) 1106 frame_number += 1 -> 1107 writer.grab_frame(**savefig_kwargs)

File ~/zelinzhao/software/conda/envs/large-scale-nerf/lib/python3.9/site-packages/matplotlib/animation.py:359, in MovieWriter.grab_frame(self, savefig_kwargs) 358 # Save the figure data to the sink, using the frame format and dpi. --> 359 self.fig.savefig(self._proc.stdin, format=self.frame_format, 360 dpi=self.dpi, savefig_kwargs)

File ~/zelinzhao/software/conda/envs/large-scale-nerf/lib/python3.9/site-packages/matplotlib/figure.py:3343, in Figure.savefig(self, fname, transparent, kwargs) 3340 stack.enter_context( 3341 ax.patch._cm_set(facecolor='none', edgecolor='none')) -> 3343 self.canvas.print_figure(fname, kwargs)

File ~/zelinzhao/software/conda/envs/large-scale-nerf/lib/python3.9/site-packages/matplotlib/backend_bases.py:2366, in FigureCanvasBase.print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox_inches, pad_inches, bbox_extra_artists, backend, kwargs) 2365 with cbook._setattr_cm(self.figure, dpi=dpi): -> 2366 result = print_method( 2367 filename, 2368 facecolor=facecolor, 2369 edgecolor=edgecolor, 2370 orientation=orientation, 2371 bbox_inches_restore=_bbox_inches_restore, 2372 kwargs) 2373 finally:

File ~/zelinzhao/software/conda/envs/large-scale-nerf/lib/python3.9/site-packages/matplotlib/backend_bases.py:2232, in FigureCanvasBase._switch_canvas_and_return_print_method..(*args, kwargs) 2231 skip = optional_kws - {inspect.signature(meth).parameters} -> 2232 print_method = functools.wraps(meth)(lambda args, kwargs: meth( 2233 *args, **{k: v for k, v in kwargs.items() if k not in skip})) 2234 else: # Let third-parties do as they see fit.

File ~/zelinzhao/software/conda/envs/large-scale-nerf/lib/python3.9/site-packages/matplotlib/backends/backend_agg.py:448, in FigureCanvasAgg.print_raw(self, filename_or_obj) 447 with cbook.open_file_cm(filename_or_obj, "wb") as fh: --> 448 fh.write(renderer.buffer_rgba())

BrokenPipeError: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

CalledProcessError Traceback (most recent call last) File ~/zelinzhao/software/conda/envs/large-scale-nerf/lib/python3.9/site-packages/IPython/core/formatters.py:344, in BaseFormatter.call(self, obj) 342 method = get_real_method(obj, self.print_method) 343 if method is not None: --> 344 return method() 345 return None 346 else:

File ~/zelinzhao/software/conda/envs/large-scale-nerf/lib/python3.9/site-packages/matplotlib/animation.py:1361, in Animation._reprhtml(self) 1359 fmt = mpl.rcParams['animation.html'] 1360 if fmt == 'html5': -> 1361 return self.to_html5_video() 1362 elif fmt == 'jshtml': 1363 return self.to_jshtml()

File ~/zelinzhao/software/conda/envs/large-scale-nerf/lib/python3.9/site-packages/matplotlib/animation.py:1288, in Animation.to_html5_video(self, embed_limit) 1284 Writer = writers[mpl.rcParams['animation.writer']] 1285 writer = Writer(codec='h264', 1286 bitrate=mpl.rcParams['animation.bitrate'], 1287 fps=1000. / self._interval) -> 1288 self.save(str(path), writer=writer) 1289 # Now open and base64 encode. 1290 vid64 = base64.encodebytes(path.read_bytes())

File ~/zelinzhao/software/conda/envs/large-scale-nerf/lib/python3.9/site-packages/matplotlib/animation.py:1107, in Animation.save(self, filename, writer, fps, dpi, codec, bitrate, extra_args, metadata, extra_anim, savefig_kwargs, progress_callback) 1105 progress_callback(frame_number, total_frames) 1106 frame_number += 1 -> 1107 writer.grab_frame(**savefig_kwargs)

File ~/zelinzhao/software/conda/envs/large-scale-nerf/lib/python3.9/contextlib.py:137, in _GeneratorContextManager.exit(self, typ, value, traceback) 135 value = typ() 136 try: --> 137 self.gen.throw(typ, value, traceback) 138 except StopIteration as exc: 139 # Suppress StopIteration unless it's the same exception that 140 # was passed to throw(). This prevents a StopIteration 141 # raised inside the "with" statement from being suppressed. 142 return exc is not value

File ~/zelinzhao/software/conda/envs/large-scale-nerf/lib/python3.9/site-packages/matplotlib/animation.py:235, in AbstractMovieWriter.saving(self, fig, outfile, dpi, *args, **kwargs) 233 yield self 234 finally: --> 235 self.finish()

File ~/zelinzhao/software/conda/envs/large-scale-nerf/lib/python3.9/site-packages/matplotlib/animation.py:349, in MovieWriter.finish(self) 345 _log.log( 346 logging.WARNING if self._proc.returncode else logging.DEBUG, 347 "MovieWriter stderr:\n%s", err) 348 if self._proc.returncode: --> 349 raise subprocess.CalledProcessError( 350 self._proc.returncode, self._proc.args, out, err)

CalledProcessError: Command '['ffmpeg', '-f', 'rawvideo', '-vcodec', 'rawvideo', '-s', '1200x500', '-pix_fmt', 'rgba', '-r', '10.0', '-loglevel', 'error', '-i', 'pipe:', '-vcodec', 'h264', '-pix_fmt', 'yuv420p', '-y', '/tmp/tmpmgxfu33e/temp.m4v']' returned non-zero exit status 1.

holl- commented 1 year ago

I tested it with 2021-03-28-git-8b2bde0494-full_build-www.gyan.dev and 4.2.7-0ubuntu0.1. On ubuntu, you can install ffmpeg with apt and it should work.

sjtuytc commented 1 year ago

I used apt installed ffmpeg but it did not work.

holl- commented 1 year ago

You could try the following: