CN111147925A - Processing method, system and device capable of playing video stream compatible with WPF (Windows presentation foundation) - Google Patents

Processing method, system and device capable of playing video stream compatible with WPF (Windows presentation foundation) Download PDF

Info

Publication number
CN111147925A
CN111147925A CN202010000471.8A CN202010000471A CN111147925A CN 111147925 A CN111147925 A CN 111147925A CN 202010000471 A CN202010000471 A CN 202010000471A CN 111147925 A CN111147925 A CN 111147925A
Authority
CN
China
Prior art keywords
wpf
processing method
bitmap
video stream
yuv data
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.)
Pending
Application number
CN202010000471.8A
Other languages
Chinese (zh)
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.)
Nanjing Jusha Display Technology Co Ltd
Nanjing Jusha Medical Technology Co Ltd
Original Assignee
Nanjing Jusha Display Technology Co Ltd
Nanjing Jusha Medical 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 Nanjing Jusha Display Technology Co Ltd, Nanjing Jusha Medical Technology Co Ltd filed Critical Nanjing Jusha Display Technology Co Ltd
Priority to CN202010000471.8A priority Critical patent/CN111147925A/en
Publication of CN111147925A publication Critical patent/CN111147925A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/435Processing of additional data, e.g. decrypting of additional data, reconstructing software from modules extracted from the transport stream

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The invention discloses a processing method, a system and a device for playing video stream compatible with WPF, comprising the following processes: decoding a video source to obtain YUV data; converting the YUV data into bitmap, and putting the bitmap into a shared memory; and reading the bitmap and rendering the target frame by using the picture control. The invention has the following beneficial effects: the system is perfectly compatible with wpf and directly uses ffmpeg decoding for playing, and the ffmpeg decoding module can be directly interacted with the wpf control, so that the problem of control compatibility is avoided, and the situation that the control is inevitably arranged at the top is avoided.

Description

