質問編集履歴

2

ffmpegのバージョン

2018/11/06 07:10

投稿

ruei
ruei

スコア284

test CHANGED
File without changes
test CHANGED
@@ -133,3 +133,43 @@
133
133
  '2.2.2'
134
134
 
135
135
  ```
136
+
137
+
138
+
139
+ ```
140
+
141
+ ffmpeg
142
+
143
+ ffmpeg version 4.0 Copyright (c) 2000-2018 the FFmpeg developers
144
+
145
+ built with gcc 7.2.0 (crosstool-NG fa8859cb)
146
+
147
+ configuration: --prefix=/home/usr/anaconda3 --cc=/tmp/build/80754af9/ffmpeg_1526323631431/_build_env/bin/x86_64-conda_cos6-linux-gnu-cc --disable-doc --enable-shared --enable-static --enable-zlib --enable-pic --enable-gpl --enable-version3 --disable-nonfree --enable-hardcoded-tables --enable-avresample --enable-libfreetype --disable-openssl --disable-gnutls --enable-libvpx --enable-pthreads --enable-libopus --enable-postproc --disable-libx264
148
+
149
+ libavutil 56. 14.100 / 56. 14.100
150
+
151
+ libavcodec 58. 18.100 / 58. 18.100
152
+
153
+ libavformat 58. 12.100 / 58. 12.100
154
+
155
+ libavdevice 58. 3.100 / 58. 3.100
156
+
157
+ libavfilter 7. 16.100 / 7. 16.100
158
+
159
+ libavresample 4. 0. 0 / 4. 0. 0
160
+
161
+ libswscale 5. 1.100 / 5. 1.100
162
+
163
+ libswresample 3. 1.100 / 3. 1.100
164
+
165
+ libpostproc 55. 1.100 / 55. 1.100
166
+
167
+ Hyper fast Audio and Video encoder
168
+
169
+ usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
170
+
171
+
172
+
173
+ Use -h to get full help or, even better, run 'man ffmpeg'
174
+
175
+ ```

1

単体で動くコードに変更

2018/11/06 07:10

投稿

ruei
ruei

スコア284

test CHANGED
File without changes
test CHANGED
@@ -2,27 +2,47 @@
2
2
 
3
3
  ```python
4
4
 
5
- def plotEfield(self):
5
+ import matplotlib
6
6
 
7
+ matplotlib.use('Agg')
8
+
9
+ import random
10
+
11
+ import matplotlib.animation as animation
12
+
13
+ import matplotlib.pyplot as plt
14
+
15
+
16
+
17
+
18
+
19
+ def run():
20
+
21
+
22
+
7
- def update(k, Ex, Ey):
23
+ def update(k, ax):
8
24
 
9
25
  ax.clear()
10
26
 
11
- ax.plot(X[k], Y[k])
27
+ X=[1,2,3,4]
12
28
 
29
+ Y=[random.random() for i in range(len(X))]
30
+
31
+ ax.plot(X,Y)
32
+
13
- fig, ax = plt.subplots(1, 1)
33
+ fig,ax=plt.subplots(1,1)
34
+
35
+ ani = animation.FuncAnimation(fig, update, fargs=[ax,], interval=50, frames=10)
36
+
37
+ ani.save("hogehoge.mp4", writer="ffmpeg")
14
38
 
15
39
 
16
40
 
17
- # アニメーション作成
18
41
 
19
- # interval [ms]毎に画像が切り替わる。
20
42
 
21
- # framse回、画像を更新する。updateの第一引数は0,1,2,...,frames-1を動く。
43
+ run()
22
44
 
23
- ani = animation.FuncAnimation(fig, update, fargs=[Ax, Ay], interval=50, frames=10)
24
45
 
25
- ani.save("hogehoge.mp4", writer="ffmpeg")
26
46
 
