[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN102932640B - Method for controlling video stream frame rate - Google Patents

Method for controlling video stream frame rate Download PDF

Info

Publication number
CN102932640B
CN102932640B CN201210443609.7A CN201210443609A CN102932640B CN 102932640 B CN102932640 B CN 102932640B CN 201210443609 A CN201210443609 A CN 201210443609A CN 102932640 B CN102932640 B CN 102932640B
Authority
CN
China
Prior art keywords
video
frame
time
buffer queue
frame rate
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201210443609.7A
Other languages
Chinese (zh)
Other versions
CN102932640A (en
Inventor
张福明
王丹
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tianjin Yaan Technology Co Ltd
Original Assignee
Tianjin Yaan Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tianjin Yaan Technology Co Ltd filed Critical Tianjin Yaan Technology Co Ltd
Priority to CN201210443609.7A priority Critical patent/CN102932640B/en
Publication of CN102932640A publication Critical patent/CN102932640A/en
Application granted granted Critical
Publication of CN102932640B publication Critical patent/CN102932640B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Television Signal Processing For Recording (AREA)

Abstract

The invention relates to a method for controlling a video stream frame rate. The technical scheme includes that the method comprises the steps of (1) establishing a buffering queue for frame playing; (2) analyzing a video file and saving an analyzing result into the buffering queue; (3) initializing video display and processing video decoding; (4) reading video data information out of the buffering queue and controlling the frame rate of obtained video data; and (5) stopping playing and issuing related resources. The method is reasonable in design, simple, easy to implement and capable of effectively improving the processing speed of the video frame rate and the playing effect and is widely applicable to the field of controlling of the video stream frame rate.

Description

A kind of control method of video stream frame rate
Technical field
The invention belongs to audio video synchronization technical field, especially a kind of control method of video stream frame rate.
Background technology
Supervisory control system is towards the future development of digitlization, intellectuality, automation, networking.Networking is the trend of the times of supervisory control system, and it has been simplified widely the mode of information transmission and has improved the speed that information is transmitted.Progressively ripe along with the development of network technology and computer technology and market applied environment, the network video monitor and control system based on video exchange technology has become supervisory control system developing direction.
Common camera that web camera is integrated and network commutator function, image can be converted to the packet based on TCP/IP network standard, the picture that video camera is taken the photograph is directly sent on network by RJ-45 Ethernet interface, can obtains far-end monitoring image by network.When have report to the police trigger time or manually this live video stream is recorded on PC or far-end storage facilities (as memory devices such as SD card, hard disks).Monitor staff can transfer video recording play, play time may need to carry out frame per second control, for example put soon, put slowly, play location and frame by frame play etc. so that institute's recorded video is analyzed.There is the problems such as control method complexity, speed be slow in the frame rate control method of existing video flowing.
Summary of the invention
The object of the invention is to overcome the deficiencies in the prior art, provide a kind of reasonable in design, control method is simple and the control method of fireballing video stream frame rate.
The present invention solves existing technical problem and takes following technical scheme to realize:
A control method for video stream frame rate, comprises the following steps:
(1) create the buffer queue that frame is play;
(2) video file is resolved and analysis result is stored in buffer queue;
(3) video is shown and carries out initialization and process video decode;
(4) reading video data information the video data getting is carried out to frame per second control from buffer queue;
(5) finish to play and discharge related resource.
And described buffer queue adopts fifo queue.
And described buffer queue comprises presentation of video frames queue and audio frame broadcasting queue; Described buffer queue comprises following information: whether this frame video position, the timestamp of this frame video, this frame video is hereof the data length of I frame and this frame video.
And (2) described step comprises following treatment step:
Step 201: open video file to be played, initialization video frame number flag bit;
Step 202: detect end-of-file mark and thread and exit flag bit, if condition is set up, exit document analysis, otherwise execution step 203;
Step 203: read video requency frame data and carry out frame head verification;
Step 204: resolve resolution, and log resolution;
Step 205, file are reorientated, and judge whether these frame data are video datas, if it is perform step 206, otherwise execution step 207;
Step 206: video requency frame data information is left in presentation of video frames queue, return to step 202;
Step 207: leave audio frame data message in audio frame and play in queue, return to step 202.
And described step (3) initialization video adopts third party's video decode storehouse in conjunction with Directshow display video mode.
And (4) described step is carried out frame per second control to video data and is comprised the following steps:
Step 401: detect thread or file and exit mark, if set exit, otherwise execution step 402;
Step 402: detect whether need to upgrade playback rate, if it is upgrade playback rate;
Step 403: whether inquiry needs frame-skipping to play, plays step if need to carry out frame-skipping;
Step 404: file reading is also carried out suitable operation;
Step 405: video frame rate control;
Step 406: displaying video;
Step 407: buffer queue pointer adds one, points to next frame video data information, returns to step 401.
And described step 402 comprises the following steps:
Step 40201: judge that speed changes flag bit, if set performs step 40202, otherwise execution step 403;
Step 40202: overall playback rate is set, and empties this flag bit, local zone time and video datum mark time reset simultaneously.
And described step 403 comprises the following steps:
Step 40301: the whether set of inquiry slider bar flag bit, if set performs step 40302, otherwise execution step 40303;
Step 40302: search forward nearest I frame according to the mark arranging, change buffer queue pointer, empty this mark, reset local zone time and video datum mark time;
Step 40303: whether inquiry next frame flag bit is true, very performs step 40304 if, otherwise execution step 40305;
Step 40304: paper suspension mark is set, empties next frame flag bit;
Step 40305: whether inquiry file pause flag position is true, very performs step 40306 if, otherwise execution step 404;
Step 40306: empty paper suspension flag bit, dormancy 100ms, refreshing video shows, reset local zone time and video datum mark time, returns to execution step 401.
And described step 404 comprises the following steps:
Step 40401: according to the information file reading in current buffer queue to specify buffering area in;
Step 40402: judge whether paper suspension flag bit is true, very performs step 406 if, otherwise execution step 405.
And described step 405 comprises the following steps:
Step 40501: whether the inquiry datum mark time resets, if resetted, performs step 40502, otherwise execution step 40504;
Step 40502: again obtain timestamp in the video information in current buffer queue pointer as the video datum mark time;
Step 40503: obtain local zone time, as the datum mark time of local zone time;
Step 40504: obtain the timestamp in the video information in current buffer queue pointer, and video datum mark subtracts each other the time difference obtaining between current video frame and datum mark, and according to current playback rate compression or elongate this time difference;
Step 40505: obtain current local zone time, subtract each other the program current location obtaining with poor with its local zone time with local time reference point;
Step 40506: inquiry local zone time is poor, and whether to be greater than video frame time poor, if be greater than, performs step 40507, otherwise execution step 406;
Step 40507: calculate that local zone time is poor deducts the poor difference of video frame time, and make this differential time of thread dormancy.
Advantage of the present invention and good effect are:
The present invention resolves each frame data and analysis result is deposited in the buffer queue of displaying video frame video file, by the mode that reads buffer queue, video requency frame data is carried out to frame per second control, adopt third party's video decode storehouse and in conjunction with Directshow display video mode simultaneously, processing speed and the result of broadcast of video frame rate are effectively improved, its method is easy and be easy to realization, can be widely used in video stream frame rate control field.
Brief description of the drawings
Fig. 1 is overall flow figure of the present invention;
Fig. 2 is step 2 is carried out dissection process flow chart to video file;
Fig. 3 is step 4 is carried out frame per second control flow chart to video data;
Fig. 4 is the process chart of step 402;
Fig. 5 is the process chart of step 403;
Fig. 6 is the process chart of step 404;
Fig. 7 is the process chart of step 405.
Embodiment
Below in conjunction with accompanying drawing, the embodiment of the present invention is further described.
A kind of control method of video stream frame rate, describe to be embodied as example in following video system: the front end of this system adopt the HISI3516 chip of Hai Si extend out FLASH, RAM taking LINUX as kernel, BUSYBOX is the video acquisition device of file system, be used for gathering audio, video data, the audio, video data gathering passes through network special delivery to PC, and on PC, completes video preview.Front end video acquisition device and PC can both be realized recording function, each frame video of their institute's recorded video files or audio frequency have the privately owned head of oneself, indicate these frame data some information (as timestamp, whether be I frame, this frame data length, be audio frequency or video data etc.).
A control method for video stream frame rate, as shown in Figure 1, comprises the following steps:
Step 1: create the buffer queue that frame is play.
This method employing is put into buffer queue by video data and is play, therefore, first need to set up the buffer queue that frame is play, buffer queue comprises presentation of video frames queue and audio frame broadcasting queue, this buffer queue can adopt FIFO(first in first out First Input First Output) queue, also can adopt other buffer queue structures.Describe as buffer queue as example taking fifo queue (video fifo queue and audio frequency fifo queue) below, this fifo queue is mainly stored following information: whether this frame video position, the timestamp of this frame video, this frame video is hereof data length of I frame (for H264 data), this frame video etc.
Step 2: video file is resolved and analysis result is stored in corresponding buffer queue.The concrete processing procedure that video file is resolved is as follows:
Step 201, open video file to be played, the flag bits such as initialization video frame number;
Step 202, detection end-of-file mark and thread exit flag bit, if condition is set up, exit document analysis, otherwise execution step 203;
Step 203, read video requency frame data and carry out frame head verification, if mistake is carried out corresponding wrong processing;
Step 204, parsing resolution, and log resolution, for future use;
Step 205, file are reorientated, and judge whether these frame data are video datas, if it is perform step 206, otherwise execution step 207;
Step 206, video requency frame data information is left in video fifo queue, return to step 202;
Step 207, audio frame data message is left in audio frequency fifo queue, return to step 202;
Step 3: video is shown and carries out initialization and process video decode.
The present embodiment adopts third party's video decode storehouse in conjunction with Directshow display video mode, in this step necessary initialization process that storehouse and video show of first decoding.
Step 4: obtain video data information from buffer queue, the video data getting is carried out to frame per second control.Concrete processing procedure is as follows:
Step 401, detection thread or file exit mark, if set performs step 5, otherwise execution step 402;
Whether step 402, detection need to upgrade playback rate, if need to, upgrade playback rate (this speed passes to this thread by interface from host computer);
Step 40201, judge speed change flag bit, if set performs step 40202, otherwise execution step 403;
Step 40202, overall playback rate is set, and empties this flag bit, local zone time and video datum mark time (object is for re-synchronization) reset simultaneously;
Whether step 403, inquiry need frame-skipping to play, and play step (need to reinitialize lock in time) if need to carry out frame-skipping;
The whether set of step 40301, inquiry slider bar flag bit, if set performs step 40302, otherwise execution step 40303;
Step 40302, search forward nearest I frame according to the mark arranging, change FIFO pointer, empty this mark, reset local zone time and video datum mark time (object is for re-synchronization);
Whether step 40303, inquiry next frame flag bit are true, very perform step 40304 if, otherwise execution step 40305;
Step 40304, paper suspension mark is set, empties next frame flag bit;
Whether step 40305, inquiry file pause flag position are true, very perform step 40306 if, otherwise execution step 404;
Step 40306, empty paper suspension flag bit, dormancy 100ms(thread switches), refreshing video shows, reset local zone time and video datum mark time (object is for re-synchronization), returns to execution step 401;
Step 404, file reading are also carried out suitable operation;
Step 40401, according to the information file reading in current FIFO to specify Buffer in;
Step 40402, judge that whether paper suspension flag bit is true, very perform step 406 if, otherwise execution step 405;
Step 405, video frame rate control;
Whether step 40501, inquiry datum mark time reset, if resetted, perform step 40502, otherwise execution step 40504;
Step 40502, again obtain timestamp in the video information in current FIFO pointer as the video datum mark time;
Step 40503, obtain local zone time, as the datum mark of local zone time;
Step 40504, obtain the timestamp in the video information in current FIFO pointer, and video datum mark subtracts each other the time difference obtaining between current video frame and datum mark.And compress or elongate this time difference according to current playback rate;
Step 40505, obtain current local zone time, subtract each other the program current location obtaining with poor with its local zone time with local time reference point;
Step 40506, inquiry local zone time are poor, and whether to be greater than video frame time poor, if be greater than, performs step 40507, otherwise execution step 406;
Step 40507, calculate that local zone time is poor deducts the poor difference of video frame time, and make this differential time of thread dormancy (completing synchronous key);
Step 406, displaying video;
Step 407, FIFO pointer add one, point to next frame video data information, return to step 401;
Step 5: discharge video and be correlated with and related resource.
It is emphasized that; embodiment of the present invention is illustrative; instead of determinate; therefore the present invention includes and be not limited to the embodiment described in embodiment; every other execution modes that drawn by those skilled in the art's technical scheme according to the present invention, belong to the scope of protection of the invention equally.

Claims (9)

1. a control method for video stream frame rate, is characterized in that: comprise the following steps:
(1) create the buffer queue that frame is play;
(2) video file is resolved and analysis result is stored in buffer queue;
(3) video is shown and carries out initialization and process video decode;
(4) reading video data information the video data getting is carried out to frame per second control from buffer queue;
(5) finish to play and discharge related resource;
(2) described step comprises following treatment step:
Step 201: open video file to be played, initialization video frame number flag bit;
Step 202: detect end-of-file mark and thread and exit flag bit, if condition is set up, exit document analysis, otherwise execution step 203;
Step 203: read video requency frame data and carry out frame head verification;
Step 204: resolve resolution, and log resolution;
Step 205, file are reorientated, and judge whether these frame data are video datas, if it is perform step 206, otherwise execution step 207;
Step 206: video requency frame data information is left in presentation of video frames queue, return to step 202;
Step 207: leave audio frame data message in audio frame and play in queue, return to step 202.
2. the control method of a kind of video stream frame rate according to claim 1, is characterized in that: described buffer queue adopts fifo queue.
3. the control method of a kind of video stream frame rate according to claim 1, is characterized in that: described buffer queue comprises presentation of video frames queue and audio frame broadcasting queue; Described buffer queue comprises following information: whether this frame video position, the timestamp of this frame video, this frame video is hereof the data length of I frame and this frame video.
4. the control method of a kind of video stream frame rate according to claim 1, is characterized in that: described step (3) initialization video adopts third party's video decode storehouse in conjunction with Directshow display video mode.
5. the control method of a kind of video stream frame rate according to claim 1, is characterized in that: (4) described step is carried out frame per second control to video data and comprised the following steps:
Step 401: detect thread or file and exit mark, if set exit, otherwise execution step 402;
Step 402: detect whether need to upgrade playback rate, if it is upgrade playback rate;
Step 403: whether inquiry needs frame-skipping to play, plays step if need to carry out frame-skipping;
Step 404: file reading is also carried out suitable operation;
Step 405: video frame rate control;
Step 406: displaying video;
Step 407: buffer queue pointer adds one, points to next frame video data information, returns to step 401.
6. the control method of a kind of video stream frame rate according to claim 5, is characterized in that: described step 402 comprises the following steps:
Step 40201: judge that speed changes flag bit, if set performs step 40202, otherwise execution step 403;
Step 40202: overall playback rate is set, and empties this flag bit, local zone time and video datum mark time reset simultaneously.
7. the control method of a kind of video stream frame rate according to claim 5, is characterized in that: described step 403 comprises the following steps:
Step 40301: the whether set of inquiry slider bar flag bit, if set performs step 40302, otherwise execution step 40303;
Step 40302: search forward nearest I frame according to the mark arranging, change buffer queue pointer, empty this mark, reset local zone time and video datum mark time;
Step 40303: whether inquiry next frame flag bit is true, very performs step 40304 if, otherwise execution step 40305;
Step 40304: paper suspension mark is set, empties next frame flag bit;
Step 40305: whether inquiry file pause flag position is true, very performs step 40306 if, otherwise execution step 404;
Step 40306: empty paper suspension flag bit, dormancy 100ms, refreshing video shows, reset local zone time and video datum mark time, returns to execution step 401.
8. the control method of a kind of video stream frame rate according to claim 5, is characterized in that: described step 404 comprises the following steps:
Step 40401: according to the information file reading in current buffer queue to specify buffering area in;
Step 40402: judge whether paper suspension flag bit is true, very performs step 406 if, otherwise execution step 405.
9. the control method of a kind of video stream frame rate according to claim 5, is characterized in that: described step 405 comprises the following steps:
Step 40501: whether the inquiry datum mark time resets, if resetted, performs step 40502, otherwise execution step 40504;
Step 40502: again obtain timestamp in the video information in current buffer queue pointer as the video datum mark time;
Step 40503: obtain local zone time, as the datum mark time of local zone time;
Step 40504: obtain the timestamp in the video information in current buffer queue pointer, and video datum mark subtracts each other the time difference obtaining between current video frame and datum mark, and according to current playback rate compression or elongate this time difference;
Step 40505: obtain current local zone time, subtract each other the program current location obtaining with poor with its local zone time with local time reference point;
Step 40506: inquiry local zone time is poor, and whether to be greater than video frame time poor, if be greater than, performs step 40507, otherwise execution step 406;
Step 40507: calculate that local zone time is poor deducts the poor difference of video frame time, and make this differential time of thread dormancy.
CN201210443609.7A 2012-11-08 2012-11-08 Method for controlling video stream frame rate Active CN102932640B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210443609.7A CN102932640B (en) 2012-11-08 2012-11-08 Method for controlling video stream frame rate

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210443609.7A CN102932640B (en) 2012-11-08 2012-11-08 Method for controlling video stream frame rate

Publications (2)

Publication Number Publication Date
CN102932640A CN102932640A (en) 2013-02-13
CN102932640B true CN102932640B (en) 2014-12-10

Family

ID=47647325

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210443609.7A Active CN102932640B (en) 2012-11-08 2012-11-08 Method for controlling video stream frame rate

Country Status (1)

Country Link
CN (1) CN102932640B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110536153A (en) * 2018-05-23 2019-12-03 视联动力信息技术股份有限公司 A kind of playback method and server of video data
CN108965807B (en) * 2018-07-17 2020-12-18 深圳市共进电子股份有限公司 Real-time video playing control method and device, terminal and storage medium
CN108989767B (en) * 2018-08-30 2021-01-26 北京计算机技术及应用研究所 Network self-adaptive multi-channel H264 video stream storage and retransmission method and system
CN112686109B (en) * 2020-12-22 2024-06-21 北京百度网讯科技有限公司 Method and device for extracting offline video file, electronic equipment and storage medium
CN115802102A (en) * 2022-11-28 2023-03-14 武汉众智数字技术有限公司 Method, system, electronic device and storage medium for playing video stream

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101207809A (en) * 2006-12-19 2008-06-25 浙江工业大学 Method and system for transmitting real time flow media based on video frequency frame splitting
CN101466045A (en) * 2007-12-20 2009-06-24 上海奇码数字信息有限公司 Adaptive decoding synchronous device, synchronous method as well as video decoding and displaying system
CN102598657A (en) * 2009-10-27 2012-07-18 佳能株式会社 Video playback device and control method for a video playback device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101207809A (en) * 2006-12-19 2008-06-25 浙江工业大学 Method and system for transmitting real time flow media based on video frequency frame splitting
CN101466045A (en) * 2007-12-20 2009-06-24 上海奇码数字信息有限公司 Adaptive decoding synchronous device, synchronous method as well as video decoding and displaying system
CN102598657A (en) * 2009-10-27 2012-07-18 佳能株式会社 Video playback device and control method for a video playback device

Also Published As

Publication number Publication date
CN102932640A (en) 2013-02-13

Similar Documents

Publication Publication Date Title
US20230256345A1 (en) Game data processing method and apparatus, and storage medium
CN108737908B (en) Media playing method, device and storage medium
CN107223316B (en) System and method for supporting selective backtracking data recording
CN104969560B (en) A kind of method and apparatus and storage medium of retrieval media data
CN102932640B (en) Method for controlling video stream frame rate
CN106162235B (en) For the method and apparatus of Switch Video stream
CN110868600B (en) Target tracking video plug-flow method, display method, device and storage medium
US20150062353A1 (en) Audio video playback synchronization for encoded media
US9094571B2 (en) Video chatting method and system
CN106371998A (en) Mobile application testing system and method
CN110401820A (en) Multipath video processing method, device, medium and electronic equipment
CN103731631B (en) The method, apparatus and system of a kind of transmitting video image
CN109842795B (en) Audio and video synchronization performance testing method and device, electronic equipment and storage medium
CN112771881B (en) Bullet screen processing method and device, electronic equipment and computer readable storage medium
CN100568958C (en) A kind of based on network remote editing method for program
US10129592B2 (en) Audience measurement and feedback system
CN105025094A (en) Multi-screen interaction method and system
CN103747259A (en) Video processing method and device
CN105472471A (en) Smart television and method for displaying online video detail page of smart television
CN109040773A (en) A kind of video improvement method, apparatus, equipment and medium
CN104298748A (en) Device and method for face search in videos
CN109168020A (en) Method for processing video frequency, device, calculating equipment and storage medium based on live streaming
WO2019149066A1 (en) Video playback method, terminal apparatus, and storage medium
CN103873804A (en) Video replay time axis and content synchronous control method for embedded NVR
CN104618673A (en) NVR (Network Video Recorder)-based multi-channel video synchronous playback control method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C56 Change in the name or address of the patentee
CP03 Change of name, title or address

Address after: 300384 in Tianjin Binhai Huayuan Industrial Zone (outer ring) eight Haitai Huake Road No. 6

Patentee after: TIANJIN YAAN TECHNOLOGY Co.,Ltd.

Address before: 300384 Tianjin city Nankai District Huayuan Industrial Zone Ziyuan Road No. 8

Patentee before: TIANJIN YAAN TECHNOLOGY Co.,Ltd.

PP01 Preservation of patent right
PP01 Preservation of patent right

Effective date of registration: 20190701

Granted publication date: 20141210

PD01 Discharge of preservation of patent
PD01 Discharge of preservation of patent

Date of cancellation: 20220701

Granted publication date: 20141210

PP01 Preservation of patent right
PP01 Preservation of patent right

Effective date of registration: 20220701

Granted publication date: 20141210