CN111399788B - Media file playing method and media file playing device - Google Patents

Media file playing method and media file playing device Download PDF

Info

Publication number
CN111399788B
CN111399788B CN201811633177.XA CN201811633177A CN111399788B CN 111399788 B CN111399788 B CN 111399788B CN 201811633177 A CN201811633177 A CN 201811633177A CN 111399788 B CN111399788 B CN 111399788B
Authority
CN
China
Prior art keywords
media file
played
format
text
file
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
CN201811633177.XA
Other languages
Chinese (zh)
Other versions
CN111399788A (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.)
Xian Novastar Electronic Technology Co Ltd
Original Assignee
Xian Novastar Electronic 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 Xian Novastar Electronic Technology Co Ltd filed Critical Xian Novastar Electronic Technology Co Ltd
Priority to CN201811633177.XA priority Critical patent/CN111399788B/en
Publication of CN111399788A publication Critical patent/CN111399788A/en
Application granted granted Critical
Publication of CN111399788B publication Critical patent/CN111399788B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/14Digital output to display device ; Cooperation and interconnection of the display device with other functional units

Abstract

The embodiment of the application discloses a media file playing method, which comprises the following steps: acquiring a media file to be played; judging the format of the media file to be played; if the format of the media file to be played is a text file format, reading the content of the media file to be played, and converting the content of the media file to be played into a picture group; and playing the picture group. The embodiment of the application also discloses a media file playing device. The embodiment of the application can play the text file on the media playing device, and can set the attributes such as the color (foreground color), background color, character font, font size, line spacing, character spacing, alignment mode and the like of characters, thereby realizing lossless playing.

Description

Media file playing method and media file playing device
Technical Field
The present application relates to the field of media playing technologies, and in particular, to a media file playing method and a media file playing device.
Background
With the increasing development of media playback technology, the type of media played is no longer limited to video and images. Text is a legacy media type and can also convey information to people, especially in the LED (Light Emitting Diode) display industry, text playback still occupies a large part of application scenes. Most of the current media playing software only can play video or image files, but the text playing function is not yet integrated into the media playing software. This limits to some extent the application scenarios of media playing software, such as text playing displays of the LED display industry.
Therefore, it is important to provide a text playing implementation scheme based on the existing media playing device.
Disclosure of Invention
The embodiment of the application provides a video source switching playing method and a video source switching playing system, which can play text files on a media playing device, and can set attributes such as text color (foreground color), background color, text font, font size, line spacing, word spacing, alignment mode and the like, so as to realize lossless playing.
In one aspect, a method for playing a media file provided by an embodiment of the present application includes: acquiring a media file to be played; judging the format of the media file to be played; if the format of the media file to be played is a text file format, reading the content of the media file to be played, and converting the content of the media file to be played into a picture group; and playing the picture.
In one embodiment of the present application, the media file playing method further includes: and if the format of the media file to be played is a video file format or an image file format, playing the media file to be played.
In one embodiment of the present application, the converting the content of the media file to be played into a group of pictures specifically includes: setting text parameters, screen height and screen width; reading the content of the media file to be played; creating at least one subgraph according to the text parameters and the screen width; drawing the content of the media file to be played on the subgraph according to the text parameters and the content of the media file to be played; and combining the subgraphs according to the text parameters and the screen height to obtain the picture group. According to the embodiment, the effect of playing the text file on the media playing device can be achieved by converting the content of the media file to be played into the picture group, and the limitation that the existing media playing device cannot play the text file is solved; through setting up text parameter, screen height and screen width, can realize setting up text parameter, increase the practicality, the text typeface of broadcasting can realize harmless broadcast, has very high definition.
In one embodiment of the present application, each of the sub-graphs is used for displaying the content of the media file to be played after a line of drawing. In this embodiment, each sub-graph is used to display the content of the media file to be played after one line of drawing, so as to conform to the content reading and writing mode of the text file, thereby improving the content reading efficiency of the media file to be played, and further improving the playing efficiency of the media file realized by the media file playing method in this embodiment.
In one embodiment of the application, the text parameter is selected from one or more of background color, text color, font size, font, alignment, word spacing, and line spacing.
In one embodiment of the present application, the subgraph is in a Bitmap format, and the group of pictures is in a PNG format.
In still another aspect, an embodiment of the present application provides a media file playing device, including: the file acquisition module is used for acquiring a media file to be played; the format judging module is used for judging the format of the media file to be played; the text conversion module is used for reading the content of the media file to be played if the format of the media file to be played is a text file format, and converting the content of the media file to be played into a picture group; and the media playing module is used for playing the picture group.
In one embodiment of the present application, the media playing module is further configured to: and if the format of the media file to be played is a video file format or an image file format, playing the media file to be played.
In one embodiment of the present application, the text conversion module includes: the parameter setting unit is used for setting text parameters, screen height and screen width; a file content reading unit, configured to read the content of the media file to be played; the sub-image creation unit is used for creating at least one sub-image according to the text parameters and the screen width; the drawing unit is used for drawing the content of the media file to be played on the subgraph according to the text parameter and the content of the media file to be played; and the combination unit is used for combining the subgraphs according to the text parameters and the screen height so as to obtain the picture group.
In one embodiment of the present application, each of the sub-graphs is used for displaying the content of the media file to be played after a line of drawing, the sub-graphs are in Bitmap format, the group of pictures are in PNG format, and the text parameter is selected from one or more of background color, text color, font size, font, alignment mode, word spacing and line spacing.
The technical scheme can have one or more of the following advantages: the text file can be played on the media playing device, so that the limitation that the existing media playing device cannot play the text file is solved; the characters can be set with the properties of color, background color, characters, line spacing, character spacing, alignment mode and the like, so that the practicability is increased; meanwhile, the played text fonts can be played in a lossless manner, and have high definition.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for the description of the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1A is a flowchart illustrating a media file playing method according to a first embodiment of the present application;
FIG. 1B is a flowchart illustrating the step S15 in the first embodiment of the present application;
fig. 1C is a schematic diagram illustrating a combination of pictures obtained by combining sub-pictures according to a first embodiment of the present application;
FIG. 1D is a schematic diagram of the content of a text file according to an embodiment of the present application;
FIG. 1E is a screenshot of a playback interface after converting a text file into a picture in an embodiment of the present application;
fig. 2 is a schematic structural diagram of a media file playing device according to a second embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
First embodiment
As shown in fig. 1A, a media file playing method 10 according to a first embodiment of the present application mainly includes:
step S11, obtaining a media file to be played. The file to be played may be obtained, for example, through a storage path of the media file to be played.
Step S13: and judging the format of the media file to be played. Specifically, the format of the media file to be played may be determined according to the suffix name of the media file to be played, so as to determine that the media file to be played is a text file, a video file, an image file or other types of files according to the format. For example, the suffix name corresponding to the text file is txt, word, or the like, the suffix name corresponding to the video file is MP4, 3GP, FLV, MKV, AVI, MOV, or the like, and the suffix name corresponding to the picture file is MPG, bitmap, JPEG, PNG, or the like.
And step S15, if the format of the media file to be played is a text file format, reading the content of the media file to be played, and converting the content of the media file to be played into a picture group. Specifically, for example, if the suffix name of the media file to be played is txt, the format of the media file to be played is a text file format. And
and S17, playing the picture group. The group of pictures is played, for example, using a media playing device, such as a media player.
Further, the media file playing method 10 further includes, for example:
and S19, if the format of the media file to be played is a video file format or an image file format, playing the media file to be played. And when the format of the media file to be played is neither a text file format nor a video file format or an image file format, the execution of the media file playing method 10 is ended.
As shown in fig. 1B, step S15 includes, for example, the sub-steps of:
step S151: setting text parameters, screen height and screen width. In particular, the text parameter is for example selected from one or more of background color, text color, font size, font, alignment, word spacing and line spacing. The background color is the background color of the picture group; the text color is the color of the content of the media file to be played, namely the text and the like, to be finally displayed on the picture group; the character color, the font size, the font, the alignment mode, the character spacing and the line spacing are respectively the color of the font to be finally displayed on the picture group, the font size, the font type, the alignment mode of the font content, the spacing between the fonts and the spacing between two adjacent lines of fonts, wherein the content of the media file to be played, namely the characters and the like, are displayed on the picture group.
Step S153: and reading the content of the media file to be played.
Step S155: and creating at least one subgraph according to the text parameter and the screen width.
Step S157: and drawing the content of the media file to be played on the subgraph according to the text parameters and the content of the media file to be played. And
step S159: and combining the subgraphs according to the text parameters and the screen height to obtain the picture group.
The execution of the sub-steps of step S15 is described in detail below: for example, firstly setting parameters such as background color, character color, font size, font, alignment mode, character spacing, line spacing, screen height and screen width for playing text file content; then reading the content of the text file, distinguishing each paragraph according to the line feed character "\n", and storing each paragraph by using a container; then instantiating a Bitmap (Bitmap file) according to the parameters of the width of the screen, the size of the font, the background color and the like, wherein the width and the height of the Bitmap are respectively equal to the width of the screen and the height of the font, and the Bitmap can be used for displaying the content after one line of drawing; then according to the parameters of character color, character size, character style, alignment mode, character spacing and the like, instantiating a drawing pen, drawing the content of each paragraph of the text file on a Bitmap image, and fully drawing a Bitmap image or drawing a paragraph, instantiating a Bitmap image until all the content of the text file is drawn on a series of Bitmap images; and then according to the height of the screen body and the set row spacing, the series of Bitmap images are arranged and combined into a PNG image group, namely a group of PNG images, for example, a combined schematic diagram shown in fig. 1C, the spacing between two adjacent Bitmap images (namely, two adjacent rows after drawing) is equal to the row spacing, gaps with the row spacing are filled among the Bitmap images and then are spliced until the height after splicing is equal to the height of the screen body, one PNG (Portable Network Graphic Format) image is obtained after the combination, and then the rest Bitmap images are spliced and combined continuously according to the combination method shown in fig. 1C until all Bitmap images are spliced and combined, and finally a group of PNG images are obtained, wherein each PNG image is a page text displayed on the screen body for playing the text file content.
Each sub-graph is used for displaying the content of the media file to be played after one line of drawing.
The subgraph is in a Bitmap format, and the picture group is in a PNG format. PNG uses a lossless data compression algorithm derived from LZ77, with the result that a high compression ratio is obtained without losing data. The repeated data are marked by a special coding method, so that the color of the image is not influenced, the color loss is not possible, and the repeated storage can be realized without reducing the image quality.
Referring to fig. 1D and 1E, a to-be-played media file is, for example, a text file in txt format with contents shown in fig. 1D, and an effect diagram of the to-be-played media file playing method 10 according to the first embodiment of the present application is shown in fig. 1E after converting the text file shown in fig. 1D into a picture. It can be seen that the method 10 for playing a media file according to the first embodiment of the present application can play a text file on a media playing device with high definition.
Second embodiment
As shown in fig. 2, a media file playing device 20 according to a second embodiment of the present application mainly includes: a file acquisition module 21, a format judgment module 23, a text conversion module 25, and a media playing module 27. The media file playing device 20 is for example used to perform the media file playing method 10 according to the first embodiment, and the functions and uses of the respective components of the media file playing device 20 are briefly described below, and other specific procedures and details may be referred to in the foregoing description of the first embodiment.
The file obtaining module 21 is, for example, configured to obtain a media file to be played, that is, to perform step S11 in the foregoing first embodiment.
The format determining module 23 is, for example, configured to determine the format of the media file to be played, that is, to perform step S13 in the foregoing first embodiment.
The text conversion module 25 is used, for example: if the format of the media file to be played is a text file format, reading the content of the media file to be played, and converting the content of the media file to be played into a picture group, namely, executing the step S15 in the first embodiment.
The media playing module 27 is for example used for playing the group of pictures, i.e. for performing step S17 in the aforementioned first embodiment. In some embodiments, the media playing module 27 is also for example configured to: if the format of the media file to be played is the video file format or the image file format, the media file to be played is played, that is, the method is further used for executing step S19 in the first embodiment.
Specifically, the text conversion module 25 includes, for example: a parameter setting unit 251, a file content reading unit 253, a sub-graph creation unit 255, a drawing unit 257, and a combination unit 259.
Wherein the parameter setting unit 251 is for example used for setting text parameters, screen height and screen width, i.e. for executing step S151 in the aforementioned first embodiment.
The file content reading unit 253 is for example used for reading the content of the media file to be played, i.e. for executing step S153 in the aforementioned first embodiment.
The sub-graph creation unit 255 is for example configured to create at least one sub-graph based on the text parameter and the screen width, i.e. to perform step S155 in the aforementioned first embodiment.
The drawing unit 257 is for example configured to draw the content of the media file to be played on the subgraph according to the text parameter and the content of the media file to be played, that is, to perform step S157 in the foregoing first embodiment.
The combining unit 259 is for example configured to combine the sub-images according to the text parameter and the screen height to obtain the group of pictures, i.e. to perform step S159 in the foregoing first embodiment.
Each sub-image is used for displaying the content of the media file to be played after one line of drawing, the sub-image is in a Bitmap format, the picture group is in a PNG format, and the text parameter is selected from one or more of background color, text color, font size, font, alignment mode, word spacing and line spacing.
The media file playing device 20 is implemented based on a ARM (Advanced RISC Machines) processor, for example, and its internal components are implemented by software modules on an ARM processor, for example.
In summary, the foregoing embodiments of the present application may implement: the text file is played on the media playing device, so that the limitation that the existing media playing device cannot play the text file is solved; the characters are set with the properties of color, background color, characters, lines spacing, characters spacing, alignment mode and the like, so that the practicability is increased; meanwhile, lossless playing is realized, and high definition is achieved.
In the several embodiments provided herein, it should be understood that the disclosed systems, devices, and/or methods may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and the division of the units/modules is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or modules may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units/modules described as separate units may or may not be physically separate, and units/modules may or may not be physically units, may be located in one place, or may be distributed on multiple network units. Some or all of the units/modules may be selected according to actual needs to achieve the purpose of the embodiment.
In addition, each functional unit/module in the embodiments of the present application may be integrated in one processing unit/module, or each unit/module may exist alone physically, or two or more units/modules may be integrated in one unit/module. The integrated units/modules may be implemented in hardware or in hardware plus software functional units/modules.
The integrated units/modules implemented in the form of software functional units/modules described above may be stored in a computer readable storage medium. The software functional units described above are stored in a storage medium and include instructions for causing one or more processors of a computer device (which may be a personal computer, a server, or a network device, etc.) to perform some steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and are not limiting; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims (8)

1. A method for playing a media file, comprising:
acquiring a media file to be played;
judging the format of the media file to be played;
if the format of the media file to be played is a text file format, reading the content of the media file to be played, and converting the content of the media file to be played into a picture group;
playing the picture group;
the converting the content of the media file to be played into a picture group specifically includes:
setting text parameters, screen height and screen width;
reading the content of the media file to be played;
creating at least one subgraph according to the text parameters and the screen width;
drawing the content of the media file to be played on the subgraph according to the text parameters and the content of the media file to be played;
and combining the subgraphs according to the text parameters and the screen height to obtain the picture group.
2. The media file playing method of claim 1, wherein the media file playing method further comprises:
and if the format of the media file to be played is a video file format or an image file format, playing the media file to be played.
3. The media file playing method of claim 1, wherein each of the sub-images is used to display a line of the contents of the media file to be played after drawing.
4. The media file playback method of claim 1, wherein the text parameter is selected from one or more of background color, text color, font size, font, alignment, word spacing, and line spacing.
5. The method of claim 1, wherein the sub-picture is in Bitmap format and the group of pictures is in PNG format.
6. A media file playback apparatus, comprising:
the file acquisition module is used for acquiring a media file to be played;
the format judging module is used for judging the format of the media file to be played;
the text conversion module is used for reading the content of the media file to be played if the format of the media file to be played is a text file format, and converting the content of the media file to be played into a picture group;
the media playing module is used for playing the picture group;
wherein, the text conversion module includes:
the parameter setting unit is used for setting text parameters, screen height and screen width;
a file content reading unit, configured to read the content of the media file to be played;
the sub-image creation unit is used for creating at least one sub-image according to the text parameters and the screen width;
the drawing unit is used for drawing the content of the media file to be played on the subgraph according to the text parameter and the content of the media file to be played;
and the combination unit is used for combining the subgraphs according to the text parameters and the screen height so as to obtain the picture group.
7. The media file playback device of claim 6, wherein the media playback module is further to:
and if the format of the media file to be played is a video file format or an image file format, playing the media file to be played.
8. The media file playback apparatus of claim 7, wherein each of the sub-graphs is for displaying content of the media file to be played after a line of drawing, the sub-graphs are in Bitmap format, the group of pictures are in PNG format, and the text parameter is selected from one or more of background color, text color, font size, font, alignment, word spacing, and line spacing.
CN201811633177.XA 2018-12-29 2018-12-29 Media file playing method and media file playing device Active CN111399788B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811633177.XA CN111399788B (en) 2018-12-29 2018-12-29 Media file playing method and media file playing device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811633177.XA CN111399788B (en) 2018-12-29 2018-12-29 Media file playing method and media file playing device

Publications (2)

Publication Number Publication Date
CN111399788A CN111399788A (en) 2020-07-10
CN111399788B true CN111399788B (en) 2023-09-08

Family

ID=71432061

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811633177.XA Active CN111399788B (en) 2018-12-29 2018-12-29 Media file playing method and media file playing device

Country Status (1)

Country Link
CN (1) CN111399788B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114115767A (en) * 2020-08-31 2022-03-01 西安诺瓦星云科技股份有限公司 Media playing method, device and system and computer readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0905679A2 (en) * 1997-09-26 1999-03-31 Adobe Systems Incorporated Associating text derived from audio with an image
CN1914906A (en) * 2004-02-10 2007-02-14 Lg电子株式会社 Text subtitle reproducing method and decoding system for text subtitle
CN101079301A (en) * 2006-07-28 2007-11-28 埃里克·路易斯·汉森 Device and method for text to audio mapping, and animation of the text
CN101976268A (en) * 2010-11-19 2011-02-16 百度在线网络技术(北京)有限公司 Online document reading device and method
CN106021343A (en) * 2016-05-09 2016-10-12 杭州施强教育科技有限公司 A PPT file processing method applied to a mobile terminal

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0905679A2 (en) * 1997-09-26 1999-03-31 Adobe Systems Incorporated Associating text derived from audio with an image
CN1914906A (en) * 2004-02-10 2007-02-14 Lg电子株式会社 Text subtitle reproducing method and decoding system for text subtitle
CN101079301A (en) * 2006-07-28 2007-11-28 埃里克·路易斯·汉森 Device and method for text to audio mapping, and animation of the text
CN101976268A (en) * 2010-11-19 2011-02-16 百度在线网络技术(北京)有限公司 Online document reading device and method
CN106021343A (en) * 2016-05-09 2016-10-12 杭州施强教育科技有限公司 A PPT file processing method applied to a mobile terminal

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于RIA的富媒体播放组件的设计与实现;黄龙军;黄明和;郭斌;姚磊岳;;江西师范大学学报(自然科学版)(02);全文 *

Also Published As

Publication number Publication date
CN111399788A (en) 2020-07-10

Similar Documents

Publication Publication Date Title
US8289338B2 (en) Systems and methods for font file optimization for multimedia files
CN110458918B (en) Method and device for outputting information
CN101699426B (en) Document format conversion system and method
RU2395856C2 (en) Data storage medium storing text-based subtitles, and device for processing text-based subtitles
US11507727B2 (en) Font rendering method and apparatus, and computer-readable storage medium
US20150046797A1 (en) Document format processing apparatus and document format processing method
US8571383B2 (en) Method and system of circumventing content filters
AU2015394928A1 (en) Multimedia service pushing method and system based on two-dimensional code
CN111221596B (en) Font rendering method, apparatus and computer readable storage medium
CN104298504A (en) Method for achieving font rendering based on FreeType font engine
CN104572683A (en) Word stroke animation processing method and device
CN108961361B (en) Method and system for generating special effect text image and computer equipment
CN111399788B (en) Media file playing method and media file playing device
CN105956133B (en) Method and device for displaying file on intelligent terminal
US10636178B2 (en) System and method for coding and decoding of an asset having transparency
CN110012338A (en) A kind of method, apparatus, computer equipment and storage medium showing barrage data
JP2006048695A (en) Device for and method of processing text data according to script attribute
US20100278507A1 (en) Subtitle Generation System and Method Thereof
CN111064986B (en) Animation data sending method with transparency, animation data playing method and computer equipment
CN117376660A (en) Subtitle element rendering method, device, equipment, medium and program product
CN115225615A (en) Illusion engine pixel streaming method and device
CN107092622A (en) The methods of exhibiting and device of a kind of comment information
CN111259276A (en) Method and device for displaying title content, electronic equipment and storage medium
CN111914850A (en) Picture feature extraction method, device, server and medium
CN112672180B (en) Live interface element configuration method, device and storage medium

Legal Events

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