27
47
  ```
28
48
 
@@ -32,63 +52,59 @@
32
52
 
33
53
  Traceback (most recent call last):
34
54
 
35
- File "input.py", line 39, in <module>
55
+ File "main.py", line 20, in <module>
36
56
 
37
- run()
57
+ run()
38
58
 
39
- File "input.py", line 32, in run
59
+ File "main.py", line 17, in run
40
60
 
41
- xyplane1.plotEfield()
61
+ ani.save("hogehoge.mp4", writer="ffmpeg")
42
62
 
43
- File "/home/usr/plot.py", line 266, in plotEfield
63
+ File "/home/usr/anaconda3/lib/python3.6/site-packages/matplotlib/animation.py", line 1200, in save
44
64
 
45
- ani.save("hogehoge.mp4", writer="ffmpeg")
65
+ writer.grab_frame(**savefig_kwargs)
46
66
 
47
- File "/home/usr/anaconda3/lib/python3.6/site-packages/matplotlib/animation.py", line 1200, in save
67
+ File "/home/usr/anaconda3/lib/python3.6/contextlib.py", line 99, in __exit__
48
68
 
49
- writer.grab_frame(**savefig_kwargs)
69
+ self.gen.throw(type, value, traceback)
50
70
 
51
- File "/home/usr/anaconda3/lib/python3.6/contextlib.py", line 99, in __exit__
71
+ File "/home/usr/anaconda3/lib/python3.6/site-packages/matplotlib/animation.py", line 241, in saving
52
72
 
53
- self.gen.throw(type, value, traceback)
73
+ self.finish()
54
74
 
55
- File "/home/usr/anaconda3/lib/python3.6/site-packages/matplotlib/animation.py", line 241, in saving
75
+ File "/home/usr/anaconda3/lib/python3.6/site-packages/matplotlib/animation.py", line 367, in finish
56
76
 
57
- self.finish()
77
+ self.cleanup()
58
78
 
59
- File "/home/usr/anaconda3/lib/python3.6/site-packages/matplotlib/animation.py", line 367, in finish
79
+ File "/home/usr/anaconda3/lib/python3.6/site-packages/matplotlib/animation.py", line 405, in cleanup
60
80
 
61
- self.cleanup()
81
+ out, err = self._proc.communicate()
62
82
 
63
- File "/home/usr/anaconda3/lib/python3.6/site-packages/matplotlib/animation.py", line 405, in cleanup
83
+ File "/home/usr/anaconda3/lib/python3.6/subprocess.py", line 843, in communicate
64
84
 
65
- out, err = self._proc.communicate()
85
+ stdout, stderr = self._communicate(input, endtime, timeout)
66
86
 
67
- File "/home/usr/anaconda3/lib/python3.6/subprocess.py", line 843, in communicate
87
+ File "/home/usr/anaconda3/lib/python3.6/subprocess.py", line 1505, in _communicate
68
88
 
69
- stdout, stderr = self._communicate(input, endtime, timeout)
89
+ selector.register(self.stdout, selectors.EVENT_READ)
70
90
 
71
- File "/home/usr/anaconda3/lib/python3.6/subprocess.py", line 1505, in _communicate
91
+ File "/home/usr/anaconda3/lib/python3.6/selectors.py", line 351, in register
72
92
 
73
- selector.register(self.stdout, selectors.EVENT_READ)
93
+ key = super().register(fileobj, events, data)
74
94
 
75
- File "/home/usr/anaconda3/lib/python3.6/selectors.py", line 351, in register
95
+ File "/home/usr/anaconda3/lib/python3.6/selectors.py", line 237, in register
76
96
 
77
- key = super().register(fileobj, events, data)
97
+ key = SelectorKey(fileobj, self._fileobj_lookup(fileobj), events, data)
78
98
 
79
- File "/home/usr/anaconda3/lib/python3.6/selectors.py", line 237, in register
99
+ File "/home/usr/anaconda3/lib/python3.6/selectors.py", line 224, in _fileobj_lookup
80
100
 
81
- key = SelectorKey(fileobj, self._fileobj_lookup(fileobj), events, data)
101
+ return _fileobj_to_fd(fileobj)
82
102
 
83
- File "/home/usr/anaconda3/lib/python3.6/selectors.py", line 224, in _fileobj_lookup
103
+ File "/home/usr/anaconda3/lib/python3.6/selectors.py", line 39, in _fileobj_to_fd
84
104
 
85
- return _fileobj_to_fd(fileobj)
105
+ "{!r}".format(fileobj)) from None
86
106
 
87
- File "/home/usr/anaconda3/lib/python3.6/selectors.py", line 39, in _fileobj_to_fd
88
-
89
- "{!r}".format(fileobj)) from None
90
-
91
- ValueError: Invalid file object: <_io.BufferedReader name=11>
107
+ ValueError: Invalid file object: <_io.BufferedReader name=6>
92
108
 
93
109
  ```
94
110