I covered a lot of land on the stack while trying to get ffmpeg so that I can make a video with a temporary resolution.
I am on a CentOS 7 machine by running python3.7.0a0.
python3
>>> import numpy as np
>>> np.__version__
'1.12.0'
>>> import matplotlib as mpl
>>> mpl.__version__
'2.0.0'
>>> import mpl_toolkits.basemap as base
>>> base.__version__
'1.0.7'
I found this github gist when installing ffmpeg. I used a chrome source and installed without an option prefix(using the default value).
I confirmed that ffmpeg is installed, although I don't know anything about testing whether it works.
which ffmpeg
/usr/local/bin/ffmpeg
ffmpeg -version
ffmpeg version N-83533-gada281d Copyright (c) 2000-2017 the FFmpeg dev elopers
built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-11
configuration:
libavutil 55. 47.100 / 55. 47.100
libavcodec 57. 80.100 / 57. 80.100
libavformat 57. 66.102 / 57. 66.102
libavdevice 57. 2.100 / 57. 2.100
libavfilter 6. 73.100 / 6. 73.100
libswscale 4. 3.101 / 4. 3.101
libswresample 2. 4.100 / 2. 4.100
I tried to run some examples of examples that I found on the Internet:
[1] http://matplotlib.org/examples/animation/basic_example_writer.html
[2] stack overflow
Everything works fine until I try to save the animation file.
[1]
anim.save('basic_animation.mp4', writer = FFwriter, fps=30, extra_args=['-vcodec', 'libx264'])
[2]
im_ani.save('im.mp4', writer=writer)
, ffmpeg, :
plt.rcParams['animation.ffmpeg_path'] = '/usr/local/bin/ffmpeg'
, , , :
Traceback (most recent call last):
File "testanim.py", line 27, in <module>
writer.grab_frame()
File "/usr/local/lib/python3.7/contextlib.py", line 100, in __exit__
self.gen.throw(type, value, traceback)
File "/usr/local/lib/python3.7/site-packages/matplotlib/animation.py", line 256, in saving
self.finish()
File "/usr/local/lib/python3.7/site-packages/matplotlib/animation.py", line 276, in finish
self.cleanup()
File "/usr/local/lib/python3.7/site-packages/matplotlib/animation.py", line 311, in cleanup
out, err = self._proc.communicate()
File "/usr/local/lib/python3.7/subprocess.py", line 836, in communicate
stdout, stderr = self._communicate(input, endtime, timeout)
File "/usr/local/lib/python3.7/subprocess.py", line 1474, in _communicate
selector.register(self.stdout, selectors.EVENT_READ)
File "/usr/local/lib/python3.7/selectors.py", line 351, in register
key = super().register(fileobj, events, data)
File "/usr/local/lib/python3.7/selectors.py", line 237, in register
key = SelectorKey(fileobj, self._fileobj_lookup(fileobj), events, data)
File "/usr/local/lib/python3.7/selectors.py", line 224, in _fileobj_lookup
return _fileobj_to_fd(fileobj)
File "/usr/local/lib/python3.7/selectors.py", line 39, in _fileobj_to_fd
"{!r}".format(fileobj)) from None
ValueError: Invalid file object: <_io.BufferedReader name=6>
- , ? Google , , /ffmpeg. .
UPDATE:
@LordNeckBeard : https://trac.ffmpeg.org/wiki/CompilationGuide/Centos
x264. libavcodec/*. C ( make) undefined . : https://mailman.videolan.org/pipermail/x264-devel/2015-February/010971.html
x264, configure:
./configure --enable-static --enable-shared --extra-ldflags="-lswresample -llzma"
UPDATE:
, libx264. ffmpeg ffmpeg_build /usr/local/bin/ffmpeg.
script , ffmpeg libx264. , , . , , , .
, , , NUX: http://linoxide.com/linux-how-to/install-ffmpeg-centos-7/
ffmpeg , . ffmpeg - .
, usiong, /usr/local/bin, ffmpeg bin. , !
, , ffmpeg , , .