Specific embodiment
To make the object, technical solutions and advantages of the present invention clearer, below in conjunction with attached drawing to embodiment party of the present inventionFormula is described in further detail.
In each embodiment of the present invention, mobile terminal can be mobile phone, tablet computer, E-book reader, MP3 and playDevice (Moving Picture Experts Group Audio Layer III, dynamic image expert's compression standard audio level3), MP4(Moving Picture Experts Group Audio Layer IV, dynamic image expert's compression standard audioLevel 3) player etc..
Referring to FIG. 1, it illustrates the method flow diagrams of video-frequency compression method provided by one embodiment of the present invention.This realityExample is applied to illustrate with the video-frequency compression method using in the terminal.The video-frequency compression method, comprising:
Step 102, the video parameter of at least one-frame video data and video data is obtained;
Mobile terminal can decode to obtain the view of at least one-frame video data and video data by existing video fileFrequency parameter;The camera collected at least one-frame video data of institute and video data of mobile terminal also available mobile terminalVideo parameter.
Step 104, the video parameter for modifying video data is compressed video parameter;
The video parameter of unpressed video data is usually higher, and mobile terminal needs to modify the ginseng of the video in video dataNumber is compressed video parameter.
Step 106, by the function of hardware acceleration of mobile terminal according to compressed video parameter to an at least frame videoData are compressed, and compressed video file is obtained.
Mobile terminal in the present embodiment provides function of hardware acceleration.Process of the mobile terminal in compressed video dataIn, at least one-frame video data is compressed according to compressed video parameter by function of hardware acceleration, after obtaining compressionVideo file.
In conclusion video-frequency compression method provided in this embodiment, by obtaining at least one-frame video data and video countsAccording to video parameter, modify video data video parameter be compressed video parameter, pass through the hardware-accelerated of mobile terminalFunction compresses at least one-frame video data according to compressed video parameter, obtains compressed video file;It solvesThe slower problem of the processing speed of current video-frequency compression method;Reached by the function of hardware acceleration of mobile terminal come intoRow video compress improves the effect of the processing speed of the video-frequency compression method on mobile terminal.
Referring to FIG. 2, it illustrates another embodiment of the present invention provides video-frequency compression method method flow diagram.This realityExample is applied to illustrate with the video-frequency compression method using in the terminal.The video-frequency compression method, comprising:
Step 201, the video parameter of at least one-frame video data and video data is obtained;
Mobile terminal can decode to obtain the view of at least one-frame video data and video data by existing video fileFrequency parameter;The camera collected at least one-frame video data of institute and video counts of mobile terminal also available mobile terminalAccording to video parameter.
When decoding to obtain at least one-frame video data by existing video file, mobile terminal can also pass through itselfFunction of hardware acceleration existing video file is decoded to obtain the video parameter of at least one-frame video data and video data.
It is for the operation that American Apple Inc produces has the electronic equipment of iOS system by mobile terminal, mobile terminal is adoptedExisting video file is decoded with the multimedia decoding component AVAssetReader in iOS system, multimedia decoding componentAVAssetReader can enable the function of hardware acceleration for running and having in the electronic equipment of iOS system, and decoding effect is greatly improvedRate.
The video parameter of video data refers to resolution ratio and code rate.In iOS system, the video parameter of video data is carriedIn SampleBuffer structural body, 1 SampleBuffer structural body of multi-frame video data sharing.For example, 1-100 frame regardsThe 1st SampleBuffer structural body of frequency data sharing has recorded 1-100 frame view in the 1st SampleBuffer structural bodyFrequency is according to respective resolution ratio and code rate (being usually all identical);101-200 frame shares the 2nd SampleBuffer structureBody has recorded the respective resolution ratio of 101-200 frame video data and code rate in the 2nd SampleBuffer structural body (usuallyAll it is identical), and so on.
Step 202, the video parameter for modifying video data is compressed video parameter;
The video parameter that mobile terminal modifies video data is compressed video parameter.Video parameter include resolution ratio andCode rate two, it is only necessary to which one of parameter is revised as compressed video parameter, so that it may realize video compress, but usuallyTwo parameters can be all revised as compressed video parameter simultaneously.Namely: the resolution ratio of mobile terminal modification video data isCompressed resolution ratio;And/or the code rate of mobile terminal modification video data is compressed code rate.Wherein, by original code rateWhen being revised as compressed code rate, the compression effectiveness of video data can be clearly.
By taking operation has the electronic equipment of iOS system as an example, mobile terminal is modified original in SampleBuffer structural bodyResolution ratio is compressed resolution ratio 480*480, and modifies the original code rate in SampleBuffer structural body (usuallyIt 1500kbps) is compressed code rate 500kbps.
Step 203, for every frame video data, joined by the function of hardware acceleration of mobile terminal according to compressed videoSeveral pairs of video datas compress;
Mobile terminal in the present embodiment provides function of hardware acceleration.Process of the mobile terminal in compressed video dataIn, at least one-frame video data is compressed according to compressed resolution ratio and/or code rate by function of hardware acceleration.
By taking operation has the electronic equipment of iOS system as an example, mobile terminal passes through the multimedia coding component in iOS systemAVAssetWriter carries out H.264 coded format at least one-frame video data according to compressed resolution ratio and/or code rateCompression.Multimedia coding component AVAssetWriter can enable the hardware-accelerated function for running and having in the electronic equipment of iOS systemCan, code efficiency is greatly improved.
Step 204, video file is written into using predetermined write-in frame per second in compressed every frame video data, after obtaining compressionVideo file.
Video file is written in compressed present frame video data by mobile terminal, is then executed to next frame video dataStep 203, it realizes and is written to what all frame video datas successively carried out in compression.By a compressed video data of frame frameWhen video file is written, frame per second is written as compressed predetermined write-in frame per second in mobile terminal control, for example mobile terminal control is pre-Surely write-in frame per second be 24 frame per second namely human eye can received minimum frame per second, to realize better compression effectiveness.Through testingIt proves, by above-mentioned compression processing, the compressed data volume of the short-sighted frequency of 8 seconds kind length only has 500K or so, has veryGood compression effectiveness.
In conclusion video-frequency compression method provided in this embodiment, by obtaining at least one-frame video data and video countsAccording to video parameter, modify video data video parameter be compressed video parameter, pass through the hardware-accelerated of mobile terminalFunction compresses at least one-frame video data according to compressed video parameter, obtains compressed video file;It solvesThe slower problem of the processing speed of current video-frequency compression method;Reached by the function of hardware acceleration of mobile terminal come intoRow video compress improves the effect of the processing speed of the video-frequency compression method on mobile terminal.
Also by when existing video file decodes to obtain at least one-frame video data, also by the hardware of mobile terminalExisting video file is decoded to obtain the video parameter of at least one-frame video data and video data by acceleration function, furtherImprove processing speed when video compress under the scene.
Referring to FIG. 3, it illustrates the structural block diagrams of video compress device provided by one embodiment of the present invention.The viewFrequency compression set can pass through all or part of software, hardware or both being implemented in combination with as mobile terminal.The dressIt sets and includes:
Data acquisition module 320, for obtaining the video parameter of at least one-frame video data and the video data;
Parameter adapting module 340, the video parameter for modifying the video data are compressed video parameter;
Hardware compression module 360, for the function of hardware acceleration by the mobile terminal according to the compressed viewFrequency parameter compresses at least one-frame video data, obtains compressed video file.
In conclusion video compress device provided in this embodiment, by obtaining at least one-frame video data and video countsAccording to video parameter, modify video data video parameter be compressed video parameter, pass through the hardware-accelerated of mobile terminalFunction compresses at least one-frame video data according to compressed video parameter, obtains compressed video file;It solvesThe slower problem of the processing speed of current video-frequency compression method;Reached by the function of hardware acceleration of mobile terminal come intoRow video compress improves the effect of the processing speed of the video-frequency compression method on mobile terminal.
Referring to FIG. 4, it illustrates another embodiment of the present invention provides video compress device structural block diagram.The viewFrequency compression set can pass through all or part of software, hardware or both being implemented in combination with as mobile terminal.The dressIt sets and includes:
Data acquisition module 320, for obtaining the video parameter of at least one-frame video data and the video data;
Parameter adapting module 340, the video parameter for modifying the video data are compressed video parameter;
Hardware compression module 360, for the function of hardware acceleration by the mobile terminal according to the compressed viewFrequency parameter compresses at least one-frame video data, obtains compressed video file.
Optionally, the data acquisition module 320 obtains at least frame view for decoding existing video fileFrequency evidence;Or,
The data acquisition module 320, for obtaining the camera institute collected described at least one of the mobile terminalFrame video data.
Optionally, the data acquisition module 320, the function of hardware acceleration for passing through the mobile terminal will be existingVideo file decodes to obtain at least one-frame video data.
Optionally, the parameter adapting module 340, comprising: resolution ratio modifies unit and/or code rate modifies unit;
The resolution ratio modifies unit, and the resolution ratio for modifying the video data is compressed resolution ratio;
The code rate modifies unit, and the code rate for modifying the video data is compressed code rate.
Optionally, the hardware compression module 360, comprising: hardware-compressed unit 362 and File write unit 364;
For every frame video data, by the function of hardware acceleration of the mobile terminal according to the compressed videoParameter compresses the video data;
Video file is written into using predetermined write-in frame per second in compressed every frame video data, obtains the compressed viewFrequency file.
In conclusion video compress device provided in this embodiment, by obtaining at least one-frame video data and video countsAccording to video parameter, modify video data video parameter be compressed video parameter, pass through the hardware-accelerated of mobile terminalFunction compresses at least one-frame video data according to compressed video parameter, obtains compressed video file;It solvesThe slower problem of the processing speed of current video-frequency compression method;Reached by the function of hardware acceleration of mobile terminal come intoRow video compress improves the effect of the processing speed of the video-frequency compression method on mobile terminal.
Also by when existing video file decodes to obtain at least one-frame video data, also by the hardware of mobile terminalExisting video file is decoded to obtain the video parameter of at least one-frame video data and video data by acceleration function, furtherImprove processing speed when video compress under the scene.
It should be understood that video compress device provided by the above embodiment is in compressed video data, only with above-mentioned eachThe division progress of functional module can according to need and for example, in practical application by above-mentioned function distribution by different functionEnergy module is completed, i.e., the internal structure of equipment is divided into different functional modules, to complete whole described above or portionDivide function.In addition, video compress device provided by the above embodiment and video-frequency compression method embodiment belong to same design, haveBody realizes that process is detailed in embodiment of the method, and which is not described herein again.
Referring to FIG. 5, the structural schematic diagram of the mobile terminal provided it illustrates one embodiment of the present of invention.The movementTerminal 500 is equipped with the client of video processing, video social activity, video sharing etc, and the client is for implementing above-mentioned realityThe video-frequency compression method provided in example is provided, specifically:
Mobile terminal 500 may include RF(Radio Frequency, radio frequency) circuit 510, include one or one withMemory 520, input unit 530, display unit 540, the sensor 550, voicefrequency circuit of upper computer readable storage medium560, short range wireless transmission module 570, include one or more than one the processor 580 and power supply of processing core590 equal components.It will be understood by those skilled in the art that mobile terminal structure shown in Fig. 5 is not constituted to mobile terminalIt limits, may include perhaps combining certain components or different component layouts than illustrating more or fewer components.Wherein:
RF circuit 510 can be used for receiving and sending messages or communication process in, signal sends and receivees, particularly, by base stationAfter downlink information receives, one or the processing of more than one processor 580 are transferred to;In addition, the data for being related to uplink are sent toBase station.In general, RF circuit 510 includes but is not limited to antenna, at least one amplifier, tuner, one or more oscillators, usesFamily identity module (SIM) card, transceiver, coupler, LNA(Low Noise Amplifier, low-noise amplifier), duplexDevice etc..In addition, RF circuit 510 can also be communicated with network and other equipment by wireless communication.Wireless communication, which can be used, appoints(Global System of Mobile communication, the whole world are moved for one communication standard or agreement, including but not limited to GSMDynamic communication system), GPRS (General Packet Radio Service, general packet radio service), CDMA (CodeDivision Multiple Access, CDMA), WCDMA (Wideband Code Division MultipleAccess, wideband code division multiple access), LTE (Long Term Evolution, long term evolution), Email, SMS (ShortMessaging Service, short message service) etc..Memory 520 can be used for storing software program and module, for example, storageDevice 520 can be used for storing preset time list, can be also used for the software program of storage acquisition voice signal, realizes keywordThe software program of identification, the software program for realizing continuous speech recognition and the software program for realizing setting prompting item, may be used alsoWireless access point and the binding relationship of user account etc. for storage.Processor 580 is stored in memory 520 by operationSoftware program and module, thereby executing in various function application and data processing, such as the embodiment of the present invention " receive withFunction, function of " detecting whether exist and the retrieval matched information model of lines " of the retrieval lines of graphical data-in " etc.Deng.Memory 520 can mainly include storing program area and storage data area, wherein storing program area can storage program area, extremelyApplication program (such as sound-playing function, image player function etc.) needed for a few function etc.;Storage data area can storeCreated data (such as audio data, phone directory etc.) etc. are used according to mobile terminal 500.In addition, memory 520 can be withIt can also include nonvolatile memory, for example, at least disk memory, a flash memory including high-speed random access memoryDevice or other volatile solid-state parts.Correspondingly, memory 520 can also include Memory Controller, to provide placeManage the access of device 580 and input unit 530 to memory 520.
Input unit 530 can be used for receiving the number or character information of input, and generate and user setting and functionControl related keyboard, mouse, operating stick, optics or trackball signal input.Specifically, input unit 530 may include touchingSensitive surfaces 531 and other input equipments 532.Touch sensitive surface 531, also referred to as touch display screen or Trackpad are collected and are usedFamily on it or nearby touch operation (such as user using any suitable object or attachment such as finger, stylus in touch-sensitive tableOperation on face 531 or near touch sensitive surface 531), and corresponding attachment device is driven according to preset formula.It is optional, touch sensitive surface 531 may include both touch detecting apparatus and touch controller.Wherein, touch detecting apparatus detection is usedThe touch orientation at family, and touch operation bring signal is detected, transmit a signal to touch controller;Touch controller is from touchingIt touches and receives touch information in detection device, and be converted into contact coordinate, then give processor 580, and processor can be received580 orders sent simultaneously are executed.Furthermore, it is possible to using multiple types such as resistance-type, condenser type, infrared ray and surface acoustic wavesType realizes touch sensitive surface 531.In addition to touch sensitive surface 531, input unit 530 can also include other input equipments 532.SpecificallyGround, other input equipments 532 can include but is not limited to physical keyboard, function key (such as volume control button, switch keyDeng), trace ball, mouse, one of operating stick etc. or a variety of.
Display unit 540 can be used for showing information input by user or the information and mobile terminal that are supplied to user500 various graphical user interface, these graphical user interface can by figure, text, icon, video and any combination thereof LaiIt constitutes.Display unit 540 may include display panel 541, optionally, can using LCD (Liquid Crystal Display,Liquid crystal display), the forms such as OLED (Organic Light-Emitting Diode, Organic Light Emitting Diode) configure displayPanel 541.Further, touch sensitive surface 531 can be covered on display panel 541, when touch sensitive surface 531 detects on itOr after neighbouring touch operation, processor 580 is sent to determine the type of touch event, is followed by subsequent processing device 580 according to touchThe type of event provides corresponding visual output on display panel 541.Although in Fig. 5, touch sensitive surface 531 and display panel541 be to realize input and input function as two independent components, but in some embodiments it is possible to by touch sensitive surface531 integrate with display panel 541 and realize and output and input function.
Mobile terminal 500 may also include at least one sensor 550, for example, optical sensor, motion sensor and otherSensor.Specifically, optical sensor may include ambient light sensor and proximity sensor, wherein ambient light sensor can basisThe light and shade of ambient light adjusts the brightness of display panel 541, proximity sensor can when mobile terminal 500 is moved in one's ear,Close display panel 541 and/or backlight.As a kind of motion sensor, gravity accelerometer can detect all directionsThe size of upper (generally three axis) acceleration, can detect that size and the direction of gravity, can be used to identify mobile phone posture when staticApplication (such as horizontal/vertical screen switching, dependent game, magnetometer pose calibrating), Vibration identification correlation function (for example pedometer, strikesHit) etc.;Gyroscope, barometer, hygrometer, thermometer, infrared sensor for can also configure as mobile terminal 500 etc. otherSensor, details are not described herein.
Voicefrequency circuit 560, loudspeaker 561, microphone 562 can provide the audio interface between user and mobile terminal 500.Electric signal after the audio data received conversion can be transferred to loudspeaker 561, be converted by loudspeaker 561 by voicefrequency circuit 560For voice signal output;On the other hand, the voice signal of collection is converted to electric signal by microphone 562, is connect by voicefrequency circuit 560Audio data is converted to after receipts, then by after the processing of audio data output processor 580, another shifting is sent to through RF circuit 510Dynamic terminal, or audio data is exported to memory 520 to be further processed.Voicefrequency circuit 560 is also possible that earplugJack, to provide the communication of peripheral hardware earphone Yu mobile terminal 500.
Short range wireless transmission module 570 can be WIFI(wireless fidelity, Wireless Fidelity) module or indigo plantTooth module etc..Mobile terminal 500 can help user to send and receive e-mail, browse net by short range wireless transmission module 570Page and access streaming video etc., it provides wireless broadband internet access for user.Although Fig. 5 shows short-distance wirelessTransmission module 570, but it is understood that, and it is not belonging to must be configured into for mobile terminal 500, it can according to need completelyIt omits within the scope of not changing the essence of the invention.
Processor 580 is the control centre of mobile terminal 500, utilizes various interfaces and the entire mobile terminal of connectionVarious pieces by running or execute the software program and/or module that are stored in memory 520, and are called and are stored inData in reservoir 520 execute the various functions and processing data of mobile terminal 500, to carry out whole prison to mobile terminalControl.Optionally, processor 580 may include one or more processing cores;Optionally, processor 580 can integrate application processorAnd modem processor, wherein the main processing operation system of application processor, user interface and application program etc., modulatedemodulateProcessor is adjusted mainly to handle wireless communication.It is understood that above-mentioned modem processor can not also be integrated into processorIn 580.
Mobile terminal 500 further includes the power supply 590(such as battery powered to all parts), it is preferred that power supply can lead toCross power-supply management system and processor 580 be logically contiguous, thus by power-supply management system realize management charging, electric discharge andThe functions such as power managed.Power supply 590 can also include one or more direct current or AC power source, recharging system, electricityThe random components such as source fault detection circuit, power adapter or inverter, power supply status indicator.
Although being not shown, mobile terminal 500 can also include camera, bluetooth module etc., and details are not described herein.
Mobile terminal 500 further includes having perhaps one of them or one of more than one program of memory and oneProcedure above is stored in memory, and is configured to execute above-mentioned Fig. 1 or Fig. 2 implementation by one or more than one processorVideo-frequency compression method described in example.
It should be added that in another embodiment, mobile terminal may include more more or fewer than Fig. 5Component combines certain components or different component layouts, perhaps to realize all or part of function.
In addition, being also implemented as the computer program executed by CPU, the computer journey according to the method for the present inventionSequence may be stored in a computer readable storage medium.When the computer program is executed by CPU, execute in method of the inventionThe above-mentioned function of limiting.
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.
Those of ordinary skill in the art will appreciate that realizing that all or part of the steps of above-described embodiment can pass through hardwareIt completes, relevant hardware can also be instructed to complete by program, the program can store in a kind of computer-readableIn storage medium, storage medium mentioned above can be read-only memory, disk or CD etc..
The foregoing is merely presently preferred embodiments of the present invention, is not intended to limit the invention, it is all in spirit of the invention andWithin principle, any modification, equivalent replacement, improvement and so on be should all be included in the protection scope of the present invention.