[英]ffmpeg + play video loop
Does anyone know how to make a video using ffmpeg + Opengl play continuously?. 有没有人知道如何使用ffmpeg + Opengl连续播放视频? Because this is only played once
因为这只播放一次
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;
}
...
}
I know av_read_frame function (...) returns 0 if the end of file. 我知道如果文件结束,av_read_frame函数(...)返回0。 But how do I make the function again returns a value other than zero?
但是,如何再次使该函数返回零以外的值? o How I can I make the video is constantly repeated?
o如何让视频不断重复?
From documentqtion lavf_decoding.html#ga4fdb3084415a82e3810de6ee60e46a61">http://ffmpeg.org/doxygen/trunk/group_ lavf _decoding.html#ga4fdb3084415a82e3810de6ee60e46a61 来自documentqtion lavf_decoding.html#ga4fdb3084415a82e3810de6ee60e46a61“> http://ffmpeg.org/doxygen/trunk/group_ lavf _decoding.html#ga4fdb3084415a82e3810de6ee60e46a61
0 if OK, < 0 on error or end of file
0如果正常,则出错<0或文件结束
so if <0 then call av_seek_frame
所以如果<0则调用
av_seek_frame
to return to start (same doc) 返回开始(同一个doc)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.