CN104093063B - The method and apparatus for reducing title - Google Patents

The method and apparatus for reducing title Download PDF

Info

Publication number
CN104093063B
CN104093063B CN201410346247.9A CN201410346247A CN104093063B CN 104093063 B CN104093063 B CN 104093063B CN 201410346247 A CN201410346247 A CN 201410346247A CN 104093063 B CN104093063 B CN 104093063B
Authority
CN
China
Prior art keywords
attribute
row
data
type
row 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.)
Active
Application number
CN201410346247.9A
Other languages
Chinese (zh)
Other versions
CN104093063A (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.)
Samsung Electronics China R&D Center
Samsung Electronics Co Ltd
Original Assignee
Samsung Electronics China R&D Center
Samsung Electronics 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 Samsung Electronics China R&D Center, Samsung Electronics Co Ltd filed Critical Samsung Electronics China R&D Center
Priority to CN201410346247.9A priority Critical patent/CN104093063B/en
Publication of CN104093063A publication Critical patent/CN104093063A/en
Application granted granted Critical
Publication of CN104093063B publication Critical patent/CN104093063B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

A kind of method and apparatus for reducing title are provided, methods described includes:Obtain the subtitle file of the multimedia file;Header data to the subtitle file is parsed, and obtains the global property of the subtitle file;Obtain current subtitle row data and current subtitle row data are parsed, obtain string attribute in the row attribute of current subtitle row data and the row of current subtitle row data;The current subtitle row data are divided at least one text filed, each is text filed to include a merging attribute;Each attribute type that the merging attribute includes is created as a corresponding attribute item;The all properties item that the current subtitle row data are included is created as the data syntax structure of the current subtitle row data;Data syntax structure according to the current subtitle row data is reduced to current subtitle row data.Methods described and device are directed to captions row data creation data syntax structure, effectively reduce the occupancy of memory headroom.

Description

