Creating a video from individual frames

horatius

I was able to successfully split a video into it's constituent image frames and analysed them using keras RESNet50 model. I was also able to add the overlays of predictions into these individual images. Now I want to recreate the original video by putting these processed images with overlays back together into an mp4 file.

How can I create a video from individual jpg image frames in sequence?

I am trying to use cv2.VideoWriter to write these images back into a separate video file.

uname -a gives me the following output

Linux myhost 4.15.0-1023-azure #24~16.04.1-Ubuntu SMP Wed Aug 29 12:54:36 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

My first 11 frames are named frame-0000.jpg through frame-0011.jpg

Albert Myšák

How can I create a video from individual jpg image frames in sequence?

You can use this code for creating video frame by frame from jpg images. These images will be read from folder where this script is.

import cv2 #Import of openCV library
import os 
#Create video, with name 'video.mp4', MP4 codec, 60 fps, width 1280 and height of 1024
video = cv2.VideoWriter('video.mp4',cv2.VideoWriter_fourcc(*'MP4V'),60,(1280,1024))
for file in os.listdir('./'): #List every file in this folder
    if ".jpg" in file: #Filter only jpg files
        image = cv2.imread(file) #Load image from disk
        video.write(image) #Put image into video.
video.release() #Save video to disk.

You can modify this code for loading images from your application or some array.

Edit: added commentary

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Video not playing when creating a video by skipping frames

From Dev

Import frames from a video

From Dev

get individual frames from gif image in matlab

From

Create video from camera frames

From Dev

Extract frames from video angular

From Dev

Creating an ImportXML to get individual YouTube video views from the video page on any content creator, for the last 30 videos. Possible?

From Dev

how to get frames with timestamp where frames are converted from video in python

From Dev

Creating an algorithm to find red intensity of the frames of a video using GPUImage

From Dev

Error creating new directories for video frames for different videos

From Dev

FFMPEG not extracting all the frames from a video

From Dev

Extract frames from video into specific folder

From Dev

Extract Frames from Video C#

From Dev

WebGL textures from YouTube video frames

From Dev

How to read frames from a video as bitmaps in UWP

From Dev

How to read frames from a video MATLAB?

From Dev

How to render video from ARGB Frames

From Java

TensorFlow - Read video frames from TFRecords file

From Dev

How to extract clear frames from video file?

From Java

Getting frames from Video Image in Android

From Dev

Grab frames from video using Swift

From Dev

Swift - get all frames from video

From Dev

Removing Borders/Margins from Video Frames

From Dev

Extract frames from video with ffmpeg - header problem?

From Dev

Getting a specific sequence of frames from video in python

From Dev

Streaming frames from the screen, generating a video

From Dev

how to select specific frames from a video in MATLAB?

From Dev

Extract frames from a video using OpenImaj in Java

From Dev

How to extract frames from a video java?

From Dev

Trying to create video from multiple frames

Related Related

  1. 1

    Video not playing when creating a video by skipping frames

  2. 2

    Import frames from a video

  3. 3

    get individual frames from gif image in matlab

  4. 4

    Create video from camera frames

  5. 5

    Extract frames from video angular

  6. 6

    Creating an ImportXML to get individual YouTube video views from the video page on any content creator, for the last 30 videos. Possible?

  7. 7

    how to get frames with timestamp where frames are converted from video in python

  8. 8

    Creating an algorithm to find red intensity of the frames of a video using GPUImage

  9. 9

    Error creating new directories for video frames for different videos

  10. 10

    FFMPEG not extracting all the frames from a video

  11. 11

    Extract frames from video into specific folder

  12. 12

    Extract Frames from Video C#

  13. 13

    WebGL textures from YouTube video frames

  14. 14

    How to read frames from a video as bitmaps in UWP

  15. 15

    How to read frames from a video MATLAB?

  16. 16

    How to render video from ARGB Frames

  17. 17

    TensorFlow - Read video frames from TFRecords file

  18. 18

    How to extract clear frames from video file?

  19. 19

    Getting frames from Video Image in Android

  20. 20

    Grab frames from video using Swift

  21. 21

    Swift - get all frames from video

  22. 22

    Removing Borders/Margins from Video Frames

  23. 23

    Extract frames from video with ffmpeg - header problem?

  24. 24

    Getting a specific sequence of frames from video in python

  25. 25

    Streaming frames from the screen, generating a video

  26. 26

    how to select specific frames from a video in MATLAB?

  27. 27

    Extract frames from a video using OpenImaj in Java

  28. 28

    How to extract frames from a video java?

  29. 29

    Trying to create video from multiple frames

HotTag

Archive