8000 ffmpeg_file vframes arg broken · Issue #3862 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

ffmpeg_file vframes arg broken #3862

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

Closed
ifmihai opened this issue Nov 29, 2014 · 20 comments
Closed

ffmpeg_file vframes arg broken #3862

ifmihai opened this issue Nov 29, 2014 · 20 comments

Comments

@ifmihai
Copy link
ifmihai commented Nov 29, 2014

I got into animation subject.
I get the same exception(s) with two different examples.
I searched the web, I tried to get my head around the exceptions, but now I'm stuck. hence this issue.
I don't know where is the problem.

The examples I ran:

  1. official example: http://matplotlib.org/examples/animation/moviewriter.html
  2. @tacaswell answer on stackoverflow: http://stackoverflow.com/a/13983801/662323

the exception(s):

python moviewriter.py
/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/tight_layout.py:225: UserWarning: tight_layout : falling back to Agg renderer
  warnings.warn("tight_layout : falling back to Agg renderer")
Traceback (most recent call last):
  File "moviewriter.py", line 34, in <module>
    ani_frame()
  File "moviewriter.py", line 31, in ani_frame
    ani.save('demo.mp4',writer=writer,dpi=dpi)
  File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 718, in save
    writer.grab_frame(**savefig_kwargs)
  File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 204, in grab_frame
    dpi=self.dpi, **savefig_kwargs)
  File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/figure.py", line 1421, in savefig
    self.canvas.print_figure(*args, **kwargs)
  File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 2220, in print_figure
    **kwargs)
  File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 497, in print_raw
    renderer._renderer.write_rgba(filename_or_obj)
RuntimeError: Error writing to file

my configuration
macosx mavericks 10.9.4
anaconda bundle
matplotlib 1.3.1 (as 1.4.2 still doesn't work in my configuration, the ascii bug #3517 still prevails)

matplotlib.get_backend() gives 'MacOSX'

I've installed ffmpeg and mencoder (through homebrew)
matplotlib.animation.writers.list() recognizes both codecs

Any help on this? is it a bug or a problem with my configuration?

@WeatherGod
Copy link
Member

Could you give it a shot with "ffmpeg_file" writer instead of "ffmpeg"?
This is a subtly different saving mechanism, but still uses ffmpeg (saves
the individual frames as temporaries and then encodes them when done
instead of on the fly). Also, try using the command-line flag of
"--debug-annoying". This will activate lots of extra logging.

On Sat, Nov 29, 2014 at 11:43 AM, Michael notifications@github.com wrote:

I got into animation subject.
I get the same exception(s) with two different examples.
I searched the web, I tried to get my head around the exceptions, but now
I'm stuck. hence this issue.
I don't know where is the problem.

The examples I ran:

  1. official example:
    http://matplotlib.org/examples/animation/moviewriter.html
  2. @tacaswell https://github.com/tacaswell answer on stackoverflow:
    http://stackoverflow.com/a/13983801/662323

the exception(s):

python moviewriter.py/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/tight_layout.py:225: UserWarning: tight_layout : falling back to Agg renderer
warnings.warn("tight_layout : falling back to Agg renderer")
Traceback (most recent call last):
File "moviewriter.py", line 34, in
ani_frame()
File "moviewriter.py", line 31, in ani_frame
ani.save('demo.mp4',writer=writer,dpi=dpi)
File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 718, in save
writer.grab_frame(*_savefig_kwargs)
File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 204, in grab_frame
dpi=self.dpi, *_savefig_kwargs)
File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/figure.py", line 1421, in savefig
self.canvas.print_figure(_args, *_kwargs)
File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 2220, in print_figure
**kwargs)
File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 497, in print_raw
renderer._renderer.write_rgba(filename_or_obj)RuntimeError: Error writing to file

my configuration
macosx mavericks 10.9.4
anaconda bundle
matplotlib 1.3.1 (as 1.4.2 still doesn't work in my configuration, the
ascii bug #3517 #3517
still prevails)

matplotlib.get_backend() gives 'MacOSX'

I've installed ffmpeg and mencoder (through homebrew)
matplotlib.animatio 8000 n.writers.list() recognizes both codecs

Any help on this? is it a bug or a problem with my configuration?


