CN102630059A - Method and device for realizing FLV video play - Google Patents

Method and device for realizing FLV video play Download PDF

Info

Publication number
CN102630059A
CN102630059A CN2012100790716A CN201210079071A CN102630059A CN 102630059 A CN102630059 A CN 102630059A CN 2012100790716 A CN2012100790716 A CN 2012100790716A CN 201210079071 A CN201210079071 A CN 201210079071A CN 102630059 A CN102630059 A CN 102630059A
Authority
CN
China
Prior art keywords
flv
file
player
stream
reconstruct
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.)
Granted
Application number
CN2012100790716A
Other languages
Chinese (zh)
Other versions
CN102630059B (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.)
Shenzhen Skyworth Digital Technology Co Ltd
Original Assignee
Shenzhen Skyworth Digital 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 Shenzhen Skyworth Digital Technology Co Ltd filed Critical Shenzhen Skyworth Digital Technology Co Ltd
Priority to CN201210079071.6A priority Critical patent/CN102630059B/en
Publication of CN102630059A publication Critical patent/CN102630059A/en
Priority to PCT/CN2012/086022 priority patent/WO2013139146A1/en
Application granted granted Critical
Publication of CN102630059B publication Critical patent/CN102630059B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/434Disassembling of a multiplex stream, e.g. demultiplexing audio and video streams, extraction of additional data from a video stream; Remultiplexing of multiplex streams; Extraction or processing of SI; Disassembling of packetised elementary stream
    • H04N21/4341Demultiplexing of audio and video streams

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses a method for realizing FLV video play. The method comprises the following steps: analyzing a stream medium FLV file, converting the FLV file into a file format supported by an android system, which comprises a transmission TS stream format, reconstructing the format stream of the filer, providing the reconstructed format stream of the file to a built-in player, and controlling the built-in player to play the reconstructed format stream of the filer. The invention also provides a device for realizing FLV video play. By adopting the method and the device, the android system can play an FLV video file in play application, and the demand of users on FLV video play can be satisfied.

Description

