邢台人民网站广告关键词有哪些
查找wav文件头关键struct 位置,当然也可查找avi文件头。用这个方法找到avi文件data位置后,可直接读出文件的每一帧图片。当然avi数据的标志位不是data,可以是00dc等。
WAV音频头文件有三个关键struct:RIFF, fmt,data。
AVI 视频文件头的关键struct:RIFF, LIST, avih,movi,strl,strh,strf.
搞懂了wav 音频格式后,可以把音乐加入avi视频中,合成带音乐的avi视频,也可以把麦克风的语音录入合成为avi音视频文件。
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <malloc.h>
#include <wait.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>int main(void){FILE *f=fopen("/home/wjs/2.wav","r");fseek(f, 0, SEEK_END);int size = ftell(f);fseek(f, 0, SEEK_SET);int fd=open("/home/wjs/2.wav",O_RDONLY);char *m=mmap(NULL,size,PROT_READ,MAP_SHARED,fd,0);for(int t=0;t<size;t++){if((m[t]=='R')&&(m[t+1]=='I')&&(m[t+2]=='F')&&(m[t+3])=='F'){printf("RIFF:%d\n",t);}}for(int t=0;t<size;t++){if((m[t]=='f')&&(m[t+1]=='m')&&(m[t+2]=='t')){printf("fmt:%d\n",t);}}for(int t=0;t<size;t++){if((m[t]=='d')&&(m[t+1]=='a')&&(m[t+2]=='t')&&(m[t+3])=='a'){printf("data:%d\n",t);}}munmap(m,size);puts("over");return 0;}