Reply to this email directly or view it on GitHub
#3862.

@ifmihai
Copy link
Author
ifmihai commented Dec 1, 2014

sorry for delay.
I tried ffmpeg_file also.
It runs for longer period of time.
And i see it writes down png files (ie _tmp00045.png)
but still errors:

python moviewriter1.py
Traceback (most recent call last):
  File "moviewriter1.py", line 36, in <module>
    ani_frame()
  File "moviewriter1.py", line 33, in ani_frame
    ani.save('demo1.mp4',writer=writer,dpi=dpi)
  File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 718, in save
    writer.grab_frame(**savefig_kwargs)
  File "/Users/ifmichael/anaconda/lib/python2.7/contextlib.py", line 24, in __exit__
    self.gen.next()
  File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 171, in saving
    self.finish()
  File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 334, in finish
    + ' Try running with --verbose-debug')
RuntimeError: Error creating movie, return code: -5 Try running with --verbose-debug

I'm running the examples by copy paste them into a py file, then run it with python.
How do I add --debug-annoying?
Maybe as a parameter to the writer?
I don't know how and I can't seem to find how.

@WeatherGod
Copy link
Member

It would be a command-line flag. But actually, I might be wrong and it is
"--verbose-debug" as the error message states. So, if you copied the
example to a file called "foo.py", you would normally type a command of
"python foo.py". Adding a command line flag of "--verbose-debug" simply
means using the following command: "python foo.py --verbose-debug".

On Mon, Dec 1, 2014 at 10:55 AM, Michael notifications@github.com wrote:

sorry for delay.
I tried ffmpeg_file also.
It runs for longer period of time.
And i see it writes down png files (ie _tmp00045.png)
but still errors:

python ffmpegwriter.py
Traceback (most recent call last):
File "ffmpegwriter.py", line 31, in
writer.grab_frame()
File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 204, in grab_frame
dpi=self.dpi, **savefig_kwargs)
File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/figure.py", line 1421, in savefig
self.canvas.print_figure(_args, *_kwargs)
File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 2220, in print_figure
**kwargs)
File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 497, in print_raw
renderer._renderer.write_rgba(filename_or_obj)RuntimeError: Error writing to file79-118-139-138:matplotlib ifmichael$ python moviewriter1.py
Traceback (most recent call last):
File "moviewriter1.py", line 36, in
ani_frame()
File "moviewriter1.py", line 33, in ani_frame
ani.save('demo1.mp4',writer=writer,dpi=dpi)
File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 718, in save
writer.grab_frame(**savefig_kwargs)
File "/Users/ifmichael/anaconda/lib/python2.7/contextlib.py", line 24, in exit
self.gen.next()
File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 171, in saving
self.finish()
File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 334, in finish
+ ' Try running with --verbose-debug')RuntimeError: Error creating movie, return code: -5 Try running with --verbose-debug

I'm running the examples by copy paste them into a py file, then run it
with python.
How do I add --debug-annoying?
Maybe as a parameter to the writer?
I don't know how and I can't seem to find how.


Reply to this email directly or view it on GitHub
#3862 (comment)
.

@ifmihai
Copy link
Author
ifmihai commented Dec 1, 2014

ah.
I thought I need to give this --verbose-debug to matplotlib, not python.
now it makes sense.

