Search code examples
ffmpegh.264yuv

using ffmpeg to convert a set of YUV images to a video?


I am trying to use ffmpeg to convert a set of YUV frames to a mp4 video. I have a set of YUV frames which named as (each one is an image) : YUV1.yuv YUV2.yuv . . YUv15.yuv The code is:

ffmpeg -s 3840x2160 -pix_fmt yuv420p -i YUV%d.yuv -vcodec libx264 -r 30 -s 3840x2160 output.mp4

It shows that the YUV%d.yuv no such file or directory. I know the png or jpeg or bmp can be named as Img%d.png/jpeg/bmp but perhaps can not be used for .yuv. So is there any way to input a set of yuv images in ffmpeg?


Solution

  • ffmpeg's wildcard syntax doesn't work on yuv or other video formats, I guess. You could concat them just like:

    cat *.yuv > all.yuv  
    # or cat `ls |grep "\d*.yuv"` > all.yuv if you like
    # or any other complex commands to get the file list
    ffmpeg -i all.yuv -c:v libx264 ...
    

    Reference