How to extract a frame every 10 s from the video ?

4 visualizaciones (últimos 30 días)
muhammad choudhry
muhammad choudhry el 21 de Abr. de 2021
Comentada: Image Analyst el 23 de Dic. de 2022
Hi,
I have a video which runs for 30 minutes at the rate of 60 fps. I need to extract the frame every 10 second. For example: 10s(600th frame),20s(1200th frame),30s(1800th frame) so on..... I looked through the internet I can get the info about how to read, write video and extract frame but did not get the info about exactly what I am looking for. Your help will be appreciated!
Thanks

Respuesta aceptada

Stephan
Stephan el 21 de Abr. de 2021
Editada: Stephan el 21 de Abr. de 2021
In your case the interval to take the first frame after 10 seconds would be:
v = VideoReader('YOUR_FILENAME.mp4');
frames = read(v,[600:600:end]);
The result is a 4D-Array which is the first 3 dimensions having the video frame and the 4th dimension is the time - here 10 seconds
  7 comentarios
B Sarath
B Sarath el 23 de Dic. de 2022
Sir could you please help me the writing the code for to divide video into frames for every 2 seconds.The file properties are length:1:46 Frame rate: 29.92 fs Storage:16.7mb
Image Analyst
Image Analyst el 23 de Dic. de 2022
I don't know what this means. Do you want to split up a single video into multiple videos, each having a run time of 2 seconds? Do you want to take the frames for each 2 second long segment and write them out to a folder (with a name that is the start time of that segment)?

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by