this is the result (i changed the example's 300 frames into 10 frames, for a shorter output to paste it here):

python moviewriter1.py --verbose-debug
$HOME=/Users/ifmichael
matplotlib data path /Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/mpl-data
loaded rc file /Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc
matplotlib version 1.3.1
verbose.level debug
interactive is False
platform is darwin
loaded modules: <dictionary-keyiterator object at 0x1021c5158>
CACHEDIR=/Users/ifmichael/.matplotlib
Using fontManager instance from /Users/ifmichael/.matplotlib/fontList.cache
backend MacOSX version unknown
Animation.save using <class 'matplotlib.animation.FFMpegFileWriter'>
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 0 to fname=_tmp0000000.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 1 to fname=_tmp0000001.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 2 to fname=_tmp0000002.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 3 to fname=_tmp0000003.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 4 to fname=_tmp0000004.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 5 to fname=_tmp0000005.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 6 to fname=_tmp0000006.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 7 to fname=_tmp0000007.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 8 to fname=_tmp0000008.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 9 to fname=_tmp0000009.png
MovieWriter.run: running command: ffmpeg -vframes 10 -r 30 -i _tmp%07d.png -vcodec mpeg4 -y demo1.mp4
dyld: Library not loaded: /usr/local/lib/libfreetype.6.dylib
  Referenced from: /usr/local/bin/ffmpeg
  Reason: image not found
MovieWriter -- Command stdout:
None
MovieWriter -- Command stderr:
None
MovieWriter: clearing temporary fnames=['_tmp0000000.png', '_tmp0000001.png', '_tmp0000002.png', '_tmp0000003.png', '_tmp0000004.png', '_tmp0000005.png', '_tmp0000006.png', '_tmp0000007.png', '_tmp0000008.png', '_tmp0000009.png']
Traceback (most recent call last):
  File "moviewriter1.py", line 36, in <module>
    ani_frame()
  File "moviewriter1.py", line 33, in ani_frame
    ani.save('demo1.mp4',writer=writer,dpi=dpi)
  File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 718, in save
    writer.grab_frame(**savefig_kwargs)
  File "/Users/ifmichael/anaconda/lib/python2.7/contextlib.py", line 24, in __exit__
    self.gen.next()
  File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 171, in saving
    self.finish()
  File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 334, in finish
    + ' Try running with --verbose-debug')
RuntimeError: Error creating movie, return code: -5 Try running with --verbose-debug

@WeatherGod
Copy link
Member

Very interesting... how did you install ffmpeg?

On Mon, Dec 1, 2014 at 11:08 AM, Michael notifications@github.com wrote:

ah.
I thought I need to give this --verbose-debug to matplotlib, not python.
now it makes sense.

this is the result (i changed the example's 300 frames into 10 frames, for
a shorter output to paste it here):

python moviewriter1.py --verbose-debug
$HOME=/Users/ifmichael
matplotlib data path /Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/mpl-data
loaded rc file /Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc
matplotlib version 1.3.1
verbose.level debug
interactive is False
platform is darwin
loaded modules: <dictionary-keyiterator object at 0x1021c5158>
CACHEDIR=/Users/ifmichael/.matplotlib
Using fontManager instance from /Users/ifmichael/.matplotlib/fontList.cache
backend MacOSX version unknown
Animation.save using <class 'matplotlib.animation.FFMpegFileWriter'>
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 0 to fname=_tmp0000000.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 1 to fname=_tmp0000001.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 2 to fname=_tmp0000002.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 3 to fname=_tmp0000003.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 4 to fname=_tmp0000004.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 5 to fname=_tmp0000005.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 6 to fname=_tmp0000006.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 7 to fname=_tmp0000007.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 8 to fname=_tmp0000008.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 9 to fname=_tmp0000009.png
MovieWriter.run: running command: ffmpeg -vframes 10 -r 30 -i _tmp%07d.png -vcodec mpeg4 -y demo1.mp4
dyld: Library not loaded: /usr/local/lib/libfreetype.6.dylib
Referenced from: /usr/local/bin/ffmpeg
Reason: image not found
MovieWriter -- Command stdout:None
MovieWriter -- Command stderr:None
MovieWriter: clearing temporary fnames=['_tmp0000000.png', '_tmp0000001.png', '_tmp0000002.png', '_tmp0000003.png', '_tmp0000004.png', '_tmp0000005.png', '_tmp0000006.png', '_tmp0000007.png', '_tmp0000008.png', '_tmp0000009.png']
Traceback (most recent call last):
File "moviewriter1.py", line 36, in
ani_frame()
File "moviewriter1.py", line 33, in ani_frame
ani.save('demo1.mp4',writer=writer,dpi=dpi)
File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 718, in save
writer.grab_frame(**savefig_kwargs)
File "/Users/ifmichael/anaconda/lib/python2.7/contextlib.py", line 24, in exit
self.gen.next()
File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 171, in saving
self.finish()
File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 334, in finish
+ ' Try running with --verbose-debug')RuntimeError: Error creating movie, return code: -5 Try running with --verbose-debug


Reply to this email directly or view it on GitHub
#3862 (comment)
.

@ifmihai
Copy link
Author
ifmihai commented Dec 1, 2014

