[英]ffmpeg + play video loop
有沒有人知道如何使用ffmpeg + Opengl連續播放視頻? 因為這只播放一次
tiempo = glfwGetTime();
duracion = 1.0/25.0; // 1 second / 25 fps
while(1){
...
if(glfwGetTime() > tiempo + duracion){
if(av_read_frame(pFormatCtx,&packet) >= 0){
if(packet.stream_index == 0){
avcodec_decode_video2(pCodecCtx,pFrame,&frameFin,&packet);
if(frameFin)sws_scale(img_convert_ctx,pFrame->data,pFrame->linesize,0,pCodecCtx->height,pFrameRGB->data,pFrameRGB->linesize);
}
av_free_packet(&packet);
}
tiempo += duracion;
}
...
}
我知道如果文件結束,av_read_frame函數(...)返回0。 但是,如何再次使該函數返回零以外的值? o如何讓視頻不斷重復?
來自documentqtion lavf_decoding.html#ga4fdb3084415a82e3810de6ee60e46a61“> http://ffmpeg.org/doxygen/trunk/group_ lavf _decoding.html#ga4fdb3084415a82e3810de6ee60e46a61
0如果正常,則出錯<0或文件結束
所以如果<0則調用av_seek_frame
返回開始(同一個doc)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.