The present disclosure relates to video technology, especially to a method for playing video files and electronic device using the same.
Video files can include video data and audio data. Audio data can include voice data and music data. For example, a film can include at least one portion of music data. A user who wishes to hear again one particular piece of music can choose to play one portion of the music data by fast forwarding or fast reversing the music data.
The components in the drawings are not necessarily drawn to scale, the emphasis instead being placed upon clearly illustrating the principles of the present disclosure. Moreover, in the drawings, like reference numerals designate corresponding parts or sections throughout the drawings.
The disclosure is illustrated by way of example and not by way of limitation in the figures of the accompanying drawings in which like references indicate similar elements. It should be noted that references to “an” or “one” embodiment in this disclosure are not necessarily to the same embodiment, and such references mean “at least one”. The references “a plurality of” and “a number of” mean “at least two.”
The electronic device 1 can include a storage unit 11, an input unit 12, a processor 13, and a playback unit 14.
The storage unit 11 stores at least one video file. The video file can include video data and audio data. The audio data can include voice data and music data.
The input unit 12 generates a signal in response to a user's operation applied thereon. In at least one embodiment, the user's operation can be an operation for opening a video file, playing the video file, playing a next video file, playing a previous video file, or other operation.
The processor 13 can include an open module 131, a decode module 132, a separation module 133, an analysis module 134, a record module 135, and a play control module 136.
The open module 131 is used for opening a video file stored in the storage unit 11.
The decode module 132 is used for decoding the opened video file.
The separation module 133 is used for separating the decoded video file into video data and audio data. The audio data can include a number of pieces of music data and a number of pieces of voice data.
The analysis module 134 is used for analyzing a starting position and an ending position of each piece of the music data of the audio data according to the spectral characteristic of the audio data as the spectral characteristic of the music data and the voice data is different.
The recording module 135 is used for recording the starting position and the ending position of each piece of the music data of the audio data, and storing the recorded starting position and the ending position of the music data of the audio data in the storage unit 11.
The play control module 13 is used for controlling the playback unit 14 to play the video file in response to a user's operation of playing the video file. The play control module 136 is further used for controlling the playback unit 14 to play the music data according to the recorded starting position and ending position of the music data of the audio data in response to a user's operation for playing the music data whose starting position and ending position has been recorded. In the embodiment, the first played piece the music data is of the music data with first starting and ending positions recorded.
After the first piece recorded music data has been played, the play control module 136 further determines whether there is another piece of recorded music data to be played, and if so controls the playback unit 14 to play the next piece of the recorded music data.
In block 210, the open module opens a video file stored in the storage unit.
In block 220, the video decode module decodes the opened video file.
In block 230, the separation module separates the decoded video file into video data and audio data. In at least one embodiment, the audio data can include a number of pieces of music data.
In block 240, the analysis module analyzes the starting position and the ending position of each piece of the music data of the audio data according to the spectral characteristic of the audio data.
In block 250, the recording module records the starting position and the ending position of each piece of the music data of the audio data, and stores the recorded starting position and the ending position of each piece of the music data of the audio data in the storage unit.
In block 260, the play control module controls the playback unit to play the first piece recorded music data according to the recorded starting ending positions of the music data of the audio data in response to a user's operation for playing music data of which the starting and ending positions has been recorded.
In block 270, after the first piece recorded music data of the audio data has been played, the play control module determines whether there is another piece of the recorded music data of the audio data to be played, if yes, the process goes to block 280, otherwise, the process ends.
In block 280, the play control module controls the playback unit to play the next piece of the recorded music data, then the process goes to block 270.
Although the present disclosure has been specifically described on the basis of various embodiments thereof, the disclosure is not to be construed as being limited thereto. Various changes or modifications may be made to the embodiments without departing from the scope of the disclosure. The embodiments described herein are illustrative and should not be construes to limit the scope of the following claims.
Number | Date | Country | Kind |
---|---|---|---|
201310244163X | Jun 2013 | CN | national |