I installed it through homebrew

@jenshnielsen
Copy link
Member

Can you try to install freetype manually? Homebrew ffmpeg lists it as an optional dependency which doesn't seem to be true.

brew install freetype

@jenshnielsen
Copy link
Member

Is is linked? I.e. is does /usr/local/lib/libfreetype.6.dylib exist?

If so I would suggest trying to reinstall ffmpeg.

@ifmihai
Copy link
Author
ifmihai commented Dec 1, 2014

I searched for this file and it's in many places
but it's not in /usr/local/lib

mdfind libfreetype.6.dylib
/Users/ifmichael/anaconda/lib/libfreetype.6.dylib
/opt/X11/lib/libfreetype.6.dylib
/Users/ifmichael/anaconda/pkgs/freetype-2.4.10-1/lib/libfreetype.6.dylib
/usr/local/Cellar/freetype/2.5.3_1/lib/libfreetype.6.dylib
/Library/Frameworks/Mono.framework/Versions/3.10.0/lib/libfreetype.6.dylib
/Library/Frameworks/Mono.framework/Versions/3.10.0/lib/libfreetype.6.dylib.dSYM
/Users/ifmichael/anaconda/pkgs/freetype-2.4.10-1/info/files

@jenshnielsen
Copy link
Member

That probably means that homebrew freetype is not linked:

Try

brew link freetype

Or if that doesn't work

brew unlink freetype && brew link freetype

@ifmihai
Copy link
Author
ifmihai commented Dec 1, 2014

Apparently there are some changes now, but it still ends in exception.
(So you basically suggest it's ffmpeg's fault?)

First, brew linking:

brew link freetype
Warning: Already linked: /usr/local/Cellar/freetype/2.5.3_1
To relink: brew unlink freetype && brew link freetype

brew unlink freetype
Unlinking /usr/local/Cellar/freetype/2.5.3_1... 1 symlinks removed

brew link freetype
Linking /usr/local/Cellar/freetype/2.5.3_1... 8 symlinks created

Now, the ffmpeg_file output:

python moviewriter1.py --verbose-debug
$HOME=/Users/ifmichael
matplotlib data path /Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/mpl-data
loaded rc file /Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc
matplotlib version 1.3.1
verbose.level debug
interactive is False
platform is darwin
loaded modules: <dictionary-keyiterator object at 0x1021c51b0>
CACHEDIR=/Users/ifmichael/.matplotlib
Using fontManager instance from /Users/ifmichael/.matplotlib/fontList.cache
backend MacOSX version unknown
Animation.save using <class 'matplotlib.animation.FFMpegFileWriter'>
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 0 to fname=_tmp0000000.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 1 to fname=_tmp0000001.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 2 to fname=_tmp0000002.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 3 to fname=_tmp0000003.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 4 to fname=_tmp0000004.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 5 to fname=_tmp0000005.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 6 to fname=_tmp0000006.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 7 to fname=_tmp0000007.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 8 to fname=_tmp0000008.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 9 to fname=_tmp0000009.png
MovieWriter.run: running command: ffmpeg -vframes 10 -r 30 -i _tmp%07d.png -vcodec mpeg4 -y demo1.mp4
dyld: Library not loaded: /usr/local/lib/libfontconfig.1.dylib
  Referenced from: /usr/local/lib/libass.5.dylib
  Reason: image not found
MovieWriter -- Command stdout:
None
MovieWriter -- Command stderr:
None
MovieWriter: clearing temporary fnames=['_tmp0000000.png', '_tmp0000001.png', '_tmp0000002.png', '_tmp0000003.png', '_tmp0000004.png', '_tmp0000005.png', '_tmp0000006.png', '_tmp0000007.png', '_tmp0000008.png', '_tmp0000009.png']
Traceback (most recent call last):
  File "moviewriter1.py", line 39, in <module>
    ani_frame()
  File "moviewriter1.py", line 36, in ani_frame
    ani.save('demo1.mp4',writer=writer,dpi=dpi)
  File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 718, in save
    writer.grab_frame(**savefig_kwargs)
  File "/Users/ifmichael/anaconda/lib/python2.7/contextlib.py", line 24, in __exit__
    self.gen.next()
  File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 171, in saving
    self.finish()
  File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 334, in finish
    + ' Try running with --verbose-debug')
