CN109119100A - The storage method of audio data or video data, storage system and computer equipment - Google Patents

The storage method of audio data or video data, storage system and computer equipment Download PDF

Info

Publication number
CN109119100A
CN109119100A CN201710492851.6A CN201710492851A CN109119100A CN 109119100 A CN109119100 A CN 109119100A CN 201710492851 A CN201710492851 A CN 201710492851A CN 109119100 A CN109119100 A CN 109119100A
Authority
CN
China
Prior art keywords
file
storage
audio data
data
video data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201710492851.6A
Other languages
Chinese (zh)
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.)
Beijing Didi Infinity Technology and Development Co Ltd
Original Assignee
Beijing Didi Infinity Technology and Development 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 Beijing Didi Infinity Technology and Development Co Ltd filed Critical Beijing Didi Infinity Technology and Development Co Ltd
Priority to CN201710492851.6A priority Critical patent/CN109119100A/en
Publication of CN109119100A publication Critical patent/CN109119100A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11BINFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
    • G11B20/00Signal processing not specific to the method of recording or reproducing; Circuits therefor
    • G11B20/10Digital recording or reproducing
    • G11B20/10527Audio or video recording; Data buffering arrangements
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11BINFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
    • G11B20/00Signal processing not specific to the method of recording or reproducing; Circuits therefor
    • G11B20/10Digital recording or reproducing
    • G11B20/10009Improvement or modification of read or write signals
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/76Television signal recording
    • H04N5/91Television signal processing therefor
    • H04N5/92Transformation of the television signal for recording, e.g. modulation, frequency changing; Inverse transformation for playback
    • H04N5/9201Transformation of the television signal for recording, e.g. modulation, frequency changing; Inverse transformation for playback involving the multiplexing of an additional signal and the video signal
    • H04N5/9202Transformation of the television signal for recording, e.g. modulation, frequency changing; Inverse transformation for playback involving the multiplexing of an additional signal and the video signal the additional signal being a sound signal
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11BINFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
    • G11B20/00Signal processing not specific to the method of recording or reproducing; Circuits therefor
    • G11B20/10Digital recording or reproducing
    • G11B20/10527Audio or video recording; Data buffering arrangements
    • G11B2020/10537Audio or video recording

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Multimedia (AREA)
  • Signal Processing For Digital Recording And Reproducing (AREA)

Abstract

The invention proposes the storage method of a kind of audio data or video data, system, computer equipment, computer readable storage medium and smart machine, the storage method of audio data or video data includes: to establish data pipe;Inputting audio data or video data into data pipe;Read audio data or video data;Audio data or video data are stored to storage file.It enables to data pipe that audio data or video data are carried out to typing in the form of data flow through the invention and reads instantaneous transmission audio data or video data in turn, and data can completely be stored to each file without stopping and restarting recording or recording service MediaRecorder, it avoids and there is the case where leakage second caused by restarting MediaRecorder between file.

Description

