How to write frames to a video file?

前端 未结 3 1753
萌比男神i
萌比男神i 2021-01-01 01:40

I am currently writing an application that read frames from camera, modify them, and save them into a video file. I\'m planing to do it with ffmpeg. There\'s rarely a docume

3条回答
  •  萌比男神i
    2021-01-01 01:55

    This might help get you started - the documentation is available, but newer features tend to be documented in ffmpeg's man pages.

    The frames need to be numbered sequentially.

    ffmpeg -f image2 -framerate 25 -i frame_%d.jpg -c:v libx264 -crf 22 video.mp4
    
    • -f defines the format
    • -framerate defines the frame rate
    • -i defines the input file/s ... %d specifies numbered files .. add 0's to specify padding, e.g. %05d for zero-padded five-digit numbers.
    • -vcodec selects the video codec
    • -crf specifies a rate control method, used to define how the x264 stream is encoded
    • video.mp4 is the output file

    For more info, see the Slideshow guide.

提交回复
热议问题