1、讀取YUV文件
read_size=fread(picture_buf,sizeof(char), picture_size, f_in);
其中picture_size=yuv.width * yuv.height * 3/2;
一次讀一個圖片數據放入編碼接口進行編碼;
2、進行編碼
設置編碼參數,包括width.height,bit_rate,fps,圖像格式
encode_len = avcodec_encode_video(ctx,encode_buffer,encode_buffer_size,frame);
在此之前要把picture_buf正確對應到frame中;
開始循環讀取圖片編碼,編碼完一幀要進行frame的pts++ 打時間戳;
3、最後保存爲264文件可用VLC播放
4、一些ffmpeg接口的初始化在此沒有列出來,可以參考網上其他資料