The storage method of audio data or video data, storage system and computer equipment
Technical field
The present invention relates to technical field of data storage, in particular to the storage of a kind of audio data or video data Method, storage system, computer equipment, computer readable storage medium and smart machine.
Background technique
User is when using automobile data recorder, it is desirable that automobile data recorder will have the function of continuously recording, record a video, and need It to be that the period will record, Video data is divided into small documents one by one and stores, and then facilitates text with set time (such as 30 seconds) The selection of part uploads.In the prior art, the common function for calling MediaRcorder to realize recording audio and video of Android App Can, but a file storage can only be carried out after its every time starting, if it is desired to recording, Video data are stored to another text Part then needs to stop and restarts MediaRecorder.
It in the related art, is to restart MediaRecorder again by above-mentioned each stopping to deposit into new file Storage data and reach will recording, video recording single cent part storage purpose.And MediaRecorder stops restarting again every time There are several seconds delay times, cause the recording within the scope of this section of delay time, video recording that can not be enrolled, i.e., every two recording or There is leakage second situation between video file, in addition storing to the recording of each file, video recording is also not fixed audio or video Format, the work of the subsequent conversion for also needing to be fixed audio or video format again.Therefore, how will recording or video recording completion Ground is simultaneously stored into each file with fixed audio or video format as urgent problem to be solved.
Summary of the invention
The present invention is directed to solve at least one of the technical problems existing in the prior art or related technologies.
For this purpose, an object of the present invention is to provide the storage methods of a kind of audio data or video data.
It is another object of the present invention to propose the storage system of a kind of audio data or video data.
Another object of the present invention is to propose a kind of computer equipment.
Yet another object of the invention is that proposing a kind of computer readable storage medium.
Yet another object of the invention is that proposing a kind of smart machine.
In view of this, a purpose according to the present invention, the storage method of a kind of audio data or video data is proposed, It include: to establish data pipe;Inputting audio data or video data into data pipe;Read audio data or video data; Audio data or video data are stored to storage file.
The storage method of audio data or video data provided by the invention, file stream refer to synchronization may only write or The file that person reads;Pipeline refers to the both ends for being known as pipeline by creating two file handles, and wherein one end can be read, referred to as the end A, Other end can be write, referred to as the end B.Newly-built Android recording or recording service MediaRecorder, newdata pipeline, and Data pipe thus is arranged in MediaRecorder output, to the form inputting audio data of one data flow of the end B of data pipe Or video data, it is stored in the form of data flow to storage file when reading data.Data are enabled to through the invention Pipeline audio data or video data are carried out in the form of data flow typing and read so instantaneous transmission audio data or Person's video data, and can be complete by data without stopping and restarting recording or recording service MediaRecorder Ground is stored to each file, avoids and there is the case where leakage second caused by restarting MediaRecorder between file.
The storage method of above-mentioned audio data or video data according to the present invention, can also have following technical characteristic:
In any of the above-described technical solution, it is preferable that when for audio data, by audio data or video data store to The step of storage file, specifically includes: when currently stored file is first storage file, obtaining the fixed byte of audio data And as file fixing head;To currently stored file storage file fixing head and audio data, while the record storage time; When storage time reaches preset time, stop storing the audio data to currently stored file, and establishes next storage text Part;To next storage file storage file fixing head and remaining audio data, until next storage time reaches preset time.
In the technical scheme, start MediaRecorder and read audio data in the form of audio stream, incited somebody to action when for the first time When this audio data is stored to file, namely when the currently stored file of storage is first storage file, audio data is obtained The first six byte content is AMR audio format fixing head as file fixing head, file fixing head, this file is fixed Head is stored to currently stored file, then also stores audio data to currently stored file in the form of audio stream, and Record storage time while starting to store audio data to currently stored file, preset time is reached when the time of storage When, storage of the currently stored file to audio data is completed, next storage file is established, above-mentioned file fixing head is stored So far next storage file is then also stored remaining audio data in the form of audio stream to next storage file, and Storage time stops storage when reaching preset time, constantly stores " file fixing head+audio data " to storage file, Until all audio datas are all stored as multiple files by the period of preset time, it can guarantee each storage file of storage All by AMR audio format fixing head having the same, prevent storage file chaotic.
In any of the above-described technical solution, it is preferable that when for video data, by audio data or video data store to The step of storage file, specifically includes: storing video data, while record storage time to currently stored file;When storage Between when reaching preset time, stop storing video data to currently stored file, and be mark by currently stored document format conversion Quasi- MP4 formatted file;Next storage file is established, stores remaining video data to next storage file, until when next storage Between reach preset time.
In the technical scheme, when for video data, to currently stored file storage video data while record storage Time completes storage of the currently stored file to video data, and will be currently stored when the time of storage reaching preset time Document format conversion is standard MP4 formatted file, resettles next storage file, stores remaining video number to next storage file According to until next storage time reaches preset time, realization format is automatic while to video data progress single cent part storage Conversion.
In any of the above-described technical solution, it is preferable that currently stored file storage file fixing head and audio data, It specifically includes: to currently stored file with file fixing head in the posterior sequence of preceding, audio data, storage file fixing head And audio data;To next file storage file fixing head and remaining audio data, specifically include: to next storage file with File fixing head is in preceding, the posterior sequence of remaining audio data, storage file fixing head and remaining audio data.
In the technical scheme, in storage file fixing head and audio into currently stored file or next storage file When data, stored according to file fixing head in the posterior sequence of preceding, audio data, i.e., constantly by " file fixing head Portion+audio data " is stored respectively to each storage file, so that the head of each storage file is identical file fixing head Portion guarantees that file storage is clear, prevents storage file from causing confusion.
In any of the above-described technical solution, it is preferable that the fixed byte of audio data is the first six byte of audio data; File fixing head is AMR audio format fixing head.
In the technical scheme, according to file memory format, the first six byte of entire audio data is obtained as fixation Byte guarantees the correctness of file storage so that the fixing head of each storage file is the first six byte of audio data. File fixing head is AMR audio format fixing head, that is to say, that same to storage file storing audio data respectively When, so that storage file is become complete audio file according to AMR audio format, there is the leakage second when audio data can either be avoided to store The case where, and can guarantee directly for audio data to be stored as AMR audio format.
In any of the above-described technical solution, it is preferable that further include: judge inputting audio data or video into data pipe Whether data terminate;At the end of the inputting audio data into data pipe or video data, closes and store currently stored text Part or next storage file.
In the technical scheme, whether real-time judge audio data or video data of typing into pipeline terminates, and works as knot Without audio data or video data in Shu Shidai table audio data or video data pipeline, then the file of storage is closed, The storage of audio data or video data is completed, and uses C layers of library by the storage file after the file for closing storage video data Processing is standard MP4 file, avoids the waste of system resource, and wherein C layers of library are the number write in Android project using c language codes According to library.
Another purpose according to the present invention proposes the storage system of a kind of audio data or video data, comprising: pipe Unit is established in road, for establishing data pipe;Typing unit, for inputting audio data or video data into data pipe; Reading unit, for reading audio data or video data;Storage unit, for storing audio data or video data to depositing Store up file.
The storage system of audio data or video data provided by the invention, file stream refer to synchronization may only write or The file that person reads;Pipeline refers to the both ends for being known as pipeline by creating two file handles, and wherein one end can be read, referred to as the end A, Other end can be write, referred to as the end B.Pipeline establishes unit and creates Android recording or recording service MediaRecorder, newly Data pipe is built, and data pipe, typing unit are counted to the end B one of data pipe thus by MediaRecorder output setting According to the form inputting audio data or video data of stream, when reading unit reads data, by storage unit with data flow Form audio data or video data are stored to storage file.Enable to data pipe by audio number through the invention According to or video data carried out in the form of data flow typing and read so instantaneous transmission audio data or video data, with And data can completely be stored without stopping and restarting recording or recording service MediaRecorder to each text Part avoids and there is the case where leakage second caused by restarting MediaRecorder between file.
The storage system of above-mentioned audio data or video data according to the present invention, can also have following technical characteristic:
In any of the above-described technical solution, it is preferable that further include: acquiring unit is audio data for working as, and works as When preceding storage file is first storage file, the fixed byte of audio data is obtained and as file fixing head;Storage unit, Specifically for currently stored file storage file fixing head and audio data, while the record storage time;And when storage When time reaches preset time, stop storing the audio data to currently stored file;File establishes unit, under establishing One storage file;Storage unit is also used to store the file fixing head and remaining audio data to next storage file, directly Reach preset time to next storage time.
In the technical scheme, start MediaRecorder and audio data is read by reading unit, when for the first time by this sound For frequency according to when storing to storage file namely when currently stored file is first storage file, acquiring unit obtains audio data The first six byte content as file fixing head, file fixing head is AMR audio format fixing head, and it is single to pass through storage Member stores this file fixing head to currently stored file, then also stores audio data to current in the form of audio stream Storage file, and record storage time while starting to store audio data to currently stored file, when storage Between reach preset time when, complete storage of the currently stored file to audio data, establish next storage file, by above-mentioned text Part fixing head stores so far next storage file, then also stores remaining audio data to next in the form of audio stream Storage file, and stop storage when storage time reaches preset time, constantly " file fixing head+audio data " is deposited Storage is to storage file, until all audio datas are all stored as multiple storage files by the period of preset time.It can guarantee AMR audio format fixing head having the same is prevented storage file chaotic by each storage file of storage.
In any of the above-described technical solution, it is preferable that storage unit is also used to when for video data, to currently stored File stores video data, while record storage time;The storage system of audio data or video data, further includes: conversion Unit stores video data to currently stored file for stopping when storage time reaches preset time, and will be currently stored Document format conversion is standard MP4 formatted file;File establishes unit, is also used to establish next storage file;Storage unit, also For storing remaining video data to next storage file, until next storage time reaches preset time.
In the technical scheme, when for video data, storage unit stores video data simultaneously to currently stored file The record storage time completes storage of the currently stored file to video data, and lead to when the time of storage reaching preset time It is standard MP4 formatted file that conversion unit, which is crossed, by currently stored document format conversion, establishes unit by file and establishes next storage File stores remaining video data to next storage file, until next storage time reaches preset time, to video data into The automatic conversion of format is realized while row single cent part stores.
In any of the above-described technical solution, it is preferable that storage unit is specifically used for: solid with file to currently stored file Head is determined in the posterior sequence of preceding, audio data, storage file fixing head and audio data;And to next storage file with File fixing head is in preceding, the posterior sequence of remaining audio data, storage file fixing head and remaining audio data.
In the technical scheme, storage unit is in the file fixing head into currently stored file or the storage of next storage file When portion and audio data, stored according to file fixing head in the posterior sequence of preceding, audio data, i.e., it constantly will " text Part fixing head+audio data " is stored respectively to each storage file, so that the head of each storage file is identical text Part fixing head guarantees that file storage is clear, prevents storage file from causing confusion.
In any of the above-described technical solution, it is preferable that the fixed byte of audio data is the first six byte of audio data; File fixing head is AMR audio format fixing head.
In the technical scheme, according to file memory format, the first six byte of entire audio data is obtained as fixation Byte guarantees the correctness of file storage so that the fixing head of each storage file is the first six byte of audio data. File fixing head is AMR audio format fixing head, that is to say, that same to storage file storing audio data respectively When, so that storage file is become complete audio file according to AMR audio format, there is the leakage second when audio data can either be avoided to store The case where, and can guarantee directly for audio data to be stored as AMR audio format.
In any of the above-described technical solution, it is preferable that further include: judging unit, for judging the typing into data pipe Whether audio data or video data terminate;Closing unit, for when into data pipe inputting audio data or video according to knot Shu Shi closes and stores currently stored file or next storage file.
In the technical scheme, by judging unit real-time judge, into pipeline, the audio data or video data of typing are No end represents in audio data or video data pipeline without audio data or video data when finished, then passes through Closing unit closes the file of storage, completes the storage of audio data or video data, and in the text for closing storage video data The storage file is handled as standard MP4 file with C layers of library after part, avoids the waste of system resource, wherein C layers of library are Android item The database write in mesh using c language codes.
Further object according to the present invention, proposes a kind of computer equipment, including memory, processor and is stored in On memory and the computer program that can run on a processor, processor are realized when executing computer program as any among the above Audio data or video data storage method the step of.
Computer equipment provided by the invention, is the server for supporting recording or Video data storage, and processor is logical It crosses the computer program of operation storage on a memory and realizes newly-built Android recording or recording service MediaRecorder, newly Data pipe is built, and data pipe thus is arranged in MediaRecorder output, to the shape of one data flow of the end B of data pipe Formula inputting audio data or video data are stored in the form of data flow to storage file when reading data.By this hair It is bright to enable to data pipe that audio data or video data are carried out to typing in the form of data flow and reads and then passes immediately Transfer audio data or video data, and without stopping and restarting recording or recording service MediaRecorder energy It is enough completely to store data to each file, it avoids and there is the leakage second caused by restarting MediaRecorder between file The case where.
Another purpose according to the present invention, proposes a kind of computer readable storage medium, is stored thereon with computer Program realizes the storage method such as any one of above-mentioned audio data or video data when computer program is executed by processor The step of.
Computer readable storage medium provided by the invention is stored with computer program on computer readable storage medium, Newly-built Android recording or recording service MediaRecorder are realized by running the computer program, newdata pipeline, And data pipe thus is arranged in MediaRecorder output, to the form inputting audio number of one data flow of the end B of data pipe According to or video data, stored in the form of data flow to storage file when reading data.It enables to count through the invention Audio data or video data are carried out to typing according to pipeline in the form of data flow and read so instantaneous transmission audio data or Person's video data, and can be complete by data without stopping and restarting recording or recording service MediaRecorder Ground is stored to each file, avoids and there is the case where leakage second caused by restarting MediaRecorder between file.
Another purpose according to the present invention, proposes a kind of smart machine, comprising: processor, memory, input dress It sets, wherein processor is by calling the operational order stored in memory, for executing such as any one of above-mentioned audio data Or video data storage method the step of.
Smart machine provided by the invention, processor are newly-built by calling the operational order stored in memory to realize Android recording or recording service MediaRecorder, newdata pipeline, and thus by MediaRecorder output setting Data pipe, to the form inputting audio data or video data of one data flow of the end B of data pipe, when reading data with The form of data flow is stored to storage file.Enable to data pipe by audio data or video data with number through the invention Typing is carried out according to the form of stream and reads instantaneous transmission audio data or video data in turn, and without stopping and opening again Dynamic recording or recording service MediaRecorder can completely store data to each file, avoid and restart There is the case where leakage second caused by MediaRecorder between file.
Additional aspect and advantage of the invention will become obviously in following description section, or practice through the invention Recognize.
Detailed description of the invention
Above-mentioned and/or additional aspect of the invention and advantage will become from the description of the embodiment in conjunction with the following figures Obviously and it is readily appreciated that, in which:
Fig. 1 shows the process signal of the audio data of one embodiment of the present of invention or the storage method of video data Figure;
Fig. 2 shows the signals of the process of the storage method of the audio data of another embodiment of the invention or video data Figure;
Fig. 3 shows the process signal of the audio data of yet another embodiment of the present invention or the storage method of video data Figure;
Fig. 4 shows the schematic block diagram of the audio data of one embodiment of the present of invention or the storage system of video data;
Fig. 5 shows the schematic block of the audio data of another embodiment of the invention or the storage system of video data Figure;
Fig. 6 shows the schematic block of the audio data of yet another embodiment of the present invention or the storage system of video data Figure;
Fig. 7 shows the schematic diagram of the computer equipment of one embodiment of the present of invention;
Fig. 8 shows the schematic diagram of the smart machine of one embodiment of the present of invention.
Specific embodiment
To better understand the objects, features and advantages of the present invention, with reference to the accompanying drawing and specific real Applying mode, the present invention is further described in detail.It should be noted that in the absence of conflict, the implementation of the application Feature in example and embodiment can be combined with each other.
In the following description, numerous specific details are set forth in order to facilitate a full understanding of the present invention, still, the present invention may be used also To be implemented using other than the one described here other modes, therefore, protection scope of the present invention is not limited to following public affairs The limitation for the specific embodiment opened.
The embodiment of first aspect present invention, proposes the storage method of a kind of audio data or video data, and Fig. 1 is shown The flow diagram of the storage method of the audio data or video data of one embodiment of the present of invention.Wherein, this method comprises:
Step 102, data pipe is established;
Step 104, inputting audio data or video data into data pipe;
Step 106, audio data or video data are read;
Step 108, audio data or video data are stored to storage file.
The storage method of audio data or video data provided by the invention, file stream refer to synchronization may only write or The file that person reads;Pipeline refers to the both ends for being known as pipeline by creating two file handles, and wherein one end can be read, referred to as the end A, Other end can be write, referred to as the end B.Newly-built Android recording or recording service MediaRecorder, newdata pipeline, and Data pipe thus is arranged in MediaRecorder output, to the form inputting audio data of one data flow of the end B of data pipe Or video data, it is stored in the form of data flow to storage file when reading data.Data are enabled to through the invention Pipeline audio data or video data are carried out in the form of data flow typing and read so instantaneous transmission audio data or Person's video data, and can be complete by data without stopping and restarting recording or recording service MediaRecorder Ground is stored to each file, avoids and there is the case where leakage second caused by restarting MediaRecorder between file.
Fig. 2 shows the signals of the process of the storage method of the audio data of another embodiment of the invention or video data Figure.Wherein, this method comprises:
Step 202, data pipe is established;
Step 204, inputting audio data or video data into data pipe;
Step 206, audio data or video data are read;
Step 208, judge whether it is audio data;
Step 210, when for audio data, and when currently stored file is first storage file, audio data is obtained Fixed byte and as file fixing head;To currently stored file storage file fixing head and audio data, remember simultaneously The address book stored time;
Step 212, when storage time reaches preset time, stop storing the audio data to currently stored file, And establish next storage file;To next storage file storage file fixing head and remaining audio data, until next storage Time reaches preset time;
Step 214, when for video data, video data, while record storage time are stored to currently stored file;
Step 216, when storage time reaches preset time, stop storing video data to currently stored file, and will Currently stored document format conversion is standard MP4 formatted file;Next storage file is established, is stored to next storage file remaining Video data, until next storage time reaches preset time.
In this embodiment, start MediaRecorder and read audio data in the form of audio stream, when for the first time by this When audio data is stored to file, namely when the currently stored file of storage is first storage file, before obtaining audio data Six byte contents are as file fixing head, and file fixing head is AMR audio format fixing head, by this file fixing head Portion is stored to currently stored file, then also stores audio data to currently stored file in the form of audio stream, and Record storage time while beginning to store audio data to currently stored file, preset time is reached when the time of storage When, storage of the currently stored file to audio data is completed, next storage file is established, above-mentioned file fixing head is stored So far next storage file is then also stored remaining audio data in the form of audio stream to next storage file, and Storage time stops storage when reaching preset time, constantly stores " file fixing head+audio data " to file, until All audio datas are all stored as multiple files by the period of preset time.It can guarantee that each storage file of storage will AMR audio format fixing head having the same prevents storage file chaotic.When for video data, to currently stored file Storing video data, the record storage time completes currently stored file to view when the time of storage reaching preset time simultaneously The storage of frequency evidence, and be standard MP4 formatted file by currently stored document format conversion, next storage file is resettled, to Next storage file stores remaining video data, until next storage time reaches preset time, carries out single cent to video data The automatic conversion of format is realized while part stores.
In one embodiment of the invention, it is preferable that currently stored file storage file fixing head and audio number According to specifically including: to currently stored file with file fixing head in the posterior sequence of preceding, audio data, storage file is fixed Head and audio data;It to next file storage file fixing head and remaining audio data, specifically includes: to next storage text Part is with file fixing head in preceding, the posterior sequence of remaining audio data, storage file fixing head and remaining audio data.
In this embodiment, in storage file fixing head and audio number into currently stored file or next storage file According to when, stored according to file fixing head in the posterior sequence of preceding, audio data, i.e., constantly will " file fixing head+ Audio data " is stored respectively to each storage file, so that the head of each storage file is identical file fixing head, Guarantee that file storage is clear, prevents storage file from causing confusion.
In one embodiment of the invention, it is preferable that the fixed byte of audio data is the first six word of audio data Section;File fixing head is AMR audio format fixing head.
In this embodiment, according to file memory format, the first six byte of entire audio data is obtained as fixed word Section guarantees the correctness of file storage so that the fixing head of each storage file is the first six byte of audio data.Text Part fixing head is AMR audio format fixing head, that is to say, that while audio data being stored respectively to storage file, So that storage file is become complete audio file according to AMR audio format, can either avoid audio data when storing in the presence of the leakage second Situation, and can guarantee directly for audio data to be stored as AMR audio format.
Fig. 3 shows the process signal of the audio data of yet another embodiment of the present invention or the storage method of video data Figure.Wherein, this method comprises:
Step 302, data pipe is established;
Step 304, inputting audio data or video data into data pipe;
Step 306, audio data or video data are read;
Step 308, judge whether it is audio data;
Step 310, when for audio data, and when currently stored file is first storage file, audio data is obtained Fixed byte and as file fixing head;To currently stored file storage file fixing head and audio data, remember simultaneously The address book stored time;
Step 312, when storage time reaches preset time, stop storing the audio data to currently stored file, And establish next storage file;To next storage file storage file fixing head and remaining audio data, until next storage Time reaches preset time;
Step 314, when for video data, video data, while record storage time are stored to currently stored file;
Step 316, when storage time reaches preset time, stop storing video data to currently stored file, and will Currently stored document format conversion is standard MP4 formatted file;Next storage file is established, is stored to next storage file remaining Video data, until next storage time reaches preset time.
Step 318, judge whether inputting audio data or video data terminate into data pipe, when into data pipe Return step 306 when inputting audio data or video data are not finished, when inputting audio data or video counts into data pipe 320 are entered step at the end of;
Step 320, close and store currently stored file or next storage file.
In this embodiment, whether real-time judge audio data or video data of typing into pipeline terminates, and works as end Without audio data or video data in epoch table audio data or video data pipeline, then the file of storage is closed, it is complete At the storage of audio data or video data, and will be at the storage file with C layers of library after the file for closing storage video data Reason is standard MP4 file, avoids the waste of system resource, and wherein C layers of library are the data write in Android project using c language codes Library.
The embodiment of second aspect of the present invention, proposes the storage system of a kind of audio data or video data, and Fig. 4 is shown The schematic block diagram of the storage system 400 of the audio data or video data of one embodiment of the present of invention.Wherein, the system packet It includes:
Pipeline establishes unit 402, for establishing data pipe;
Typing unit 404, for inputting audio data or video data into data pipe;
Reading unit 406, for reading audio data or video data;
Storage unit 408, for storing audio data or video data to storage file.
The storage system of audio data or video data provided by the invention, file stream refer to synchronization may only write or The file that person reads;Pipeline refers to the both ends for being known as pipeline by creating two file handles, and wherein one end can be read, referred to as the end A, Other end can be write, referred to as the end B.Pipeline establishes unit 402 and creates Android recording or recording service MediaRecorder, Newdata pipeline, and by MediaRecorder output setting data pipe thus, typing unit 404 is to the end B of data pipe The form inputting audio data or video data of one data flow pass through storage unit when reading unit 406 reads data 408 are stored audio data or video data to storage file in the form of data flow.Data are enabled to through the invention Pipeline audio data or video data are carried out in the form of data flow typing and read so instantaneous transmission audio data or Person's video data, and can be complete by data without stopping and restarting recording or recording service MediaRecorder Ground is stored to each file, avoids and there is the case where leakage second caused by restarting MediaRecorder between file.
Fig. 5 shows the signal of the audio data of another embodiment of the invention or the storage system 500 of video data Block diagram.Wherein, which includes:
Pipeline establishes unit 502, for establishing data pipe;
Typing unit 504, for inputting audio data or video data into data pipe;
Reading unit 506, for reading audio data or video data;
Storage unit 508, for storing audio data or video data to storage file.
Acquiring unit 510 is audio data for working as, and when currently stored file is first storage file, is obtained The fixed byte of audio data and as file fixing head;
Storage unit 508 is used for currently stored file storage file fixing head and audio data, while record storage Time;And when storage time reaches preset time, stop storing audio data to currently stored file;
File establishes unit 512, for establishing next storage file;
Storage unit 508 is also used to next storage file storage file fixing head and remaining audio data, until under One storage time reaches preset time;
Storage unit 508 is also used to when for video data, is stored video data to currently stored file, is recorded simultaneously Storage time;
The storage system 500 of audio data or video data, further includes:
Conversion unit 514 stores video counts to currently stored file for stopping when storage time reaches preset time According to, and be standard MP4 formatted file by currently stored document format conversion;
File establishes unit 512, is also used to establish next storage file;
Storage unit 508 is also used to store remaining video data to next storage file, until next storage time reaches Preset time.
In this embodiment, start MediaRecorder and read audio number in the form of audio stream by reading unit 506 According to obtaining when for the first time storing this audio data to file, namely when the currently stored file of storage is first storage file Unit 510 obtains the first six byte content of audio data as file fixing head, and file fixing head is AMR audio format Fixing head is stored this file fixing head to currently stored file, then by audio data with sound by storage unit 508 The form of frequency stream is also stored to currently stored file, and record is deposited while starting to store audio data to current file The time is stored up, when the time of storage reaching preset time, completes storage of the currently stored file to audio data, file is established single Member 512 establishes next storage file, above-mentioned file fixing head is stored so far next storage file, then by remaining sound Frequency sound data are also stored in the form of audio stream to next storage file, and stop depositing when storage time reaches preset time Storage, constantly stores " file fixing head+audio data " to file, until being all with preset time by all audio datas Period is stored as multiple files.The each storage file stored can be guaranteed AMR audio format fixing head having the same Portion prevents storage file chaotic.When for video data, storage unit 508 stores video data simultaneously to currently stored file The record storage time completes storage of the currently stored file to video data, and lead to when the time of storage reaching preset time It is standard MP4 formatted file that conversion unit 514, which is crossed, by currently stored document format conversion, is established under the foundation of unit 512 by file One storage file stores remaining video data to next storage file, until next storage time reaches preset time, to video Data carry out the automatic conversion that format is realized while the storage of single cent part.
In any of the above-described technical solution, it is preferable that storage unit 508 is specifically used for: to currently stored file with file Fixing head is in the posterior sequence of preceding, audio data, storage file fixing head and audio data;And to next storage file With file fixing head in preceding, the posterior sequence of remaining audio data, storage file fixing head and remaining audio data.
In the technical scheme, the file in storing to currently stored file or next storage file of storage unit 508 is solid It when determining head and audio data, is stored, i.e., constantly will in the posterior sequence of preceding, audio data according to file fixing head " file fixing head+audio data " is stored respectively to each storage file, so that the head of each storage file is identical File fixing head, guarantee that file storage is clear, prevent storage file from causing confusion.
In one embodiment of the invention, it is preferable that the fixed byte of audio data is the first six word of audio data Section;File fixing head is AMR audio format fixing head.
In this embodiment, according to file memory format, the first six byte of entire audio data is obtained as fixed word Section guarantees the correctness of file storage so that the fixing head of each storage file is the first six byte of audio data.Text Part fixing head is AMR audio format fixing head, that is to say, that while audio data being stored respectively to storage file, So that storage file is become complete audio file according to AMR audio format, can either avoid audio data when storing in the presence of the leakage second Situation, and can guarantee directly for audio data to be stored as AMR audio format.
Fig. 6 shows the signal of the audio data of yet another embodiment of the present invention or the storage system 600 of video data Block diagram.Wherein, which includes:
Pipeline establishes unit 602, for establishing data pipe;
Typing unit 604, for inputting audio data or video data into data pipe;
Reading unit 606, for reading audio data or video data;
Storage unit 608, for storing audio data or video data to storage file.
Acquiring unit 610 is audio data for working as, and when currently stored file is first storage file, is obtained The fixed byte of audio data and as file fixing head;
Storage unit 608 is used for currently stored file storage file fixing head and audio data, while record storage Time;And when storage time reaches preset time, stop storing audio data to currently stored file;
File establishes unit 612, for establishing next storage file;
Storage unit 608 is also used to next storage file storage file fixing head and remaining audio data, until under One storage time reaches preset time;
Storage unit 608 is also used to when for video data, is stored video data to currently stored file, is recorded simultaneously Storage time;
The storage system 600 of audio data or video data, further includes:
Conversion unit 614 stores video counts to currently stored file for stopping when storage time reaches preset time According to, and be standard MP4 formatted file by currently stored document format conversion;
File establishes unit 612, is also used to establish next storage file;
Storage unit 608 is also used to store remaining video data to next storage file, until next storage time reaches Preset time;
Judging unit 616, for judging whether inputting audio data or video data terminate into data pipe;
Closing unit 618, for closing and storing at the end of the inputting audio data into data pipe or video data Currently stored file or next storage file.
In this embodiment, pass through the audio of 616 real-time judge of judging unit typing into pipeline during storage Whether data or video data terminate, represent in audio data or video data pipeline when finished without audio data or Video data is then closed the file of storage by closing unit 618, completes the storage of audio data or video data, and is being closed The storage file is handled as standard MP4 file with C layers of library after storing the file of video data, avoids the waste of system resource, Wherein C layers of library are the database write in Android project using c language codes.
The embodiment of third aspect present invention, proposes a kind of computer equipment, and Fig. 7 shows one embodiment of the present of invention Computer equipment 700 schematic diagram.Wherein, which includes:
Memory 702, processor 704 and it is stored in the computer journey that can be run on memory 702 and on processor 704 Sequence, processor 704 realize the storage method such as any one of above-mentioned audio data or video data when executing computer program The step of.
Computer equipment provided by the invention is the server for supporting recording or Video data storage, processor 704 Newly-built Android recording or Video service are realized by running the computer program being stored on memory 702 MediaRecorder, newdata pipeline, and data pipe thus is arranged in MediaRecorder output, to data pipe The form inputting audio data or video data of one data flow of the end B are stored when reading data in the form of data flow to depositing Store up file.Enable to through the invention data pipe audio data or video data are carried out in the form of data flow typing and Instantaneous transmission audio data or video data in turn are read, and without stopping and restarting recording or Video service MediaRecorder can completely store data to each file, avoid caused by restarting MediaRecorder There is the case where leakage second between file.
The embodiment of fourth aspect present invention proposes a kind of computer readable storage medium, is stored thereon with computer journey Sequence is realized when computer program is executed by processor such as the storage method of any one of above-mentioned audio data or video data Step.
Computer readable storage medium provided by the invention is stored with computer program on computer readable storage medium, Newly-built Android recording or Video service MediaRecorder are realized by running the computer program, newdata pipeline, And data pipe thus is arranged in MediaRecorder output, to the form inputting audio number of one data flow of the end B of data pipe According to or video data, stored in the form of data flow to storage file when reading data.It enables to count through the invention Audio data or video data are carried out to typing according to pipeline in the form of data flow and read so instantaneous transmission audio data or Person's video data, and can be complete by data without stopping and restarting recording or Video service MediaRecorder Ground is stored to each file, avoids and there is the case where leakage second caused by restarting MediaRecorder between file.
The embodiment of fourth aspect present invention proposes that a kind of smart machine, Fig. 8 show one embodiment of the present of invention The schematic diagram of smart machine 800.Wherein, which includes:
Processor 802, memory 804, input unit 806, wherein processor 802 is stored by calling in memory 804 Operational order, for the step of executing the storage method such as any one of above-mentioned audio data or video data.
Smart machine provided by the invention, by input unit 806 into data pipe inputting audio data or video counts According to processor 802 is by calling the operational order stored in memory 804 to realize newly-built Android recording or Video service MediaRecorder, newdata pipeline, and data pipe thus is arranged in MediaRecorder output, to data pipe The form inputting audio data or video data of one data flow of the end B are stored when reading data in the form of data flow to depositing Store up file.Enable to through the invention data pipe audio data or video data are carried out in the form of data flow typing and Instantaneous transmission audio data or video data in turn are read, and without stopping and restarting recording or Video service MediaRecorder can completely store data to each file, avoid caused by restarting MediaRecorder There is the case where leakage second between file.
In one particular embodiment of the present invention, the storage method of recording data is based on Android system, specially a kind of The method of single cent part storage recording in the case where not restarting recording service scenario, this method comprises:
Step 1 creates Android recording service MediaRecorder, creates pipeline, and MediaRecorder is defeated Pipeline thus is set out, starts MediaRecorder, data are written into pipeline from system recording service, user is in main thread It is interior that data are read from pipeline.
Step 2, firstly, being labeled as the flag F lag of this storage file when storage file is first storage file True, later non-first file mark are false.Then, circulation reads data from pipeline in a manner of audio stream, judges to mark Remember Flag, if flag F lag is true, records six byte contents before the data, and six byte contents are made For AMR audio format fixing head;If flag F lag is false, it is not processed, that is, is not required to obtain six before the data again A byte content.
Step 3, the AMR audio format fixing head that will acquire and data are stored to storage file, and start timing, are sentenced It is disconnected whether to reach fixed time-count cycle, if data are otherwise stored so far storage file always;If it is this storage is closed File, while next storage file is created, AMR audio format fixing head and remaining data are stored to next storage text Part, the storing data into next one storage file again after reaching fixed time-count cycle again, until data all store to In each storage file.For each text for, it is exactly a data identical head+current this period, constitutes One complete AMR audio format.
Step 4 judges whether to stop recording, if it is, closing storage file, i.e. data storage is completed;If not, Then continue step 3.
Recording is written to pipeline in the present invention rather than in file, constantly circulation takes out data in pipeline and carries out timing, Every compartment time writes data into storage file one by one, and when being written new file according to audio A MR format by storage file Supplement is complete audio file.Not only do not have to restart MediaRecorder, but also can divide the small documents to be by audio storage Whole correct audio format file.
In the description of this specification, the description of term " one embodiment ", " some embodiments ", " specific embodiment " etc. Mean that particular features, structures, materials, or characteristics described in conjunction with this embodiment or example are contained at least one reality of the invention It applies in example or example.In the present specification, schematic expression of the above terms are not necessarily referring to identical embodiment or reality Example.Moreover, description particular features, structures, materials, or characteristics can in any one or more of the embodiments or examples with Suitable mode combines.
The foregoing is only a preferred embodiment of the present invention, is not intended to restrict the invention, for the skill of this field For art personnel, the invention may be variously modified and varied.All within the spirits and principles of the present invention, made any to repair Change, equivalent replacement, improvement etc., should all be included in the protection scope of the present invention.