Processing method, system and device capable of playing video stream compatible with WPF (Windows presentation foundation)
Technical Field
The invention belongs to the technical field of video processing, and particularly relates to a processing method, a system and a device for playing a video stream compatible with WPF.
Background
An Ffmeg (an open source coding and decoding library) is used as a powerful open source coding and decoding tool, an analyzed packet is usually directly rendered by an SDL (cross-platform multimedia development library) or a GDI (graphic device interface) through a YVU (a color coding method), and a WPF (Windows-based user interface framework) is different from a traditional WinForm (Windows window form application program), a window of the WPF has a handle, and a control of the WPF does not have a handle of a distribution system, so that the problem that a WindowHost is needed to render a playing video is brought, however, the WPF brings much compatibility, for example, the playing picture is inevitably set at the top, and other controls cannot be covered on the playing picture, therefore, the invention provides a method which can be compatible with the WPF to play the FFmpeg decoding video stream, has higher compatibility, and cannot damage the layout of the original WPF.
Disclosure of Invention
The invention aims to overcome the problems in the prior art, and provides a processing method, a system and a device for playing a video stream compatible with WPF (Windows presentation framework), which can improve the compatibility of a control and avoid the situation that the control needs to be set on top.
In order to solve the problems of the prior art, the invention discloses a processing method capable of playing video stream compatible with WPF, which comprises the following steps:
decoding a video source to obtain YUV data;
converting the YUV data into bitmap, and putting the bitmap into a shared memory;
and reading the bitmap and rendering the target frame by using the picture control.
Further, the air conditioner is provided with a fan,
the specific process for decoding the video source to obtain YUV data is as follows:
reading frames from a video source using ffmpeg and storing the frames in a queue;
and taking out the original frame from the queue, and then decoding the original frame by using a corresponding decoder to obtain YUV data.
Further, the air conditioner is provided with a fan,
the specific process of converting YUV data into bitmap is as follows:
performing linear processing on the YUV data to obtain corresponding Y ', U ' and V ' values;
and respectively calculating corresponding R, G, B values according to Y ', U ' and V '.
Further, the air conditioner is provided with a fan,
in the step of carrying out linear processing on the YUV data to obtain corresponding Y ', U ' and V ' values, the value of Y is 16-235, the value of U is 16-240, and the value of V is 16-240.
Further, the air conditioner is provided with a fan,
in the step of performing linear processing on the YUV data to obtain corresponding values Y ', U' and V ', the calculation formulas of Y', U 'and V' are respectively as follows:
Y'=Y*[(235-16)/255]+16;
U'=U*[(240-16)/255]+16;
V'=V*[(40-16)/255]+16。
further, the air conditioner is provided with a fan,
in the step of respectively calculating and obtaining corresponding R, G, B values according to Y ', U ' and V ', the calculation formula of R, G, B is respectively:
R=(298*Y'+411*V'-57344),R>>8;
G=(298*Y'-101*U'-211*V'+34739),G>>8;
B=(298*Y'+519*U'-71117),B>>8。
further, the air conditioner is provided with a fan,
the video source is video data in any one format of RTSP, RTMP, MP4 and flv.
Further, the air conditioner is provided with a fan,
the storage of the bitmap is asynchronous storage, and the reading of the bitmap is asynchronous reading.
The invention also provides a processing system compatible with WPF playing video stream, comprising:
the decoding module is used for decoding a video source to obtain YUV data;
the conversion module is used for converting the YUV data into bitmap and putting the bitmap into the shared memory; and
and the rendering module is used for reading the bitmap and rendering the target frame by adopting the picture control.
The invention also provides a processing device compatible with WPF playing video stream, comprising a memory and a processor, wherein the memory stores computer program, and the processor realizes the steps of the method when executing the computer program.
The invention has the following beneficial effects: the system is perfectly compatible with wpf and directly uses ffmpeg decoding for playing, and the ffmpeg decoding module can be directly interacted with the wpf control, so that the problem of control compatibility is avoided, and the situation that the control is inevitably arranged at the top is avoided.
Drawings
FIG. 1 is a flow chart of a process of the present invention.
Detailed Description
The invention is further described below with reference to the accompanying drawings. The following examples are only for illustrating the technical solutions of the present invention more clearly, and the protection scope of the present invention is not limited thereby.
As shown in fig. 1, a processing method for playing a video stream compatible with WPF includes the following processes:
and S1, decoding the video source to obtain YUV data. The specific process is as follows:
s11, reading frames from a video source by using ffmpeg and storing the frames into a queue;
s12, taking out the original frame from the queue, then decoding with the corresponding decoder to get YUV data, the decoded data packet is a frame of YUV data. In this step, the video source is video data in any one format of RTSP, RTMP, MP4, and flv. In this step, the ffmpeg decoded video data is divided into asynchronous reading and enqueuing operation of each frame of data to the data queue, and asynchronous dequeuing operation from the data queue is used for decoding.
And S2, converting the YUV data into bitmap, and placing the bitmap into the shared memory. The specific process is as follows:
s21, quantizing the YUV data, making Y (brightness), U (chroma) and V (chroma) in the range of Y [16-235], U [16-240] and V [16-240] through linear change, and obtaining Y ', U ' and V ' values respectively through conversion formulas, wherein the conversion formulas are respectively:
Y'=Y*[(235-16)/255]+16;
U'=U*[(240-16)/255]+16;
V'=V*[(40-16)/255]+16。。
s22, respectively calculating corresponding R, G, B values according to Y ', U ' and V '. Wherein, R, G, B's formula of calculation is respectively:
R=(298*Y'+411*V'-57344),R>>8;
G=(298*Y'-101*U'-211*V'+34739),G>>8;
B=(298*Y'+519*U'-71117),B>>8。
and S23, asynchronously storing the converted RGB data into a shared memory queue.
And S3, performing dequeue operation on the queue in the shared memory by using the WPF, and rendering the target frame by using the picture control.
Based on the same inventive concept, the invention also provides a processing system compatible with the WPF playing video stream, which comprises a decoding module, a conversion module and a rendering module.
The decoding module is used for decoding a video source to obtain YUV data; the conversion module is used for converting the YUV data into bitmap and putting the bitmap into the shared memory; and the rendering module is used for reading the bitmap and rendering the target frame by adopting the picture control.
The invention also provides a processing device compatible with WPF playing video stream, comprising a memory and a processor, wherein the memory stores computer program, and the processor realizes the steps of the method when executing the computer program. The method comprises the following steps:
and S1, decoding the video source to obtain YUV data. The specific process is as follows:
s11, reading frames from a video source by using ffmpeg and storing the frames into a queue;
and S12, taking out the original frame from the queue, and then decoding the original frame by using a corresponding decoder to obtain YUV data.
And S2, converting the YUV data into bitmap, and placing the bitmap into the shared memory. The specific process is as follows:
s21, quantizing the YUV data, making Y (brightness), U (chroma) and V (chroma) in the range of Y16-235, U16-240 and V16-240 through linear change. Obtaining Y ', U ' and V ' values respectively through conversion formulas, wherein the conversion formulas are respectively as follows:
Y'=Y*[(235-16)/255]+16;
U'=U*[(240-16)/255]+16;
V'=V*[(40-16)/255]+16。。
s22, respectively calculating corresponding R, G, B values according to Y ', U ' and V '. Wherein, R, G, B's formula of calculation is respectively:
R=(298*Y'+411*V'-57344),R>>8;
G=(298*Y'-101*U'-211*V'+34739),G>>8;
B=(298*Y'+519*U'-71117),B>>8。
and S23, asynchronously storing the converted RGB data into a shared memory queue.
And S3, performing dequeue operation on the queue in the shared memory by using the WPF, and rendering the target frame by using the picture control.
The above description is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, several modifications and variations can be made without departing from the technical principle of the present invention, and these modifications and variations should also be regarded as the protection scope of the present invention.

Claims (10)

1. A processing method for playing video stream compatible with WPF is characterized in that: the method comprises the following steps:
decoding a video source to obtain YUV data;
converting the YUV data into bitmap, and putting the bitmap into a shared memory;
and reading the bitmap and rendering the target frame by using the picture control.
2. The processing method of claim 1, wherein the video stream is played in a WPF-compatible manner, and the processing method comprises the following steps:
the specific process for decoding the video source to obtain YUV data is as follows:
reading frames from a video source using ffmpeg and storing the frames in a queue;
and taking out the original frame from the queue, and then decoding the original frame by using a corresponding decoder to obtain YUV data.
3. The processing method of claim 1, wherein the video stream is played in a WPF-compatible manner, and the processing method comprises the following steps:
the specific process of converting YUV data into bitmap is as follows:
performing linear processing on the YUV data to obtain corresponding Y ', U ' and V ' values;
and respectively calculating corresponding R, G, B values according to Y ', U ' and V '.
4. The processing method of claim 3, wherein the video stream is played in a WPF-compatible manner, and the processing method comprises the following steps:
in the step of carrying out linear processing on the YUV data to obtain corresponding Y ', U ' and V ' values, the value of Y is 16-235, the value of U is 16-240, and the value of V is 16-240.
5. The processing method of claim 3, wherein the video stream is played in a WPF-compatible manner, and the processing method comprises the following steps:
in the step of performing linear processing on the YUV data to obtain corresponding values Y ', U' and V ', the calculation formulas of Y', U 'and V' are respectively as follows:
Y'=Y*[(235-16)/255]+16;
U'=U*[(240-16)/255]+16;
V'=V*[(40-16)/255]+16。
6. the processing method of claim 3, wherein the video stream is played in a WPF-compatible manner, and the processing method comprises the following steps:
in the step of respectively calculating and obtaining corresponding R, G, B values according to Y ', U ' and V ', the calculation formula of R, G, B is respectively:
R=(298*Y'+411*V'-57344),R>>8;
G=(298*Y'-101*U'-211*V'+34739),G>>8;
B=(298*Y'+519*U'-71117),B>>8。
7. the processing method of claim 1, wherein the video stream is played in a WPF-compatible manner, and the processing method comprises the following steps:
the video source is video data in any one format of RTSP, RTMP, MP4 and flv.
8. The processing method of claim 1, wherein the video stream is played in a WPF-compatible manner, and the processing method comprises the following steps:
the storage of the bitmap is asynchronous storage, and the reading of the bitmap is asynchronous reading.
9. A processing system capable of playing video stream compatible with WPF is characterized in that: the method comprises the following steps:
the decoding module is used for decoding a video source to obtain YUV data;
the conversion module is used for converting the YUV data into bitmap and putting the bitmap into the shared memory; and
and the rendering module is used for reading the bitmap and rendering the target frame by adopting the picture control.
10. A processing device capable of playing video stream compatible with WPF is characterized in that: comprising a memory storing a computer program and a processor implementing the steps of the method of any one of claims 1 to 8 when executing the computer program.
CN202010000471.8A 2020-01-02 2020-01-02 Processing method, system and device capable of playing video stream compatible with WPF (Windows presentation foundation) Pending CN111147925A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010000471.8A CN111147925A (en) 2020-01-02 2020-01-02 Processing method, system and device capable of playing video stream compatible with WPF (Windows presentation foundation)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010000471.8A CN111147925A (en) 2020-01-02 2020-01-02 Processing method, system and device capable of playing video stream compatible with WPF (Windows presentation foundation)

Publications (1)

Publication Number Publication Date
CN111147925A true CN111147925A (en) 2020-05-12

Family

ID=70523247

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010000471.8A Pending CN111147925A (en) 2020-01-02 2020-01-02 Processing method, system and device capable of playing video stream compatible with WPF (Windows presentation foundation)

Country Status (1)

Country Link
CN (1) CN111147925A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112153117A (en) * 2020-09-07 2020-12-29 深圳创维-Rgb电子有限公司 Image-text data transmission method, storage medium and terminal

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080166025A1 (en) * 2004-12-02 2008-07-10 British Telecommunications Public Limited Company Video Processing
CN103581695A (en) * 2012-07-27 2014-02-12 永泰软件有限公司 System and method for achieving access of mobile terminal to global eye
CN105427236A (en) * 2015-12-18 2016-03-23 魅族科技(中国)有限公司 Method and device for image rendering
CN109618144A (en) * 2018-12-04 2019-04-12 天津大学 The method for identifying YUV signal source in more primary image signals
CN110572715A (en) * 2019-09-24 2019-12-13 四川长虹电器股份有限公司 Method for solving problem of webp blockage during Android TV playing

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080166025A1 (en) * 2004-12-02 2008-07-10 British Telecommunications Public Limited Company Video Processing
CN103581695A (en) * 2012-07-27 2014-02-12 永泰软件有限公司 System and method for achieving access of mobile terminal to global eye
CN105427236A (en) * 2015-12-18 2016-03-23 魅族科技(中国)有限公司 Method and device for image rendering
CN109618144A (en) * 2018-12-04 2019-04-12 天津大学 The method for identifying YUV signal source in more primary image signals
CN110572715A (en) * 2019-09-24 2019-12-13 四川长虹电器股份有限公司 Method for solving problem of webp blockage during Android TV playing

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112153117A (en) * 2020-09-07 2020-12-29 深圳创维-Rgb电子有限公司 Image-text data transmission method, storage medium and terminal
CN112153117B (en) * 2020-09-07 2023-12-29 深圳创维-Rgb电子有限公司 Image-text data transmission method, storage medium and terminal

Similar Documents

Publication Publication Date Title
CN109600666B (en) Video playing method, device, medium and electronic equipment in game scene
US11418832B2 (en) Video processing method, electronic device and computer-readable storage medium
TWI439942B (en) Graphics processing unit and information processing apparatus
CN111193876B (en) Method and device for adding special effect in video
JP5182957B2 (en) Variable scaling of image data for aspect ratio conversion
CN108235055B (en) Method and device for realizing transparent video in AR scene
US7312800B1 (en) Color correction of digital video images using a programmable graphics processing unit
CN113473214B (en) Screen recording method and device, computing equipment and readable storage medium
CN107533832B (en) Image processing apparatus, image processing method, and program
JP2001508631A (en) Method and apparatus for processing DVD video
CN102074257A (en) Software and hardware-decoding general multi-media playing equipment and playing method thereof
EP3972253A1 (en) Image rendering and encoding method, and related apparatus
CN114025219A (en) Rendering method, device, medium and equipment for augmented reality special effect
US7483037B2 (en) Resampling chroma video using a programmable graphics processing unit to provide improved color rendering
CN111147925A (en) Processing method, system and device capable of playing video stream compatible with WPF (Windows presentation foundation)
US7580041B1 (en) Direct storage of compressed scan converted data
WO2022042286A1 (en) Method and apparatus for optimizing hdr video display processing, and storage medium and terminal
CN111741343B (en) Video processing method and device and electronic equipment
JP4144258B2 (en) Image output apparatus and image output method
CN113052748B (en) Graphics processor and video decoding display method
US20050212784A1 (en) Liquid crystal display system with a storage capability
CN111179386A (en) Animation generation method, device, equipment and storage medium
US20060215060A1 (en) Video processing apparatus and computer system integrated with the same
CN202111812U (en) Software and hardware combined decoding universal multimedia player
US7822315B2 (en) Editing device, editing apparatus, and editing method for HDTV signal

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200512