Python Forum
OpenCV - extract 1st frame out of a video file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
OpenCV - extract 1st frame out of a video file
#2
import cv2
import numpy as np
vidcap = cv2.VideoCapture('http://Desktop/SampleVideo_1280x720_1mb.mp4')
success,image = vidcap.read()
count = 0
while success:
  cv2.imwrite("frame%d.jpg" % count, image)     # save frame as JPEG file      
  success,image = vidcap.read()
  print('Read a new frame: ', success)
  count += 1
Reply


Messages In This Thread
RE: OpenCV - extract 1st frame out of a video file - by Daredevil - Nov-10-2018, 08:39 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  extract and plot data from a txt file usercat123 2 1,302 Apr-20-2022, 06:50 PM
Last Post: usercat123
  save video frames into pandas data-frame tofi 0 2,753 Oct-18-2018, 07:02 PM
Last Post: tofi
  Upload csv file as numbers (floating?) and extract element, row, and column bentaz 7 4,655 Mar-19-2018, 05:34 PM
Last Post: bentaz
  Reading json file as pandas data frame? Alberto 1 8,437 Feb-05-2018, 12:43 AM
Last Post: snippsat
  Extract data between two dates from a .csv file using Python 2.7 sujai_banerji 1 10,482 Nov-15-2017, 09:48 PM
Last Post: snippsat
  Identifying items in a csv file that also appear in a Text extract Jaynorth 17 18,029 Sep-21-2016, 10:51 PM
Last Post: Jaynorth

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020