Claims (15)

1. the storage method of a kind of audio data or video data characterized by comprising
Establish data pipe;
Audio data described in typing or the video data into the data pipe;
Read the audio data or the video data;
The audio data or the video data are stored to storage file.
2. the storage method of audio data according to claim 1 or video data, which is characterized in that when for the audio When data, the step of the audio data or the video data are stored to the storage file, specifically include:
When currently stored file is first storage file, the fixed byte of the audio data is obtained and as file fixing head Portion;
The file fixing head and the audio data, while record storage time are stored to the currently stored file;
When the storage time reaches preset time, stop storing the audio data to the currently stored file, and build Make a storage file;
The file fixing head and remaining audio data are stored to next storage file, until next storage time reaches The preset time.
3. the storage method of audio data according to claim 1 or video data, which is characterized in that when for the video When data, the step of the audio data or the video data are stored to the storage file, specifically include:
The video data, while record storage time are stored to currently stored file;
When the storage time reaches preset time, stop storing the video data to the currently stored file, and will The currently stored document format conversion is standard MP4 formatted file;
Next storage file is established, remaining video data are stored to next storage file, until next storage time reaches The preset time.
4. the storage method of audio data according to claim 2 or video data, which is characterized in that described to work as to described Preceding storage file stores the file fixing head and the audio data, specifically includes:
To the currently stored file with the file fixing head in preceding, the described posterior sequence of audio data, described in storage File fixing head and the audio data;
It is described to store the file fixing head and the remaining audio data to next storage file, it specifically includes:
It is described to next storage file with the file fixing head in preceding, the described posterior sequence of remaining audio data, Store the file fixing head and the remaining audio data.
5. the storage method of audio data according to claim 4 or video data, which is characterized in that
The fixed byte of the audio data is the first six byte of the audio data;
The file fixing head is AMR audio format fixing head.
6. the storage method of the audio data according to any one of claim 2 to 5 or video data, which is characterized in that Further include:
Judge whether audio data described in typing or the video data terminate into the data pipe;
At the end of audio data or the video data described in the typing into the data pipe, closes and store described current Storage file or next storage file.
7. the storage system of a kind of audio data or video data characterized by comprising
Pipeline establishes unit, for establishing data pipe;
Typing unit, for audio data or the video data described in the typing into the data pipe;
Reading unit, for reading the audio data or the video data;
Storage unit, for storing the audio data or the video data to storage file.
8. the storage system of audio data according to claim 7 or video data, which is characterized in that further include:
Acquiring unit is the audio data for working as, and when currently stored file is first storage file, described in acquisition The fixed byte of audio data and as file fixing head;
The storage unit is specifically used for storing the file fixing head and the audio number to the currently stored file According to, while the record storage time;And when the storage time reaches preset time, stop depositing to the currently stored file Store up the audio data;
File establishes unit, for establishing next storage file;
The storage unit is also used to store the file fixing head and remaining audio data to next storage file, Until next storage time reaches the preset time.
9. the storage system of audio data according to claim 7 or video data, which is characterized in that
The storage unit is also used to when for the video data, stores the video data to currently stored file, simultaneously The record storage time;
The storage system of the audio data or video data, further includes:
Conversion unit, for when the storage time reaches preset time, stopping to described in the currently stored file storage Video data, and be standard MP4 formatted file by the currently stored document format conversion;
File establishes unit, is also used to establish next storage file;
The storage unit is also used to next storage file storage remaining video data, until next storage time reaches To the preset time.
10. the storage system of audio data according to claim 8 or video data, which is characterized in that the storage is single Member is specifically used for:
To the currently stored file with the file fixing head in preceding, the described posterior sequence of audio data, described in storage File fixing head and the audio data;And
It is described to next storage file with the file fixing head in preceding, the described posterior sequence of remaining audio data, Store the file fixing head and the remaining audio data.
11. the storage system of audio data according to claim 10 or video data, which is characterized in that
The fixed byte of the audio data is the first six byte of the audio data;
The file fixing head is AMR audio format fixing head.
12. the storage system of the audio data according to any one of claim 8 to 11 or video data, feature exist In, further includes:
Judging unit, for judging whether audio data described in typing or the video data terminate into the data pipe;
Closing unit, for closing at the end of audio data or the video data described in typing into the data pipe And store the currently stored file or next storage file.
13. a kind of computer equipment, including memory, processor and it is stored on the memory and can be on the processor The computer program of operation, which is characterized in that the processor realizes such as claim 1 to 6 when executing the computer program Any one of described in audio data or video data storage method the step of.
14. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the computer program It realizes when being executed by processor such as the storage method of audio data described in any one of claims 1 to 6 or video data Step.
15. a kind of smart machine characterized by comprising processor, memory, input unit, wherein the processor is logical The operational order for calling and storing in the memory is crossed, for executing such as audio data described in any one of claims 1 to 6 Or video data storage method the step of.
CN201710492851.6A 2017-06-26 2017-06-26 The storage method of audio data or video data, storage system and computer equipment Pending CN109119100A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710492851.6A CN109119100A (en) 2017-06-26 2017-06-26 The storage method of audio data or video data, storage system and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710492851.6A CN109119100A (en) 2017-06-26 2017-06-26 The storage method of audio data or video data, storage system and computer equipment

