1
votes

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?

2

2 Answers

1
votes

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

0
votes

From ffmpeg documentation: You can use YUV files as input:

ffmpeg -i /tmp/test%d.Y /tmp/out.mpg

It will use the files:

/tmp/test0.Y, /tmp/test0.U, /tmp/test0.V,
/tmp/test1.Y, /tmp/test1.U, /tmp/test1.V, etc...

I found that i needed to use this line:

-r, 21, -pix_fmt, yuv420p, -s, 1280x720, -i, file.Y

https://ffmpeg.org/ffmpeg.html#Video-Options