Create video from array of pixel values in C++

后端 未结 2 1673
难免孤独
难免孤独 2020-12-18 13:21

Does anyone know of a method to save a sequence of pixel values, stored in an array to a video? Currently I\'m using Cimg to visualise a simple n-body simulation, whilst I c

2条回答
  •  半阙折子戏
    2020-12-18 14:03

    If saving image files is slow, you may have done something wrong. The cons of saving image files is disk space.

    To produce video there are many choices:

    • produce image sequences, and encode using 3rd party external tools like ffmpeg.
    • use video lib, e.g. ffmpeg, libx264, gstreamer, DirectShow, etc.

    On linux I strongly recommend libx264 or ffmpeg, they also provide example to save a video file from bitmap sequence.

提交回复
热议问题