The method and apparatus for reducing title
Technical field
This invention relates generally to parsing and reduction to title, more particularly, it is related to a kind of reduction captions The method and apparatus of attribute.
Background technology
Captions refer to non-visual contents such as the dialogues inside written form display TV, film, stage works, also refer to shadow It is regarded as the word of product post-production.With the development of multimedia technology, can add many for subtitle file when subtitle file is made The title of type, to enrich the result of broadcast of captions.
It is existing reduction title method be:First by the subtitle file to multimedia file (for example, embedded word Curtain or plug-in captions) parsed, captioned test and title are obtained, title is gone back using subtitle template then It is former.When being reduced to title using the above method, when subtitle file updates, new captioned test replaces subtitle template In old captioned test, and keep title constant.This is presently the most conventional captions alternative patterns, simple and fast.
If there is polytype title in subtitle file, title is gone back by subtitle template After original, the subtitle file for restoring will be changed into unified title, therefore, the method for existing reduction title cannot be right Polytype title present in subtitle file is reduced well.If additionally, will exist in subtitle file Polytype title all reduced, then need to make and polytype captions present in whole subtitle file belong to The corresponding multiple subtitle templates of property, so can excessive committed memory space.
The content of the invention
The purpose of exemplary embodiment of the present is regarding to the issue above, it is proposed that a kind of method for reducing title And device, to read, reduce the title of captions row data in real time, abandon the use to subtitle template.
The one side of exemplary embodiment of the present provides a kind of method for reducing title, and methods described includes:From The subtitle file of the multimedia file is obtained in multimedia file;Header data to the subtitle file is parsed, and is obtained To the global property of the subtitle file;Obtain current subtitle row data and current subtitle row data are parsed, worked as String attribute in the row attribute of preceding captions row data and the row of current subtitle row data;The current subtitle row data are divided For at least one text filed, wherein, each is text filed to include a merging attribute, and the merging attribute is the overall situation The superposition of string attribute in attribute, the row attribute, the row;Each attribute type that the merging attribute is included It is created as a corresponding attribute item;The all properties that the current subtitle row data are included are created as the current word The data syntax structure of curtain row data;Data syntax structure according to the current subtitle row data is entered to current subtitle row data Row reduction.
Alternatively, the current subtitle row data are divided into described at least one text filed step may include:Inspection Whether survey in the current subtitle row data comprising unique identifier;When in the current subtitle row data do not include specific identifier Fu Shi, by the current subtitle row data be defined as one it is text filed;When in the current subtitle row data include specific mark When knowing symbol, using the unique identifier as text filed decollator is divided, the current subtitle row data are divided into It is multiple text filed, wherein, the unique identifier is to be marked between the two neighboring character of the current subtitle row data Two neighboring character has the symbol of interior string attribute of not going together.
Alternatively, the attribute item may include the text filed a kind of attribute type for including, described text filed Starting character position and termination character position, a kind of property value of attribute type.
Alternatively, during the data syntax structure may include the form of the subtitle file, the current subtitle row data Including the number of all properties, all properties that include of the current subtitle row data.
Alternatively, any one text filed merging attribute for including can be obtained by following steps:To described complete Property under a bureau and the row attribute are merged, and obtain the text filed initial attribute;To the initial attribute and the row Interior string attribute is merged, and obtains the text filed merging attribute.
Alternatively, the global property and the row attribute are merged, obtains the text filed initial attribute The step of may include:Detect the attribute type with the presence or absence of row attribute in the attribute type of the global property;When the overall situation When there is the attribute type of row attribute in the attribute type of attribute, then updated with the property value of the attribute type of the row attribute Property value in the attribute type of the global property, using the global property after Update attribute value as initial attribute;When described When in the attribute type of global property in the absence of the attribute type of row attribute, then by the attribute type and the row of the row attribute The property value of the attribute type of attribute is added in global property, using the global property after addition as initial attribute.
Alternatively, string attribute in the initial attribute and the row is merged, obtains described text filed The step of merging attribute may include:Detect in the attribute type of the initial attribute with the presence or absence of string attribute in the row Attribute type;When there is the attribute type of string attribute in the row in the attribute type of the initial attribute, then institute is used The property value of the attribute type of string attribute in row is stated come the property value in the attribute type for updating the initial attribute, will more Initial attribute after new property value is used as the merging attribute;When in the attribute type of the initial attribute in the absence of in the row During the attribute type of string attribute, then by string attribute in the attribute type and the row of string attribute in the row The property value of attribute type is added in initial attribute, using the initial attribute after addition as the merging attribute.
Alternatively, the data syntax structure according to the current subtitle row data is reduced to current subtitle row data Step may include:The ith attribute that a data syntax structure that () obtains the current subtitle row data includes, 1≤i≤ The initial value of m, i is the number that 1, m is all properties that the current subtitle row data include, m is the natural number more than zero; B () is based on the attribute type that ith attribute item includes, the property value of the attribute type includes to ith attribute item The character that starting character position includes with termination character position is reduced;Whether (c) detection i is equal to m, as i ≠ m, makes I=i+1 is obtained, and returns to execution step (a), as i=m, terminate the step of being reduced to current subtitle row data.
The another aspect of exemplary embodiment of the present provides a kind of device for reducing title, and described device includes: Subtitle file acquiring unit, obtains the subtitle file of the multimedia file from multimedia file;First resolution unit, to institute The header data for stating subtitle file is parsed, and obtains the global property of the subtitle file;Second resolution unit, obtains current Captions row data are simultaneously parsed to current subtitle row data, obtain the row attribute and current subtitle line number of current subtitle row data According to row in string attribute;Division unit, it is text filed by being divided at least one in the current subtitle row data, its In, each is text filed to include a merging attribute, and the merging attribute is the global property, the row attribute, described The superposition of string attribute in row;Attribute item creating unit, each attribute type that the merging attribute includes is created It is a corresponding attribute item;Data syntax Structure Creating unit, all properties that the current subtitle row data are included Item is created as the data syntax structure of the current subtitle row data;Title reduction unit, according to the current subtitle row The data syntax structure of data is reduced to current subtitle row data.
Alternatively, division unit may include:Whether detection unit, specific mark is included in the detection current subtitle row data Know symbol;Text filed determining unit, when unique identifier is not included in the current subtitle row data, by the current subtitle Row data be defined as one it is text filed, when in the current subtitle row data include unique identifier when, by the specific mark Symbol is known as dividing text filed decollator, and it is text filed that the current subtitle row data are divided into multiple, wherein, institute It is that two neighboring character is marked between the two neighboring character of the current subtitle row data with difference to state unique identifier The symbol of string attribute in row.
Alternatively, the attribute item may include the text filed a kind of attribute type for including, an attribute The property value of type, the text filed starting character position and termination character position.
Alternatively, during the data syntax structure may include the form of the subtitle file, the current subtitle row data Including the number of all properties, all properties that include of the current subtitle row data.
Alternatively, division unit can also include:Initial attribute determining unit, enters to the global property and the row attribute Row merges, and obtains the text filed initial attribute;Merge attribute determining unit, to word in the initial attribute and the row Symbol string attribute is merged, and obtains the text filed merging attribute.
Alternatively, initial attribute determining unit can detect in the attribute type of the global property with the presence or absence of row attribute Attribute type, when there is the attribute type of row attribute in the attribute type of the global property, then with the category of the row attribute The property value of property type come the property value in the attribute type for updating the global property, by the global property after Update attribute value As initial attribute, when in the attribute type of the global property in the absence of the attribute type of row attribute, then the row is belonged to The property value of the attribute type of property and the attribute type of the row attribute is added in global property, by the global property after addition As initial attribute.
Alternatively, merge attribute determining unit to can detect in the attribute type of the initial attribute with the presence or absence of in the row The attribute type of string attribute, when the Attribute class that there is string attribute in the row in the attribute type of the initial attribute During type, then with the property value of the attribute type of string attribute in the row come in the attribute type for updating the initial attribute Property value, using the initial attribute after Update attribute value as the merging attribute, when in the attribute type of the initial attribute not When there is the attribute type of string attribute in the row, then by the attribute type and the row of string attribute in the row The property value of the attribute type of string attribute is added in initial attribute, and initial attribute after addition is merged into category as described Property.
Alternatively, title reduction unit can obtain what the data syntax structure of the current subtitle row data included Ith attribute, the initial value of 1≤i≤m, i is the number that 1, m is all properties that the current subtitle row data include, M is the natural number more than zero, and attribute type, the property value of the attribute type included based on ith attribute item are to i-th The character that the starting character position that attribute item includes includes with termination character position is reduced, and whether detection i is equal to m, As i ≠ m so that i=i+1, and obtain the ith attribute that the data syntax structure of the current subtitle row data includes , as i=m, end is reduced to current subtitle row data.
Using the method and apparatus of the reduction title of exemplary embodiment of the present, by by captions row data creation It is a data syntactic structure, and captions row data are reduced according to the data syntax structure, can effectively reduces internally The occupancy in space is deposited, the real-time to title reduction is improved.
Brief description of the drawings
By the detailed description for carrying out below in conjunction with the accompanying drawings, above and other purpose of exemplary embodiment of the present, spy Point and advantage will become apparent, wherein:
Fig. 1 is the flow chart of the method for showing reduction title according to an exemplary embodiment of the present invention;
Fig. 2 is to show flow the step of reduced to current subtitle row data according to an exemplary embodiment of the present invention Figure;
Fig. 3 is the block diagram of the device for showing reduction title according to an exemplary embodiment of the present invention.
Specific embodiment
The embodiment of the present invention is described in detail now, its example is illustrated in the accompanying drawings, wherein, identical label begins Same parts are represented eventually.Below with reference to the accompanying drawings embodiment is described to explain the present invention.
Fig. 1 is the flow chart of the method for showing reduction title according to an exemplary embodiment of the present invention.
Reference picture 1, in step slo, obtains the subtitle file of the multimedia file from multimedia file.Here, As an example, subtitle file can be the embedded captions or plug-in captions of multimedia file.Here, using existing decoding side Method is parsed to multimedia file, obtains the subtitle file of multimedia file.
In step S20, the header data to the subtitle file is parsed, and obtains the global category of the subtitle file Property.Typically when subtitle file is made, captions producer can pre-define captions text in the header data of subtitle file The global property (for example, global property 1, global property 2 ... ..., global property N) of part.By the head number to subtitle file According to being parsed, you can obtain the global property of subtitle file, here, can be using existing analytic method come from subtitle file The global property of subtitle file is parsed in header data.
Alternatively, the title of subtitle file may include text attribute, renderer property, special efficacy attribute.For example, text belongs to Property may include the attribute types such as font, font size, font color, background color;Renderer property may include caption area background color, The attribute types such as character edge sharpening, inside and outside back gauge;The attribute types such as special efficacy attribute may include to enter, wipe, mosaic.This In, at least one of above-mentioned attribute type is may include in each global property.
In step s 30, current subtitle row data are obtained and the current subtitle row data is parsed, obtain current String attribute in the row attribute of captions row data and the row of current subtitle row data.Alternatively, the action scope of row attribute is word The all characters included in curtain row data, the action scope of string attribute is the bebinning character of string attribute in the row in row The character included in position and termination character position.Here, captions row data refer to the corresponding caption data of setting time section, and The final a line captions for showing are not implied that.
In one example, subtitle file may include following content:
Header data:
Global property 1:
Global property 2:
……
Global property N:
Time period 1:Global property 1:Row attribute:<String attribute 1 in row, starting character position>Character string 1<Terminate word Symbol position><String attribute 2 in row, starting character position>Character string 2<Termination character position>
……
Time period N:Global property N:Row attribute:<String attribute 1 in row, starting character position>Character string 1<Terminate word Symbol position>……<String attribute M, starting character position in row>Character string M<Termination character position>
In the examples described above, 1~time period of time period N represents N number of time period of setting, with the corresponding captions of time period 1 Data:Global property 1;Row attribute;<String attribute 1 in row, starting character position>Character string 1<Termination character position><OK Interior string attribute 2, starting character position>Character string 2<Termination character position>, as one captions row data are (hereinafter referred to as First captions row data).
Based on above-mentioned form, finally it is shown as with the first captions row data:As a example by.Assuming that global Attribute 1 is font attribute type (for example, regular script), and the row attribute of the first captions row data is font size attribute type (for example, No. four Word), string attribute 1 is font format attribute type (for example, italic) in row, and the interior string attribute 2 of row belongs to for font format Property type (for example, underscore), then the corresponding first captions row data of the time period 1 in subtitle file may include following interior Hold:
00:10~00:40:Font attribute type:Font size attribute type:<Font format attribute type, 1>Samsung<2><Word Physique formula attribute type, 3>China Electronics<6>.
After being parsed to the first captions row data in step s 30, the row attribute of available first captions row data is Font size attribute type (for example, No. four words), and string attribute in two rows of current subtitle row data is obtained, character string in row Attribute 1 is font format attribute (for example, italic), and starting character position is the 1st character in row, and termination character position is row The 2nd interior character;String attribute 2 is font format attribute (for example, underscore) in row, and starting character position is in row 3rd character, termination character position is the 6th character in row.
In step s 40, that the current subtitle row data are divided into at least one is text filed.Alternatively, each text A merging attribute is may include in one's respective area, the merging attribute can be global property, the current subtitle row data of subtitle file Row attribute, in the row of current subtitle row data string attribute superposition.
Alternatively, the current subtitle row data are divided into described at least one text filed step may include:Inspection Whether survey in the current subtitle row data comprising unique identifier;When in the current subtitle row data do not include specific identifier Fu Shi, by the current subtitle row data be defined as one it is text filed;When in the current subtitle row data include specific mark When knowing symbol, using the unique identifier as text filed decollator is divided, the current subtitle row data are divided into It is multiple text filed.Here, unique identifier can be to mark institute between the two neighboring character of the current subtitle row data Stating two neighboring character has the symbol of interior string attribute of not going together.
In one example, finally it is shown as with the first captions row data with step S30: Example as a example by.Particularly, in the first captions row data comprising string attribute in two rows, then can in each row character Unique identifier is set before the starting character position of string attribute, comprising unique identifier in the first captions row data are detected When, can be divided with to the first captions row data using unique identifier as text filed decollator is divided.
Particularly, the starting character position of string attribute is respectively the 1st in two rows in the first captions row data Character and the 3rd character, then be respectively arranged with two unique identifiers at the 1st character and at the 3rd character, when detecting the 1st word Before symbol include unique identifier when, then by the 1st character and the later character of the 1st character be divided into one it is text filed, when When before detecting the 3rd character comprising unique identifier, then the 3rd character and the later character of the 3rd character are divided into another It is individual text filed.Based on above-mentioned dividing mode can by the first captions row data be divided into two it is text filed, first is text filed Starting character position be row in the 1st character, termination character position be row in the 2nd character, second is text filed Starting character position is the 3rd character in row, and termination character position is the 6th character in row.
Alternatively, any one text filed merging attribute for including can be obtained by following steps:To captions text The global property of part and the row attribute of current subtitle row data are merged, and obtain the text filed initial attribute;To institute State string attribute in the row of initial attribute and current subtitle row data to merge, obtain the text filed merging category Property.
For example, the row attribute of the global property and current subtitle row data to subtitle file is merged, the text is obtained The step of initial attribute of one's respective area, may include:Detect the attribute with the presence or absence of row attribute in the attribute type of the global property Type;When there is the attribute type of row attribute in the attribute type of the global property, then with the Attribute class of the row attribute The property value of type come the property value in the attribute type for updating the global property, using the global property after Update attribute value as Initial attribute;When in the attribute type of the global property in the absence of the attribute type of row attribute, then by the row attribute The property value of the attribute type of attribute type and the row attribute is added in global property, using the global property after addition as Initial attribute.
For example, being merged to string attribute in the row of the initial attribute and current subtitle row data, obtain described The step of text filed merging attribute, may include:Detect in the attribute type of the initial attribute with the presence or absence of word in the row Accord with the attribute type of string attribute;When the attribute type that there is string attribute in the row in the attribute type of the initial attribute When, then with the property value of the attribute type of string attribute in the row come the category in the attribute type for updating the initial attribute Property value, using the initial attribute after Update attribute value as the merging attribute;Do not deposited when in the attribute type of the initial attribute In the row during attribute type of string attribute, then by word in the attribute type and the row of string attribute in the row The property value for according with the attribute type of string attribute is added in initial attribute, and initial attribute after addition is merged into category as described Property.
In one example, finally it is shown as with the first captions row data with step S30: Example as a example by.Particularly, after execution of step S20, the global property 1 that can obtain the subtitle file in example is font Attribute type (for example, regular script).After execution of step S30, the row attribute that can obtain the first captions row data is font size attribute class Type (for example, No. four words), string attribute in two rows of the first captions row data, string attribute 1 is font format in row String attribute 2 is font format attribute type (for example, underscore), and the first word in attribute type (for example, italic), row Curtain row data be divided into two it is text filed, correspondingly the first captions row data have two merging attributes.
Here, introduced as a example by determining the first text filed merging attribute and obtain any one text filed middle bag The step of merging attribute for including.Particularly, because global property 1 is font attribute type (for example, regular script), and the first captions The row attribute of row data is font size attribute type (for example, No. four words), then show in the attribute type of global property 1 in the absence of the , then be added to the property value of font size attribute type and font size attribute type entirely by the attribute type of the row attribute of one captions row data In property 1 under a bureau, the global property 1 of property value of font size attribute type and font size attribute type will be with the addition of as initial attribute. In the case, initial attribute includes font attribute type (for example, regular script) and font size attribute type (for example, No. four words).
Then, because initial attribute includes font attribute type (for example, regular script) and font size attribute type (for example, four Number word), and string attribute 1 is font format attribute type (for example, italic) in row, then show in initial attribute in the absence of row , then be added to the property value of font format attribute type and font format attribute type in initial attribute by interior string attribute 1, The initial attribute that the property value of font format attribute type and font format attribute type will be with the addition of is text filed as first Merging attribute.
From above-mentioned example, the starting character position of the first text filed merging attribute is the 1st character in row, Termination character position is the 2nd character in row, and the attribute type of the first text filed merging attribute includes font attribute class Type, font size attribute type, font format attribute type, i.e. in the first captions row dataTwo merging category of character Property is regular script, No. four, italic.Similarly, the attribute type of the second text filed merging attribute includes font attribute type, word Number attribute type, font format attribute type, i.e. in the first captions row dataFour merging category of character Property be regular script, No. four, underline.
In step s 50, each attribute type that the merging attribute includes is created as a corresponding attribute .Alternatively, the attribute item may include the text filed a kind of attribute type for including, a kind of attribute type Property value, the text filed starting character position and termination character position.
In one example, finally it is shown as with the first captions row data with step S30: Example as a example by, the font format attribute type that the first text filed merging attribute includes is created as attribute item, the category Property include:Font format attribute type, the first text filed starting character position (that is, the 1st character in row), end Character position (that is, the 2nd character in row), the property value of font format attribute type.
In step S60, all properties that the current subtitle row data are included are created as the current subtitle The data syntax structure of row data.Alternatively, the data syntax structure may include the form of the subtitle file, described current The all properties that the number of all properties that captions row data include, the current subtitle row data include.
In one example, finally it is shown as with the first captions row data with step S30: Example as a example by, all properties that current subtitle row data are included item is created as the data syntax knot of current subtitle row data Structure.Particularly, the data syntax structure of current subtitle row data may include:The form (for example, ssa) of subtitle file, attribute The content that the number 6 of item, each attribute item include.
Specifically, the first attribute item includes:Font format attribute type, the 2nd in the 1st character, row in row Character, the property value of font format attribute type;Second attribute item includes:Font size attribute type, the 1st character, OK in row The 2nd interior character, the property value of font size attribute type;3rd attribute item includes:Font attribute type, the 1st word in row The 2nd character in symbol, row, the property value of font attribute type;4th attribute item includes:Font attribute type, the in row the 3rd The 6th character in individual character, row, the property value of font attribute type;5th attribute item includes:Font size attribute type, in row The 3rd character, the 6th character in row, the property value of font size attribute type;6th attribute item includes:Font format attribute Type, the 3rd character, the 6th character in row, the property value of font format attribute type in row.
In step S70, the data syntax structure according to the current subtitle row data is to the current subtitle row data Reduced.
Fig. 2 is to show flow the step of reduced to current subtitle row data according to an exemplary embodiment of the present invention Figure.
Reference picture 2, in step s 701, obtains the data syntax structure of the current subtitle row data includes i-th Individual attribute item.Here, the initial value of 1≤i≤m, i is the individual of all properties that the current subtitle row data include for 1, m Number, m is the natural number more than zero.
In step S702, attribute type, the property value of the attribute type included based on ith attribute item are to the The character that the starting character position that i attribute item includes includes with termination character position is reduced.For example, can be by i-th The attribute type that individual attribute item includes is applied in the starting character position and termination character position that ith attribute item includes Including character on, and the property value of the attribute type is updated to the ith attribute property value that includes of item.
In step S703, whether detection i is equal to m.As i ≠ m so that i=i+1, and return to execution step S701.This The method of the reduction title of invention exemplary embodiment is that captions row data are reduced one by one, as i=m, is then terminated The step of current subtitle row data are reduced, and return to the execution step S30 next captions row data of acquisition.
In one example, finally it is shown as with the first captions row data with step S30: Example as a example by.Particularly, due to including 6 attribute items in the data syntax structure of the first captions row data altogether, then can be first Obtain first attribute item in the data syntax structure of current subtitle row data, and the word included using first attribute item Physique formula attribute type, the property value of font format attribute type are carried out to the 2nd character in the 1st character and row in row Reduction, then detects whether i is equal to m, due to i=1 and m=6 here, then i ≠ m so that i=i+1, i.e. i=2 continue to obtain the Second attribute item in the data syntax structure of one captions row data, until during i=m=6, being gone back to the first captions row data Original terminates, then the next captions row data of continuation acquisition, and repeats the reduction title of exemplary embodiment of the present Step S30~step S70, until whole caption data reduction are finished.
Moreover, it should be understood that the method for above-mentioned reduction title according to an exemplary embodiment of the present invention can be implemented It is the computer code in computer readable recording medium storing program for performing.Those skilled in the art can be according to the description to the above method come real The existing computer code.The upper of exemplary embodiment of the present is realized when the computer code is performed in a computer State method.
Fig. 3 is the block diagram of the device for showing reduction title according to an exemplary embodiment of the present invention.
As shown in figure 3, the device of reduction title according to an exemplary embodiment of the present invention includes:Subtitle file is obtained Unit 10, the first resolution unit 20, the second resolution unit 30, division unit 40, attribute item creating unit 50, data syntax structure Creating unit 60, title reduction unit 70.These units can be logical by digital signal processor, field programmable gate array etc. Realized with hardware processor, can also be realized by dedicated hardware processors such as special chips, can also completely pass through computer Program is realized with software mode.
Specifically, subtitle file acquiring unit 10 obtains the captions text of the multimedia file from multimedia file Part.Here, as an example, the subtitle file can be the embedded captions or plug-in captions of multimedia file.Here, captions text Part acquiring unit 10 can realize parsing multimedia file for existing decoder, obtain the captions of multimedia file File.
The header data of first 20 pairs of subtitle files of resolution unit is parsed, and obtains the overall situation of the subtitle file Attribute.Typically when subtitle file is made, captions producer can pre-define captions in the header data of subtitle file The global property (for example, global property 1, global property 2 ... ..., global property N) of file.By the head to subtitle file Data are parsed, you can obtain the global property of subtitle file, and here, the first resolution unit 20 can utilize existing parsing side Method parses the global property of subtitle file from the header data of subtitle file.
Alternatively, the title of the subtitle file may include text attribute, renderer property, special efficacy attribute.For example, literary This attribute may include the attribute types such as font, font size, font color, background color;Renderer property may include caption area background The attribute types such as color, character edge sharpening, inside and outside back gauge;The Attribute class such as special efficacy attribute may include to enter, wipe, mosaic Type.Here, may include at least one of above-mentioned attribute type in each global property.
Second resolution unit 30 obtains current subtitle row data and current subtitle row data is parsed, and obtains current word String attribute in the curtain row attribute of row data and the row of current subtitle row data.Here, captions row data refer to setting time The corresponding caption data of section, and do not imply that a line captions of final display.Alternatively, the action scope of row attribute is captions line number The all characters included in, row in string attribute action scope be in the row starting character position of string attribute and The character included in termination character position.
Due in Fig. 1 the step of S30 in the function of the second resolution unit 30 has been described in detail, herein not Repeat again.
It is text filed that the current subtitle row data are divided at least one by division unit 40.Alternatively, each text A merging attribute is may include in region, the merging attribute can be the global property of subtitle file, current subtitle row data The superposition of string attribute in row attribute, the row of current subtitle row data.
Alternatively, division unit 40 may include:Detection unit and text filed determining unit.
For example, whether detection unit can detect in the current subtitle row data comprising unique identifier.Here, the spy It is that the two neighboring character is marked between the two neighboring character of the current subtitle row data with difference to determine identifier The symbol of string attribute in row.
When unique identifier is not included in the current subtitle row data, text filed determining unit is by the current word Curtain row data be defined as one it is text filed;It is text filed true when unique identifier is included in the current subtitle row data Used as text filed decollator is divided, the current subtitle row data are divided into the unique identifier many by order unit It is individual text filed.
Due in Fig. 1 the step of S40 in the detection unit in division unit 40 and text filed determining unit Function be described in detail, will not be repeated here.
Alternatively, division unit 40 can also include initial category in addition to including detection unit and text filed determining unit Property determining unit and merge attribute determining unit.
Initial attribute determining unit is merged to the global property of subtitle file and the row attribute of current subtitle row data, Obtain the text filed initial attribute.
For example, with the presence or absence of the row attribute in the attribute type of the initial attribute determining unit detection global property Attribute type, when there is the attribute type of row attribute in the attribute type of the global property, then with the category of the row attribute The property value of property type come the property value in the attribute type for updating the global property, by the global property after Update attribute value As initial attribute, when in the attribute type of the global property in the absence of the attribute type of row attribute, then the row is belonged to The property value of the attribute type of property and the attribute type of the row attribute is added in global property, by the global property after addition As initial attribute.
Merge attribute determining unit to close string attribute in the row of the initial attribute and current subtitle row data And, obtain the text filed merging attribute.
For example, with the presence or absence of character in the row in the attribute type of the merging attribute determining unit detection initial attribute The attribute type of string attribute, when the attribute type that there is string attribute in the row in the attribute type of the initial attribute When, then with the property value of the attribute type of string attribute in the row come the category in the attribute type for updating the initial attribute Property value, the initial attribute after Update attribute value as the merging attribute is not deposited when in the attribute type of the initial attribute In the row during attribute type of string attribute, then by word in the attribute type and the row of string attribute in the row The property value for according with the attribute type of string attribute is added in initial attribute, and initial attribute after addition is merged into category as described Property.
Due in Fig. 1 the step of S40 in the initial attribute determining unit in division unit 40 and merge attribute The function of determining unit has been described in detail, and will not be repeated here.
Each attribute type that the merging attribute includes is created as corresponding one by attribute item creating unit 50 Attribute item.Alternatively, the attribute item may include the text filed a kind of attribute type for including, a kind of Attribute class The property value of type, the text filed starting character position and termination character position.
Due in Fig. 1 the step of S50 in the function of attribute item creating unit 50 has been described in detail, herein Repeat no more.
The all properties that data syntax Structure Creating unit 60 includes the current subtitle row data are created as institute State the data syntax structure of current subtitle row data.Alternatively, the data syntax structure may include the lattice of the subtitle file It is all that the number of all properties that formula, the current subtitle row data include, the current subtitle row data include Attribute item.
Due in Fig. 1 the step of S60 in the function of attribute item creating unit 60 has been described in detail, herein Repeat no more.
Title reduction unit 70 is according to the data syntax structure of the current subtitle row data to the current subtitle Row data are reduced.
Particularly, during title reduction unit 70 obtains the data syntax structure of the current subtitle row data first Including ith attribute, here, the initial value of 1≤i≤m, i is all category that the current subtitle row data include for 1, m Property number, m is the natural number more than zero, then attribute type, the attribute type included based on ith attribute item Property value is reduced to the character that the starting character position that ith attribute item includes includes with termination character position, so Afterwards whether detection i is equal to m, as i ≠ m so that i=i+1, and obtains the data syntax structure of the current subtitle row data Including ith attribute, as i=m, end is reduced to current subtitle row data.Here, title reduction unit 70 is that captions row data are reduced one by one, as i=m, then terminates the step of being reduced to current subtitle row data, and by Second resolution unit 30 continues to obtain next captions row data, until whole caption data reduction are finished.
Using the method and apparatus of the reduction title of exemplary embodiment of the present, the word in subtitle file can be directed to Curtain row data create data syntax structure one by one, and are reduced line by line, make have real-time to the reduction of captions row data.This Outward, due to being, to captions row data creation data syntax structure, to be effectively reduced the occupancy to memory headroom.
Although the present invention, those skilled in the art are particularly shown and described with reference to its exemplary embodiment It should be understood that in the case where the spirit and scope of the present invention that claim is limited are not departed from, form can be carried out to it With the various changes in details.

