teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

追記

2019/07/29 05:45

投稿

kokawa2003
kokawa2003

スコア217

title CHANGED
File without changes
body CHANGED
@@ -14,4 +14,34 @@
14
14
  ```
15
15
  これで画像は出ていますが音声がいまのところ出ていません。
16
16
  pyaudioでなんとかなるのか?とおもっていろいろ試したのですがうまくできませんでした。
17
- もし知っていればお教えいただけるとありがたいです。
17
+ もし知っていればお教えいただけるとありがたいです。
18
+
19
+ まだ考えています
20
+ ```python
21
+ for frame in container.decode(video=0,audio=1):
22
+ print (type(frame))
23
+ if type(frame) is av.video.frame.VideoFrame:
24
+ img = frame.to_ndarray(format='bgr24')
25
+ cv2.imshow("Test", img)
26
+ key=cv2.waitKey(1)
27
+ elif type(frame) is av.audio.frame.AudioFrame:
28
+ print ("is Audio")
29
+ audio=frame.to_ndarray(format='s16')
30
+ #ary=[frame]
31
+ stream.write(audio)
32
+ #print (frame.sample_rate)
33
+ #if packet.stream.type == 'video':
34
+ # print("is video ")
35
+ # img = frame.to_ndarray(format='bgr24')
36
+ # cv2.imshow("Test", img)
37
+ # key=cv2.waitKey(1)
38
+ #elif packet.stream.type == 'audio':
39
+ # print("is audio")
40
+ #print(packet.stream.type)
41
+ #print(frame)
42
+ #img = frame.to_ndarray(format='bgr24')
43
+ #cv2.imshow("Test", img)
44
+ #key=cv2.waitKey(1)
45
+ ```
46
+
47
+ こう書き直しました。が依然として音はでません

1

追記

2019/07/29 05:45

投稿

kokawa2003
kokawa2003

スコア217

title CHANGED
File without changes
body CHANGED
@@ -14,4 +14,4 @@
14
14
  ```
15
15
  これで画像は出ていますが音声がいまのところ出ていません。
16
16
  pyaudioでなんとかなるのか?とおもっていろいろ試したのですがうまくできませんでした。
17
- もし知っていればお教えいただけると
17
+ もし知っていればお教えいただけるとありがたいです。