Converting more yuv frames to one yuv frame

别说谁变了你拦得住时间么 提交于 2019-12-24 17:12:27

问题


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


回答1:


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


来源:https://stackoverflow.com/questions/20124553/converting-more-yuv-frames-to-one-yuv-frame

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!