CN109547864B - Media data processing method and device - Google Patents

Media data processing method and device Download PDF

Info

Publication number
CN109547864B
CN109547864B CN201710856551.1A CN201710856551A CN109547864B CN 109547864 B CN109547864 B CN 109547864B CN 201710856551 A CN201710856551 A CN 201710856551A CN 109547864 B CN109547864 B CN 109547864B
Authority
CN
China
Prior art keywords
segment
clipped
divided
fragment
starting position
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
CN201710856551.1A
Other languages
Chinese (zh)
Other versions
CN109547864A (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201710856551.1A priority Critical patent/CN109547864B/en
Publication of CN109547864A publication Critical patent/CN109547864A/en
Application granted granted Critical
Publication of CN109547864B publication Critical patent/CN109547864B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/83Generation or processing of protective or descriptive data associated with content; Content structuring
    • H04N21/845Structuring of content, e.g. decomposing content into time segments
    • H04N21/8456Structuring of content, e.g. decomposing content into time segments by decomposing the content in the time domain, e.g. in time segments

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The application discloses a media data processing method, which comprises the following steps: acquiring the starting position and the ending position of each fragment to be divided of the first media file; acquiring the starting position and the ending position of each segment to be clipped in the first media file; when one fragment to be segmented contains incomplete fragments to be clipped, modifying the starting position and/or the ending position of the incomplete fragments to be clipped contained in the fragment to be segmented so as to enable each fragment to be clipped to be contained in one fragment to be segmented; segmenting the first media file according to the initial position and the end position of each segment to be segmented to obtain each segment; aiming at each fragment obtained by segmentation, according to the starting position and the ending position of each segment to be clipped in the fragment, carrying out clipping operation on the fragment to obtain each segment; and combining the segments to obtain a second media file so as to improve the processing efficiency of the media data.

Description

Media data processing method and device
Technical Field
The present application relates to the field of multimedia technologies, and in particular, to a method and an apparatus for processing media data.
Background
The sources of the audio-video data in the internet are wide, so the audio-video data contains various contents, and in order to better manage the audio-video data, the audio-video data needs to be processed, for example, a part of the contents in the audio-video data is clipped.
Disclosure of Invention
The embodiment of the application provides a media data processing method and device, so as to improve the processing efficiency of media data.
One embodiment of the present application provides a media data processing method, including:
acquiring the starting position and the ending position of each fragment to be divided of the first media file;
acquiring the starting position and the ending position of each segment to be clipped in the first media file;
when one fragment to be segmented contains incomplete fragments to be clipped, modifying the starting position and/or the ending position of the incomplete fragments to be clipped contained in the fragment to be segmented so as to enable each fragment to be clipped to be contained in one fragment to be segmented;
segmenting the first media file according to the initial position and the end position of each segment to be segmented to obtain each segment;
aiming at each fragment obtained by segmentation, according to the starting position and the ending position of each segment to be clipped in the fragment, carrying out clipping operation on the fragment to obtain each segment;
and merging the segments to obtain a second media file.
In an embodiment of the present application, when a segment to be divided contains an incomplete segment to be clipped, modifying a start position and/or an end position of the incomplete segment to be clipped contained in the segment includes:
when a first to-be-divided slice includes a first part of a to-be-clipped segment, and an adjacent second to-be-divided slice following the first to-be-divided slice includes a second part of the to-be-clipped segment,
setting the mark of a first part of the segment to be clipped as the mark of the segment to be clipped, and modifying the end position of the first part into the end position of the first segment to be divided;
and allocating a second to-be-clipped segment identifier to a second part of the to-be-clipped segment, and setting the starting position of the second part as the starting position of the second to-be-divided fragment.
In one embodiment of the present application, when the to-be-divided slice does not contain any part of any to-be-clipped segment, the method further comprises:
and modifying the end position of the fragment to be segmented so that the fragment to be segmented at least comprises a complete fragment to be clipped.
In an embodiment of the present application, modifying the end position of the segment to be divided so that the segment to be divided at least includes a complete segment to be clipped includes:
acquiring the starting position and the ending position of a first segment to be clipped after the segment to be divided;
when the duration of the segment to be clipped is less than or equal to the duration of the segment to be clipped, modifying the end position of the segment to be clipped to the end position of the segment to be clipped;
and when the duration of the segment to be clipped is greater than the duration of the segment to be divided, modifying the end position of the segment to be divided into the starting position of the segment to be clipped and the duration of the segment to be divided.
In an embodiment of the present application, segmenting the first media file according to the start position and the end position of each segment to be segmented to obtain each segment includes:
acquiring the starting position and the ending position of a first to-be-segmented fragment;
when the starting position of the first segment to be divided is equal to the ending position of an adjacent second segment to be divided before the first segment to be divided, dividing the first media file according to the starting position and the ending position of the first segment to be divided to obtain a first segment;
when the starting position of the first segment to be divided is not equal to the ending position of the second segment to be divided, modifying the starting position of the first segment to be divided into the ending position of the second segment to be divided, modifying the ending position of the first segment to be divided into the ending position of the second segment to be divided plus the duration of the first segment to be divided, and dividing the first media file according to the modified starting position and ending position of the first segment to be divided to obtain the first segment.
In one embodiment of the present application, the method further comprises:
storing each fragment obtained by the segmentation and the initial position and the end position of each segment to be clipped in each fragment;
according to the starting position and the ending position of each segment to be clipped in the segment, the clipping operation is carried out on the segment to obtain each segment, and the method comprises the following steps: the method comprises the steps of sequentially obtaining stored fragments and the starting position and the ending position of each segment to be clipped in each fragment, and executing clipping operation on each fragment according to the starting position and the ending position of each segment to be clipped in each fragment to obtain each segment.
In one embodiment of the present application, the method further comprises: sending the segments to a plurality of transcoding servers for transcoding processing to obtain transcoded segments;
the step of combining the segments to obtain a second media file comprises the following steps: and merging the transcoded segments to obtain the second media file.
An embodiment of the present application provides a media data processing apparatus, including:
the first position determining module is used for acquiring the starting position and the ending position of each fragment to be divided of the first media file;
the second position determining module is used for acquiring the starting position and the ending position of each segment to be clipped in the first media file;
the segmentation position modification module is used for modifying the starting position and/or the ending position of the incomplete segment to be clipped contained in one segment to be clipped when the segment to be clipped contains the incomplete segment to be clipped, so that each segment to be clipped is contained in one segment to be clipped;
the dividing module is used for dividing the first media file according to the starting position and the ending position of each fragment to be divided to obtain each fragment;
the cutting module is used for carrying out cutting operation on each fragment according to the starting position and the ending position of each segment to be cut in the fragment to obtain each segment;
and the merging module is used for merging the segments to obtain a second media file.
In one embodiment of the present application, when a first to-be-divided slice includes a first portion of a segment to be clipped, and an adjacent second to-be-divided slice following the first to-be-divided slice includes a second portion of the segment to be clipped,
the segment position modifying module is further configured to allocate a first segment to be clipped to a first part of the segment to be clipped, and modify an end position of the first segment to be clipped to an end position of the first segment to be divided; and allocating a second to-be-clipped segment identifier to a second part of the to-be-clipped segment, and setting the starting position of the second to-be-clipped segment as the starting position of the second to-be-divided segment.
In one embodiment of the present application, when the to-be-divided slice does not contain any portion of any to-be-clipped segment, the method further comprises:
and the fragment position modifying module is used for modifying the end position of the fragment to be segmented so that the fragment to be segmented at least comprises a complete fragment to be clipped.
In an embodiment of the present application, the fragment position modification module is further configured to obtain a starting position and an ending position of a first fragment to be clipped after the fragment to be clipped, and modify the ending position of the fragment to be clipped to the ending position of the fragment to be clipped when a duration of the fragment to be clipped is less than or equal to a duration of the fragment to be clipped; and when the duration of the segment to be clipped is greater than the duration of the segment to be divided, modifying the end position of the segment to be divided into the starting position of the segment to be clipped and the duration of the segment to be divided.
In an embodiment of the present application, the segmentation module is further configured to
Acquiring the starting position and the ending position of a first to-be-segmented fragment;
when the starting position of the first segment to be divided is equal to the ending position of an adjacent second segment to be divided before the first segment to be divided, dividing the first media file according to the starting position and the ending position of the first segment to be divided to obtain a first segment;
when the starting position of the first segment to be divided is not equal to the ending position of the second segment to be divided, modifying the starting position of the first segment to be divided into the ending position of the second segment to be divided, modifying the ending position of the first segment to be divided into the ending position of the second segment to be divided plus the duration of the first segment to be divided, and dividing the first media file according to the modified starting position and ending position of the first segment to be divided to obtain the first segment.
In one embodiment of the present application, the apparatus further comprises:
a sending module, configured to send the start positions and the end positions of the segments to be clipped in the segments and the segments obtained by splitting to a memory for storage;
the clipping module is further configured to sequentially obtain the stored fragments and the start positions and the end positions of the segments to be clipped in the fragments from the memory, and perform a clipping operation on each obtained fragment according to the start position and the end position of each segment to be clipped in the fragment to obtain each segment.
In one embodiment of the present application, the apparatus further comprises:
the sending module is used for sending the segments to a plurality of transcoding servers for transcoding processing to obtain transcoded segments;
the merging module is further configured to merge the transcoded segments to obtain the second media file.
One embodiment of the present application provides a computer-readable storage medium storing computer-readable instructions, which are executed by at least one processor for performing the above-mentioned method.
In the embodiment of the application, the starting position and the ending position of each segment to be cut of a first media file are obtained, the starting position and the ending position of each segment to be cut in the first media file are obtained, when one segment to be cut contains an incomplete segment to be cut, the starting position and/or the ending position of the incomplete segment to be cut contained in the segment to be cut are modified, each segment to be cut is contained in one segment to be cut, the first media file is cut according to the starting position and the ending position of each segment to be cut to obtain each segment, for each segment obtained through cutting, the cutting operation is performed on the segment according to the starting position and the ending position of each segment to be cut in the segment to obtain each segment, and the segments are combined to obtain a second media file. By using the technical scheme of the application, when one fragment to be segmented contains an incomplete fragment to be clipped, the starting position and/or the ending position of the incomplete fragment to be clipped contained in the fragment to be clipped are modified, so that each fragment to be clipped is contained in one fragment to be clipped, the starting position and the ending position of each fragment to be clipped in each fragment are further determined, each fragment is clipped according to the starting position and the ending position of each fragment to be clipped in each fragment, therefore, the starting position and the ending position of each fragment to be clipped in each fragment can be determined by combining the starting position and the ending position of each fragment to be segmented in a media file and the starting position and the ending position of each fragment to be clipped in the media file, and clipping processing based on each fragment can be realized. Therefore, the scheme has high treatment efficiency and is easy to realize.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
FIG. 1 is a schematic block diagram of an implementation environment in which various embodiments of the present application are implemented;
fig. 2 is a schematic flowchart of a media data processing method according to an embodiment of the present application;
fig. 3 is a schematic flowchart of a media data processing method according to an embodiment of the present application;
fig. 4 is a schematic diagram illustrating distribution of segments to be clipped in a segment to be split according to an embodiment of the present application;
fig. 5 is a schematic diagram illustrating distribution of segments to be clipped in a segment to be split according to an embodiment of the present application;
fig. 6 is a schematic diagram illustrating distribution of segments to be clipped in a segment to be split according to an embodiment of the present application;
fig. 7 is a schematic diagram illustrating distribution of segments to be clipped in a segment to be split according to an embodiment of the present application;
fig. 8 is a schematic diagram illustrating distribution of segments to be clipped in a segment to be split in the embodiment of the present application;
fig. 9 is a schematic structural diagram of a media data processing apparatus according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of a media data processing apparatus according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Fig. 1 is a schematic structural diagram of an implementation environment according to embodiments of the present application. As shown in fig. 1, the implementation environment includes: a media data splitting and clipping device 110, a media data transcoding device 120 and a media data storage device 130.
The media data dividing and clipping device 110 may be a PC, a notebook computer, or a mobile phone, and is configured to run a media data processing program, divide the media data into segments, and perform a clipping operation on each segment to obtain segments.
The media data transcoding device 120 may be a PC, a notebook computer, or a mobile phone, and is configured to transcode the obtained segments to obtain transcoded segments, and send the transcoded segments to the media data segmenting and editing device 110 for merging to obtain a new media file. In one embodiment of the present application, a plurality of media data transcoding devices 120 may be included, and the plurality of media data transcoding devices 120 constitute a distributed transcoding system. Each media data transcoding device 120 is configured to transcode a portion of the obtained segments of the clip.
The media data store 130 may be a storage device for storing media files, slices, segments, and the like.
In one embodiment of the present application, the media data splitting and clipping device 110, the media data transcoding device 120 and the media data storage device 130 may be separate physical devices or parts of a physical device. Any of the media data splitting and clipping device 110, the media data transcoding device 120 and the media data storage device 130 may be located on the server side or on the client side.
Fig. 2 is a schematic flowchart of a media data processing method according to an embodiment of the present disclosure. As shown in fig. 2, the method is performed by a media data processing apparatus and comprises the following steps.
Step 201, obtaining the starting position and the ending position of each segment to be divided of the first media file.
Step 202, obtaining the starting position and the ending position of each segment to be clipped in the first media file.
In step 203, when a segment to be divided contains incomplete segments to be clipped, the starting position and/or the ending position of the incomplete segments to be clipped contained in the segment are modified, so that each segment to be clipped is contained in one segment to be divided.
And 204, segmenting the first media file according to the initial position and the end position of each segment to be segmented to obtain each segment.
Step 205, for each segment obtained by splitting, according to the starting position and the ending position of each segment to be clipped in the segment, performing a clipping operation on the segment to obtain each segment.
And step 206, merging the segments to obtain a second media file.
In the embodiment of the application, the starting position and the ending position of each segment to be cut of a first media file are obtained, the starting position and the ending position of each segment to be cut in the first media file are obtained, when one segment to be cut contains an incomplete segment to be cut, the starting position and/or the ending position of the incomplete segment to be cut contained in the segment to be cut are modified, each segment to be cut is contained in one segment to be cut, the first media file is cut according to the starting position and the ending position of each segment to be cut to obtain each segment, for each segment obtained through cutting, the cutting operation is performed on the segment according to the starting position and the ending position of each segment to be cut in the segment to obtain each segment, and the segments are combined to obtain a second media file. By using the technical scheme of the application, when one fragment to be segmented contains an incomplete fragment to be clipped, the starting position and/or the ending position of the incomplete fragment to be clipped contained in the fragment to be clipped are modified, so that each fragment to be clipped is contained in one fragment to be clipped, the starting position and the ending position of each fragment to be clipped in each fragment are further determined, each fragment is clipped according to the starting position and the ending position of each fragment to be clipped in each fragment, therefore, the starting position and the ending position of each fragment to be clipped in each fragment can be determined by combining the starting position and the ending position of each fragment to be segmented in a media file and the starting position and the ending position of each fragment to be clipped in the media file, and clipping processing based on each fragment can be realized. The scheme has high treatment efficiency and is easy to realize.
Fig. 3 is a flowchart illustrating a media data processing method according to an embodiment of the present disclosure. As shown in fig. 3, the method is performed by a media data processing apparatus and comprises the following steps.
Step 301, obtaining the starting position and the ending position of each segment to be divided of the first media file.
In this step, the first media file, i.e., the source media file, may be an audio file or a video file. The source media file may be partitioned according to preset equal partition durations, and partitioned into respective segments. The fragmentation refers to an audio/video file which is obtained by segmenting a source media file and has a length smaller than that of the source media file.
When the executing device of the media data processing method is a server, the start position and the end position of each segment to be divided may be the start position and the end position input by an administrator at an input end of the server, may be preset start positions and end positions stored in the server, or may be the start position and the end position received from a client device. When the executing device of the media data processing method is a client device, the start position and the end position of each segment to be divided may be input by a user at an input end of the client device, may be preset start positions and end positions stored in the client device, or may be start positions and end positions obtained from other devices, for example, a server.
In an embodiment of the present application, the starting position and the ending position of each segment to be divided may be a time offset of the starting point and the ending point of each segment to be divided with respect to the starting point of the media file, for example, 0 th second, and the unit is second. For example, the starting position of the first segment to be divided may be 0 second, the ending position of the first segment to be divided may be T1, and T1 is the duration of the segment. The starting position of the second segment to be divided may be T1, the ending position of the second segment to be divided may be T1+ T2, T1 and T2 may be equal, and so on, to determine the starting position and the ending position of each segment.
Step 302, obtaining the starting position and the ending position of each segment to be clipped in the first media file.
In one embodiment of the present application, the first media file may include a television program and advertisement content, and the television program in the first media file may be clipped according to specific needs, that is, the advertisement content in the first media file is removed. Therefore, the process of cutting the source media file according to the starting position and the ending position of the segment to be clipped to generate a new segment of audio-video file is called clipping process. The audio/video file with the length smaller than that of the source media file obtained by clipping is called a clipping segment, which is called a segment for short.
Like step 301, when the executing apparatus of the media data processing method is a server, the start position and the end position of each segment to be clipped may be the start position and the end position input by the administrator at the input end of the server, or may be preset start positions and end positions stored in the server, or may be the start position and the end position received from the client device. When the executing device of the media data processing method is a client device, the start position and the end position of each segment to be clipped may be input by a user at an input end of the client device, may be preset start positions and end positions stored in the client device, or may be start positions and end positions obtained from other devices, for example, a server.
Similarly, the start position and the end position of each segment to be clipped may be time offsets of the start point and the end point of each segment to be clipped relative to the start point of the media file, for example, 0 th second, and the time offsets are in seconds. For the segment to be divided with the time length of T, the initial position of the first media file is determined as the initial position of the first segment to be divided, and the initial position and the end position of each subsequent segment to be divided are sequentially determined by taking the time length of T as an interval. Unlike the method of determining the start position and the end position of the segment to be divided with the duration T, in this step, the start position and the end position of the content required in the first media file, i.e. the time offset with respect to the first media file, are determined as the start position and the end position of each segment to be clipped. In an embodiment of the present application, a start position and an end position of unnecessary content in the first media file may also be determined, a start position and an end position of remaining content after the unnecessary content is removed are obtained through a conversion process, and the start position and the end position of the remaining content are determined as a start position and an end position of each segment to be clipped.
Step 303, obtaining the start position and the end position of the first segment to be divided from the start position and the end position of each segment to be divided of the first media file.
Step 304, judging whether the segment to be cut currently contains the segment to be cut according to the start position and the end position of each segment to be cut in the first media file acquired in step 302 and the acquired start position and end position of the segment to be cut currently. When it is determined that the current to-be-divided slice does not contain any portion of any to-be-clipped segment, step 305 is performed, otherwise step 306 is performed.
Reading the initial position and the end position of each segment to be clipped in the first media file, judging whether the initial position of the current segment to be clipped is larger than the end position of one segment to be clipped, and whether the end position of the current segment to be clipped is smaller than the initial position of an adjacent segment to be clipped after the segment to be clipped, namely, the segment to be clipped is positioned between two adjacent segments to be clipped, and judging that the current segment to be clipped does not contain any part of any segment to be clipped when the initial position of the current segment to be clipped is larger than the end position of one segment to be clipped and the end position of the current segment to be clipped is smaller than the initial position of an adjacent segment to be clipped after the segment to be clipped are judged.
Step 305, modify the end position of the current segment to be segmented so that the current segment to be segmented at least includes a complete segment to be clipped, and execute step 308.
The method comprises the following steps:
first, the start position and the end position of the first segment to be clipped after the current segment to be divided are obtained.
Secondly, judging whether the time length of the segment to be clipped is less than or equal to the time length of the segment to be divided.
Thirdly, when the duration of the segment to be clipped is less than or equal to the duration of the segment to be clipped, modifying the end position of the segment to be clipped into the end position of the segment to be clipped.
Fourthly, when the duration of the segment to be clipped is longer than the duration of the segment to be divided, the ending position of the segment to be divided is modified into the starting position of the segment to be clipped plus the duration of the segment to be divided.
As shown in fig. 4, fig. 4 is a schematic diagram illustrating a distribution of segments to be clipped in a certain segment to be divided in the embodiment of the present application. When the starting position and the ending position of the ith fragment to be divided are read, and the position of the ith fragment to be divided meets the following conditions: e (j-1) < cs (i), and ce (i) ═ cs (i) + T < s (j), then determining that the ith slice to be segmented does not contain any part of any segment to be clipped, and modifying the end position of the ith slice to be segmented so that the ith slice to be segmented contains at least one complete segment to be clipped. E (j-1) is the ending position of the j-1 th segment to be clipped in the media file, S (j) is the starting position of the j-th segment to be clipped in the media file, E (j) is the ending position of the j-th segment to be clipped in the media file, CS (i) is the starting position of the ith segment to be divided in the media file, CE (i) is the ending position of the ith segment to be divided in the media file, i is a positive integer, and j is a positive integer larger than 1.
The following two processing modes can be divided according to the length of the jth segment to be clipped:
when E (j) -S (j) ≦ T, that is, the length of the jth segment to be clipped is less than or equal to the predetermined length of the ith segment to be clipped, modify CE (i) to CE (i) = E (j), where the modified ith segment contains 1 segment to be clipped, that is, the jth segment to be clipped.
When E (j) -S (j) > T, namely the length of the j-th segment to be clipped is greater than the predetermined length of the i-th segment to be clipped, CE (i) is modified to CE (i)' (s (j) + T, and the modified i-th segment contains 1 segment to be clipped, namely a part of the j-th segment to be clipped.
In this step, if the segment to be divided does not contain any part of any segment to be clipped, the end position of the current segment to be divided is modified to contain at least one complete segment to be clipped. Therefore, the segmentation can be cut from each fragment obtained by cutting, and the fragments without the segments to be cut are prevented from being obtained by cutting. For each fragment obtained by splitting, the system reads the start position and the end position of the corresponding segment to be clipped, and if a certain fragment does not contain any part of any segment to be clipped, the system cannot read the start position and the end position of the corresponding segment to be clipped, so that subsequent clipping processing cannot be performed, and the previous reading operation wastes system resources. Therefore, by adjusting the ending position of the segment to be segmented to include at least one complete segment to be clipped, the above situation can be avoided, and the waste of system resources can be avoided.
Further, for the slices each divided by the equal time length T, for the segment to be clipped whose time length is greater than T, particularly for the segment to be clipped whose time length is long, for example, e (j) -s (j) > T, by modifying the end position of the slice to be divided to ce (i)' -s (j) + T, the time length of the segment to be clipped from the slice to be divided can be ensured to be not greater than T. Therefore, the length of the segments obtained by clipping can be ensured to be uniform as much as possible, and the segments with overlong output time length are avoided. Further, the workload of the transcoding system in the subsequent transcoding process can be guaranteed to be uniform as much as possible, and the transcoding operation can be guaranteed to be performed synchronously, for example, if the process is not performed, a segment with a long time may be obtained, the workload of the transcoding system for subsequently transcoding the segment is increased, the transcoding time required by the segment is longer than the transcoding time required by other segments, the subsequent merging progress is affected, and the processing efficiency of the whole media file is affected.
Step 306, determining whether the current segment to be segmented contains an incomplete segment to be clipped, if the current segment to be segmented contains an incomplete segment to be clipped, executing step 307, otherwise executing step 308.
In this step, when the starting position of a certain segment to be divided is greater than the starting position of a segment to be clipped and is less than or equal to the ending position of the segment to be clipped, or the ending position of a certain segment to be divided is greater than the starting position of a segment to be clipped and is less than the ending position of the segment to be clipped, it is determined that the segment to be divided before the party contains incomplete segments to be clipped.
As shown in fig. 5, fig. 5 is a schematic diagram illustrating distribution of segments to be clipped in a certain segment to be divided in the embodiment of the present application. In this fig. 5, E (j-1) < cs (i) ≦ S (j), and S (j + n) < ce (i) ═ cs (i) + T < E (j + n); wherein, E (j-1) is the ending position of the j-1 th segment to be clipped in the media file, S (j) is the starting position of the j-th segment to be clipped in the media file, the starting position of the j + n th segment to be clipped in the S (j + n) media file, the ending position of the j + n th segment to be clipped in the E (j + n) media file, CS (i) is the starting position of the ith segment to be divided in the media file, CE (i) is the ending position of the ith segment to be divided in the media file, i is a positive integer, j is a positive integer larger than 1, k is an integer, n is a positive integer, and k is smaller than n. It is determined that the ith slice to be segmented contains an incomplete segment to be clipped, i.e., a portion of the (j + n) th slice to be segmented.
As shown in fig. 6, fig. 6 is a schematic diagram illustrating distribution of segments to be clipped in a certain segment to be divided in the embodiment of the present application. In fig. 6, s (j) < cs (i), and ce (i) ═ cs (i) + T < e (j), s (j) is the starting position of the jth segment to be clipped in the media file, e (j) is the ending position of the jth segment to be clipped in the media file, cs (i) is the starting position of the ith segment to be divided in the media file, ce (i) is the ending position of the ith segment to be divided in the media file, i is a positive integer, and j is a positive integer. It is determined that the ith slice to be segmented contains an incomplete segment to be clipped, i.e., a portion of the jth slice to be segmented.
As shown in fig. 7, fig. 7 is a schematic diagram illustrating distribution of segments to be clipped in a certain segment to be divided in the embodiment of the present application. In fig. 7, S (j) < cs (i) < E (j), E (j + k) < ce (i) < cs (i) + T ≦ S (j + k +1), S (j) is a start position of a jth segment to be clipped in the media file, E (j) is an end position of a jth segment to be clipped in the media file, S (j + k) is a start position of a jth segment to be clipped in the media file, E (j + k) is an end position of a jth segment to be clipped in the media file, S (j + k +1) is a start position of a jth segment to be clipped in the media file, cs (i) is a start position of an ith segment to be divided in the media file, ce (i) is an end position of an ith segment to be divided in the media file, and i, j, and k are positive integers. It is determined that the ith slice to be segmented contains an incomplete segment to be clipped, i.e., a portion of the jth slice to be segmented.
As shown in fig. 8, fig. 8 is a schematic diagram illustrating distribution of segments to be clipped in a certain segment to be divided in the embodiment of the present application. In this fig. 8, S (j) < cs (i) < E (j), S (j + n) < ce (i) < cs (i) + T < E (j + n), S (j) is the start position of the jth segment to be clipped in the media file, E (j) is the end position of the jth segment to be clipped in the media file, S (j + n) is the start position of the jth segment to be clipped in the media file, E (j + n) is the end position of the jth segment to be clipped in the media file, S (j + k) is the start position of the jth segment to be clipped in the media file, E (j + k) is the end position of the jth segment to be clipped in the media file, cs (i) is the start position of the ith segment to be divided in the media file, ce (i) is the end position of the ith segment to be divided in the media file, i, k and n are positive integers, and k is less than n. It is determined that the ith segment to be divided contains an incomplete segment to be clipped, i.e., a portion of the jth segment to be clipped and a portion of the j + n segment to be clipped.
Step 307, modifying the starting position and/or the ending position of the incomplete segments to be clipped included in the segment so that each segment to be clipped is included in one segment to be clipped, and executing step 308.
In this step, the current segment to be divided is referred to as a segment to be divided a, and the next adjacent segment to be divided after the current segment to be divided is referred to as a segment to be divided B. When the A to-be-segmented fragment contains a first part of the to-be-segmented fragment and the B to-be-segmented fragment contains a second part of the to-be-segmented fragment, allocating a first to-be-segmented identification to the first part of the to-be-segmented fragment, wherein the first to-be-segmented identification can be the to-be-segmented identification, modifying the end position of the first part to be the end position of the A to-be-segmented fragment, allocating a second to-be-segmented identification to the second part of the to-be-segmented fragment, and setting the start position of the second part to be the start position of the B to-be-segmented fragment. Through the above processing, the segments to be clipped distributed in the two adjacent segments to be divided can be divided into two segments to be clipped respectively contained in the two adjacent segments to be divided. If the first to-be-clipped segment identifier is the to-be-clipped segment identifier, a second to-be-clipped segment identifier is allocated to the second part, the to-be-clipped segment is adjusted to the first to-be-clipped segment, and a new second to-be-clipped segment is generated.
In the above example shown in fig. 5, the end position of the part of the j + n th segment to be clipped in the ith segment to be divided is modified to be ce (i), and the identifier of the part of the j + n th segment to be clipped in the ith segment to be divided is set as the identifier of the j + n th segment to be clipped as the last segment to be clipped in the ith segment. And allocating a new clipping segment identifier to the part of the j + n segments to be clipped, which are located in the (i +1) th segment to be clipped, and generating a new segment to be clipped, which is used as the first segment to be clipped in the (i +1) th segment to be clipped. The start position of the new segment to be clipped is set to the start position of the (i +1) th segment to be divided, i.e. CS (i + 1).
In fig. 6, in the processing of the i-1 th segment to be divided, the start position of the segment to be clipped included in the i-th segment to be divided is set to cs (i), the first segment to be divided of the i-th segment to be divided is generated, and the segment identifier is allocated to the first segment to be divided. The end position of the portion of the segment to be clipped included in the ith segment to be divided is set to the end position of the segment to be divided, i.e., ce (i). Setting the starting position of the part of the segment to be clipped, which is contained in the (i +1) th segment to be clipped, as the starting position of the (i +1) th segment to be clipped, namely CS (i +1), generating the first segment to be clipped of the (i +1) th segment to be clipped, and allocating a clipping segment identifier to the first segment to be clipped.
In fig. 7, in the processing of the i-1 th segment to be divided, the start position of the segment to be clipped included in the i-th segment to be divided is set to the start position of the i-th segment to be divided, i.e., cs (i), and the first segment to be divided of the i-th segment to be divided is generated and assigned with the clip identifier.
In fig. 8, in the processing in the i-1 th slice to be divided, the start position of the portion to be clipped included in the i-th slice to be divided is set to the start position of the i-th slice to be divided, i.e., cs (i), and a clip segment identifier is assigned thereto. Modifying the end position of the part of the j + n th segment to be clipped, which is positioned in the ith segment to be clipped, into the end position of the ith segment to be clipped, namely CE (i), and setting the identifier of the part of the j + n th segment to be clipped, which is positioned in the ith segment to be clipped, as the identifier of the j + n th segment to be clipped. Setting the starting position of the part of the j + n segments to be clipped in the (i +1) th segment to be clipped as the starting position of the (i +1) th segment to be clipped, namely CS (i +1), generating the first segment to be clipped in the (i +1) th segment to be clipped, and allocating a new clipping segment identifier to the first segment to be clipped.
Step 308, determining whether there are other to-be-segmented fragments after the current to-be-segmented fragment, when determining that there are other to-be-segmented fragments, obtaining the starting position and the ending position of an adjacent to-be-segmented fragment after the current to-be-segmented fragment, and returning to execute step 304; otherwise, step 309 is performed.
In an embodiment of the present application, the identifier and the serial number of each to-be-divided fragment may be obtained while obtaining the determined start position and end position of each to-be-divided fragment in step 301, and the serial number, the identifier and the start position and the end position of each to-be-divided fragment are sequentially stored in table 1 as follows
Sequence number of segment to be divided Identification of fragments to be divided Starting position, ending position
1 S1 (CS(1),CE(1))
2 S2 (CS(2),CE(2))
3 S3 (CS(3),CE(3))
……. …… ……
n Sn (CS(n),CE(n))
TABLE 1
In this step, the table 1 may be traversed, if the sequence number of the next segment to be segmented can be read from the sequence number of the current segment to be segmented in the table 1, the start position and the end position of the next segment to be segmented, for example, (CS (2), CE (2)), are read, the step 304 is returned to be executed, and if no other sequence number is read, the step 309 is executed.
Step 309, segmenting the first media file according to the starting position and the ending position of each segment to be segmented to obtain each segment.
Since the end position of the segment to be divided may be adjusted in step 305 to obtain an adjusted end position, the start position and the end position of the subsequent segment to be divided also need to be adjusted correspondingly. Therefore, in this step, in the process of executing the segmentation, the start position and the end position of the current segment to be segmented need to be determined first, and whether the start position and the end position of the current segment to be segmented need to be adjusted is determined according to the end position of the previous adjacent segment to be segmented.
In this step, the first media file may be segmented by:
acquiring a current fragment to be segmented, such as a starting position and an ending position of a first fragment to be segmented;
when the starting position of the first segment to be divided is equal to the ending position of an adjacent second segment to be divided before the first segment to be divided, dividing the first media file according to the starting position and the ending position of the first segment to be divided to obtain a first segment;
when the starting position of the first segment to be divided is not equal to the ending position of the second segment to be divided, modifying the starting position of the first segment to be divided into the ending position of the second segment to be divided, modifying the ending position of the first segment to be divided into the ending position of the second segment to be divided plus the duration of the first segment to be divided, and dividing the first media file according to the modified starting position and ending position of the first segment to be divided to obtain the first segment.
In this step, the first media file may be segmented one by one according to the starting position and the ending position of each segment to be segmented to obtain each segment. Alternatively, in the loop processing of each of the above steps 304-308, the first media file may be divided after the step 305 to obtain a segment.
Step 310, storing the start position and the end position of each segment obtained by dividing and each segment to be clipped in each segment.
In this step, the start positions and the end positions of the segments to be clipped in the segments and the segments obtained by splitting may be stored in the server.
Step 311, for each segment obtained by the segmentation, obtaining a start position and an end position of each segment to be clipped in the segment, and performing a clipping operation on the segment according to the start position and the end position of each segment to be clipped to obtain each segment.
In the above processing, when one segment to be clipped is included in two adjacent segments to be divided, the start position and/or end position of the segment to be clipped is adjusted so that each segment to be clipped is included in one segment to be divided. For a segment to be clipped that is completely contained in one segment to be divided, there is no need to adjust its start position and end position.
Whether the segment to be clipped is the segment to be clipped whose start position and/or end position needs to be adjusted or the segment to be clipped whose start position and end position need not be adjusted, the start position and end position of the segment to be clipped are time offsets in seconds relative to the start position of the first media file before non-fragmentation processing. After the first media file is divided into segments in step 309, each segment is a complete media file, and the start position and the end position of the segment to be clipped included in the segment are adjusted to be time offsets relative to the start position of the segment. That is, before performing a clipping operation, for example, before this step or step 309, the method further comprises: and determining the starting position and the ending position of each segment to be clipped in each segment relative to the segment, namely modifying the starting position and the ending position of each segment to be clipped in each segment into the time offset relative to the starting position of the segment. Specifically, the adjusted starting position of each segment to be clipped is the starting position of each segment to be clipped — the starting position of the slice; and the adjusted ending position of each segment to be clipped is equal to the ending position of each segment to be clipped, namely the starting position of the segment. And carrying out clipping operation on the fragments according to the adjusted starting positions and ending positions of the fragments to be clipped in each fragment to obtain the fragments.
As in the example shown in fig. 4, when e (j) -s (j) ≦ T, the start position and the end position of the segment to be clipped in the ith segment to be divided with respect to the ith segment to be divided are respectively modified as: cuts (1) ═ s (j) -cs (i), cute (i) (1) ═ e (j) -cs (i). When E (j) -S (j) > T, the starting position and the ending position of the segment to be clipped in the ith segment to be divided relative to the ith segment to be divided are respectively modified into: cuts (1) ═ s (j) -cs (i), cute (i) (1) ═ s (j) + T-cs (i).
As in the example shown in fig. 5, the starting position and the ending position of the kth segment to be clipped in the ith segment to be divided with respect to the ith segment to be divided are respectively determined as: cuts (i) (k) ═ S (j + k) -cs (i) and cute (i) (k) ═ E (j + k) -cs (i). Respectively modifying the starting position and the ending position of the nth segment to be clipped in the ith segment to be divided relative to the ith segment to be divided into: cuts (i) (n) (S (j + n) -cs (i) and cute (i) (n) (ce) (i) -cs (i)).
As in the example shown in fig. 6, the starting position and the ending position of the segment to be clipped in the ith segment to be divided with respect to the ith segment to be divided are respectively determined as: cuts (1) ═ cs (i) — cs (i) ═ 0, cute (i) (1) ═ ce (i) — cs (i) ═ T.
As in the example shown in fig. 7, the starting position and the ending position of the 1 st segment to be clipped in the ith segment to be divided with respect to the ith segment to be divided are respectively determined as: cuts (1) ═ cs (i) — cs (i) ═ 0, cute (i) (1) ═ e (j) — cs (i), the start position and the end position of the (k +1) th segment to be clipped in the i-th segment to be sliced are respectively determined as: cuts (i), (k +1) ═ S (j + k) -cs (i), cute (i) (k +1) ═ E (j + k) -cs (i).
As in the example shown in fig. 8, the starting position and the ending position of the 1 st segment to be clipped in the ith segment to be divided with respect to the ith segment to be divided are respectively determined as: cuts (1) ═ cs (i) — cs (i) ═ 0, cute (i) (1) ═ e (j) — cs (i); respectively determining the starting position and the ending position of the (k +1) th segment to be clipped in the ith segment to be divided relative to the ith segment to be divided as follows: cuts (i), (k +1) ═ S (j + k) -cs (i), cute (i) (k +1) ═ E (j + k) -cs (i); respectively determining the starting position and the ending position of the (n +1) th segment to be clipped in the ith segment to be divided relative to the ith segment to be divided as follows: cots (i) (n +1) ═ S (j + n) -cs (i), coute (i) (n +1) ═ ce (i) -cs (i).
And step 312, sending the segments to a plurality of transcoding servers for transcoding to obtain transcoded segments.
In the embodiment of the application, all the segments can be sent to a plurality of transcoding servers for transcoding processing, and the transcoding efficiency can be improved through the distributed parallel transcoding processing, so that the media data processing efficiency is improved.
And 313, merging the transcoded segments to obtain the second media file.
Fig. 9 is a schematic structural diagram of a media data processing apparatus according to an embodiment of the present application. The media data processing apparatus includes:
a first position determining module 901, configured to obtain a starting position and an ending position of each segment to be segmented of the first media file;
a second position determining module 902, configured to obtain a starting position and an ending position of each segment to be clipped in the first media file;
a segment position modifying module 903, configured to modify, when a segment to be segmented includes an incomplete segment to be clipped, a start position and/or an end position of the incomplete segment to be clipped included in the segment, so that each segment to be clipped is included in one segment to be segmented;
a dividing module 904, configured to divide the first media file according to the starting position and the ending position of each segment to be divided to obtain each segment;
a clipping module 905, configured to, for each segmented fragment, perform a clipping operation on the segmented fragment according to a start position and an end position of each segment to be clipped in the segmented fragment to obtain each segment;
a merging module 906, configured to merge the segments to obtain a second media file.
In one embodiment of the present application, when a first to-be-divided slice includes a first portion of a segment to be clipped, and an adjacent second to-be-divided slice following the first to-be-divided slice includes a second portion of the segment to be clipped,
the segment position modifying module 903 is further configured to allocate a first segment to be clipped to a first part of the segment to be clipped, and modify an end position of the first segment to be clipped to an end position of the first segment to be divided; and allocating a second to-be-clipped segment identifier to a second part of the to-be-clipped segment, and setting the starting position of the second to-be-clipped segment as the starting position of the second to-be-divided segment.
In an embodiment of the application, the to-be-divided partition does not contain any part of any to-be-clipped segment, and the apparatus further comprises: a fragment position modifying module 907, configured to modify an end position of the fragment to be divided, so that the fragment to be divided at least includes a complete fragment to be clipped.
In an embodiment of the present application, the fragment position modifying module 903 is further configured to obtain a starting position and an ending position of a first fragment to be clipped after the fragment to be clipped, and modify the ending position of the fragment to be clipped to the ending position of the fragment to be clipped when a duration of the fragment to be clipped is less than or equal to a duration of the fragment to be clipped; and when the duration of the segment to be clipped is greater than the duration of the segment to be divided, modifying the end position of the segment to be divided into the starting position of the segment to be clipped and the duration of the segment to be divided.
In an embodiment of the present application, the segmentation module 904 is further configured to
Acquiring the starting position and the ending position of a first to-be-segmented fragment;
when the starting position of the first segment to be divided is equal to the ending position of an adjacent second segment to be divided before the first segment to be divided, dividing the first media file according to the starting position and the ending position of the first segment to be divided to obtain a first segment;
when the starting position of the first segment to be divided is not equal to the ending position of the second segment to be divided, modifying the starting position of the first segment to be divided into the ending position of the second segment to be divided, modifying the ending position of the first segment to be divided into the ending position of the second segment to be divided plus the duration of the first segment to be divided, and dividing the first media file according to the modified starting position and ending position of the first segment to be divided to obtain the first segment.
In one embodiment of the present application, the apparatus further comprises:
a sending module 908, configured to send the start positions and the end positions of the fragments obtained by splitting and the segments to be clipped in the fragments to a memory for storage;
the clipping module 905 is further configured to sequentially obtain, from the memory, the stored fragments and the start positions and the end positions of the segments to be clipped in the fragments, and perform, for each obtained fragment, a clipping operation on the fragment according to the start position and the end position of each segment to be clipped in the fragment to obtain each segment.
In one embodiment of the present application, the apparatus further comprises:
a sending module 909, configured to send each segment to multiple transcoding servers for transcoding, so as to obtain a transcoded segment;
the merging module 906 is further configured to merge the transcoded segments to obtain the second media file.
Fig. 10 is a schematic structural diagram of a media data processing apparatus according to an embodiment of the present invention. As shown in fig. 10, the apparatus includes: a processor 1001, a non-volatile computer-readable memory 1002, a display unit 1003, a network communication interface 1004. These components communicate over a bus 1005.
In this embodiment, a number of program modules are stored in memory 1002, including an operating system 1006, a network communication module 1007, and an application 1008.
The processor 1001 can read various modules (not shown in the figure) included in the application program in the memory 1002 to execute various functional applications and data processing. The processor 1001 in this embodiment may be one or more, and may be a CPU, a processing unit/module, an ASIC, a logic module, a programmable gate array, or the like.
The application programs 1008 may include: media data processing module 1009. The method comprises the following steps: the media data processing module 1009 may include a set of computer-executable instructions 1009-1 and corresponding metadata and heuristics 1009-2 formed by the various functional modules in the device shown in fig. 9. These sets of computer-executable instructions may be executed by the processor 1001 and perform the methods of fig. 2 and 3 or the functions of the apparatus of fig. 9.
In this embodiment, the network communication interface 1004 and the network communication module 1007 cooperate to complete the transmission and reception of various network signals of the media data processing apparatus.
The display unit 1003 has a display panel, such as a liquid crystal display, for inputting and displaying related information.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each module may exist alone physically, or two or more modules are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit. The functional modules of the embodiments may be located in one terminal or network node, or may be distributed over a plurality of terminals or network nodes.
In addition, each of the embodiments of the present invention can be realized by a data processing program executed by, for example, a computer. It is clear that the data processing program constitutes the invention. Further, the data processing program, which is generally stored in one storage medium, is executed by directly reading the program out of the storage medium or by installing or copying the program into a storage device (such as a hard disk and/or a memory) of the data processing device. Such a storage medium therefore also constitutes the present invention. The storage medium may use any type of recording means, such as a paper storage medium (e.g., paper tape, etc.), a magnetic storage medium (e.g., a flexible disk, a hard disk, a flash memory, etc.), an optical storage medium (e.g., a CD-ROM, etc.), a magneto-optical storage medium (e.g., an MO, etc.), and the like.
The present invention therefore also provides a storage medium having stored therein computer readable instructions which, when executed, are adapted to perform any of the above-described embodiments of the method of the present invention.
In addition, functional modules in the embodiments of the present application may be integrated into one processing unit, or each module may exist alone physically, or two or more modules are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit. The functional modules of the embodiments may be located in one terminal or network node, or may be distributed over a plurality of terminals or network nodes.
In addition, each of the embodiments of the present application can be realized by a data processing program executed by, for example, a computer. It is clear that a data processing program constitutes the present application. Further, a data processing program, which is generally stored in one storage medium, is executed by directly reading the program out of the storage medium or by installing or copying the program into a storage device (such as a hard disk and/or a memory) of the data processing device. Such a storage medium therefore also constitutes the present application. The storage medium may use any type of recording means, such as a paper storage medium (e.g., paper tape, etc.), a magnetic storage medium (e.g., a flexible disk, a hard disk, a flash memory, etc.), an optical storage medium (e.g., a CD-ROM, etc.), a magneto-optical storage medium (e.g., an MO, etc.), and the like.
The present application therefore also provides a storage medium in which a data processing program is stored, the data processing program being adapted to perform any one of the embodiments of the method described above in the present application.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the scope of protection of the present application.

Claims (16)

1. A method for media data processing, comprising:
acquiring the starting position and the ending position of each fragment to be divided of the first media file;
acquiring the starting position and the ending position of each segment to be clipped in the first media file;
when one fragment to be segmented contains incomplete fragments to be clipped, modifying the starting position and/or the ending position of the incomplete fragments to be clipped contained in the fragment to be segmented so as to enable each fragment to be clipped to be contained in one fragment to be segmented;
segmenting the first media file according to the initial position and the end position of each segment to be segmented to obtain each segment;
aiming at each fragment obtained by segmentation, according to the starting position and the ending position of each segment to be clipped in the fragment, carrying out clipping operation on the fragment to obtain each segment;
merging the segments to obtain a second media file;
when one fragment to be divided contains an incomplete fragment to be clipped, modifying the starting position and/or the ending position of the incomplete fragment to be clipped contained in the fragment comprises:
when a first to-be-divided slice includes a first part of a to-be-clipped segment, and an adjacent second to-be-divided slice following the first to-be-divided slice includes a second part of the to-be-clipped segment,
setting the mark of a first part of the segment to be clipped as the mark of the segment to be clipped, and modifying the end position of the first part into the end position of the first segment to be divided;
and allocating a second to-be-clipped segment identifier to a second part of the to-be-clipped segment, and setting the starting position of the second part as the starting position of the second to-be-divided fragment.
2. The method of claim 1, further comprising:
if the starting position of the current segment to be segmented is larger than the starting position of a segment to be clipped and is smaller than or equal to the ending position of the segment to be clipped, or if the ending position of the current segment to be segmented is larger than the starting position of a segment to be clipped and is smaller than the ending position of the segment to be clipped, the current segment to be segmented is judged to contain an incomplete segment to be clipped.
3. The method of claim 1, wherein when the to-be-divided slice does not contain any portion of any to-be-clipped segment, further comprising:
and modifying the end position of the fragment to be segmented so that the fragment to be segmented at least comprises a complete fragment to be clipped.
4. The method according to claim 3, wherein modifying the end position of the segment to be divided so that the segment to be divided contains at least one complete segment to be clipped comprises:
acquiring the starting position and the ending position of a first segment to be clipped after the segment to be divided;
when the duration of the segment to be clipped is less than or equal to the duration of the segment to be clipped, modifying the end position of the segment to be clipped to the end position of the segment to be clipped;
and when the duration of the segment to be clipped is greater than the duration of the segment to be divided, modifying the end position of the segment to be divided into the starting position of the segment to be clipped and the duration of the segment to be divided.
5. The method of claim 1, wherein segmenting the first media file into segments according to the starting position and the ending position of each segment to be segmented comprises:
acquiring the starting position and the ending position of a first to-be-segmented fragment;
when the starting position of the first segment to be divided is equal to the ending position of an adjacent second segment to be divided before the first segment to be divided, dividing the first media file according to the starting position and the ending position of the first segment to be divided to obtain a first segment;
when the starting position of the first segment to be divided is not equal to the ending position of the second segment to be divided, modifying the starting position of the first segment to be divided into the ending position of the second segment to be divided, modifying the ending position of the first segment to be divided into the ending position of the second segment to be divided plus the duration of the first segment to be divided, and dividing the first media file according to the modified starting position and ending position of the first segment to be divided to obtain the first segment.
6. The method of claim 1, further comprising:
storing each fragment obtained by the segmentation and the initial position and the end position of each segment to be clipped in each fragment;
according to the starting position and the ending position of each segment to be clipped in the segment, the clipping operation is carried out on the segment to obtain each segment, and the method comprises the following steps: the method comprises the steps of sequentially obtaining stored fragments and the starting position and the ending position of each segment to be clipped in each fragment, and executing clipping operation on each fragment according to the starting position and the ending position of each segment to be clipped in each fragment to obtain each segment.
7. The method of claim 1,
further comprising: sending the segments to a plurality of transcoding servers for transcoding processing to obtain transcoded segments;
the step of combining the segments to obtain a second media file comprises the following steps: and merging the transcoded segments to obtain the second media file.
8. A media data processing apparatus, comprising:
the first position determining module is used for acquiring the starting position and the ending position of each fragment to be divided of the first media file;
the second position determining module is used for acquiring the starting position and the ending position of each segment to be clipped in the first media file;
the segmentation position modification module is used for modifying the starting position and/or the ending position of the incomplete segment to be clipped contained in one segment to be clipped when the segment to be clipped contains the incomplete segment to be clipped, so that each segment to be clipped is contained in one segment to be clipped;
the dividing module is used for dividing the first media file according to the starting position and the ending position of each fragment to be divided to obtain each fragment;
the cutting module is used for carrying out cutting operation on each fragment according to the starting position and the ending position of each segment to be cut in the fragment to obtain each segment;
the merging module is used for merging the segments to obtain a second media file;
when a first segment to be divided contains a first part of a segment to be cut and a second segment to be divided which is next to the first segment to be divided contains a second part of the segment to be cut, the segment position modifying module is used for setting the identification of the first part of the segment to be cut as the identification of the segment to be cut and modifying the end position of the first part into the end position of the first segment to be divided; and allocating a second to-be-clipped segment identifier to a second part of the to-be-clipped segment, and setting the starting position of the second part as the starting position of the second to-be-divided fragment.
9. The apparatus of claim 8, wherein the segment position modification module is further configured to determine that the current segment to be segmented contains an incomplete segment to be clipped if a starting position of the current segment to be segmented is greater than a starting position of a segment to be clipped and is less than or equal to an ending position of the segment to be clipped, or if an ending position of the current segment to be segmented is greater than a starting position of a segment to be clipped and is less than an ending position of the segment to be clipped.
10. The apparatus of claim 8, wherein when the to-be-divided slice does not contain any portion of any to-be-clipped segment, further comprising:
and the fragment position modifying module is used for modifying the end position of the fragment to be segmented so that the fragment to be segmented at least comprises a complete fragment to be clipped.
11. The apparatus according to claim 10, wherein the fragment position modification module is further configured to obtain a starting position and an ending position of a first fragment to be clipped after the fragment to be divided, and modify the ending position of the fragment to be divided into the ending position of the fragment to be divided when a duration of the fragment to be divided is less than or equal to a duration of the fragment to be divided; and when the duration of the segment to be clipped is greater than the duration of the segment to be divided, modifying the end position of the segment to be divided into the starting position of the segment to be clipped and the duration of the segment to be divided.
12. The apparatus of claim 8, wherein the partitioning module is further configured to
Acquiring the starting position and the ending position of a first to-be-segmented fragment;
when the starting position of the first segment to be divided is equal to the ending position of an adjacent second segment to be divided before the first segment to be divided, dividing the first media file according to the starting position and the ending position of the first segment to be divided to obtain a first segment;
when the starting position of the first segment to be divided is not equal to the ending position of the second segment to be divided, modifying the starting position of the first segment to be divided into the ending position of the second segment to be divided, modifying the ending position of the first segment to be divided into the ending position of the second segment to be divided plus the duration of the first segment to be divided, and dividing the first media file according to the modified starting position and ending position of the first segment to be divided to obtain the first segment.
13. The apparatus of claim 8, further comprising:
a sending module, configured to send the start positions and the end positions of the segments to be clipped in the segments and the segments obtained by splitting to a memory for storage;
the clipping module is further configured to sequentially obtain the stored fragments and the start positions and the end positions of the segments to be clipped in the fragments from the memory, and perform a clipping operation on each obtained fragment according to the start position and the end position of each segment to be clipped in the fragment to obtain each segment.
14. The apparatus of claim 8, further comprising:
the sending module is used for sending the segments to a plurality of transcoding servers for transcoding processing to obtain transcoded segments;
the merging module is further configured to merge the transcoded segments to obtain the second media file.
15. A computer-readable storage medium storing computer-readable instructions for execution by at least one processor to perform the method of any one of claims 1 to 7.
16. An apparatus comprising a memory and a processor, the memory having stored therein computer-readable instructions which, when executed by the processor, implement the method of any one of claims 1 to 7.
CN201710856551.1A 2017-09-21 2017-09-21 Media data processing method and device Active CN109547864B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710856551.1A CN109547864B (en) 2017-09-21 2017-09-21 Media data processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710856551.1A CN109547864B (en) 2017-09-21 2017-09-21 Media data processing method and device

Publications (2)

Publication Number Publication Date
CN109547864A CN109547864A (en) 2019-03-29
CN109547864B true CN109547864B (en) 2021-05-07

Family

ID=65827363

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710856551.1A Active CN109547864B (en) 2017-09-21 2017-09-21 Media data processing method and device

Country Status (1)

Country Link
CN (1) CN109547864B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114900713B (en) * 2022-07-13 2022-09-30 深圳市必提教育科技有限公司 Video clip processing method and system

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103745736A (en) * 2013-12-27 2014-04-23 宇龙计算机通信科技(深圳)有限公司 Method of video editing and mobile terminal thereof
CN104519323A (en) * 2014-12-26 2015-04-15 桂林远望智能通信科技有限公司 Personnel and vehicle target classification system and method
CN105227968A (en) * 2014-06-30 2016-01-06 惠州市伟乐科技股份有限公司 Based on the video code conversion accelerated method of section
CN105376612A (en) * 2014-08-26 2016-03-02 华为技术有限公司 Video playing method, media equipment, playing equipment and multimedia system
CN105721933A (en) * 2016-03-23 2016-06-29 Tcl集团股份有限公司 Method for creating advertisement video information base, advertisement video identification method, apparatus for creating advertisement video information base and advertisement video identification apparatus
CN105763960A (en) * 2016-03-01 2016-07-13 青岛海信传媒网络技术有限公司 Method and apparatus for network video playing
WO2017061103A1 (en) * 2015-10-05 2017-04-13 パナソニックIpマネジメント株式会社 Program dividing device and program dividing method
CN106686391A (en) * 2016-12-15 2017-05-17 广州术医传承信息科技有限公司 Medical interaction live video method and system
EP3185564A1 (en) * 2015-12-22 2017-06-28 Harmonic Inc. Video stream splicing of groups of pictures (gop)
GB2546027A (en) * 2013-04-09 2017-07-05 Canon Kk Method, device, and computer program for encapsulating partioned timed media data

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105357531B (en) * 2015-12-15 2018-07-20 北京网博视界科技股份有限公司 Based on video local code fly-cutting packaging method

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2546027A (en) * 2013-04-09 2017-07-05 Canon Kk Method, device, and computer program for encapsulating partioned timed media data
CN103745736A (en) * 2013-12-27 2014-04-23 宇龙计算机通信科技(深圳)有限公司 Method of video editing and mobile terminal thereof
CN105227968A (en) * 2014-06-30 2016-01-06 惠州市伟乐科技股份有限公司 Based on the video code conversion accelerated method of section
CN105376612A (en) * 2014-08-26 2016-03-02 华为技术有限公司 Video playing method, media equipment, playing equipment and multimedia system
CN104519323A (en) * 2014-12-26 2015-04-15 桂林远望智能通信科技有限公司 Personnel and vehicle target classification system and method
WO2017061103A1 (en) * 2015-10-05 2017-04-13 パナソニックIpマネジメント株式会社 Program dividing device and program dividing method
EP3185564A1 (en) * 2015-12-22 2017-06-28 Harmonic Inc. Video stream splicing of groups of pictures (gop)
CN105763960A (en) * 2016-03-01 2016-07-13 青岛海信传媒网络技术有限公司 Method and apparatus for network video playing
CN105721933A (en) * 2016-03-23 2016-06-29 Tcl集团股份有限公司 Method for creating advertisement video information base, advertisement video identification method, apparatus for creating advertisement video information base and advertisement video identification apparatus
CN106686391A (en) * 2016-12-15 2017-05-17 广州术医传承信息科技有限公司 Medical interaction live video method and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
《面向移动视频的云编辑系统研究与实现》;周礼;《中国优秀硕士学位论文全文数据库》;20140615;全文 *

Also Published As

Publication number Publication date
CN109547864A (en) 2019-03-29

Similar Documents

Publication Publication Date Title
CN110636340B (en) Video file uploading method, storage device, terminal device and storage medium
WO2019201039A1 (en) Method and system for updating application and application server
CN110149518A (en) Processing method, system, device, equipment and the storage medium of media data
CN109325034B (en) Data processing method, device, computer equipment and storage medium
CN113485962B (en) Log file storage method, device, equipment and storage medium
US9055268B2 (en) Multi-tier recorder to enable seek-back unique copy recording
CN109241099B (en) Data query method and terminal equipment
CN111935227A (en) Method for uploading file through browser, browser and electronic equipment
CN105786539B (en) File downloading method and device
CN111614730B (en) File processing method and device of cloud storage system and electronic equipment
CN112632008A (en) Data fragment transmission method and device and computer equipment
CN109547864B (en) Media data processing method and device
CN105872635A (en) Video resource distribution method and device
CN114095755A (en) Video processing method, device and system, electronic equipment and storage medium
CN104008116A (en) File synchronization method and electronic device
KR20160002789A (en) Transmitting information based on reading speed
CN108055594B (en) Edge slicing implementation method and device, computer equipment and storage medium
CN113742376A (en) Data synchronization method, first server and data synchronization system
CN111147226B (en) Data storage method, device and storage medium
CN111107443A (en) DASH fragment file merging method, terminal device and storage medium
CN107422991B (en) Storage strategy management system
US11386043B2 (en) Method, device, and computer program product for managing snapshot in application environment
CN111669667B (en) Content display control method and device, server and storage medium
CN109947613B (en) File reading test method and device
CN109302446B (en) Cross-platform access method and device, electronic equipment 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