![]() When stderr buffer is full, FFmpeg sub-process halts and wait for stderr data to be read. The main issue is setting stderr=subprocess.PIPE without "draining" the stderr pipe. I used cv2.set but it took long time to play from start_second. I expect to play the video start from start_second and end at end_second. # Convert the frame buffer to a numpy arrayįrame = np.frombuffer(frame_buffer, dtype='uint8').reshape((height, width, 3))įrame_resized = cv2.resize(frame, (width, height), interpolation=cv2.INTER_AREA)Ĭv2.imshow('Video Player', frame_resized) # Read the frame from the subprocess stdout into the bufferīytes_read = (frame_buffer) Process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) # Open a subprocess to execute the ffmpeg command '-t', str((end_seconds - start_seconds)), # Build the ffmpeg command to skip to the desired start time and end time import subprocessĭef play_video_with_ffmpeg(video_path, start_seconds, end_seconds):Ĭv2.namedWindow('Video Player', cv2.WINDOW_NORMAL)Ĭv2.moveWindow('Video Player', window_x, window_y) I want to play the video start at start_seconds and end at end_seconds. The following code stuck in the middle of the video.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |