Oh yeah you can just read frames from it and silently discard them to "empty it" ... maybe?
On Sat, Mar 28, 2020 at 12:55 PM salsaman <[email protected]> wrote: > > Maybe something like this ? > > for (int i = 0; i < input_context->nb_streams; i++) { > AVStream *s = input_context->streams[i]; > AVCodecContext *cc = s->codec; > avcodec_flush_buffers(cc); > } > > > > http://lives-video.com > https://www.openhub.net/accounts/salsaman > > > On Fri, Mar 27, 2020 at 1:08 AM Roger Pack <[email protected]> wrote: >> >> You'd probably have to drill into dshow.c and maybe add a method to it? >> >> On Thu, Nov 29, 2018 at 6:16 AM DDD ZZZ <[email protected]> >> wrote: >> > >> > Hi everybody! >> > Here's the part of c++ code that I'm using to access my webcam. >> > >> > ********************************************************************** >> > ********************************************************************** >> > >> > int Camera::Init(char* file_name, >> > char* device_name, >> > char* format, >> > char* resolution, >> > char* frame_rate, >> > char* pixel_format) >> > { >> > av_log(NULL, AV_LOG_INFO, "---INIT STARTED---\n"); >> > avdevice_register_all(); >> > av_register_all(); >> > >> > AVDictionary* properties_collection = NULL; >> > av_dict_set(&properties_collection, "f", format, NULL); >> > av_dict_set(&properties_collection, "video_size", resolution, NULL); >> > av_dict_set(&properties_collection, "framerate", frame_rate, NULL); >> > av_dict_set(&properties_collection, "pix_fmt", pixel_format, NULL); >> > AVInputFormat *input_format = av_find_input_format("dshow"); >> > char command_line[256]; >> > sprintf(command_line, "video=%s", device_name); >> > AVFormatContext *input_context = avformat_alloc_context(); >> > //input_context->flags |= AVFMT_FLAG_NOBUFFER; //DOESN'T HELP >> > //input_context->max_picture_buffer = 0; //ERR >> > >> > int err_code = 0; >> > err_code = avformat_open_input(&input_context, >> > command_line, >> > input_format, >> > &properties_collection); >> > >> > ////////////////////////////////////// >> > //////////PROBLEM SECTION///////////// >> > ////////////////////////////////////// >> > int i = 0; >> > while (i++ < 30) >> > { >> > Sleep(1000); >> > //avformat_flush(input_context); //DOESN'T HELP >> > //av_free(input_context); //ERR >> > } >> > ////////////////////////////////////// >> > system("pause"); >> > return 0; >> > } >> > >> > ********************************************************************** >> > ********************************************************************** >> > >> > Right after "avformat_open_input()" it starts reading frames to some >> > internal buffer without me even calling "av_read_frame()". After about 10 >> > seconds it start's giving me error messages: >> > >> > [dshow @ 0014ed40] real-time buffer [VirtualBox Webcam - FULL HD 1080P >> > Webcam] [video input] >> > too full or near too full (62% of size: 3041280 [rtbufsize parameter])! >> > frame dropped! >> > ... >> > ... >> > ... >> > [dshow @ 0014ed40] real-time buffer [VirtualBox Webcam - FULL HD 1080P >> > Webcam] [video input] >> > too full or near too full (100% of size: 3041280 [rtbufsize parameter])! >> > frame dropped! >> > >> > >> > Q: How to clear this buffer or avoid using it? >> > >> > Thanks in advance. >> > >> > >> > >> > P.S.Please pardon my english. >> > >> > P.P.S.Have a good day. >> > >> > >> > _______________________________________________ >> > Libav-user mailing list >> > [email protected] >> > http://ffmpeg.org/mailman/listinfo/libav-user >> > >> > To unsubscribe, visit link above, or email >> > [email protected] with subject "unsubscribe". >> _______________________________________________ >> Libav-user mailing list >> [email protected] >> https://ffmpeg.org/mailman/listinfo/libav-user >> >> To unsubscribe, visit link above, or email >> [email protected] with subject "unsubscribe". > > _______________________________________________ > Libav-user mailing list > [email protected] > https://ffmpeg.org/mailman/listinfo/libav-user > > To unsubscribe, visit link above, or email > [email protected] with subject "unsubscribe". _______________________________________________ Libav-user mailing list [email protected] https://ffmpeg.org/mailman/listinfo/libav-user To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