Publications (1)

Publication Number Publication Date
CN109119100A true CN109119100A (en) 2019-01-01

Family

ID=64733814

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710492851.6A Pending CN109119100A (en) 2017-06-26 2017-06-26 The storage method of audio data or video data, storage system and computer equipment

Country Status (1)

Country Link
CN (1) CN109119100A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111654743A (en) * 2020-05-27 2020-09-11 海信视像科技股份有限公司 Audio playing method and display device

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101217638A (en) * 2007-12-28 2008-07-09 深圳市迅雷网络技术有限公司 A downloading method, system and device of video file fragmentation
JP2009157272A (en) * 2007-12-27 2009-07-16 Roland Corp Audio playback device
CN102610005A (en) * 2011-01-21 2012-07-25 佑诚电子股份有限公司 Travelling recording system with video locking function
CN102665103A (en) * 2012-04-13 2012-09-12 烽火通信科技股份有限公司 Audio and video packaging method applicable to streaming media services
CN103269374A (en) * 2013-05-29 2013-08-28 北京小米科技有限责任公司 Method, device and equipment for recording synchronization
CN103369284A (en) * 2012-03-31 2013-10-23 浙江大华技术股份有限公司 Audio video data prerecording method and device
CN103686203A (en) * 2013-12-04 2014-03-26 深圳市融创天下科技股份有限公司 Video transcoding method and device
US20170117014A1 (en) * 2015-10-26 2017-04-27 International Business Machines Corporation Efficient recovery of the codeword interleave address

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009157272A (en) * 2007-12-27 2009-07-16 Roland Corp Audio playback device
CN101217638A (en) * 2007-12-28 2008-07-09 深圳市迅雷网络技术有限公司 A downloading method, system and device of video file fragmentation
CN102610005A (en) * 2011-01-21 2012-07-25 佑诚电子股份有限公司 Travelling recording system with video locking function
CN103369284A (en) * 2012-03-31 2013-10-23 浙江大华技术股份有限公司 Audio video data prerecording method and device
CN102665103A (en) * 2012-04-13 2012-09-12 烽火通信科技股份有限公司 Audio and video packaging method applicable to streaming media services
CN103269374A (en) * 2013-05-29 2013-08-28 北京小米科技有限责任公司 Method, device and equipment for recording synchronization
CN103686203A (en) * 2013-12-04 2014-03-26 深圳市融创天下科技股份有限公司 Video transcoding method and device
US20170117014A1 (en) * 2015-10-26 2017-04-27 International Business Machines Corporation Efficient recovery of the codeword interleave address

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111654743A (en) * 2020-05-27 2020-09-11 海信视像科技股份有限公司 Audio playing method and display device

