Krcevina
Krcevina

Reputation: 141

Converting more yuv frames to one yuv frame

I have some number of images in yuv format which are all part of one sequence I captured. Now I want to make video by converting them to mpg4 file. But before doing that I need somehow to make one yuv file from all of those yuv frames that I have. I have heard that it's possible, but couldn't find anything on Internet.

Does anyone knows how to do that? Apparently there is a Windows command for such thing...

Thanks

Upvotes: 1

Views: 3615

Answers (1)

Fredrik Pihl
Fredrik Pihl

Reputation: 45670

YUV-video (or more correctly YCbCr) is just a concatenation of all frames into a single file.

On linux (bash) I'd do like this:

Sometimes a simple

cat *.yuv > movie.yuv

work, but you might run into problems with the number-sorting order. I.e you might end up with something like this:

frame0.yuv
frame100.yuv
frame101.yuv
frame102.yuv
frame103.yuv
frame104.yuv
frame105.yuv
frame106.yuv
frame107.yuv
frame108.yuv
frame109.yuv
frame10.yuv
frame110.yuv

To solve this, loop over the indexes like this:

for i in {0..299}; do
    cat frame$i.yuv >> movie.yuv
done

On windows you can use the type command:

type file1 file2 > file3

copy also works:

copy /b file1+file2 destfile

Upvotes: 4

Related Questions