video-processing

Python: take screenshot from video

左心房为你撑大大i 提交于 2020-08-26 04:53:40
问题 The idea is that, user should be able to load a video from their local machine and tell the program to take a screenshot from the video every 5sec or 30sec. Is there any library to help me with this task? Any idea from how to proceed would be helpful. 回答1: install opencv-python (which is an unofficial pre-built OpenCV package for Python) by issuing the following command: pip install opencv-python # Importing all necessary libraries import cv2 import os import time # Read the video from

ffmpeg : how to determine frame rate automatically?

天大地大妈咪最大 提交于 2020-08-25 19:02:35
问题 I use this simple script to convert video to images using ffmpeg , but frame rate is fixed, how can I determine it automatically? FRAME_RATE="30" SEPARATOR='/' VIDEO_PATH=$1 VIDEO_BASE_DIR=`dirname $1` FRAMES_DIR=$VIDEO_BASE_DIR$SEPARATOR"Frames" rm -rf $FRAMES_DIR mkdir $FRAMES_DIR #Convert video to images ./ffmpeg -r $FRAME_RATE -i $VIDEO_PATH $FRAMES_DIR$SEPARATOR"image%d.png" UPDATE: By ffprobe I checked that my 1st video frame rate is 30. Also results are the same (339 frames are