WO2019227751A1 - 媒体文件转换方法、装置及存储介质 - Google Patents
媒体文件转换方法、装置及存储介质 Download PDFInfo
- Publication number
- WO2019227751A1 WO2019227751A1 PCT/CN2018/103581 CN2018103581W WO2019227751A1 WO 2019227751 A1 WO2019227751 A1 WO 2019227751A1 CN 2018103581 W CN2018103581 W CN 2018103581W WO 2019227751 A1 WO2019227751 A1 WO 2019227751A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- media
- container
- media data
- media file
- time
- 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.)
- Ceased
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/23—Processing of content or additional data; Elementary server operations; Server middleware
- H04N21/233—Processing of audio elementary streams
- H04N21/2335—Processing of audio elementary streams involving reformatting operations of audio signals, e.g. by converting from one coding standard to another
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/23—Processing of content or additional data; Elementary server operations; Server middleware
- H04N21/234—Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs
- H04N21/2343—Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving reformatting operations of video signals for distribution or compliance with end-user requests or end-user device requirements
- H04N21/234336—Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving reformatting operations of video signals for distribution or compliance with end-user requests or end-user device requirements by media transcoding, e.g. video is transformed into a slideshow of still pictures or audio is converted into text
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/20—Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
- H04N21/23—Processing of content or additional data; Elementary server operations; Server middleware
- H04N21/235—Processing of additional data, e.g. scrambling of additional data or processing content descriptors
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
- H04N21/434—Disassembling of a multiplex stream, e.g. demultiplexing audio and video streams, extraction of additional data from a video stream; Remultiplexing of multiplex streams; Extraction or processing of SI; Disassembling of packetised elementary stream
- H04N21/4341—Demultiplexing of audio and video streams
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
- H04N21/435—Processing of additional data, e.g. decrypting of additional data, reconstructing software from modules extracted from the transport stream
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/40—Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
- H04N21/43—Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
- H04N21/44—Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
- H04N21/4402—Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display
- H04N21/440236—Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display by media transcoding, e.g. video is transformed into a slideshow of still pictures, audio is converted into text
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N21/00—Selective content distribution, e.g. interactive television or video on demand [VOD]
- H04N21/80—Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
- H04N21/83—Generation or processing of protective or descriptive data associated with content; Content structuring
- H04N21/845—Structuring of content, e.g. decomposing content into time segments
- H04N21/8456—Structuring of content, e.g. decomposing content into time segments by decomposing the content in the time domain, e.g. in time segments
Definitions
- the present disclosure relates to multimedia technology, and in particular, to a method, device, and storage medium for media file conversion.
- the Moving Picture Experts Group (MPEG, Moving Picture Experts Group) -4 package format (MP4 format for short in this article) is a widely used container format that can store video data and audio data in multiple encoding methods.
- the MP4 package format is a non-streaming media format.
- Files that use the MP4 package format (herein referred to as MP4 files) do not support playback in the form of streaming media (that is, while downloading and playing). For this reason, related technologies have to convert MP4 files are converted to streaming media formats, such as FLV (Flash Video), Hypertext Transfer Protocol Live Streaming (HLS, HTTP Live Streaming), etc., so as to achieve playback in the form of streaming media.
- FLV Flash Video
- HLS Hypertext Transfer Protocol Live Streaming
- HTTP Live Streaming etc.
- embodiments of the present disclosure provide a method, device and storage medium for media file conversion, capable of converting a non-streaming media file into a segmented media file of smaller size that can be independently decoded and adapted for network transmission. .
- An embodiment of the present disclosure provides a method for converting a media file, including: parsing metadata encapsulated in a metadata container of the media file to obtain media information for describing the media data encapsulated in the media data container of the media file;
- the media file uses a non-streaming media format; finds media data of a given time period according to the time of the media data indicated by the media information; and positions of the media data in the media file according to the media information To find the position of the media data of the given time period in the media file; extract the media data corresponding to the position from the media data container of the media file; describe the extracted media data and describe the media
- the metadata of the data is packaged according to the packaging structure of the segmented media file to obtain a segmented media file that can be used for independent decoding.
- An embodiment of the present disclosure further provides a media file conversion device, including: a parsing module configured to parse metadata encapsulated in a metadata container of a media file to obtain a media encapsulated in a media data container for describing the media file Media information of the data, the media file adopts a non-streaming media format; a search module that searches for media data of a given time period according to the time of the media data indicated by the media information; the search module is configured to The position of the media data in the media file indicated by the media information, looking for the position of the media data in the given time period in the media file; an extraction module configured to extract the media data from the media data container of the media file Extracting media data corresponding to the location; a synthesis module configured to encapsulate the extracted media data and metadata describing the media data according to the packaging structure of the segmented media file to obtain segments that can be used for independent decoding Media files.
- a parsing module configured to parse metadata encapsulated in a metadata container of
- an embodiment of the present disclosure further provides a media file conversion device, including:
- Memory for storing executable instructions
- a processor configured to execute executable instructions stored in the memory to implement the media file conversion method provided by the embodiment of the present disclosure.
- an embodiment of the present disclosure further provides a storage medium that stores executable instructions. When the executable instructions are executed, the method is used to implement the media file conversion method provided by the embodiments of the present disclosure.
- an embodiment of the present disclosure further provides a storage medium that stores executable instructions. When the executable instructions are executed, the method is used to implement the media file conversion method provided by the embodiments of the present disclosure.
- FIG. 1 is a schematic diagram of an optional structure of a container for multimedia file packaging according to an embodiment of the present disclosure
- FIG. 2 is a schematic diagram of an optional packaging structure of an MP4 file in an embodiment of the present disclosure
- FIG. 3 is an optional structure diagram of a media data container storing media data in a media file according to an embodiment of the present disclosure
- FIG. 4 is a schematic diagram of an optional packaging structure of an FMP4 file in an embodiment of the present disclosure
- FIG. 5 is an optional schematic structural diagram of a media file conversion device according to an embodiment of the present disclosure.
- FIG. 6 is an optional structural diagram of a media file conversion device provided by an embodiment of the present disclosure.
- FIG. 7 is an optional flowchart of a method for converting a media file according to an embodiment of the present disclosure
- FIG. 8 is a schematic flowchart of an optional process for obtaining media information from a metadata container according to an embodiment of the present disclosure
- FIG. 9 is an optional flowchart for searching media data of a given period from a media file according to an embodiment of the present disclosure.
- FIG. 10 is a schematic flowchart of an optional process for finding a position of media data of a given time period from a media file according to an embodiment of the present disclosure
- FIG. 11 is an optional flowchart of an encapsulated segmented media file according to an embodiment of the present disclosure
- FIG. 12 is a schematic diagram of an optional usage scenario of a media file conversion method provided by an embodiment of the present disclosure.
- FIG. 13 is a schematic diagram of converting an MP4 file to an FMP4 file and playing it through a media source extension interface according to an embodiment of the present disclosure.
- Media file a file that stores encoded media data (such as at least one of audio data and video data) in the form of a container (Box), which also includes media information to ensure media The metadata is correctly decoded.
- MP4 files For example, a media file formed by using the Moving Picture Experts Group (MPEG, Moving Picture Experts Group) -4 encapsulation format to encapsulate media data is called an MP4 file.
- MP4 files store video data encoded with Advanced Video Coding (AVC, Advanced Video Coding, H.264) or MPEG-4 (Part 2) specifications, and audio encoded with Advanced Audio Coding (AAC, Advanced Audio Coding) specifications. Data, of course, does not exclude other encodings of video and audio.
- AVC Advanced Video Coding
- H.264 Advanced Video Coding
- AAC Advanced Audio Coding
- a container also called a box
- a container is an object-oriented component defined by a unique type identifier and a length. See FIG. 1 for an optional structural diagram of a container provided by an embodiment of the present disclosure, including a container header. Department (Box Header) and Container Data (Box Data), which are filled with binary data used to express various information.
- the container header includes a size (size) and a type (type).
- the capacity indicates the length occupied by the container in the media file, and the type indicates the type of the container. See FIG. 2, which is an example of an MP4 file provided by the embodiment of the present disclosure. Schematic diagram of the selected package structure.
- the basic container types involved in MP4 files include file type containers (ftyp boxes), metadata containers (moov boxes), and media data containers (mdat boxes).
- the container data section can store specific data. At this time, the container is called a "data container”, and the container data section can further encapsulate other types of containers. At this time, the container is called a "container container”.
- Track also called stream, is a time-related related sample in a media data container.
- a track represents a video frame sequence or an audio frame sequence. It consists of a subtitle track synchronized with a sequence of video frames. A set of consecutive samples in the same track is called a chunk.
- a file type container which is used to store the capacity (ie, the length of the occupied bytes) and type of container in the media file. As shown in Figure 2, the file type container is marked as "ftyp box", where the binary data is stored. The file type and compatibility are described according to the specified byte length.
- Metadata container a container used to store metadata (that is, data describing multimedia data stored in the media data container) in the media file.
- metadata that is, data describing multimedia data stored in the media data container
- Information expressed by binary data stored in the metadata container in the MP4 file is called media information.
- the header of the metadata container uses binary data to indicate that the type of the container is "moov box".
- the container data part encapsulates the mvhd container used to store the overall information of the MP4 file. It is independent of the MP4 file and is related to MP4 file playback is related, including duration, creation time and modification time.
- the media data container of the media file may include sub-containers corresponding to multiple tracks, such as an audio track container (video track box) and a video track container (video track box), which are included in the sub-containers of the audio track container and the video track container.
- the necessary sub-containers include: a container (denoted as a tkhd box) for describing the characteristics and general information of the track (such as duration, width and height), and recording the track's media information (such as media Type and sampled information) container (denoted as mdia box).
- the sub-containers encapsulated in the mdia box may include: a container that records related attributes and content of the track (denoted as mdhd box), a container that records information about the playback process of the media (denoted as hdlr box), and describes media data in the track Container of media information (recorded as minf box); minf box also encapsulates a sub-container (recorded as dinf box) for explaining how to locate media information, and used to record all time information (decode time / Display time), location information and codec sub-containers (recorded as stbl box).
- FIG. 3 it is a schematic diagram of a structure for storing media data in a media data container in a media file provided by an embodiment of the present disclosure.
- the sampling time, type, capacity, and The position in the media data container is described below for each child container in the stbl box.
- each media file can have one or more description tables.
- the description table can find the description information of each sample.
- the description information can ensure the correct decoding of the samples.
- Different media types store different description information. For example, for video media, the description information is the structure of the image.
- the stts box stores the sampling time information, and provides a table to map the time (decoding time) and the sequence number of the sample. Through the stx box, you can locate the sample at any time in the media file; the stts box also uses other tables to map the sample Capacity and pointer. Each entry in the table provides the serial number of consecutive samples in the same time offset, and the offset of the sample. Increasing these offsets can build a complete time-sample mapping table. Calculated as follows:
- the sum of all offsets is the duration of the media data in the track.
- stssbox records the sequence number of the key frames in the media file.
- the stsbox records the mapping relationship between the sample and the block where the sample is stored.
- the relationship between the number of the sample and the number of the block is mapped through the table.
- the block containing the specified sample can be found by looking up the table.
- the stco box defines the position of each block in the track, and the position is expressed by an offset from the start byte of the media data container and a length (ie, capacity) from the start byte.
- stszbox records the capacity (ie size) of each sample in the media file.
- Media data container a container for storing multimedia data in a media file, for example, a media data container in an MP4 file, as shown in FIG. 3, sampling is a unit stored in the media data container and stored in a block of the media file The length of the blocks and samples can be different.
- Segmented media files, sub-files formed by segmenting media files, and each segmented media file can be decoded independently.
- media data in MP4 files is divided according to key frames.
- the divided media data and corresponding metadata are encapsulated to form segmented MP4 (FMP4, Fragmented MP4) files.
- the metadata in each FMP4 file can guarantee The media data is decoded correctly.
- each FMP4 file shown in FIG. 2 is converted into multiple FMP4 files, referring to FIG. 4, it is a schematic diagram of an optional package structure of the FMP4 file provided by the embodiment of the present disclosure.
- One MP4 file can be converted into multiple FMP4 files, each FMP4 file includes three basic containers: moov container, moof container, and mdat container.
- the moov container includes MP4 file-level metadata, which is used to describe all media data in the MP4 file from which the FMP4 file is derived, such as the length, creation time, and modification time of the MP4 file.
- the moof container stores segment-level metadata, which is used to describe the media data encapsulated in the FMP4 file in which it is located, ensuring that the media data in FMP4 can be decoded.
- One moof container and one mdat container constitute one segment of a segmented MP4 file.
- One segmented MP4 file can include one or more such segments.
- the metadata encapsulated in each segment guarantees the segmentation.
- Media data encapsulated in a segment can be independently decoded.
- MSE Media Resource Extensions
- MSE Media Source Extensions
- the player is provided with a function of playing a media stream by invoking a Hypertext Markup Language (HTML) Media Element, for example, using a video element ⁇ video> and an audio element ⁇ audio> to implement a video / audio playback function.
- HTML Hypertext Markup Language
- Streaming media format which encapsulates media data into streaming media files.
- Media files can be decoded and played without having to be completely downloaded or transcoded, that is, natively supporting the packaging technology while downloading and playing at the same time.
- Files in a typical streaming media format include: TS media file fragments based on HTTP Live Streaming (HLS, HTTP Live Streaming) technology, FLV (Flash Video) files, and the like.
- Non-streaming media format a packaging technology that encapsulates media data into media files and can be decoded and played after the media file is completely downloaded.
- Typical non-streaming format files include: MP4 files, Windows Media Video (WMV, Windows Media (Video) file, Advanced Streaming Format (ASF) file, etc.
- MP4 files do not natively support streaming media playback, but invalid binary data is filled with missing binary data (for example, in the ftyp container) through the media stream after transcoding to the player or the missing part of the downloaded MP4 file.
- missing binary data for example, in the ftyp container
- filling the missing part of the mdat container with invalid binary data can also be used to achieve the technical effect of downloading and playing. Called non-streaming format.
- the media file conversion device may be provided in a manner of hardware, software, or a combination of software and hardware.
- FIG. 5 is an optional composition diagram of the media file conversion device according to the embodiment of the present disclosure.
- the media file conversion device 500 may include a video playback function. Mobile phones, computers, digital broadcast terminals, messaging equipment, game consoles, tablet devices, medical equipment, fitness equipment, personal digital assistants, etc.
- the media file conversion apparatus 500 shown in FIG. 5 includes at least one processor 501, a memory 502, at least one network interface 504, and a user interface 503.
- the various components in the media file conversion apparatus 500 are coupled together via a bus system 505. It can be understood that the bus system 505 is configured to implement connection and communication between these components.
- the bus system 505 includes a data bus, a power bus, a control bus, and a status signal bus. However, for the sake of clarity, various buses are marked as the bus system 505 in FIG. 6.
- the user interface 503 may include a display, a keyboard, a mouse, a trackball, a click wheel, keys, buttons, a touch panel, or a touch screen.
- the memory 502 may be a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories.
- the non-volatile memory may be a read-only memory (ROM, Read Only Memory), a programmable read-only memory (PROM, Programmable Read-Only Memory), or an erasable programmable read-only memory (EPROM, Erasable Programmable Read- Only Memory), electrically erasable and programmable read-only memory (EEPROM, Electrically Programmable Read-Only Memory); magnetic surface memory can be magnetic disk storage or magnetic tape storage.
- the volatile memory may be a random access memory (RAM, Random Access Memory), which is used as an external cache.
- RAM Static Random Access Memory
- SSRAM Synchronous Static Random Access Memory
- DRAM Dynamic Random Access Memory
- SDRAM Synchronous Dynamic Random Access Memory
- the memory 502 in the embodiment of the present disclosure includes, but is not limited to, a tri-state content addressable memory and a static random access memory capable of storing media file data obtained from a server to support the operation of the media file conversion apparatus 500.
- Examples of these data include: any computer program for operating on the media file conversion apparatus 500, such as an operating system 5021 and an application program 5022; various types of media file data information, and the like.
- the operating system 5021 includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks.
- the application 5022 may include various applications, such as a client with a media file conversion function, or an application.
- a program that implements a method for converting a media file according to an embodiment of the present disclosure may be included in an application program 5022.
- the method disclosed in the embodiment of the present disclosure is implemented by the processor 501.
- the processor 501 may be an integrated circuit chip and has a signal processing capability.
- the media file conversion method provided by the embodiment of the present disclosure may be completed by an operation of a hardware integrated logic circuit or software in the processor 501.
- the above-mentioned processor 501 may be a general-purpose processor, a digital signal processor (DSP, Digital Signal Processor), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and the like.
- DSP Digital Signal Processor
- the processor 501 may implement or execute the methods, steps, and logic block diagrams provided in the embodiments of the present disclosure.
- a general-purpose processor may be a microprocessor or any conventional processor.
- the steps of the method provided by the embodiments of the present disclosure may be directly implemented by a hardware decoding processor, or may be performed by a combination of hardware and software modules in the decoding processor.
- the software module may be located in a storage medium.
- the storage medium is located in the memory 502.
- the processor 501 reads the information in the memory 502 and completes the media file conversion method in combination with its hardware.
- an embodiment of the present disclosure further provides a computer-readable storage medium, such as a memory 502 including a computer program, and the computer program may be executed by the processor 501 of the media file conversion apparatus 500 to complete a media file. Conversion method.
- the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface memory, optical disk, or CD-ROM; it may also be a variety of devices including one or any combination of the above memories, such as Mobile phones, computers, tablet devices, personal digital assistants, etc.
- the pure hardware implementation of the media file conversion device is described below.
- the media file conversion device according to the embodiment of the present disclosure can be implemented by one or more Application Specific Integrated Circuits (ASICs), DSPs, and Programmable Logic Devices (PLDs). Device), complex programmable logic device (CPLD, Complex Programmable Logic Device), Field Programmable Gate Array (FPGA, Field-Programmable Gate Array), or other electronic components to implement the media file conversion provided by the embodiments of the present disclosure method.
- ASICs Application Specific Integrated Circuits
- DSPs Digital Signal Processing
- PLDs Programmable Logic Device
- CPLD complex programmable logic device
- FPGA Field Programmable Gate Array
- Field-Programmable Gate Array Field-Programmable Gate Array
- the pure software implementation of the media file conversion device is described below.
- the media file conversion device according to the embodiment of the present disclosure may be implemented by an application program or a plug-in, or a combination of the two.
- the application program may be a client dedicated to media file conversion, or a client that uses the media file conversion function as an optional function by installing a corresponding plug-in.
- the plug-in can be implemented as an application's function upgrade installation package, and the function of media file conversion is superimposed in the application for media playback; it can also be an element in a web page for media playback, implemented in a front-end language, and viewed by The device directly interprets and executes the functions of media file conversion and media playback in the web page.
- the media file conversion device may be provided as a series of modules that have a coupling relationship at the signal / information / data level, which will be described below with reference to FIG. 6, see FIG. 6, FIG. 6
- the modules are further split or merged according to the different functions implemented. The functions implemented by the modules shown in FIG. 6 are described below.
- the parsing module 601 is configured to parse the metadata encapsulated in the metadata container of the media file to obtain media information for describing the media data encapsulated in the media data container of the media file, and the media file is in a non-streaming media format.
- the parsing module 601 is configured to parse the nested structure of the sub-containers in the metadata container, and read out the binary data in each sub-container according to the nested structure; the parsing module 601 is configured to The read binary data parses out the media information of the media data represented by each sub-container.
- the container can be a nested structure
- the nested structure of the child container in the metadata container is first parsed, and the corresponding binary data is parsed from the mdat container.
- the analysis of the metadata container of the nested structure and the acquisition of related data can be realized.
- the searching module 602 searches for media data of a given period according to the time of the media data indicated by the media information.
- the search module 602 is configured to search for two key frames in a media file according to the time of the media data, and the two key frames correspond to the start time and the end time of a given time period; the search module 602, It is configured to find the audio frame aligned with the video frame between the two key frames according to the time of the media data; the finding module 602 is configured to find the video frame between the two key frames in the media file according to the position of the media data Position and find the position of the audio frame in the media file.
- the video frames in the nested structure can be determined, and the positions of the corresponding audio frames in the audio track container can be realized.
- the search module 602 is configured to search for the position of the media data in a media file at a given time period according to the position of the media data indicated in the media information in the media file.
- the search module 602 is further configured to search for a first key frame whose decoding time is aligned with the start time of a given time period according to the time of the media data; the search module 602 is further configured to search for an earlier decoding time.
- the first key frame that is closest to the start time among the key frames at the start time of the given period; the search module 602 is further configured to find the second key aligned with the end time of the given period according to the time of the media data.
- a frame; the searching module 602 is further configured to find a second key frame closest to the end time among key frames whose decoding time is later than the end time of the given time period.
- the search module 602 is further configured to search for audio frames whose decoding time is in a given period according to the time of the media data;
- the decoding time of the last audio frame is aligned with the end time of the given period, or is later than the end time of the given period and is closest to the end time.
- the extraction module 603 is configured to extract media data at a corresponding location from a media data container of a media file.
- the extraction module 603 is configured to be based on an offset and a capacity corresponding to a position of a video frame between two key frames, and an offset corresponding to a position of an audio frame aligned with the video frame. And a capacity, to determine an interval composed of a minimum offset and a maximum capacity; an extraction module 603 is configured to extract media data from a corresponding interval of a media data container of a media file.
- the offset characterizes the storage start position of the media data in the media data container of the media file
- the capacity characterizes the length occupied by the media data from the storage start position
- the extraction module 603 is configured to extract a video frame according to the storage position of the video frame, and after the video frame extraction is completed, extract the audio frame according to the storage position of the audio frame.
- the extraction module 603 is configured to extract video frames and audio frames from the media data according to a preset break value. With the technical solution shown in this embodiment, it is possible to obtain corresponding audio frames and video frames through one extraction, so as to improve the processing speed of media files.
- the synthesizing module 604 is configured to encapsulate the extracted media data and metadata describing the media data according to the packaging structure of the segmented media file to obtain a segmented media file that can be used for independent decoding.
- the composition module 604 is configured to perform filling operations to fill data representing the type and compatibility of the media file into the file type container of the segment media file; the composition module 604 is configured to display the The file-level metadata of the media file is filled into the metadata container of the segmented media file; the synthesis module 604 is configured to fill the extracted media data and the metadata describing the media data into the segmented media file correspondingly. Media data container in the segment container, and metadata container at the segment level. With reference to the structure shown in FIG. 4, the synthesis module 604 is configured to fill the moov container with data indicating the type and compatibility of the media file, fill the moof container with the file-level metadata representing the media file, and extract the extracted data. Media data, and metadata describing the media data is populated into the mdat container.
- composition module 604 is further configured to call a class write operation function in a device corresponding to the sub-container of the segmented media file to complete the merging of the sub-container and the sub-container with a nested relationship.
- composition module 604 is further configured to call the write operation function of the class to complete the writing and merging of binary data in the memory buffer of the subcontainer, and return an instance of the class. The returned instance is used For merging child containers with child containers with nested relationships.
- the synthesis module 604 is further configured to provide a memory buffer through a class Stream to store the written binary data; and to convert the multi-byte decimal data to be filled through a static method provided by the Stream To binary data; through the write operation function provided by each type of Stream instance, the binary data to be filled into the child container is merged in the memory buffer; the method returns a new Stream instance, and through the technical solution shown in this embodiment, Merging of the current sub-container with other sub-containers with a nested relationship can be implemented to flexibly implement adjustment of the sub-container.
- the metadata of the requested media file is further included.
- the metadata of the original resolution media file or the target resolution media file is requested, first, Check whether the requested cache has been requested. If so, continue to request media data, and do not repeatedly request metadata.
- the requested media data can be used to save data acquisition time and improve operations. speed.
- the synthesis module 604 is further configured to obtain binary data corresponding to the metadata container from the binary data of the media file according to the position of the metadata container in the media file; and sequentially parse the obtained binary data
- the binary data corresponding to the length of the container data in the parsed data is used to obtain the media information represented by the container data.
- a process for the player to acquire media data in a given time period is described.
- the player When a video file or a track media file is played by a player embedded in a webpage, the player must be able to correctly parse the data stream, obtain corresponding media data for a certain time, and ensure that this piece of media data can Decoded independently.
- the method for implementing the media file conversion according to the embodiment of the present disclosure will be described in conjunction with the media file conversion device provided by the embodiment of the present disclosure.
- the following description uses the media file as an MP4 file as an example.
- the solution can be easily applied to other non-streaming media formats, such as MKV, WMV, and ASF, and other non-streaming media files.
- FIG. 7 is an optional flowchart of a media file conversion method provided by an embodiment of the present disclosure, and will be described in conjunction with the steps shown in FIG. 7.
- Step 701 Parse metadata encapsulated in a metadata container of a media file to obtain media information of media data encapsulated in a media data container for describing the media file.
- the media file is an MP4 file.
- the nested structure of the sub-containers in the metadata container of the media file is parsed, and the binary data in each sub-container is read according to the nested structure.
- the binary data parses out the media information of the media data represented by each sub-container.
- the moov container of the MP4 file is a nested structure.
- the nested structure of the sub-containers in the metadata container is analyzed to determine the sub-containers nested in the moov container, such as mvhd containers, audio track containers, Video track containers, etc. If the sub-containers are still nested, continue parsing, until the sub-containers are no longer nested, read the binary data encapsulated in the corresponding sub-containers, and parse to obtain the binary data.
- Media messages such as the key frame sequence number in the media file recorded by stss box, the capacity (ie, size) of each sample in the media file recorded by stsz box, and so on.
- a method for setting a parser according to a container type and parsing a child container in a metadata container according to the container type to obtain media information will be described with reference to FIG. 8.
- FIG. 8 is a schematic diagram of an optional process for obtaining media information from a metadata container according to an embodiment of the present disclosure, and will be described in conjunction with the steps shown in FIG. 8.
- Step 801 Locate the position of the metadata container in the media file.
- the binary data conforming to the container header specification is read from the binary data of the media file, according to the type and length of the container identified in the read binary data, until the bias of the metadata container in the media file is located. Volume and capacity.
- the binary data starting from zero bytes corresponds to the file type container.
- the canonical length of the container header reads the starting position of the binary data of the media file and reads the container header.
- the length of the binary data of the standard length Parsing the read binary data can determine the type and length of the container in the media file that is located after the file type container.
- the parsed type is a file type container
- the length (that is, capacity) of the metadata container can be parsed.
- the offset of the metadata container is the length of the file type container.
- the parsed type is a media data container
- the length of the media data container and the length of the subtype container as an offset continue to read binary data that conforms to the canonical length of the container header, so that the metadata container can be parsed.
- Length that is, capacity
- the length of the metadata container is the sum of the length of the file type container and the length of the media data container.
- the packaging order of subsequent containers is not standardized.
- the packaging order of the containers in the media file is a file type container, metadata container, media data container, or file type Containers, media data containers, and metadata containers can accurately and efficiently locate the location of file type containers in media files.
- Step 802 Obtain binary data corresponding to the metadata container from the binary data of the media file according to the position of the metadata container in the media file.
- the position of the metadata container in the media file is expressed by the offset and capacity.
- the binary data is read from the media file at the position corresponding to the offset, until the length of the read binary data matches the capacity of the metadata container. To read out the binary data corresponding to the metadata container.
- step 803 the binary data corresponding to the canonical length of the header of the metadata container binary data is sequentially parsed to obtain the container type of the child container in the metadata container and the length of the container data of the child container.
- the offset of each read of the binary data is the sum of the lengths of the identified sub-containers, and the length of the read binary data conforms to The canonical length of the container header, so that the type and length of the child container currently being processed can be parsed.
- the binary data when reading for the first time, the binary data is read from the zero byte of the binary data of the metadata container, and the length of the read binary data conforms to the canonical length of the container header, so that the first child container can be parsed
- the type and length of the read when reading for the second time, the length of the first read sub-container is used as an offset to start reading binary data, and the length of the read binary data conforms to the canonical length of the container header, so You can parse out the type and length of the second child container.
- Reading the binary data in the above manner does not cause the situation that multiple reads cause rollback, nor does it occur that there are fewer reads and secondary reads, and the efficiency and accuracy of parsing are guaranteed.
- step 804 a parser corresponding to the container type of the child container is called, and the binary data corresponding to the length of the container data in the unparsed data is sequentially parsed to obtain the media information represented by the container data.
- a typical container type nested in the metadata container is pre-labeled to indicate whether the container is directly used to encapsulate binary data or further encapsulates the container. For example, for mvhd box, audio track shown in FIG. 2 Boxes and video boxes are further encapsulated with containers. For the stts box, stsd box, etc. shown in FIG. 2, they are directly encapsulated with binary data.
- a parser corresponding to the container type is set, and the parser is used to parse out the represented media information according to the binary data; in step 804, the sub-container parsed in step 803
- the parser is used to parse out the represented media information according to the binary data; in step 804, the sub-container parsed in step 803
- Case 1 When the container type of the sub-container is determined by comparison and is pre-marked to directly encapsulate binary data, a parser corresponding to the container type of the sub-container is called, and the sub-container is parsed by the parser. Container data to get the media information represented by the container data.
- Case 2 When the container type of the sub-container is pre-marked by comparison and is pre-marked to continue to encapsulate the container, according to the canonical length of the container header in the media file, recursively parse the binary data corresponding to the sub-container, Until the container type resolved to the container enclosed in the child container is pre-marked and pre-marked for direct packaging of binary data, a parser corresponding to the container type of the container enclosed in the child container is invoked to parse the binary data byte by byte , The length of the parsed binary data corresponds to the length of the container data of the container encapsulated in the child container to obtain the media information represented by the container data of the container encapsulated in the child container.
- a method for recording media information in the process of parsing the metadata container is described.
- the binary data corresponding to the canonical length of the container header in the binary data of the metadata container is sequentially parsed to obtain the subcontainers in the metadata container.
- an object is established based on the nested relationship between the child container and the container to which it belongs, and the nested relationship between the child container and the encapsulated container.
- the container type of the child container is pre-marked to directly encapsulate binary data
- An array including media information is stored in the object created by the corresponding sub-container, and the stored media information is represented by the container data of the sub-container.
- a description is given of a manner of recording a nested relationship between sub-containers in the process of parsing a metadata container.
- the binary data corresponding to the canonical length of the container header in the metadata container binary data is sequentially parsed to obtain metadata
- the parsed sub-container is recorded in the called parser; the recorded sub-container instance is set to the sub-container property
- the child container attribute is included in the container to which the child container belongs, and is used to describe the nesting relationship between the child container and the container to which the child container belongs.
- the container type of the sub-container is not pre-marked, or is pre-marked to directly encapsulate the binary data, but the corresponding type of parser is not called, the binary data corresponding to the parsed sub-container is ignored.
- the length of the subcontainer jumps to the part of the binary data corresponding to the next subcontainer and continues to parse.
- Step 702 Search for media data of a given period according to the time of the media data indicated by the media information.
- FIG. 9 is an optional flowchart for finding media data of a given period from a media file according to an embodiment of the present disclosure, and will be performed in conjunction with the steps shown in FIG. 9. Instructions.
- Step 901 Find two key frames in a media file according to the time of the media data, and the two key frames correspond to a start time and an end time of a given time period.
- the length of a media file is 120 seconds, which contains several key frames.
- the given time period is 20 to 40 seconds, according to the mapping relationship between the decoding time of the frame and the sequence number of the frame, first find whether there is a decoding time that is just right The keyframe at the 20th second, if it exists, the decoding time is exactly the keyframe at the 20th second as the first keyframe; if it does not exist, the decoding time is earlier than the 20th second, and it is closest to the start time at the 20th second A key frame is used as the first key frame.
- Second find out if there is a key frame with a decoding time that is exactly 40th second. If it exists, the key frame with a decoding time that is exactly 40th second is used as the second key frame; if it does not exist, look for a decoding time that is later than 40th, And the closest key frame from the 40th second is used as the second key frame.
- Step 902 Find the audio frame aligned with the video frame between the two key frames according to the time of the media data.
- the player can find the audio frame aligned with the given time period from the time of the media data by: finding the audio frame with the decoding time distributed from the time of the media data according to the given time period, and using the video frame as The benchmark is to locate audio frames that are synchronized in time at the video frame; where, when the time of the playback point corresponds to the presence of an audio frame, the decoding time of the first audio frame is aligned with the start time of a given period; when the time of the playback point does not have a corresponding audio frame
- the decoding time of the first audio frame is earlier than the start time of the given time period and is closest to the start time, to ensure that the decoding time of the first audio frame is not later than the decoding start time of the first video frame (the first key frame mentioned above); when When the end time of a fixed period corresponds to the presence of audio frames, the decoding time of the last audio frame is aligned with the end time of the given time period; when there is no corresponding audio frame at the end time of the
- the segmented media file including video frames and corresponding audio frames overcomes the problem of inconsistent video and audio time lengths, and ensures that there is synchronized audio playback during each frame of video playback. Silence will occur.
- Step 903 Find the position of the video frame between the two key frames in the media file according to the position of the media data, and find the position of the audio frame in the media file.
- the position of the media data in the media file may be expressed as two intervals: the first interval, that is, the position of the video frame between the two key frames in the media file, is included in the media The offset and capacity in the media data container of the file; the second interval, the position of the audio frame between the two audio frames in the media file, including the offset and capacity in the media data container of the media file .
- the offset indicates the storage start position of the media data in the media data container of the media file
- the capacity indicates the length occupied by the media data from the storage start position.
- the position of the media data in the media file is represented as an interval, according to the offset and capacity corresponding to the position of the video frame between the two key frames, and the position of the audio frame aligned with the video frame.
- the corresponding offset and capacity determine the interval consisting of the minimum offset and the maximum capacity.
- the offset of the position of the video frame between the first key frame and the second key frame at the target resolution media file, the corresponding interval is [a, b] (the address is in ascending order), and the audio frame is at the target resolution media.
- the offset of the position of the file, the corresponding interval is [c, d] (the address is in ascending order), then the interval formed by taking the upper and lower limits of the position is [min (a, c), max (b, d)] .
- media data of a given time can be extracted from the media file at one time, reducing the number of reading times of the player, and improving processing efficiency.
- the player sends a network request carrying the offset and capacity of the target interval to the server to request the media data of the target interval.
- the server extracts the media data in the media file based on the offset and capacity of the target interval and returns it once.
- the media data in the target interval does not need to be obtained twice, which reduces the number of requests from the player and improves the processing efficiency.
- the video frame in the nested structure can be determined, and the position of the corresponding audio frame in the audio track container can be realized.
- Step 703 Find the position of the media data of the given time period in the media file according to the position of the media data in the media file indicated by the media information.
- FIG. 10 uses the package structure shown in FIG. 4 as an example for a media file to describe the position of the media data in a media file for a given period of time from the media file.
- FIG. 10 An optional flow chart for finding the location of media data in a given time period in a media file will be described with reference to the steps shown in FIG. 10.
- Step 1001 Determine a period corresponding to the media data to be acquired.
- the time period is a period of time after the playback point.
- the time corresponding to the playback point is a time measurement relative to the media time coordinate system (with the media file playback start time as the time origin).
- the predetermined proportion is 5%, or a set length such as 10 minutes.
- Step 1002 Check the stts box to determine the sequence number of samples (including video frames and audio frames) whose decoding time is within a given period.
- Step 1003 Query the STSC box according to the sampled sequence number to determine the sequence number of the block including the sample.
- Step 1004 Find the offset of the block from the stco box according to the sequence number of the block.
- step 1005 the stsz box is searched according to the sequence number of the sample, and the offset and the capacity of the sample within the block are found.
- the serial number and capacity of the sample are recorded in the stsz box, and the offset of the block and the offset of the sample within the block are accumulated to obtain the offset of the sample in the mdat container (box).
- step 1006 the offset corresponding to the block with the smallest offset and the offset sampled in the corresponding block are accumulated to be used as the offset of the media data in a given period.
- Step 1007 Accumulate the offset corresponding to the block with the largest offset, the offset of the corresponding sample within the block, and the capacity of the corresponding sample as the length that can cover the media data and the offset from the media data. Do the difference to get the capacity of the media data.
- steps 1006 and 1007 calculate the position (including offset and capacity) of the audio frame in a given period and the position (including offset and capacity) of the video frame in a given period, respectively, to obtain video. Intervals when frames and audio frames are stored in mdat boxes.
- Step 704 Extract the media data at the corresponding location from the media data container of the media file.
- step 703 when the position of the media file data in the media data container is represented by the two intervals described in step 703, that is, when the interval corresponding to the video frame and the audio frame is used to represent, respectively, according to the position of the video frame
- media data is extracted from the corresponding interval of the media data container of the media file at a time, which effectively improves The processing efficiency of media data, especially when network transmission is required, can significantly save the occupation of the connection and the consumption of traffic.
- Step 705 Encapsulate the extracted media data and metadata describing the media data according to the packaging structure of the segmented media file to obtain a segmented media file that can be used for independent decoding.
- FIG. 11 is a schematic diagram of an optional process of packaging segmented media files according to an embodiment of the present disclosure, and will be described in conjunction with the steps shown in FIG.
- Step 1101 Fill data indicating the type and compatibility of the segmented media file into the file type container of the segmented media file.
- the file type container of the FMP4 file is the head of the ftyp box and the type and length of the container (representing the overall length of the ftyp box).
- the data part of the box is filled to generate data (binary data) indicating that the file type is FMP4 and compatible protocols.
- step 1102 the metadata representing the file level of the segmented media file is filled into the metadata container of the segmented media file.
- the metadata describing the media data required to fill the nested structure is calculated .
- the file-level metadata representing the FMP4 file is calculated and filled into the FMP4 metadata container (that is, the moov box).
- the metadata encapsulated in the mvhd container is used to represent media information related to the playback of segmented media files, including location, duration, creation time, and modification time, etc .; sub-containers in the track container represent corresponding tracks in the media data References and descriptions, such as a container (recorded as tkhd box) that describes the characteristics and general information (such as duration, width and height) of the track, and records the track's media information (such as media type and sampling information).
- Container (denoted as mdia box).
- step 1103 the extracted media data and metadata describing the media data are correspondingly filled into a media data container in a segment container of a segmented media file and a metadata container at a segment level.
- one or more fragments may be encapsulated in the segmented media file.
- the media data to be filled one or more media data containers of the segmented media file ( In the mdat box), each segment is encapsulated with a segment-level metadata container (denoted as a moof box).
- the filled metadata is used to describe the media data filled in the segment, so that the segment can be decoded independently. .
- the metadata in the container (that is, the moof box) is correspondingly filled into the sub-containers of the moof box, where the head of the moof box is called moof box, and the filled binary data is used to indicate that the type of the container is "moof box "and the length of the moof box.
- the write operation function of the calling class is used to complete the writing and merging of binary data in the memory buffer of the child container, and return the class The returned instance is used to merge the child container with the child container with the nested relationship.
- each class Stream provides a memory buffer to store the binary data to be filled.
- the buffer completes the merging and filling of the binary data to be filled into the child container; the static method provided by Stream returns a new Stream instance, which can realize the current child container's merging with other child containers with a nested relationship.
- FIG. 12 is a schematic diagram of an optional use scenario of a media file conversion method provided by an embodiment of the present disclosure.
- the media file conversion device provided by the embodiment of the present disclosure may be implemented as a user terminal 10.
- the user terminal 10 (exemplarily showing the user terminal 10-1 and the user terminal 10-2) connects to the server 30 through a network 20, and the network 20 may be a wide area network or a local area network, or a combination of the two, using a wireless link Achieve data transmission.
- the user terminal 10 plays a media file through a webpage embedded with a player, and displays the played content through a graphical interface 110 (a graphical interface 110-1 and a graphical interface 110-2 are exemplarily shown).
- the user terminal 10 parses the metadata obtained from the server 30 encapsulated in the metadata container of the media file to obtain media information for describing the media data encapsulated in the media data container of the media file, and the media file uses a non-streaming Media format; searching for media data of a given period according to the time of the media data represented by the media information; finding the given time according to the position of the media data represented in the media information in the media file The position of the media data of the segment in the media file; extracting the media data corresponding to the position from the media data container of the media file; dividing the extracted media data and metadata describing the media data according to the
- the encapsulation structure of segment media files is encapsulated to obtain segmented media files that can be used for independent decoding.
- FIG. 13 is a schematic diagram of converting an MP4 file to an FMP4 file and playing it through a media source extension interface according to an embodiment of the present disclosure.
- the player is based on the real address of the media file (http://www.toutiao.com/ a / b.mp4)
- Obtain media data that meets a fixed duration and then construct a segmented media file based on the obtained media data, that is, convert it to a segmented MP4 format media file, and then add the segmented media file to the media source of the MSE Object (for example, implemented in the form of a file-like object (Blob))
- the MSE creates a virtual URL corresponding to the media source object, and passes the virtual URL to the Video element, so that the Video element obtains the corresponding media source object, and implements the above extraction.
- Media data and metadata describing the media data are packaged according to the packaging structure of the segmented media file to obtain segmented media files that can be used for independent decoding.
- media file conversion method by parsing metadata encapsulated in a metadata container of a media file, media information for describing the media data encapsulated in the media data container of the media file is obtained, and according to the media, Time of the media data indicated by the information, find the media data of the given time period; and according to the position of the media data indicated by the media information in the media file, find the media data of the given time period in the media file.
- the position in the media file extracting the media data corresponding to the position from the media data container of the media file; performing the extraction of the media data and the metadata describing the media data according to the packaging structure of the segmented media file Encapsulate to get segmented media files that can be used for independent decoding.
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
- Television Signal Processing For Recording (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
Claims (20)
- 一种媒体文件转换方法,包括:解析媒体文件的元数据容器中封装的元数据,得到用于描述所述媒体文件的媒体数据容器中封装的媒体数据的媒体信息,所述媒体文件采用非流媒体格式;根据所述媒体信息表示的所述媒体数据的时间,查找给定时段的媒体数据;根据所述媒体信息表示的所述媒体数据在所述媒体文件中的位置,查找所述给定时段的媒体数据在所述媒体文件中的位置;从所述媒体文件的媒体数据容器中提取对应所述位置的媒体数据;将所提取的媒体数据、以及描述所述媒体数据的元数据根据分段媒体文件的封装结构进行封装,得到能够用于独立解码的分段媒体文件。
- 根据权利要求1所述的方法,其中,所述根据所述媒体信息表示的所述媒体数据的时间,查找给定时段的媒体数据,包括:根据所述媒体数据的时间查找所述媒体文件中的两个关键帧,所述两个关键帧对应所述给定时段的起始时间和结束时间;根据所述媒体数据的时间查找与所述两个关键帧之间的视频帧对齐的音频帧;根据所述媒体数据的位置,查找所述两个关键帧之间的视频帧在所述媒体文件中的位置,并查找所述音频帧在所述媒体文件中的位置。
- 根据权利要求2所述的方法,其中,所述根据所述媒体数据的时间查找所述媒体文件中的两个关键帧,包括:根据所述媒体数据的时间,查找解码时间对齐所述给定时段的起始时间的第一关键帧,或者,查找解码时间早于所述给定时段的起始时间的关键帧,并在所查找到的关键帧中查找解码时间距离所述起始时间最近的第一关键帧;根据所述媒体数据的时间,查找解码时间对齐所述给定时段的结束时间的第二关键帧,或者,查找解码时间晚于所述给定时段的结束时间的关键帧,并在所查找到的关键帧中查找解码时间距离所述结束时间最近的第二关键帧。
- 根据权利要求3所述的方法,其中,所述根据所述媒体数据的时间查找与所述两个关键帧之间的视频帧对齐的音频帧,包括:根据所述媒体数据的时间,查找解码时间处于所述给定时段的音频帧;其中,首音频帧的解码时间对齐所述给定时段的开始时间,或者,早于所述给定时段的开始时间且距离所述开始时间最近;末音频帧的解码时间对齐所述给定时段的结束时间,或者,晚于所述给定时段的结束时间且距离所述结束时间最近。
- 根据权利要求1所述的方法,其中,所述解析媒体文件的元数据容器中封装的元数据,得到用于描述所述媒体文件的媒体数据容器中封装的媒体数据的媒体信息,包括:解析所述元数据容器中子容器的嵌套结构,根据所述嵌套结构读取出各子容器中的二进制数据;从所读取出的二进制数据解析出各子容器表征的所述媒体数据的媒体信息。
- 根据权利要求1所述的方法,其中,所述从所述媒体文件的媒体数据容器中提取对应所述位置的媒体数据,包括:根据所述两个关键帧之间的视频帧的位置对应的偏移量和容量,以及与所述视频帧对齐的音频帧的位置对应的偏移量和容量,确定由最小偏移量和最大容量构成的区间;从所述媒体文件的媒体数据容器的相应区间内提取所述给定时段的媒体数据。
- 根据权利要求6所述的方法,其中,所述偏移量表征所述媒体数据在所述媒体文件的媒体数据容器中的存储起始位置,所述容量表征所述媒体数据从所述存储起始位置开始占用的长度。
- 根据权利要求1所述的方法,其中,所述将所提取的媒体数据、以及描述所述媒体数据的元数据根据分段媒体文件的封装结构进行封装,包括:将表示所述分段媒体文件的类型和兼容性的数据,填充到所述分段媒体文件的文件类型容器中;将表示所述分段媒体文件的文件级别的元数据,填充到所述分段媒体文件的元数据容器中;将所提取的媒体数据、以及描述所述媒体数据的元数据,对应填充到所述分段媒体文件的分段容器中的媒体数据容器、以及分段级别的元数据容器。
- 根据权利要求1至8任一项所述的方法,其中,所述将所提取的媒体数据、以及描述所述媒体数据的元数据根据分段媒体文件的封装结构进行封装,包括:调用类的写操作功能在所述分段媒体文件的子容器的内存缓冲区完成二进制的媒体数据的写入和合并,以及,合并所述子容器与具有嵌套关系的子容器。
- 一种媒体文件转换装置,包括:解析模块,配置为解析媒体文件的元数据容器中封装的元数据,得到用于描述所述媒体文件的媒体数据容器中封装的媒体数据的媒体信息,所述媒体文件采用非流媒体格式;查找模块,根据所述媒体信息表示的所述媒体数据的时间,查找给定时段的媒体数据;所述查找模块,配置为根据所述媒体信息表示的所述媒体数据在所述媒体文件中的位置,查找所述给定时段的媒体数据在所述媒体文件中的位置;提取模块,配置为从所述媒体文件的媒体数据容器中提取对应所述位置的媒体数据;合成模块,配置为将所提取的媒体数据、以及描述所述媒体数据的元数据根据分段媒体文件的封装结构进行封装,得到能够用于独立解码的分段媒体文件。
- 根据权利要求10所述的装置,其中,所述查找模块,配置为根据所述媒体数据的时间查找所述媒体文件中的两个关键帧,所述两个关键帧对应所述给定时段的起始时间和结束时间;所述查找模块,配置为根据所述媒体数据的时间查找与所述两个关键帧之间的视频帧对齐的音频帧;所述查找模块,配置为根据所述媒体数据的位置,查找所述两个关键帧之间的视频帧在所述媒体文件中的位置,并查找所述音频帧在所述媒体文件中的位置。
- 根据权利要求11所述的装置,其中,所述查找模块,还配置为根据所述媒体数据的时间,查找解码时间对齐所述给定时段的起始时间的第一关键帧;所述查找模块,还配置为找解码时间早于所述给定时段的起始时间的关键帧,并在所查找到的关键帧中查找解码时间距离所述起始时间最近的第一关键帧;所述查找模块,还配置为根据所述媒体数据的时间,查找解码时间对齐所述给定时段的结束时间的第二关键帧;所述查找模块,还配置为查找解码时间晚于所述给定时段的结束时间的关键帧,并 在所查找到的关键帧中查找解码时间距离所述结束时间最近的第二关键帧。
- 根据权利要求12所述的装置,其中,所述查找模块,还配置为根据所述媒体数据的时间,查找解码时间处于所述给定时段的音频帧;其中,首音频帧的解码时间对齐所述给定时段的开始时间,或者,早于所述给定时段的开始时间且距离所述开始时间最近;末音频帧的解码时间对齐所述给定时段的结束时间,或者,晚于所述给定时段的结束时间且距离所述结束时间最近。
- 根据权利要求10所述的装置,其中,所述解析模块,配置为解析所述元数据容器中子容器的嵌套结构,根据所述嵌套结构读取出各子容器中的二进制数据;所述解析模块,配置为从所读取出的二进制数据解析出各子容器表征的所述媒体数据的媒体信息。
- 根据权利要求10所述的装置,其中,所述提取模块,配置为根据所述两个关键帧之间的视频帧的位置对应的偏移量和容量,以及与所述视频帧对齐的音频帧的位置对应的偏移量和容量,确定由最小偏移量和最大容量构成的区间;所述提取模块,配置为从所述媒体文件的媒体数据容器的相应区间内提取所述给定时段的媒体数据。
- 根据权利要求15所述的装置,其中,所述偏移量表征所述媒体数据在所述媒体文件的媒体数据容器中的存储起始位置,所述容量表征所述媒体数据从所述存储起始位置开始占用的长度。
- 根据权利要求10所述的装置,其中,所述合成模块,配置为将表示所述分段媒体文件的类型和兼容性的数据,执行填充操作以填充到所述分段媒体文件的文件类型容器中;所述合成模块,配置为将表示所述分段媒体文件的文件级别的元数据,填充到所述分段媒体文件的元数据容器中;所述合成模块,配置为将所提取的媒体数据、以及描述所述媒体数据的元数据,对应填充到所述分段媒体文件的分段容器中的媒体数据容器、以及分段级别的元数据容器。
- 根据权利要求10至17所述的装置,其中,所述合成模块,还配置为调用类的写操作功能在所述分段媒体文件的子容器的内存缓冲区完成二进制的媒体数据的写入和合并;所述合成模块,还配置为合并所述子容器与具有嵌套关系的子容器。
- 一种媒体文件转换装置,包括:存储器,配置为存储可执行指令;处理器,配置为执行所述可执行指令时,实现如权利要求1至9任一项所述的媒体文件转换方法。
- 一种存储介质,存储有可执行指令,所述可执行指令被执行时,配置为实现如权利要求1至9任一项所述的媒体文件转换方法。
Priority Applications (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2020552076A JP7068489B2 (ja) | 2018-05-29 | 2018-08-31 | メディアファイル変換方法、装置及び記憶媒体 |
| US16/913,821 US11064269B2 (en) | 2018-05-29 | 2020-06-26 | Conversion method, device and storage medium for media file |
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201810530467.5 | 2018-05-29 | ||
| CN201810530467.5A CN110545490B (zh) | 2018-05-29 | 2018-05-29 | 媒体文件转换方法、装置及存储介质 |
Related Child Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| US16/913,821 Continuation US11064269B2 (en) | 2018-05-29 | 2020-06-26 | Conversion method, device and storage medium for media file |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2019227751A1 true WO2019227751A1 (zh) | 2019-12-05 |
Family
ID=68697358
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2018/103581 Ceased WO2019227751A1 (zh) | 2018-05-29 | 2018-08-31 | 媒体文件转换方法、装置及存储介质 |
Country Status (4)
| Country | Link |
|---|---|
| US (1) | US11064269B2 (zh) |
| JP (1) | JP7068489B2 (zh) |
| CN (1) | CN110545490B (zh) |
| WO (1) | WO2019227751A1 (zh) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113873176A (zh) * | 2021-10-27 | 2021-12-31 | 北京奇艺世纪科技有限公司 | 一种媒体文件合并方法及装置 |
Families Citing this family (9)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN114598915B (zh) * | 2020-12-03 | 2025-03-18 | 南京中兴软件有限责任公司 | 一种媒体服务方法、装置、设备及计算机存储介质 |
| CN112507148B (zh) * | 2020-12-16 | 2024-10-11 | 北京华宇信息技术有限公司 | 媒体文件自动合成方法及装置 |
| CN112584061B (zh) * | 2020-12-24 | 2023-08-01 | 咪咕文化科技有限公司 | 多媒体通用模板生成方法、电子设备及存储介质 |
| CN112687375A (zh) * | 2021-01-06 | 2021-04-20 | 武汉联影医疗科技有限公司 | Dicom文件传输方法、系统、装置、服务器和存储介质 |
| CN113973222A (zh) * | 2021-12-02 | 2022-01-25 | 成都统信软件技术有限公司 | 一种视频播放方法、装置及计算设备 |
| CN114845135B (zh) * | 2022-04-24 | 2025-07-15 | 腾讯音乐娱乐科技(深圳)有限公司 | 流媒体数据处理方法、流媒体播放方法、设备和程序产品 |
| US12149769B2 (en) * | 2022-06-15 | 2024-11-19 | Microsoft Technology Licensing, Llc | Self-driven adaptive upload |
| US12341844B2 (en) * | 2022-06-15 | 2025-06-24 | Microsoft Technology Licensing, Llc | Self-driven adaptive upload |
| CN116110410B (zh) * | 2023-04-14 | 2023-06-30 | 北京算能科技有限公司 | 音频数据处理方法、装置、电子设备和存储介质 |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1949876A (zh) * | 2006-11-21 | 2007-04-18 | 华为技术有限公司 | 一种支持多种编码格式的媒体数据的方法及系统 |
| US20080010658A1 (en) * | 1997-03-31 | 2008-01-10 | Abbott Michael J | System and method for media stream indexing and synchronization |
| CN102413358A (zh) * | 2011-08-12 | 2012-04-11 | 青岛海信传媒网络技术有限公司 | 流媒体文件存储和播放的方法、装置及系统 |
| CN102510519A (zh) * | 2011-10-11 | 2012-06-20 | 成都市华为赛门铁克科技有限公司 | 流媒体数据的处理方法、播放方法以及装置 |
Family Cites Families (8)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2003114845A (ja) * | 2001-10-03 | 2003-04-18 | Hitachi Ltd | メディア変換方法およびメディア変換装置 |
| JP2006129078A (ja) * | 2004-10-28 | 2006-05-18 | Canon Inc | データファイル編集方法及び装置及び制御プログラム及び記憶媒体 |
| JP2008199387A (ja) * | 2007-02-14 | 2008-08-28 | Hitachi Software Eng Co Ltd | 動画部分配信システム |
| CN103051953B (zh) * | 2012-12-30 | 2016-01-20 | 乐视网信息技术(北京)股份有限公司 | 一种利用视频播放器对视频文件进行解码方法 |
| JP6411862B2 (ja) * | 2013-11-15 | 2018-10-24 | パナソニック株式会社 | ファイル生成方法およびファイル生成装置 |
| CN107979783B (zh) * | 2016-10-25 | 2020-03-24 | 杭州海康威视数字技术股份有限公司 | 一种流式数据解析方法、装置及电子设备 |
| CN106961613A (zh) * | 2017-03-30 | 2017-07-18 | 上海七牛信息技术有限公司 | 一种流式实时转码点播方法及系统 |
| US10694241B2 (en) * | 2017-06-08 | 2020-06-23 | T-Mobile Usa, Inc. | Capturing border metadata while recording content |
-
2018
- 2018-05-29 CN CN201810530467.5A patent/CN110545490B/zh active Active
- 2018-08-31 JP JP2020552076A patent/JP7068489B2/ja active Active
- 2018-08-31 WO PCT/CN2018/103581 patent/WO2019227751A1/zh not_active Ceased
-
2020
- 2020-06-26 US US16/913,821 patent/US11064269B2/en active Active
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20080010658A1 (en) * | 1997-03-31 | 2008-01-10 | Abbott Michael J | System and method for media stream indexing and synchronization |
| CN1949876A (zh) * | 2006-11-21 | 2007-04-18 | 华为技术有限公司 | 一种支持多种编码格式的媒体数据的方法及系统 |
| CN102413358A (zh) * | 2011-08-12 | 2012-04-11 | 青岛海信传媒网络技术有限公司 | 流媒体文件存储和播放的方法、装置及系统 |
| CN102510519A (zh) * | 2011-10-11 | 2012-06-20 | 成都市华为赛门铁克科技有限公司 | 流媒体数据的处理方法、播放方法以及装置 |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113873176A (zh) * | 2021-10-27 | 2021-12-31 | 北京奇艺世纪科技有限公司 | 一种媒体文件合并方法及装置 |
| CN113873176B (zh) * | 2021-10-27 | 2024-03-08 | 北京奇艺世纪科技有限公司 | 一种媒体文件合并方法及装置 |
Also Published As
| Publication number | Publication date |
|---|---|
| US11064269B2 (en) | 2021-07-13 |
| US20200329283A1 (en) | 2020-10-15 |
| JP7068489B2 (ja) | 2022-05-16 |
| CN110545490B (zh) | 2021-03-16 |
| CN110545490A (zh) | 2019-12-06 |
| JP2021508429A (ja) | 2021-03-04 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN110545490B (zh) | 媒体文件转换方法、装置及存储介质 | |
| US11178452B2 (en) | Playing method, device and storage medium of webpage-based media file | |
| US10924801B2 (en) | Method and device for playing media file while switching resolution in webpage and storage medium | |
| US11012759B2 (en) | Webcasting method, device and storage medium of media file | |
| CN110545456B (zh) | 媒体文件的同步播放方法、装置及存储介质 | |
| WO2019227742A1 (zh) | 媒体播放的加载控制方法、装置及存储介质 | |
| US11025991B2 (en) | Webpage playing method and device and storage medium for non-streaming media file | |
| CN110545460A (zh) | 一种媒体文件的预加载方法、装置及存储介质 | |
| JP7174762B2 (ja) | メタデータ容器の解析方法、装置及び記憶媒体 | |
| CN110545471B (zh) | 基于离线转换的播放控制方法、装置及存储介质 | |
| CN110545463B (zh) | 基于媒体文件转换的播放控制方法、装置及存储介质 | |
| CN110545461A (zh) | 一种媒体文件的分辨率切换方法、装置及存储介质 | |
| CN110545467B (zh) | 一种媒体文件加载控制方法、装置及存储介质 | |
| CN110545464A (zh) | 一种媒体文件分辨率切换方法、装置及存储介质 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 18920199 Country of ref document: EP Kind code of ref document: A1 |
|
| ENP | Entry into the national phase |
Ref document number: 2020552076 Country of ref document: JP Kind code of ref document: A |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 18/03/2021) |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 18920199 Country of ref document: EP Kind code of ref document: A1 |