A kind of method and device of realizing the FLV video playback
Technical field
The present invention relates to the multimedia transmission technology, relate in particular to a kind of method and device of the FLV of realization video playback.
Background technology
Present intelligent mobile device is more and more general; And disposed intelligent operating system; Wherein the android system is a kind of main intelligent operating system; Very fast since the back development of emerging, become the widest intelligent operating system of application in the global mobile device intelligent operating system, a lot of video formats of android system support such as 3GP, MP4, TS, MKV; But also have some video formats can't support like FLV; And the FLV format video is because of himself the file volume is little, video quality good, network download speed becomes a lot of video website soon support, because the android system but can't support the broadcast of FLV format video, this will influence the demand of user to video playback.
Solve the method for android system plays FLV video in the prior art, great majority all are to be employed in the android system transplanting media library ffmpeg that increases income to accomplish parsing, decoding, broadcast to the FLV file.
But prior art exists a lot of defectives as transplanting the media library ffmpeg that the increases income problem of separating firmly very complicated, broadcast FLV file in the android system in the android system and docking very complicated with the android standard interface.
Summary of the invention
Embodiment of the invention technical problem to be solved is, a kind of method and device of the FLV of realization video playback is provided, and can be implemented in to play FLV format video file in the application of android system plays, satisfies the demand that the user plays the FLV format video.
In order to solve the problems of the technologies described above, the embodiment of the invention provides a kind of method of the FLV of realization video playback, comprising:
Resolution flow medium FLV file, with the file format that this FLV file conversion is supported for the android system, the said file format stream of reconstruct, the file format of said android system support comprises transmission TS stream format;
The file format stream of said reconstruct is offered built-in player;
Control the file format stream of the said built-in said reconstruct of player plays.
Wherein, said parsing FLV file, with the file format that this FLV file conversion is supported for the android system, the step of the said file format stream of reconstruct comprises:
Receive the FLV file, said FLV file comprises local FLV file and online FLV file;
Resolve said FLV file, to the parsing of said FLV voice data and parameter;
The said file format stream of reconstruct obtains the file format that the android system supports.
Wherein, the step of the said FLV file of said parsing specifically comprises:
Read the FLV file header, and obtain said FLV file type according to said FLV file header;
Read audio tag audio tag, obtain the low multiplexing latm head of overhead transmission, make up audio data transport stream adts head according to said latm head, wherein, said structure adts head is for audio decoder parameter to be provided;
Read header and the tag data field head of audio frequency and video label tag; And stab and time migration according to the header of the said audio frequency and video tag that reads and a tag data field acquisition time, so that reconstruct TS flows through journey data transmission stream dts, shows the calculating of time stamp data stream pts.
Wherein, the said file format flow step of said reconstruct comprises:
The head of the key frame in video data adds video format sps/pps information, and said key frame is meant first frame in the video data;
Add the adts head at said audio/video frames, frame length comprises said adts head length degree in the said adts head.
Wherein, also comprise:
Receive the Play Control information that built-in player sends, and said FLV file is controlled according to said Play Control information.
Wherein, said file format stream with said reconstruct offers built-in player, comprising:
Set up HTTP service http server thread, control said http server thread and send the customization uniform resource position mark URL to said built-in player;
Control said http server thread and receive the http authentication request that said built-in player sends according to said customization URL;
Control said http server thread when verifying successfully, send successful connection information to said built-in player;
Through said http server thread the file format of said reconstruct stream is offered built-in player.
Correspondingly, the embodiment of the invention also provides a kind of device of the FLV of realization video playback, comprising: parsing module, link block, player, wherein,
Said parsing module is used to resolve the FLV file that receives, with the file format that this FLV file conversion is supported for the android system, and the said file format stream of reconstruct;
Said link block is used for through http server thread according to the file format of said parsing module reconstruct stream, and the file format stream of said reconstruct is offered said player;
Said player, the file format stream of the reconstruct that is used for providing, the file format stream of the said reconstruct of controls playing according to said link block.
Wherein, said parsing module comprises:
Receiving element is used to receive the FLV file, and said FLV file comprises local FLV file and online FLV file;
Resolution unit is used for the FLV file that receives according to said receiving element, resolves this FLV file, so that the said file format stream of reconstruct;
Converting unit is used for the analysis result according to said resolution unit, is the file format that said android supports with said FLV file conversion.
Wherein, said parsing module also comprises:
Control module is used to receive the Play Control information that said player sends, and according to said Play Control information said FLV file is controlled.
Wherein, said link block comprises:
Second control unit is used to control said http server thread and sends customization URL to said player;
Second receiving element is used to receive the http authentication request that said player sends according to said customization URL;
Transmitting element is used for the checking request that receives according to said receiving element, when confirming said checking successful request, sends successful connection information to said player, and the file format stream of said reconstruct is offered described player.
Embodiment of the invention technical problem to be solved is; A kind of method and device of the FLV of realization video playback are provided; The problem of separating firmly that solution combines with the android system interface and FLV plays effectively; Realized in the android system plays is used, playing the FLV video, satisfied the demand of user the FLV video playback.
Description of drawings
In order to be illustrated more clearly in the embodiment of the invention or technical scheme of the prior art; To do to introduce simply to the accompanying drawing of required use in embodiment or the description of the Prior Art below; Obviously, the accompanying drawing in describing below only is some embodiments of the present invention, for those of ordinary skills; Under the prerequisite of not paying creative work property, can also obtain other accompanying drawing according to these accompanying drawings.
Fig. 1 is the flow chart of method first embodiment of a kind of FLV of realization video playback of providing of the embodiment of the invention;
Fig. 2 is the flow chart of method second embodiment of a kind of FLV of realization video playback of providing of the embodiment of the invention;
Fig. 3 is that a kind of FLV of realization that the embodiment of the invention provides looks the flow chart of playing method the 3rd embodiment frequently;
Fig. 4 is the structural representation of first embodiment of the device of a kind of FLV of realization video playback of providing of the embodiment of the invention;
Fig. 5 is the structural representation of second embodiment of the device of a kind of FLV of realization video playback of providing of the embodiment of the invention;
Fig. 6 is the structural representation of the 3rd embodiment of the device of a kind of FLV of realization video playback of providing of the embodiment of the invention.
Embodiment
To combine the accompanying drawing in the embodiment of the invention below, the technical scheme in the embodiment of the invention is carried out clear, intactly description, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills are not making the every other embodiment that is obtained under the creative work prerequisite, all belong to the scope of the present invention's protection.
The embodiment of the invention provides a kind of method and device of the FLV of realization video playback, solves effectively and the combining and the problem of separating firmly that FLV plays of android system interface, has realized broadcast FLV video in the android system.
Need explain to be that the embodiment of the invention mainly is the support that in android2.3 and above version, realizes the FLV video playback, make things convenient for the developer playing the FLV video file in the android system arbitrarily.
Two environmental conditions that the technical scheme of realization android system plays FLV video need possess in the embodiment of the invention: the first, the android system version must be able to be supported the broadcast of TS stream.The second, the coded format that audio frequency and video adopted in the FLV file must be the codec format that android system itself supports, otherwise the FLV file can be play failure.
Referring to Fig. 1, the flow chart of method first embodiment of the realization FLV video playback that provides for the embodiment of the invention.Said method comprises:
S101, resolution flow medium FLV file, with the file format that this FLV file conversion is supported for the android system, the said file format stream of reconstruct, the file format of said android system support comprises transmission TS stream format;
Concrete; The embodiment of the invention needs to change the file format of FLV video, and must be the file format that the android system can support in order to be implemented in the function of playing the FLV video in the android system; The video format of android system support comprises 3GP, MP4, TS, MKVD etc. at present; Adopt the TS stream format in the embodiment of the invention, be and be implemented in the function of playing the FLV video in the android system, resolve said FLV video format; And change said FLV video format into the TS stream format; With the source data of the TS stream format after the reconstruct, just the TS of said reconstruct stream is offered built-in player, and control the TS stream format of the said built-in said reconstruct of player plays as the built-in player of android system; Thereby accomplish broadcast, in fact just accomplish the broadcast of authentic data source FLV video format in the android system at the TS stream format.
To accomplish in the embodiment of the invention and in the android system, play the FLV video; Comprise control to the audio, video data of said FLV video, Play Control etc.; At first need one and play main program; And play main thread and also need set up a background thread before at the real video display process that gets into; Said background thread is used to resolve said FLV file through parsing conversion thread is provided, with the TS stream format that this FLV file conversion is supported for the android system, and the file format stream of the said TS stream of reconstruct.
S102 offers built-in player with the file format of said reconstruct stream;
Concrete; Be to be implemented in the function of playing the FLV video in the android system in the embodiment of the invention; The processing scheme that proposition becomes the TS stream format to play said FLV video format conversion in the android system; Resolve said FLV video format through background thread; The TS stream format that said FLV video format conversion is supported for the android system, and the TS stream of said reconstruct sent to HTTP service http server thread, said http server thread offers built-in player with the TS format stream that receives as source data; And accomplish and in said built-in player, play the TS format stream; Said http server thread is to play main thread to set up, and walks abreast with playing main thread, and also walks abreast with FLV document analysis conversion thread that background thread described in the S101 step is set up; The embodiment of the invention provides the service of TS stream through the http server thread of in the android system, setting up to built-in player, thereby accomplishes the butt joint of android system interface.
Said http server thread accomplish with the android system in after the docking of built-in player interface; Built-in player just can constantly obtain the TS flow data that said http server thread provides in the said android system; Said connection is meant that transmission control protocol tcp connects; Be to receive the tcp that plays main thread after said http server thread is set up to connect; And handle http checking request, and only returning correct response to playing main thread, can be with the TS format stream that obtains in the said FLV document analysis conversion thread process as source data; Offer built-in player in the said android system; So just set up a connection between the data playback in data processing in FLV document analysis conversion thread process and the built-in player plays process, make that data processing and the data playback in the built-in player plays process in the FLV document analysis conversion thread walks abreast, the two is independent of each other.
S103 controls the file format stream of the said built-in said reconstruct of player plays.
Concrete; The embodiment of the invention is play the FLV video format in order to be implemented in the android system; At first change the FLV video format into file format that the android system can support; The file format that said android system can support comprises the TS stream format, and through said http server thread said TS stream format is offered the built-in player of said android system as data source, is implemented in the android system plays and plays TS stream in using; Accomplished the broadcast of FLV video in the android system; Broadcast main thread in the embodiment of the invention can initiatively be got in touch said http server thread after having set up http server thread, and judges whether said http server thread sends http checking request response correctly to it, if said http server thread sends the response of " connecting normal "; The expression successful connection is set up; Then said built-in player constantly receives the TS stream that said http server thread sends, and realizes the broadcast of TS stream, has accomplished the broadcast of authentic data source FLV video file in the android system.
The process that need to prove the file format stream of the said built-in said reconstruct of player plays of said control comprises: whether what said built-in player was judged current broadcast is the FLV video format; If be judged as be; URL according to the setting of said android system standard interface receives the http authentication request that said built-in player sends according to said customization URL; If http checking request is sent in connection request success back,, represent that said http server thread can provide TS stream for said broadcast main thread if send " successful connection " according to the HTTP standard agreement; If be judged as not, withdraw from playing process.
Http server thread in the embodiment of the invention accomplish with the android system in after the docking of built-in player; Utilize the built-in player support of said android system to play the characteristics of TS format stream; Directly from said http server thread, receive the TS flow data; The decode procedure of audio, video data is by said android system handles like this; Such as the said android support Advanced Audio Coding AAC of system itself, the hardware decoding of audio/video coding forms such as H264 AVC then finally can be through complete call in the application interface of android system; Just solve the problem that said FLV audio, video data is separated firmly; Said in addition http server thread accomplish with the android system in after the docking of built-in player, by the completion of said android system, development process is identical with the broadcast of generic media file such as MP4 fully in the broadcast of said FLV video format; Simultaneously said FLV document analysis conversion thread and the built-in player data playback of http server thread and the android system process that provides TS to flow service walk abreast; Can not exert an influence to the built-in player plays TS format stream of android system, its process of playing the FLV video format is identical with the process of playing the generic media file, reduces development difficulty greatly.
Referring to Fig. 2, the flow chart of method second embodiment of the realization FLV video playback that provides for the embodiment of the invention.Said method comprises:
S201 receives the FLV file, and said FLV file comprises local FLV file and online FLV file;
Concrete; Background thread at first will be obtained the data of FLV file in the embodiment of the invention; Have only through background thread get access to said FLV file can resolve the conversion said FLV file; The said FLV file that obtains comprises local FLV file and online FLV file, and wherein said local FLV file can be stored in the secure data storage card SD card, and said online FLV file is meant automatic network.
In addition, background thread described in the embodiment of the invention receives the information of the controls playing of the built-in player transmission of android system when obtaining the FLV file, and according to the information of this controls playing said FLV file is controlled.
S202 resolves said FLV file, to the parsing of said FLV voice data and parameter;
Concrete; The file of FLV described in the embodiment of the invention is made up of file header (FLV header) and a lot of body of text (tag) usually; The FLV file that gets access to according to S201; The said FLV file that gets access to is resolved; Said parsing comprises resolves with video and resolves the audio frequency that carries out of the FLV file that gets access to, and said FLV file audio frequency is resolved is that to adopt Advanced Audio Coding AAC coding, said video to the FLV file to resolve be to adopt normal video coding H264 AVC coding, and the wherein said AAC modal form of encoding comprises that audio data transmission layer ADTS opens the multiplexing LATM of audio transmission slightly with hanging down.
The process of resolving the said FLV file that gets access in the embodiment of the invention mainly comprises: read said FLV file header and file body and obtain file type and the latm frame head and the sps/pps information of FLV file, make up the adts frame head through the said latm frame head that gets access to; Thereby for to the audio/video decoding of said FLV file parameter being provided, reading header and the tag data field head of audio frequency and video tag; Therefrom acquisition time stabs and time migration information, and the calculating of flowing through journey dts, pts for reconstruct TS provides foundation.
Need to prove; In order to guarantee that background thread is in the validity to the parsing transfer process of FLV file; Usually the process of obtaining the FLV file in the S201 step is combined to realize the parsing conversion to said FLV file with the process of parsing FLV file in the S202 step; Said parsing conversion to the FLV file is that the size of the FLV file structure element of resolving according to the FLV document analysis thread in the S202 step decides the data length that obtains the FLV file in the S201 step; So just guaranteed that the data read fetch pointer is in the edge of FLV file structure element all the time; So both reduced the uncertainty of the data of obtaining the FLV file, can find again to exist in the FLV file wrong also can in time be handled accordingly, avoids influencing whole FLV document analysis transfer process and follow-up FLV file is play.
S203, the said file format stream of reconstruct obtains the file format that the android system supports;
Concrete; According to carrying out the analysis result of audio, video data and parameter to receiving the FLV file in the S202 step; Further reconstruct TS stream format; Be about to said FLV file conversion and be the TS stream format that said android system supports, comprise in the process of said TS stream reconstruct: the key frame head in the data of said TS stream adds sps/pps information, add the adts head in to each audio frame of TS stream, and frame length comprises the length of adts head in the said adts head.
S204 offers built-in player with the file format of said reconstruct stream;
S205 controls the file format stream of the said built-in said reconstruct of player plays.
Embodiment of the invention background thread is accomplished the parsing conversion to the FLV video file; Said parsing conversion to the FLV video file comprises: provide background thread receive the FLV file, according to the said FLV file that receives; Resolve this FLV file; So that the said file format of reconstruct stream, and be the TS stream format that android supports, this TS stream offered built-in player as data source through http server thread with said FLV file conversion; Be implemented in and play TS stream in the android system, realized the broadcast of authentic data source FLV file in the android system.
Referring to Fig. 3, Fig. 3 is the flow chart of method the 3rd embodiment of the realization FLV video playback that provides of the embodiment of the invention.Said method comprises:
S301, resolution flow medium FLV file, with the file format that this FLV file conversion is supported for the android system, the said file format stream of reconstruct, the file format of said android system support comprises transmission TS stream format;
S302 sets up HTTP service http server thread, controls said http server thread and sends the customization uniform resource position mark URL to said built-in player;
Concrete; Broadcast main thread in the embodiment of the invention can be set up tcp with said http server thread and get in touch after setting up the foundation of http server thread; After successfully setting up, said http server thread can send the customization uniform resource position mark URL to said built-in player; The URL of said customization can be following form: http://localhost: [port] or http: // 127.0.0.1: [port], the URL of said http server can accomplish through android system standard interface and be provided with.
S303 controls said http server thread and receives the http authentication request that said built-in player sends according to said customization URL;
Concrete; Http server thread is set up by playing main thread in the embodiment of the invention; Said broadcast main thread is as the client of http server; Accomplish with the interface of android system built-in player and dock through connecting http server; After said http server thread starts, wait for the tcp connection request of said broadcast main thread, and receive the http authentication request that said built-in player sends according to said customization URL according to the URL of said android system standard interface setting; Said http server thread sends " successful connection " according to the HTTP standard agreement; Represent that said http server thread can provide TS stream for said broadcast main thread, said http server thread is to set up the data butt joint between the video display process for the data handling procedure of changing thread at the FLV document analysis and FLV broadcast main thread, makes said http server thread provide TS stream service completion to dock with the interface of said FLV broadcast main thread.
The server of http described in embodiment of the invention thread is the key that realization is docked with said android system interface; Play main thread and URL is set through the data source SetDataSource (string path) that is provided with in the invokes media players MediaPlayer interface; And through the customization URL connect said http server thread; Thereby set up FLV broadcast main thread and FLV and resolve the contact between the conversion thread, realized that the data playback of FLV broadcast main thread and FLV resolve the data butt joint between the data analysis of changing thread.
S304 controls said http server thread when verifying successfully, sends successful connection information to said built-in player;
Concrete; Http server thread is set up by playing main thread in the embodiment of the invention; After said http server thread starts; Wait for the tcp connection request of said broadcast main thread; And receiving the http authentication request that said built-in player sends according to said customization URL according to the URL of said android system standard interface setting, said http server thread is when verify successfully, to said built-in player transmission successful connection information; Be that said http server thread sends " successful connection " according to the HTTP standard agreement, represent that said http server thread can offer the built-in player of said android system as source traffic with said TS stream.
Need to prove; Play main thread in the embodiment of the invention and URL is set through the SetDataSource (string path) that calls in the MediaPlayer interface; The data playback and the FLV that have realized FLV broadcast main thread resolve the data butt joint between the data analysis of changing thread; But real docking operation is in setDataSource (string path) and the inner completion of two methods of prepare (); Relate to just that the inside of android standard interface realizes; Therefore only need write exactly in embodiments of the present invention is that method through calling setDataSource in the MediaPlayer interface (string path) get final product, judges according to S304 that the MediaPlayer that plays main thread plays and prepares successfully, and said http server receives the TS that said FLV parsing changes thread reconstruct and flows; And said TS stream is offered said FLV as source data play main thread, the MediaPlayer calling interface start () that FLV plays main thread begins to play.
S305 offers built-in player through said http server thread with the file format of said reconstruct stream.
S306 controls the file format stream of the said built-in said reconstruct of player plays.
The embodiment of the invention is set up http server thread purpose and between FLV document analysis conversion thread and broadcast main thread, has been set up a connection through http server thread exactly in the android system; Make the data processing in the FLV document analysis conversion thread walk abreast with the data playback of playing in the main thread; The two is independent of each other; Therefore said broadcast main thread just can constantly be obtained the ts stream that http server thread provides as long as accomplish connection http server thread; Effectively with the docking of the controls playing interface of android system; Make what the operation of FLV Play Control was accomplished by the broadcast main thread fully; And the foundation of said FLV document analysis conversion thread, http server thread can not exert an influence to the broadcast that FLV plays main thread, and the 3GP of said FLV playing process and android system support itself, the playing process of other generic media files of MP4 are identical, have so just reduced development difficulty.
Referring to Fig. 4, Fig. 4 is the structural representation of first embodiment of the device of a kind of FLV of realization video playback of providing of the embodiment of the invention.As shown in Figure 4, comprising: parsing module 10, link block 20, player 30, wherein,
Said parsing module 10 is used to resolve the FLV file that receives, with the file format that this FLV file conversion is supported for the android system, and the said file format stream of reconstruct;
Concrete; Parsing module 10 is used to resolve the FLV file that receives in the embodiment of the invention, and with the file format of said FLV file conversion for the support of android system, the said file format stream of reconstruct; Exactly in order to be implemented in the function of playing the FLV video in the android system; Change the file format of FLV video, and must be file format such as the TS stream format that the android system can support, resolve TS stream format after the reconstruct that obtains as the source data of the built-in player of android system through said parsing module 10; Accomplish the broadcast of TS stream format, in fact accomplish the broadcast of FLV video format in the android system.
Said link block 20 is used for receiving through http server thread the file format stream of said parsing module 10 reconstruct, and the file format stream of said reconstruct is offered said player 30;
Concrete; Link block 20 in the embodiment of the invention is to receive said parsing module 10 through http server thread to resolve the TS stream that obtains after the conversion; And said TS stream offered said player module 30 as source data; Wherein said link block 20 receives the tcp that plays main thread through http server thread and connects; And handle the http checking and ask; Only obtain correct response in said checking request; Said link block 20 can offer the broadcast main thread as source data with said TS stream, just can obtain TS stream as long as said broadcast main thread has been accomplished connection http server thread, so just between parsing module 10 and player 30, has set up a connection; In the just said parsing module 10 data processing in the FLV document analysis conversion thread and the data playback of said player are walked abreast; The two is independent of each other, said in embodiments of the present invention link block 20 be exactly through http server thread accomplish with the android system in player 30 accomplish and dock, offer said player 30 thereby make link block 20 TS that obtains in the said parsing module 10 flowed as source data through http server thread.
Said player 30, the file format stream of the reconstruct that is used for providing, the file format stream of the said reconstruct of controls playing according to said link block 20.
Concrete; The embodiment of the invention is play the FLV video format in order to be implemented in the android system; At first change the FLV video format into TS stream format that the android system can support through parsing module 10; Link block 20 offers in said android system built-in player 30 with said TS stream format as data source through http server thread, is implemented in the android system plays and plays TS stream in using, and has accomplished the broadcast of FLV video in the android system.
The process that need to prove the file format stream of the said reconstruct of said player 30 broadcasts comprises: whether what said player 30 was judged current broadcast is the FLV video format; If be judged as be; If the URL according to the setting of said android system standard interface receives the http authentication request connection request success back transmission http checking request that said player 30 sends according to said customization URL; If http sends " successful connection " according to the HTTP standard agreement; Represent that said http server thread can provide TS stream for said broadcast main thread, if be judged as not, withdraws from playing process.Broadcast main thread in the embodiment of the invention can initiatively be got in touch said http server thread after having set up http server thread; And judge whether said http server thread sends http checking request response correctly to it; If said http server thread sends the response of " connecting normal "; The expression successful connection is set up; Then said built-in player constantly receives the TS stream that said http server thread sends, and realizes the broadcast of TS stream, has accomplished the broadcast of authentic data source FLV video file in the android system.
Link block 20 in the embodiment of the invention through http server thread accomplish with the android system in after the docking of player 30; Said player 30 directly receives the TS flow data from said link block 20; The decode procedure of audio, video data is accomplished by said android system fully like this; Solved the problem that said FLV audio, video data is separated firmly; And its development process is identical with the broadcast of generic media file such as MP4, and the FLV document analysis of said parsing module 10 is changed thread and provided the data playback process of player 30 in TS link block that stream is served 20 and the android system to walk abreast simultaneously, can not play the TS format stream to the player in the android system 30 and exert an influence; Its process of playing the FLV video format is identical with the process of playing the generic media file, reduces development difficulty.
Referring to Fig. 5, Fig. 5 is the structural representation of second embodiment of a kind of FLV of realization video play device of providing of the embodiment of the invention.As shown in Figure 5; Said realization FLV video play device is realized in comprising above-mentioned first embodiment the link block 20, player 30 in the broadcast FLV video-unit; Said parsing module 10 further comprises: receiving element 101, resolution unit 102, converting unit 103; Control unit 104, wherein
Said receiving element 101 is used to receive the FLV file, and said FLV file comprises local FLV file and online FLV file;
Concrete; Receiving element 101 obtains the FLV file; Have only get access to behind the FLV file through receiving element 101 can resolve through background thread, conversion FLV file; The FLV file that said receiving element 101 obtains comprises local FLV file and online FLV file, and wherein said local FLV file can be stored on the secure data storage SD card.
Said resolution unit 102 is used for the FLV file that receives that receives according to said receiving element 101, and resolves this FLV file, so that the said file format stream of reconstruct;
Concrete; The FLV file that gets access to according to said receiving element 101 of resolution unit 102 in embodiments of the present invention; FLV file to said receiving element 101 receives is resolved; Said parsing comprises that the audio frequency of the FLV file that receiving element 101 is got access to is resolved and video is resolved; The parsing of the FLV file that 102 pairs of receiving elements 101 of resolution unit receive comprises: read the file type that the FLV file header obtains file, the audio frequency tag that reads the FLV file, obtain latm frame head and sps/pps information, make up the adts frame head by the said latm frame head that obtains again, thereby parameter is provided, reads header and the tag data field head of audio frequency and video tag for audio decoder and video decode; Therefrom acquisition time stabs and time migration information, for reconstruct TS flows through journey dts, pts calculates foundation is provided.
Said converting unit 103 according to the file format stream of said resolution unit 102 reconstruct of resolving, is the file format that said android supports with said FLV file conversion.
Concrete; Analysis result according to said resolution unit 102; The FLV file conversion that said receiving element 101 is received is the file format that said android supports; Just said converting unit 103 according to the said receiving elements 101 of 102 pairs of said resolution unit receive to the FLV file conversion carry out the analysis result of audio, video data and parameter, further reconstruct TS stream format, promptly said converting unit 103 is supported said FLV file conversion for the android system TS stream format.
Said control unit 104 is used to receive the Play Control information that player 30 sends, and according to said Play Control information said FLV file is controlled.
Need to prove; In order to guarantee that background thread is in the validity to the parsing transfer process of FLV file; Usually the process of the said FLV file that gets access to of parsing of receiving element 101 being obtained process and the resolution unit 102 of FLV file combines; The size of the FLV file structure element of being resolved by resolution unit 102 determines the data length of the FLV file that said receiving element 101 obtains; So just guaranteed that the data read fetch pointer is in the edge of FLV file structure element all the time; So both reduced the uncertainty of receiving element, and can find the FLV file existing problems obtained again, avoided influencing whole FLV document analysis transfer process simultaneously and follow-up FLV file is play the FLV file data that obtains.
It is the process of how accomplishing the parsing conversion of FLV video file that the embodiment of the invention has been analyzed background thread; Said FLV document analysis transfer process comprises that receiving element 101 obtains the FLV file that FLV file, resolution unit 102 get access to according to said receiving element 101; Resolving this FLV file that gets access to, converting unit 103 is the TS stream format that said android supports according to the analysis result of said resolution unit 102 with said FLV file conversion; And said TS stream for offering FLV, data source play main thread; Promptly in the android system plays is used, play this TS stream, so just accomplished the broadcast of authentic data source FLV file in the android system.
Referring to Fig. 6, Fig. 6 is the structural representation of the 3rd embodiment of a kind of FLV of realization video play device of providing of the embodiment of the invention.As shown in Figure 6; Said realization FLV video play device is realized in comprising the above-mentioned first above-mentioned example the parsing module 10, player 30 in the FLV video play device; Said link block 20 further comprises: second control unit 201, second receiving element 202, transmitting element 203, wherein
Said second control unit 201 is used to control said http server thread and sends customization URL to said player 30;
Concrete; Link block 20 in the embodiment of the invention through http server thread accomplish with the android system in after the docking of player 30; Said player 30 can be set up tcp with said link block 20 and get in touch after said link block 20 is set up http server thread; And pass through control unit 201 and send the customization uniform resource position mark URL to said player module 20; The URL of said customization can be following form: http://localhost: [port] or http: // 127.0.0.1: [port], said customization uniform resource position mark URL of sending to said player module 20 can be accomplished through android system standard interface and be provided with.
Said second receiving element 202 is used to receive the http authentication request that said player module 30 sends according to said customization URL;
Concrete; Http server thread in the embodiment of the invention is set up by said player 30; Said player 30 is as the client that connects r module 20; Through http server thread accomplish with the android system in player 30 interfaces dock, said link block 20 is waited for the tcp connection request of said player 30 after the startup of http server thread; And through of the http authentication request of the said player 30 of said second receiving element, 202 receptions according to said customization URL transmission; Said link block 20 is sent " successful connection " according to the HTTP standard agreement, representes that said link block 20 can provide TS stream for said player 30, makes said link block 20 provide the service of TS stream to accomplish and docks with the interface of said player 30.
Said transmitting element 203; Be used for the checking request that receives according to said receiving element 202; When confirming said checking successful request, send the successful connection information to said player 30, and the file format stream of said reconstruct is offered said player module 30.
Concrete; The server of http described in embodiment of the invention thread be link block 20 realize with said android system in the player 30 interfaces key of docking; Said link block 20 is after http server thread starts; Wait for the tcp connection request of said player 30, and the said player 30 that receives according to the said receiving element 202 http authentication request of sending, when confirming said checking successful request according to said customization URL; Send successful connection information through said transmitting element 203 to said player 30; Be that said link block 20 is sent " successful connection " according to the HTTP standard agreement, represent that said link block 20 can offer the player 30 in the said android system as source traffic with said TS stream, and with realizing playing the TS format stream in the said player module 30.
The link block 20 of the embodiment of the invention connects through the tcp that http server thread receives player 30; And handle the http checking and ask; Only obtain correct response in said checking request; Said link block 20 can offer player 30 as source data with said TS stream; Between the playing process of the parsing transfer process of parsing module 10 and player module 30, set up a connection through link block 20; That is to say that data processing and the data playback of player 30 in the document analysis conversion thread of parsing module 10 walk abreast; The two is independent of each other, and therefore said player 30 is as long as accomplish and connect link block 20 and just can constantly be obtained the ts stream that link block 20 provides, like this with regard to effectively with the docking of player 30 interfaces of android system; Make what the operation of FLV broadcast system was accomplished by player 30 fully; And the foundation of said FLV document analysis conversion thread, http server thread can not exert an influence to the broadcast that said player 30 is play the FLV video formats, and the 3GP of said FLV playing process and android system support itself, the playing process of other generic media files of MP4 are identical, have so just reduced development difficulty.
Through the description of above execution mode, those skilled in the art can be well understood to the present invention and can realize by the mode that software adds essential hardware platform, can certainly all implement through hardware.Based on such understanding; All or part of can the coming out that technical scheme of the present invention contributes to background technology with the embodied of software product; This computer software product can be stored in the storage medium, like ROM/RAM, magnetic disc, CD etc., comprises that some instructions are with so that a computer equipment (can be a personal computer; Server, the perhaps network equipment etc.) carry out the described method of some part of each embodiment of the present invention or embodiment.
Above disclosedly be merely a kind of preferred embodiment of the present invention, can not limit the present invention's interest field certainly with this, the equivalent variations of therefore doing according to claim of the present invention still belongs to the scope that the present invention is contained.

Claims (10)

1. a method that realizes the FLV video playback is characterized in that, comprising:
Resolution flow medium FLV file, with the file format that this FLV file conversion is supported for the android system, the said file format stream of reconstruct, the file format of said android system support comprises transmission TS stream format;
The file format stream of said reconstruct is offered built-in player;
Control the file format stream of the said built-in said reconstruct of player plays.
2. the method for claim 1 is characterized in that, said parsing FLV file, and with the file format that this FLV file conversion is supported for the android system, the step of the said file format stream of reconstruct comprises:
Receive the FLV file, said FLV file comprises local FLV file and online FLV file;
Resolve said FLV file, to the parsing of said FLV voice data and parameter;
The said file format stream of reconstruct obtains the file format that the android system supports.
3. method as claimed in claim 2 is characterized in that, the step of the said FLV file of said parsing specifically comprises:
Read the FLV file header, and obtain said FLV file type according to said FLV file header;
Read audio tag audio tag, obtain the low multiplexing latm head of overhead transmission, make up audio data transport stream adts head according to said latm head, wherein, said structure adts head is for audio decoder parameter to be provided;
Read header and the tag data field head of audio frequency and video label tag; And stab and time migration according to the header of the said audio frequency and video tag that reads and a tag data field acquisition time, so that reconstruct TS flows through journey data transmission stream dts, shows the calculating of time stamp data stream pts.
4. method as claimed in claim 2 is characterized in that, the said file format flow step of said reconstruct comprises:
The head of the key frame in video data adds video format sps/pps information, and said key frame is meant first frame in the video data;
Add the adts head at said audio/video frames, frame length comprises said adts head length degree in the said adts head.
5. method as claimed in claim 2 is characterized in that, also comprises:
Receive the Play Control information that built-in player sends, and said FLV file is controlled according to said Play Control information.
6. the method for claim 1 is characterized in that, said file format stream with said reconstruct offers built-in player, comprising:
Set up HTTP service http server thread, control said http server thread and send the customization uniform resource position mark URL to said built-in player;
Control said http server thread and receive the http authentication request that said built-in player sends according to said customization URL;
Control said http server thread when verifying successfully, send successful connection information to said built-in player;
Through said http server thread the file format of said reconstruct stream is offered built-in player.
7. a device of realizing the FLV video playback is characterized in that, comprising: parsing module, link block, player, wherein,
Said parsing module is used to resolve the FLV file that receives, with the file format that this FLV file conversion is supported for the android system, and the said file format stream of reconstruct;
Said link block is used for receiving through http server thread the file format stream of said parsing module reconstruct, and the file format stream of said reconstruct is offered said player;
Said player, the file format stream of the reconstruct that is used for providing, the file format stream of the said reconstruct of controls playing according to said link block.
8. device as claimed in claim 7 is characterized in that, said parsing module comprises:
Receiving element is used to receive the FLV file, and said FLV file comprises local FLV file and online FLV file;
Resolution unit is used for the FLV file that receives according to said receiving element, resolves this FLV file, so that the said file format stream of reconstruct;
Converting unit is used for the analysis result according to said resolution unit, is the file format that said android supports with said FLV file conversion.
9. device as claimed in claim 8 is characterized in that, said parsing module also comprises:
Control module is used to receive the Play Control information that said player sends, and according to said Play Control information said FLV file is controlled.
10. device as claimed in claim 7 is characterized in that, said link block comprises:
Second control unit is used to control said http server thread and sends customization URL to said player;
Second receiving element is used to receive the http authentication request that said player sends according to said customization URL;
Transmitting element is used for the checking request that receives according to said receiving element, when confirming said checking successful request, sends successful connection information to said player, and the file format stream of said reconstruct is offered described player.
CN201210079071.6A 2012-03-23 2012-03-23 A kind of method and device realizing FLV video playback Active CN102630059B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201210079071.6A CN102630059B (en) 2012-03-23 2012-03-23 A kind of method and device realizing FLV video playback
PCT/CN2012/086022 WO2013139146A1 (en) 2012-03-23 2012-12-06 Device and apparatus for playing flv video

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210079071.6A CN102630059B (en) 2012-03-23 2012-03-23 A kind of method and device realizing FLV video playback

Publications (2)

Publication Number Publication Date
CN102630059A true CN102630059A (en) 2012-08-08
CN102630059B CN102630059B (en) 2015-09-30

Family

ID=46588197

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210079071.6A Active CN102630059B (en) 2012-03-23 2012-03-23 A kind of method and device realizing FLV video playback

Country Status (2)

Country Link
CN (1) CN102630059B (en)
WO (1) WO2013139146A1 (en)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102929559A (en) * 2012-09-20 2013-02-13 深圳市亚特尔科技有限公司 Method and system for providing file
CN103702240A (en) * 2013-12-06 2014-04-02 乐视网信息技术(北京)股份有限公司 Method and equipment for video laying
CN104717446A (en) * 2013-12-12 2015-06-17 中国航空工业集团公司第六三一研究所 Method for automatically converting videos of multiple formats to video of ITU 656 protocol PAL format
CN104717444A (en) * 2013-12-12 2015-06-17 中国航空工业集团公司第六三一研究所 Method of automatically converting video of multiple formats to VESA (Video Electronics Standards Association)-protocol 1920*1440-resolution 75Hz-frame rate video
CN104754349A (en) * 2013-12-25 2015-07-01 炫一下(北京)科技有限公司 Method and device for hardware decoding of audio/video
CN106686443A (en) * 2015-11-10 2017-05-17 中兴通讯股份有限公司 Media playback method, media playback terminal and media playback system
CN108184137A (en) * 2017-12-29 2018-06-19 北京奇虎科技有限公司 A kind of positioning playing method and apparatus of Streaming Media FLV files
CN110858923A (en) * 2018-08-24 2020-03-03 北京字节跳动网络技术有限公司 Method and device for generating segmented media file and storage medium
CN110858919A (en) * 2018-08-24 2020-03-03 北京字节跳动网络技术有限公司 Data processing method and device in media file playing process and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100094728A1 (en) * 2008-09-12 2010-04-15 James Denning Method and system for distributing media content and processing payments and/or voluntary data collection
CN102123279A (en) * 2010-12-28 2011-07-13 乐视网信息技术(北京)股份有限公司 Distributed real-time transcoding method and system

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101415069B (en) * 2008-10-22 2010-07-14 清华大学 Server and method for sending on-line play video
WO2011090715A2 (en) * 2009-12-28 2011-07-28 Akamai Technologies, Inc. Edge server for format-agnostic streaming architecture
CN102075528B (en) * 2010-12-27 2014-12-10 上海聚欣网络科技有限公司 Method and equipment for playing network multimedia files of multiple encapsulation formats
CN102118428B (en) * 2010-12-29 2012-12-26 天脉聚源(北京)传媒科技有限公司 Method and system for playing streaming media

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100094728A1 (en) * 2008-09-12 2010-04-15 James Denning Method and system for distributing media content and processing payments and/or voluntary data collection
CN102123279A (en) * 2010-12-28 2011-07-13 乐视网信息技术(北京)股份有限公司 Distributed real-time transcoding method and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王奎澎,刘建辉: "FLV文件格式及其嵌入式应用", 《计算机系统应用》, vol. 19, no. 3, 31 December 2010 (2010-12-31), pages 190 - 193 *

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102929559A (en) * 2012-09-20 2013-02-13 深圳市亚特尔科技有限公司 Method and system for providing file
CN102929559B (en) * 2012-09-20 2015-07-22 深圳市亚特尔科技有限公司 Method and system for providing file
CN103702240A (en) * 2013-12-06 2014-04-02 乐视网信息技术(北京)股份有限公司 Method and equipment for video laying
CN104717446A (en) * 2013-12-12 2015-06-17 中国航空工业集团公司第六三一研究所 Method for automatically converting videos of multiple formats to video of ITU 656 protocol PAL format
CN104717444A (en) * 2013-12-12 2015-06-17 中国航空工业集团公司第六三一研究所 Method of automatically converting video of multiple formats to VESA (Video Electronics Standards Association)-protocol 1920*1440-resolution 75Hz-frame rate video
CN104717444B (en) * 2013-12-12 2017-11-24 中国航空工业集团公司第六三一研究所 Automatic switching method of more video formats to VESA agreement 1920X1440 resolution ratio 75Hz frame-rate videos
CN104754349A (en) * 2013-12-25 2015-07-01 炫一下(北京)科技有限公司 Method and device for hardware decoding of audio/video
CN106686443A (en) * 2015-11-10 2017-05-17 中兴通讯股份有限公司 Media playback method, media playback terminal and media playback system
CN108184137A (en) * 2017-12-29 2018-06-19 北京奇虎科技有限公司 A kind of positioning playing method and apparatus of Streaming Media FLV files
CN110858923A (en) * 2018-08-24 2020-03-03 北京字节跳动网络技术有限公司 Method and device for generating segmented media file and storage medium
CN110858919A (en) * 2018-08-24 2020-03-03 北京字节跳动网络技术有限公司 Data processing method and device in media file playing process and storage medium
CN110858923B (en) * 2018-08-24 2022-09-06 北京字节跳动网络技术有限公司 Method and device for generating segmented media file and storage medium