Claims (16)

1. a kind of method for reducing title, methods described includes:
The subtitle file of the multimedia file is obtained from multimedia file;
Header data to the subtitle file is parsed, and obtains the global property of the subtitle file;
Obtain current subtitle row data and the current subtitle row data are parsed, obtain the row category of current subtitle row data String attribute in the row of property and current subtitle row data, wherein, the action scope of row attribute is the institute included in captions row data There is character, the action scope of string attribute is the starting character position of string attribute and termination character position in the row in row In the character that includes;
The current subtitle row data are divided into it is at least one text filed, wherein, each is text filed to include a conjunction And attribute, the merging attribute is the global property, the row attribute, in the row string attribute superposition;
Each attribute type that the merging attribute includes is created as a corresponding attribute item;
The all properties item that the current subtitle row data are included is created as the data syntax of the current subtitle row data Structure;
Data syntax structure according to the current subtitle row data is reduced to the current subtitle row data.
2. method according to claim 1, wherein, the current subtitle row data are divided at least one text The step of region, includes:
Whether detect in the current subtitle row data comprising unique identifier;
When unique identifier is not included in the current subtitle row data, the current subtitle row data are defined as a text One's respective area;
It is when unique identifier is included in the current subtitle row data, the unique identifier is text filed as dividing Decollator, the current subtitle row data are divided into it is multiple text filed,
Wherein, the unique identifier is that described adjacent two are marked between the two neighboring character of the current subtitle row data Individual character has the symbol of interior string attribute of not going together.
3. method according to claim 1, wherein, the attribute item includes the text filed attribute for including Type, a kind of property value of attribute type, the text filed starting character position and termination character position.
4. method according to claim 1, wherein, the data syntax structure includes form, the institute of the subtitle file State the number of all properties that current subtitle row data include, all properties that the current subtitle row data include .
5. method according to claim 1, wherein, any one text filed merging attribute for including is by following step It is rapid obtained:
The global property and the row attribute are merged, the text filed initial attribute is obtained;
String attribute in the initial attribute and the row is merged, the text filed merging attribute is obtained.
6. method according to claim 5, wherein, the global property and the row attribute are merged, obtain institute The step of stating text filed initial attribute includes:
Detect the attribute type with the presence or absence of row attribute in the attribute type of the global property;
When there is the attribute type of row attribute in the attribute type of the global property, then with the attribute type of the row attribute Property value come the property value in the attribute type for updating the global property, using the global property after Update attribute value as first Beginning attribute;
When in the attribute type of the global property in the absence of the attribute type of row attribute, then by the Attribute class of the row attribute The property value of the attribute type of type and the row attribute is added in global property, using the global property after addition as initial category Property.
7. method according to claim 5, wherein, string attribute in the initial attribute and the row is closed And, include the step of obtain the text filed merging attribute:
Detect the attribute type with the presence or absence of string attribute in the row in the attribute type of the initial attribute;
When there is the attribute type of string attribute in the row in the attribute type of the initial attribute, then with the row The property value of the attribute type of string attribute come the property value in the attribute type for updating the initial attribute, by Update attribute Initial attribute after value is used as the merging attribute;
When in the attribute type of the initial attribute in the absence of the attribute type of string attribute in the row, then by the row The property value of the attribute type of string attribute is added in initial attribute in the attribute type of interior string attribute and the row, Using the initial attribute after addition as the merging attribute.
8. method according to claim 3, wherein, the data syntax structure according to the current subtitle row data is to current The step of captions row data are reduced includes:
The ith attribute that a data syntax structure that () obtains the current subtitle row data includes, 1≤i's≤m, i is first It is number that 1, m is all properties that include of the current subtitle row data to be worth, and m is the natural number more than zero;
B attribute type, the property value of the attribute type that () is included based on ith attribute item in ith attribute to wrapping The character that the starting character position for including includes with termination character position is reduced;
Whether (c) detection i is equal to m, as i ≠ m so that i=i+1, and returns to execution step (a), as i=m, terminates to working as The step of preceding captions row data are reduced.
9. a kind of device for reducing title, described device includes:
Subtitle file acquiring unit, obtains the subtitle file of the multimedia file from multimedia file;
First resolution unit, the header data to the subtitle file is parsed, and obtains the global property of the subtitle file;
Second resolution unit, obtains current subtitle row data and current subtitle row data is parsed, and obtains current subtitle row String attribute in the row attribute of data and the row of current subtitle row data, wherein, the action scope of row attribute is captions row data In all characters for including, the action scope of string attribute is the starting character position of string attribute and knot in the row in row The character included in beam character position;
Division unit, the current subtitle row data are divided into it is at least one text filed, wherein, each text filed middle bag A merging attribute is included, the merging attribute is the global property, the row attribute, string attribute is folded in the row Plus;
Attribute item creating unit, a corresponding attribute is created as by each attribute type that the merging attribute includes ;
Data syntax Structure Creating unit, all properties item that the current subtitle row data are included is created as described current The data syntax structure of captions row data;
Title reduction unit, the data syntax structure according to the current subtitle row data is carried out to current subtitle row data Reduction.
10. device according to claim 9, wherein, division unit includes:
Whether detection unit, unique identifier is included in the detection current subtitle row data;
Text filed determining unit, when unique identifier is not included in the current subtitle row data, by the current subtitle Row data be defined as one it is text filed, when in the current subtitle row data include unique identifier when, by the specific mark Symbol is known as dividing text filed decollator, and it is text filed that the current subtitle row data are divided into multiple,
Wherein, the unique identifier is that described adjacent two are marked between the two neighboring character of the current subtitle row data Individual character has the symbol of interior string attribute of not going together.
11. devices according to claim 9, wherein, the attribute item includes the text filed kind for including Property type, a kind of property value of attribute type, the text filed starting character position and termination character position.
12. devices according to claim 9, wherein, the data syntax structure includes form, the institute of the subtitle file State the number of all properties that current subtitle row data include, all properties that the current subtitle row data include .
13. devices according to claim 9, wherein, division unit also includes:
Initial attribute determining unit, merges to the global property and the row attribute, obtain it is described it is text filed just Beginning attribute;
Merge attribute determining unit, string attribute in the initial attribute and the row is merged, obtain the text The merging attribute in region.
14. devices according to claim 13, wherein, initial attribute determining unit detects the Attribute class of the global property With the presence or absence of the attribute type of row attribute in type, when the attribute type that there is row attribute in the attribute type of the global property When, then with the property value of the attribute type of the row attribute come the property value in the attribute type for updating the global property, will Global property after Update attribute value as initial attribute, when the category in the attribute type of the global property in the absence of row attribute During property type, then the property value of the attribute type of the row attribute and the attribute type of the row attribute is added to global property In, using the global property after addition as initial attribute.
15. devices according to claim 13, wherein, merge the Attribute class that attribute determining unit detects the initial attribute With the presence or absence of the attribute type of string attribute in the row in type, when there is the row in the attribute type of the initial attribute During the attribute type of interior string attribute, then update described first with the property value of the attribute type of string attribute in the row Property value in the attribute type of beginning attribute, using the initial attribute after Update attribute value as the merging attribute, when described first When not existing the attribute type of string attribute in the row in the attribute type of beginning attribute, then by string attribute in the row Attribute type and the row in the property value of attribute type of string attribute be added in initial attribute, by addition after just Beginning attribute is used as the merging attribute.
16. devices according to claim 9, wherein, title reduction unit obtains the current subtitle row data The ith attribute that data syntax structure includes, the initial value of 1≤i≤m, i is that 1, m is bag in the current subtitle row data The number of all properties for including, m is the natural number more than zero, based on attribute type, the category that ith attribute item includes Property type property value the character that the starting character position that includes of ith attribute item includes with termination character position is carried out Whether reduction, detection i is equal to m, as i ≠ m so that i=i+1, and obtains the data syntax knot of the current subtitle row data The ith attribute that structure includes, as i=m, end is reduced to current subtitle row data.
CN201410346247.9A 2014-07-18 2014-07-18 The method and apparatus for reducing title Active CN104093063B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410346247.9A CN104093063B (en) 2014-07-18 2014-07-18 The method and apparatus for reducing title

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410346247.9A CN104093063B (en) 2014-07-18 2014-07-18 The method and apparatus for reducing title

Publications (2)

Publication Number Publication Date
CN104093063A CN104093063A (en) 2014-10-08
CN104093063B true CN104093063B (en) 2017-06-27

Family

ID=51640736

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410346247.9A Active CN104093063B (en) 2014-07-18 2014-07-18 The method and apparatus for reducing title

Country Status (1)

Country Link
CN (1) CN104093063B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106454486B (en) * 2016-10-28 2019-08-16 青岛海信电器股份有限公司 Caption presentation method and subtitling display equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1855479A1 (en) * 2005-02-28 2007-11-14 Matsushita Electric Industrial Co., Ltd. Subtitle display
CN101355697A (en) * 2008-09-17 2009-01-28 深圳市同洲电子股份有限公司 Method and device for displaying caption
CN102082934A (en) * 2009-11-30 2011-06-01 新奥特(北京)视频技术有限公司 Caption object updating method and device
CN102082933A (en) * 2009-11-30 2011-06-01 新奥特(北京)视频技术有限公司 Subtitle making system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1879403A (en) * 2003-11-10 2006-12-13 皇家飞利浦电子股份有限公司 Adaptation of close-captioned text based on surrounding video content

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1855479A1 (en) * 2005-02-28 2007-11-14 Matsushita Electric Industrial Co., Ltd. Subtitle display
CN101355697A (en) * 2008-09-17 2009-01-28 深圳市同洲电子股份有限公司 Method and device for displaying caption
CN102082934A (en) * 2009-11-30 2011-06-01 新奥特(北京)视频技术有限公司 Caption object updating method and device
CN102082933A (en) * 2009-11-30 2011-06-01 新奥特(北京)视频技术有限公司 Subtitle making system

Also Published As

Publication number Publication date
CN104093063A (en) 2014-10-08

Similar Documents

Publication Publication Date Title
CN102289667B (en) The user of the mistake occurred in the text document to experience optical character identification (OCR) process corrects
US11216425B2 (en) System and method of recognizing data in a table area from unstructured data
US8627203B2 (en) Method and apparatus for capturing, analyzing, and converting scripts
JPH10124289A (en) Binary data encoding method
US10261884B2 (en) Method for correcting violation of source code and computer readable recording medium having program performing the same
CN109492177B (en) web page blocking method based on web page semantic structure
US7602972B1 (en) Method and apparatus for identifying white space tables within a document
WO2022188510A1 (en) Method and device for reviewing video, and computer readable storage medium
WO2017088479A1 (en) Method of identifying digital on-screen graphic and device
US20160092409A1 (en) Method for obfuscating the display of text
US9049400B2 (en) Image processing apparatus, and image processing method and program
CN104093063B (en) The method and apparatus for reducing title
JP2019105910A (en) Display verification apparatus, display verification method and display verification program
US20070071278A1 (en) Method and computer-readable medium for shuffling an asian document image
CN114529933A (en) Contract data difference comparison method, device, equipment and medium
US20190188466A1 (en) Method, system and apparatus for processing a page of a document
CN106293671B (en) Method and device for generating component template
CN104536947A (en) Layout document processing method and device
JP5720182B2 (en) Image processing apparatus and image processing program
CN112541505B (en) Text recognition method, text recognition device and computer-readable storage medium
CN105512100B (en) A kind of printed page analysis method and device
CN110909323B (en) Remote sensing image stream forwarding tracing method based on XML multi-label watermark
Zayene et al. Semi-automatic news video annotation framework for arabic text
CN102082922B (en) Method and device for updating subtitles in subtitle templates
CN101325642B (en) Information processing apparatus and method thereof

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant