sohojoe commited on
Commit
4904f3e
1 Parent(s): 4df5a8a

suppress that ffmpeg warning

Browse files
Files changed (1) hide show
  1. streamlit_av_queue.py +10 -0
streamlit_av_queue.py CHANGED
@@ -1,3 +1,4 @@
 
1
  from typing import List
2
  import av
3
  import asyncio
@@ -39,7 +40,16 @@ class StreamlitAVQueue:
39
  if len(video_output_frames) > 0:
40
  self._video_output_frame = video_output_frames[-1]
41
  for i, frame in enumerate(frames):
 
 
 
 
 
42
  user_image = frame.to_ndarray(format="rgb24")
 
 
 
 
43
  if should_look:
44
  shared_tensor_ref = ray.put(user_image)
45
  await self.app_interface_actor.enqueue_video_input_frame.remote(shared_tensor_ref)
 
1
+ import os
2
  from typing import List
3
  import av
4
  import asyncio
 
40
  if len(video_output_frames) > 0:
41
  self._video_output_frame = video_output_frames[-1]
42
  for i, frame in enumerate(frames):
43
+
44
+ # supress the ffmpeg warning
45
+ saved_stderr_fd = os.dup(2)
46
+ stderr_fd = os.open(os.devnull, os.O_WRONLY)
47
+ os.dup2(stderr_fd, 2)
48
  user_image = frame.to_ndarray(format="rgb24")
49
+ os.dup2(saved_stderr_fd, 2)
50
+ os.close(stderr_fd)
51
+ os.close(saved_stderr_fd)
52
+
53
  if should_look:
54
  shared_tensor_ref = ray.put(user_image)
55
  await self.app_interface_actor.enqueue_video_input_frame.remote(shared_tensor_ref)