Also Published As

Publication number Publication date
CN102630059B (en) 2015-09-30
WO2013139146A1 (en) 2013-09-26

Similar Documents

Publication Publication Date Title
CN102630059A (en) Method and device for realizing FLV video play
CA2963765C (en) Receiving device, transmitting device, and data processing method
CN103069769B (en) For the special-effect mode transmitted through the network crossfire of decoded video data
JP2018513583A (en) Audio video file live streaming method, system and server
US20200275148A1 (en) Event-Based Content Replacement In Live Media Services
EP3220653B1 (en) Reception device, reception method, transmission device, and transmission method for layer-coded services using route sessions
US9369508B2 (en) Method for transmitting a scalable HTTP stream for natural reproduction upon the occurrence of expression-switching during HTTP streaming
KR102499231B1 (en) Receiving device, sending device and data processing method
CN105898496A (en) HLS stream hardware decoding method based on Android device and device
CN105979373A (en) Play method and device
US20120207454A1 (en) Streaming service and playback device using svc server
CN107925798B (en) Receiving apparatus, transmitting apparatus, and data processing method
CN108965997A (en) Stream media live broadcasting method and device based on mobile vulnerable network environment
CN102625193A (en) A method of realizing multimedia file network playing by virtue of auxiliary files
CN205230019U (en) System for realize video seamless handover between many screens
CN102263990A (en) Method, device and system for playing digital TV programs
CN102045586A (en) Network device, information processing apparatus, stream switching method and content distribution system
CN106303754A (en) A kind of audio data play method and device
KR101313592B1 (en) Computing device and method for streaming
WO2011093629A3 (en) Rich media service method and system using media streaming
US20180020043A1 (en) Method for playing audio/video and display device
WO2007114107A1 (en) Server device in contents transmitting system and contents transmitting method
CN106302465B (en) A kind of method and device of playing audio-video data
CN102780878A (en) Method and system for acquiring media files
KR102533674B1 (en) Receiving device, sending device and data processing method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C53 Correction of patent of invention or patent application
CB02 Change of applicant information

Address after: 518000 Guangdong city of Shenzhen province Nanshan District Gao Xin Road Building A14, SKYWORTH

Applicant after: Shenzhen Skyworth Digital Technology Co., Ltd.

Address before: 518000 Guangdong city of Shenzhen province Nanshan District Gao Xin Road Building A14, SKYWORTH

Applicant before: Shenzhen Skyworth Digital Technology Co., Ltd.

COR Change of bibliographic data

Free format text: CORRECT: APPLICANT; FROM: SKY-WORTH DIGITAL TECHNOLOGY CO., LTD.;SHENZHEN CITY TO: SHENZHEN SKYWORTH DIGITAL TECHNOLOGY CO., LTD.

C14 Grant of patent or utility model
GR01 Patent grant