gpt4 book ai didi

ffmpeg - 将视频转换为 ppm 文件

转载 作者:行者123 更新时间:2023-12-04 22:55:50 25 4
gpt4 key购买 nike

我找到了将视频转换为 ppm 的教程。
http://webcache.googleusercontent.com/search?q=cache:http://dranger.com/ffmpeg/tutorial01.html&gws_rd=cr&ei=BU9tWNyFNsvCjwTXqbuwDg

但是,我不明白为什么 width*3 在这里。

void SaveFrame(AVFrame *pFrame, int width, int height, int iFrame) {
FILE *pFile;
char szFilename[32];
int y;

// Open file
sprintf(szFilename, "frame%d.ppm", iFrame);
pFile=fopen(szFilename, "wb");
if(pFile==NULL)
return;

// Write header
fprintf(pFile, "P6\n%d %d\n255\n", width, height);

// Write pixel data
for(y=0; y<height; y++) {

fwrite(pFrame->data[0]+y*pFrame->linesize[0], 1, width*3, pFile);
}

// Close file
fclose(pFile);
}

最佳答案

可能是因为对于每个图像点,您都有三个 channel (RGB)。

关于ffmpeg - 将视频转换为 ppm 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41513984/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com