RuntimeError: Error creating movie, return code: -5 Try running with --verbose-debug

@ifmihai
Copy link
Author
ifmihai commented Dec 1, 2014

ok. after reading the output again, I saw a pb with fontconfig. I did

brew unlink fontconfig
brew link fontconfig 

Now the output is changed:

python moviewriter1.py --verbose-debug
$HOME=/Users/ifmichael
matplotlib data path /Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/mpl-data
loaded rc file /Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc
matplotlib version 1.3.1
verbose.level debug
interactive is False
platform is darwin
loaded modules: <dictionary-keyiterator object at 0x1021c5158>
CACHEDIR=/Users/ifmichael/.matplotlib
Using fontManager instance from /Users/ifmichael/.matplotlib/fontList.cache
backend MacOSX version unknown
Animation.save using <class 'matplotlib.animation.FFMpegFileWriter'>
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 0 to fname=_tmp0000000.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 1 to fname=_tmp0000001.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 2 to fname=_tmp0000002.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 3 to fname=_tmp0000003.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 4 to fname=_tmp0000004.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 5 to fname=_tmp0000005.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 6 to fname=_tmp0000006.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 7 to fname=_tmp0000007.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 8 to fname=_tmp0000008.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 9 to fname=_tmp0000009.png
MovieWriter.run: running command: ffmpeg -vframes 10 -r 30 -i _tmp%07d.png -vcodec mpeg4 -y demo1.mp4
ffmpeg version 2.4.3 Copyright (c) 2000-2014 the FFmpeg developers
  built on Nov 29 2014 17:33:28 with Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/2.4.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid --enable-libfreetype --enable-libvorbis --enable-libvpx --enable-libass --enable-ffplay --enable
8000
-libfdk-aac --enable-libopus --enable-libquvi --enable-libx265 --enable-vda
  libavutil      54.  7.100 / 54.  7.100
  libavcodec     56.  1.100 / 56.  1.100
  libavformat    56.  4.101 / 56.  4.101
  libavdevice    56.  0.100 / 56.  0.100
  libavfilter     5.  1.100 /  5.  1.100
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  0.100 /  3.  0.100
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  0.100 / 53.  0.100
Option vframes (set the number of video frames to record) cannot be applied to input file _tmp%07d.png -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to.
Error parsing options for input file _tmp%07d.png.
Error opening input files: Invalid argument
MovieWriter -- Command stdout:
None
MovieWriter -- Command stderr:
None
MovieWriter: clearing temporary fnames=['_tmp0000000.png', '_tmp0000001.png', '_tmp0000002.png', '_tmp0000003.png', '_tmp0000004.png', '_tmp0000005.png', '_tmp0000006.png', '_tmp0000007.png', '_tmp0000008.png', '_tmp0000009.png']
Traceback (most recent call last):
  File "moviewriter1.py", line 39, in <module>
    ani_frame()
  File "moviewriter1.py", line 36, in ani_frame
    ani.save('demo1.mp4',writer=writer,dpi=dpi)
  File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 718, in save
    writer.grab_frame(**savefig_kwargs)
  File "/Users/ifmichael/anaconda/lib/python2.7/contextlib.py", line 24, in __exit__
    self.gen.next()
  File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 171, in saving
    self.finish()
  File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 334, in finish
    + ' Try running with --verbose-debug')
RuntimeError: Error creating movie, return code: 1 Try running with --verbose-debug

One more mention. I checked again how I installed ffmpeg. I did it through the following command (from their site, for macosx):

brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-libass --with-libquvi --with-libvorbis --with-libvpx --with-opus --with-x265

I will unlink/link all of these

@WeatherGod
Copy link
Member

Just for sanity checking, run "which ffmpeg".

On Mon, Dec 1, 2014 at 11:43 AM, Michael notifications@github.com wrote:

Apparently there are some changes now, but it still ends in exception.
(So you basically suggest it's ffmpeg's fault?)

First, brew linking:

brew link freetypeWarning: Already linked: /usr/local/Cellar/freetype/2.5.3_1
To relink: brew unlink freetype && brew link freetype

brew unlink freetype
Unlinking /usr/local/Cellar/freetype/2.5.3_1... 1 symlinks removed