Similar Documents

Publication Publication Date Title
CN107516510B (en) Automatic voice testing method and device for intelligent equipment
CN108305632A (en) A kind of the voice abstract forming method and system of meeting
CN109361825A (en) Meeting summary recording method, terminal and computer storage medium
US20140147095A1 (en) Semi-automatic generation of multimedia content
US10747947B2 (en) Electronic health record compatible distributed dictation transcription system
CN106600750B (en) A kind of method of circulation recording, system and automobile data recorder
CN101187896B (en) On-spot programmable gate array data cache management method
US20130055205A1 (en) Filtering source code analysis results
CN109491708A (en) Document structure tree method, system, equipment and medium
CN110442752A (en) Organizational structure drawing generating method, device, computer equipment and storage medium
CN109669858A (en) Test method, device and the equipment of program deadlock
WO2020093876A1 (en) Video editing method and apparatus, computer device and readable storage medium
CN107315586A (en) Using the methods, devices and systems of packing
CN109101423A (en) A kind of automated testing method based on server-side log playback
CN109213977A (en) The generation system of court's trial notes
CN109284252A (en) Lightweight file method for managing system in a kind of communication equipment
CN105260139B (en) A kind of disk management method and system
CN107798408B (en) Conference management method, conference management device, conference management terminal and computer-readable storage medium
CN109408050A (en) The code generating method and device of appliance applications interface for rail vehicle
CN109119100A (en) The storage method of audio data or video data, storage system and computer equipment
CN110299036A (en) Interaction reading method, device, system and storage medium
CN102802025B (en) Video-audio files upgrades system and video-audio files update method
CN109213971A (en) The generation method and device of court's trial notes
CN110019527A (en) From library read method, relevant apparatus and equipment
CN101986302A (en) Media file association method and device

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20190101