brew link freetype
Linking /usr/local/Cellar/freetype/2.5.3_1... 8 symlinks created

Now, the ffmpeg_file output:

python moviewriter1.py --verbose-debug
$HOME=/Users/ifmichael
matplotlib data path /Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/mpl-data
loaded rc file /Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc
matplotlib version 1.3.1
verbose.level debug
interactive is False
platform is darwin
loaded modules: <dictionary-keyiterator object at 0x1021c51b0>

CACHEDIR=/Users/ifmichael/.matplotlib
Using fontManager instance from /Users/ifmichael/.matplotlib/fontList.cache
backend MacOSX version unknown
Animation.save using <class 'matplotlib.animation.FFMpegFileWriter'>
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 0 to fname=_tmp0000000.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 1 to fname=_tmp0000001.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 2 to fname=_tmp0000002.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 3 to fname=_tmp0000003.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 4 to fname=_tmp0000004.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 5 to fname=_tmp0000005.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 6 to fname=_tmp0000006.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 7 to fname=_tmp0000007.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 8 to fname=_tmp0000008.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 9 to fname=_tmp0000009.png
MovieWriter.run: running command: ffmpeg -vframes 10 -r 30 -i _tmp%07d.png -vcodec mpeg4 -
y demo1.mp4
dyld: Library not loaded: /usr/local/lib/libfontconfig.1.dylib
Referenced from: /usr/local/lib/libass.5.dylib
Reason: image not found
MovieWriter -- Command stdout:None
MovieWriter -- Command stderr:None
MovieWriter: clearing temporary fnames=['_tmp0000000.png', '_tmp0000001.png', '_tmp0000002.png', '_tmp0000003.png', '_tmp0000004.png', '_tmp0000005.png', '_tmp0000006.png', '_tmp0000007.png', '_tmp0000008.png', '_tmp0000009.png']
Traceback (most recent call last):
File "moviewriter1.py", line 39, in
ani_frame()
File "moviewriter1.py", line 36, in ani_frame
ani.save('demo1.mp4',writer=writer,dpi=dpi)
File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 718, in save
writer.grab_frame(**savefig_kwargs)
File "/Users/ifmichael/anaconda/lib/python2.7/contextlib.py", line 24, in exit
self.gen.next()
File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 171, in saving
self.finish()
File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 334, in finish
+ ' Try running with --verbose-debug')RuntimeError: Error creating movie, return code: -5 Try running with --verbose-debug


Reply to this email directly or view it on GitHub
#3862 (comment)
.

@ifmihai
Copy link
Author
ifmihai commented Dec 1, 2014
which ffmpeg
/usr/local/bin/ffmpeg

@ifmihai
Copy link
Author
ifmihai commented Dec 1, 2014

apparently, the core of the issue now is:
"
ffmpeg -vframes 10 -r 30 -i _tmp%07d.png -vcodec mpeg4 -y demo1.mp4

Option vframes (set the number of video frames to record) cannot be applied to input file _tmp%07d.png -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to.
Error parsing options for input file _tmp%07d.png."

I'm not sure what this means, but it may be a syntax error given to ffmpeg?

@WeatherGod
Copy link
Member

Are the tmp files still in the directory? If not, then that might be the
problem.

On Mon, Dec 1, 2014 at 12:01 PM, Michael notifications@github.com wrote:

apparently, the core of the issue now is:
"
ffmpeg -vframes 10 -r 30 -i _tmp%07d.png -vcodec mpeg4 -y demo1.mp4

Option vframes (set the number of video frames to record) cannot be
applied to input file _tmp%07d.png -- you are trying to apply an input
option to an output file or vice versa. Move this option before the file it
belongs to.
Error parsing options for input file _tmp%07d.png."

I'm not sure what this means, but it may be a syntax error given to ffmpeg?


Reply to this email directly or view it on GitHub
#3862 (comment)
.

@ifmihai
Copy link
Author
ifmihai commented Dec 1, 2014

I've watched in parallel the directory in finder.
It creates all files, then deletes them all.

After unlink/link all packages installed along with ffmpeg
I also did a brew update && brew upgrade
Now it works with 'ffmpeg' writer!

but it still doesn't work with 'ffmpeg_file'

the result is:

python moviewriter1.py --verbose-debug
$HOME=/Users/ifmichael
matplotlib data path /Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/mpl-data
loaded rc file /Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc
matplotlib version 1.3.1
verbose.level debug
interactive is False
platform is darwin
loaded modules: <dictionary-keyiterator object at 0x1021c51b0>
CACHEDIR=/Users/ifmichael/.matplotlib
Using fontManager instance from /Users/ifmichael/.matplotlib/fontList.cache
backend MacOSX version unknown
Animation.save using <class 'matplotlib.animation.FFMpegFileWriter'>
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 0 to fname=_tmp0000000.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 1 to fname=_tmp0000001.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 2 to fname=_tmp0000002.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 3 to fname=_tmp0000003.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 4 to fname=_tmp0000004.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 5 to fname=_tmp0000005.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 6 to fname=_tmp0000006.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 7 to fname=_tmp0000007.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 8 to fname=_tmp0000008.png
MovieWriter.grab_frame: Grabbing frame.
FileMovieWriter.frame_sink: saving frame 9 to fname=_tmp0000009.png
MovieWriter.run: running command: ffmpeg -vframes 10 -r 30 -i _tmp%07d.png -vcodec mpeg4 -y demo1.mp4
ffmpeg version 2.4.3 Copyright (c) 2000-2014 the FFmpeg developers
  built on Nov 29 2014 17:33:28 with Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/2.4.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid --enable-libfreetype --enable-libvorbis --enable-libvpx --enable-libass --enable-ffplay --enable-libfdk-aac --enable-libopus --enable-libquvi --enable-libx265 --enable-vda
  libavutil      54.  7.100 / 54.  7.100
  libavcodec     56.  1.100 / 56.  1.100
  libavformat    56.  4.101 / 56.  4.101
  libavdevice    56.  0.100 / 56.  0.100
  libavfilter     5.  1.100 /  5.  1.100
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  0.100 /  3.  0.100
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  0.100 / 53.  0.100
Option vframes (set the number of video frames to record) cannot be applied to input file _tmp%07d.png -- you are trying to apply an input option to an output file or vice versa. Move this option before the file it belongs to.
Error parsing options for input file _tmp%07d.png.
Error opening input files: Invalid argument
MovieWriter -- Command stdout:
None
MovieWriter -- Command stderr:
None
MovieWriter: clearing temporary fnames=['_tmp0000000.png', '_tmp0000001.png', '_tmp0000002.png', '_tmp0000003.png', '_tmp0000004.png', '_tmp0000005.png', '_tmp0000006.png', '_tmp0000007.png', '_tmp0000008.png', '_tmp0000009.png']
Traceback (most recent call last):
  File "moviewriter1.py", line 39, in <module>
    ani_frame()
  File "moviewriter1.py", line 36, in ani_frame
    ani.save('demo1.mp4',writer=writer,dpi=dpi)
  File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 718, in save
    writer.grab_frame(**savefig_kwargs)
  File "/Users/ifmichael/anaconda/lib/python2.7/contextlib.py", line 24, in __exit__
    self.gen.next()
  File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 171, in saving
    self.finish()
  File "/Users/ifmichael/anaconda/lib/python2.7/site-packages/matplotlib/animation.py", line 334, in finish
    + ' Try running with --verbose-debug')
RuntimeError: Error creating movie, return code: 1 Try running with --verbose-debug

@tacaswell tacaswell changed the title animation issue ffmpeg_file vframes arg broken Dec 4, 2014
@tacaswell tacaswell added this to the v1.4.x milestone Dec 4, 2014
@tacaswell
Copy link
Member

Change title to point at the real issue found here which is the incantation for ffmpeg file seems to have rotted. My understanding is that ffmpeg has a history of breaking api without much warning. It is also made far worse by the ffmpeg/libav split.

@dopplershift
Copy link
Contributor

I went to go fix this latter problem with ffmpeg options, and it turns out this is a duplicate of #2482.

I tested, was able to reproduce the error using the ffmpeg I have installed on my Mac and the problematic command from the log above. Using a current matplotlib version, everything works fine here.

@tacaswell
Copy link
Member

blah, I totally missed that this was a 1.3.1 bug, closing as fixed.

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

No branches or pull requests

5 participants
0