CN110531939A - A kind of video on-demand system disk space optimization method - Google Patents

A kind of video on-demand system disk space optimization method Download PDF

Info

Publication number
CN110531939A
CN110531939A CN201910850655.0A CN201910850655A CN110531939A CN 110531939 A CN110531939 A CN 110531939A CN 201910850655 A CN201910850655 A CN 201910850655A CN 110531939 A CN110531939 A CN 110531939A
Authority
CN
China
Prior art keywords
file
video
value
mpeg2
slice
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.)
Granted
Application number
CN201910850655.0A
Other languages
Chinese (zh)
Other versions
CN110531939B (en
Inventor
张天昊
胡成钢
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nanjing Focus Leading Cloud Computing Technology Co Ltd
Original Assignee
Nanjing Focus Leading Cloud Computing Technology 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 Nanjing Focus Leading Cloud Computing Technology Co Ltd filed Critical Nanjing Focus Leading Cloud Computing Technology Co Ltd
Priority to CN201910850655.0A priority Critical patent/CN110531939B/en
Publication of CN110531939A publication Critical patent/CN110531939A/en
Application granted granted Critical
Publication of CN110531939B publication Critical patent/CN110531939B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0608Saving storage space on storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/0652Erasing, e.g. deleting, data cleaning, moving of data to a wastebasket
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/433Content storage operation, e.g. storage operation in response to a pause request, caching operations
    • H04N21/4335Housekeeping operations, e.g. prioritizing content for deletion because of storage space restrictions

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Television Signal Processing For Recording (AREA)

Abstract

The invention discloses a kind of video on-demand system disk space optimization methods characterized by comprising step 1, receives the original video files that user uploads, step 2, transcoding obtains the mp4 video file of different resolution;Step 3, mp4 video file is generated into corresponding MPEG2-TS file;Step 4: MPEG2-TS file being cut into the MPEG2-TS video segment of different durations, while generating m3u8 index file;Step 5: storing video file weighted value by file MD5 value in the database, use formula (D-100)3The calculated result of/1000+100 is that reference value is used as judgment basis, when reference value be reduced to 40 with or when rising to 60 or more progress file deletion and recovery.It can achieve efficiently using disk, do not duplicate file, the disk for reducing the file that is of little use occupies, and the effect of the normal play for the file that can guarantee to be of little use.

Description

A kind of video on-demand system disk space optimization method
Technical field
The present invention relates to computer software fields, more particularly to a kind of video on-demand system disk space optimization method.
Background technique
For using this kind of enterprises and mechanism of self-built server room, no image of Buddha cloud platform manufacturer equally possesses largely Server resource, and upgrade server is a pretty troublesome thing, then purchases arrive installation and debugging again ring upon ring, is expended For a long time, and the growth of business can't wait the procurement process of enterprise or mechanism, system before may cause new equipment in place With regard to alarm.
For video on-demand system, the consuming to disk be it is very big, first user upload most of video be It can not directly be played on network, server is needed to carry out transcoding processing, and this is the equal of answering original video file Portion is made, disk occupancy also just expands one times, and according to instantly conventional user experience requirement, when netcast is required to Automatically select suitable video code rate according to network condition, then just need to obtain a source video file transcoding it is a variety of clear The transcoded video file of degree, expands more times to the occupancy of disk so again, when amount of video reaches certain scale, to disk Occupy only wherein sub-fraction that is considerable, and often being played in all videos, most out-of-date videos are seldom quilts It plays, therefore the disk space of this kind of video can be optimised.
The present invention mainly discusses the optimization method that aspect is occupied to server disk, can effectively reduce disk occupancy, improves System reasonable utilization rate.
Summary of the invention
The technical problem to be solved by the present invention is to overcome the deficiencies of the prior art and provide a kind of video on-demand system disk Space optimization method.
In order to solve the above technical problems, the present invention provides a kind of video on-demand system disk space optimization method, feature It is, includes the following steps:
Step 1: receiving the original video files that user uploads, it is contemplated that the MD5 value for calculating original video files, if in system There are this MD5 values, then the original video files no longer re-write disk, and add this file in the database another draw With if this MD5 value is not present in system, newly-built one catalogue with the name of MD5 value is to store file;
Step 2: the mp4 video file that resolution ratio is 480P, 720P and 1080P is respectively obtained using FFmpeg transcoding, and After delete original video files;
Step 3: the mp4 video file of three kinds of resolution ratio is generated into corresponding MPEG2-TS file using FFmpeg again, The mp4 video file for deleting 480P, 720P Resolutions, retains the mp4 video file of 1080P;
Step 4: the MPEG2-TS file of three kinds of resolution ratio of generation is different by video code rate, when being cut into different respectively Long MPEG2-TS video segment, while generating m3u8 index file;
Step 5: storing video file weighted value by file MD5 value in the database, initial weight value is 100 and weight is total It binds with 100, the video file weighted value successively decreases 1 daily, but increases with the increase of playback volume, uses formula (D- 100) calculated result of 3/1000+100 is reference value as judgment basis, and wherein D is weighted value, when reference value drops to 40 or less When, the slice file and m3u8 index file of corresponding video are deleted, but retain the mp4 video file and MPEG2- of three kinds of clarity TS file such as encounters the request for playing video after deletion, then directly plays the mp4 file of corresponding clarity;When reference value drops When being 0, the MPEG2-TS file and mp4 file of three kinds of clarity is removed, but retain the mp4 video file of 1080P, such as met at this time To the request for playing video, then the mp4 video file of 1080P is directly played;When reference value reaches 60 again, 4 weights are gone to step Newly-generated video segment and m3u8 index file, wherein when ging up again after reference value is down to 0 to 60, regenerate 480P and The mp4 file and MPEG2-TS file of 720P Resolutions, and it is cut into video segment.
In the step 2, if original video files are not H.264 formats, its transcoding is become into H.264 format, such as The mp4 video file size that transcoding obtains then then skips over step 3 and step 4, direct jump procedure 5 less than 30mb.
Cutting in the step 4, to video specifically: utilize formula " time × code rate=size ", work as slice size When less than 2mb, extend slice duration so that slice size reaches 2mb, when slice size reaches 2mb but slice duration less than 5s When, extend slice duration to 5s.
In the step 5, the computation rule of the video file weighted value further include: video text below for 300Mb Part plays the weight of increase by 2 every time, plays the weight of increase by 5 every time for the video file of 300Mb or more, and management console plays not Calculate weight.
Advantageous effects of the invention:
(1) disk is efficiently utilized, file is not duplicated, the disk for reducing the file that is of little use occupies, by limited disk Space supplies active file, and the normal play for the file that can guarantee to be of little use.
(2) right to use metering mode can preferably control disk use, will not slightly increase because of playback volume and add deduct Operate video file less.
Detailed description of the invention
Fig. 1 is a kind of video on-demand system disk space optimization method implementation flow chart in the embodiment of the present invention;
Fig. 2 is deleted caused by changing for video on-demand system disk space optimization method weighted value a kind of in the embodiment of the present invention The flow chart of operations such as remove, restore;
Fig. 3 is a kind of specific calculating rule of video on-demand system disk space optimization method weighted value in the embodiment of the present invention Then flow chart;
Fig. 4 is a kind of video on-demand system disk space optimization method weight calculation Comparative result in the embodiment of the present invention Figure;
Fig. 5 is a kind of video on-demand system disk space optimization method file status figure in the embodiment of the present invention.
Specific embodiment
The present invention is further illustrated with exemplary embodiment with reference to the accompanying drawing:
A kind of video on-demand system disk space optimization method, which comprises the steps of:
Step 1: receiving the original video files that user uploads, it is contemplated that the MD5 value for calculating original video files, if in system There are this MD5 values, then the original video files no longer re-write disk, and add this file in the database another draw With if this MD5 value is not present in system, newly-built one catalogue with the name of MD5 value is to store file;
Step 2: the mp4 video file that resolution ratio is 480P, 720P and 1080P is respectively obtained using FFmpeg transcoding, and After delete original video files;
Step 3: the mp4 video file of three kinds of resolution ratio is generated into corresponding MPEG2-TS file using FFmpeg again, The mp4 video file for deleting 480P, 720P Resolutions, retains the mp4 video file of 1080P;
Step 4: the MPEG2-TS file of three kinds of resolution ratio of generation is different by video code rate, when being cut into different respectively Long MPEG2-TS video segment, while generating m3u8 index file;
Step 5: storing video file weighted value by file MD5 value in the database, initial weight value is 100 and weight is total It binds with 100, the video file weighted value successively decreases 1 daily, but increases with the increase of playback volume, uses formula (D- 100)3The calculated result of/1000+100 is reference value as judgment basis, and wherein D is weighted value, is utilized formula (D-100)3/ 1000+100 can achieve 47 days without the effect for playing i.e. Free up Memory, use deenergized period for weight shorter compared to simple, Space utilization rate is higher;When reference value drops to 40 or less, the slice file and m3u8 index file of corresponding video are deleted, but is protected The mp4 video file and MPEG2-TS file of three kinds of clarity are stayed, the request for playing video is such as encountered after deletion, then directly broadcasts Put the mp4 file of corresponding clarity;When reference value is reduced to 0, the MPEG2-TS file and mp4 file of three kinds of clarity are removed, But retains the mp4 video file of 1080P, such as encounter the request for playing video at this time, then directly play the mp4 video text of 1080P Part;When reference value reaches 60 again, goes to step 4 and regenerate video segment and m3u8 index file.
When reference value be reduced to 40 with or the deletion and recovery of file are carried out when rising to 60 or more, reduce the small amplitude wave of amount of access The dynamic influence to program avoids frequent creation and destroys file.It is related that slice is only removed when reference value is down to 40 simultaneously File fluctuates the influence to program also for reduction amount of access;When reference value be down to 40 or less but not up to 0 go up at this time to 60, it does not need to generate MPEG2-TS file again, directly can be quickly generated slice using MPEG2-TS file, when reference value drops Go up again after to 0 to 60, at this time due to having deleted the All Files in addition to the mp4 file of 1080P, regenerates 480P With the mp4 file and MPEG2-TS file of 720P Resolutions, and it is cut into video segment.
In the step 2, if original video files are not H.264 formats, its transcoding is become into H.264 format, such as The mp4 video file size that transcoding obtains belongs to small video less than 30mb, can guarantee that broadcasting is smooth without being sliced also, then with After skip over step 3 and step 4, direct jump procedure 5.
Cutting in the step 4, to video specifically: utilize formula " time × code rate=size ", work as slice size When less than 2mb, extend slice duration so that slice size reaches 2mb, when slice size reaches 2mb but slice duration less than 5s When, extend slice duration to 5s.To guarantee the fluency played, the size of each fragment is contemplated to be within 2Mb long comprising video Degree 5 seconds or more, this can optimize the viewing experience of user, not only will not lead to downloading slowly because of fragment is excessive, but also will not be because of The length of a film of downloading is too short to lead to Caton.
In the step 5, the computation rule of the video file weighted value further include: video text below for 300Mb Part plays the weight of increase by 2 every time, it is contemplated that the time cost of video file conversion makes spy for the file of 300Mb or more Different setting, plays the video file of 300Mb or more the weight of increase by 5 every time, and daily weight increase does not set the upper limit, with optimization Usage experience when big playback volume in short-term, management console broadcasting do not calculate weight.
Fig. 1 is a kind of video on-demand system disk space optimization method implementation flow chart in the embodiment of the present invention, specific to wrap It includes:
Step 101: user's uploaded videos are received, if file, which exists, does not do repetition upload jump procedure 102;
Step 102: generating the transcoding mp4 file of 3 kinds of clarity, and delete user's initial upload file
Step 103: generating ts file when video is more than or equal to 30Mb and be sliced;
Step 104: video is less than when 30Mb, does not generate slice, jump procedure 105;
Step 105: storage adduction relationship records initial weight value;
Fig. 2 is to delete caused by a kind of video on-demand system disk space optimization method weighted value variation of the embodiment of the present invention The flow chart operations such as remove, restore, specifically includes:
Step 201: using formula (D-100)3/ 1000+100 (D indicates weighted value) brings weighted value into and is calculated, and calculates As a result 100 and 0 are taken more than 100 or less than 0;
Step 202: when calculated result is less than 40, deleting corresponding video slice file and m3u8 index file;
Step 203: when calculated result is equal to 0, deleting the mp4 file of two kinds of clarity of 480P, 720P and all Ts file;
Step 204: when calculated result is greater than 60, checking that mp4 file, ts file, slice file whether there is, if not depositing Then sequentially generating;
Fig. 3 is a kind of specific computation rule of video on-demand system disk space optimization method weighted value of the embodiment of the present invention Flow chart specifically includes:
Step 301: to the weighted value of each video, doing the processing that subtracts 1 daily;
Step 302: less than 300Mb is the weight that video plays increase by 5 every time, each more than or equal to the video of 300Mb Play the weight of increase by 2
Fig. 4 is a kind of video on-demand system disk space optimization method weight calculation comparative result figure of the embodiment of the present invention
When not playing weight when 40 days and dropping to 60, reference value has reached 40 removing critical value, and 41 days whens start Free up Memory, space reaches the release of space maximum at 47 days, and if only being used as using weighted value with reference to then 61 days Shi Caihui Reach 40 critical values, can be only achieved within 100 days the release of space maximum, substantially reduces space release time using function calculating, it will The file not used for a long time is removed as early as possible;Occurs broadcasting for three days on end 7 times a day when simultaneously such as 71 days, reference value can be with It is promptly restored to 60 recovery critical value, supports the needs largely played.
Fig. 5 is a kind of video on-demand system disk space optimization method file status figure of the embodiment of the present invention
As shown,
When weight reference value declines:
When weight reference value rises:
Present invention is mainly used for providing a kind of video on-demand system disk space optimization method, it has the advantage that:
(1) disk is efficiently utilized, file is not duplicated, the disk for reducing the file that is of little use occupies, by limited disk Space supplies active file, and the normal play for the file that can guarantee to be of little use.
(2) right to use metering mode can preferably control disk use, will not slightly increase because of playback volume and add deduct Operate video file less.
Above embodiments do not limit the present invention in any way, all to be made in a manner of equivalent transformation to above embodiments Other improvement and application, belong to protection scope of the present invention.

Claims (4)

1. a kind of video on-demand system disk space optimization method, which comprises the steps of:
Step 1: receiving the original video files that user uploads, it is contemplated that the MD5 value for calculating original video files, if existing in system This MD5 value, then the original video files no longer re-write disk, and add another reference of this file in the database, If this MD5 value is not present in system, a catalogue with the name of MD5 value is created to store file;
Step 2: respectively obtaining the mp4 video file that resolution ratio is 480P, 720P and 1080P using FFmpeg transcoding, then delete Except original video files;
Step 3: the mp4 video file of three kinds of resolution ratio being generated into corresponding MPEG2-TS file using FFmpeg again, is deleted The mp4 video file of 480P, 720P Resolutions retains the mp4 video file of 1080P;
Step 4: the MPEG2-TS file of three kinds of resolution ratio of generation is different by video code rate, it is cut into different durations respectively MPEG2-TS video segment, while generating m3u8 index file;
Step 5: storing video file weighted value by file MD5 value in the database, initial weight value is 100 and weight summation 100 It binds, the video file weighted value successively decreases 1 daily, but increases with the increase of playback volume, uses formula (D-100)3/1000 + 100 calculated result is reference value as judgment basis, and wherein D is weighted value, when reference value drops to 40 or less, deletion pair The slice file and m3u8 index file of video are answered, but retains the mp4 video file and MPEG2-TS file of three kinds of clarity, such as The request for playing video is encountered after deletion, then directly plays the mp4 file of corresponding clarity;When reference value is reduced to 0, remove The MPEG2-TS file and mp4 file of three kinds of clarity, but retain the mp4 video file of 1080P, broadcasting video is such as encountered at this time Request, then directly play 1080P mp4 video file;When reference value reaches 60 again, goes to step 4 and regenerate video Slice and m3u8 index file, wherein when ging up again after reference value is down to 0 to 60, regenerate 480P and two kinds points of 720P The mp4 file and MPEG2-TS file of resolution, and it is cut into video segment.
2. a kind of video on-demand system disk space optimization method as described in claim 1, it is characterised in that: the step 2 In, if original video files are not H.264 formats, its transcoding is become into H.264 format, the mp4 video obtained such as transcoding File size then then skips over step 3 and step 4, direct jump procedure 5 less than 30mb.
3. a kind of video on-demand system disk space optimization method as claimed in claim 2, it is characterised in that: the step 4 In, the cutting to video specifically: utilize formula " time × code rate=size ", when slice size is less than 2mb, extend slice Duration is so that slice size reaches 2mb, and when slice size reaches 2mb but slice duration less than 5s, extension is sliced duration to 5s.
4. a kind of video on-demand system disk space optimization method as claimed in claim 3, it is characterised in that: the step 5 In, the computation rule of the video file weighted value further include: video file below for 300Mb plays every time increases by 2 Weight, plays the video file of 300Mb or more the weight of increase by 5 every time, and management console broadcasting does not calculate weight.
CN201910850655.0A 2019-09-10 2019-09-10 Disk space optimization method for video-on-demand system Active CN110531939B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910850655.0A CN110531939B (en) 2019-09-10 2019-09-10 Disk space optimization method for video-on-demand system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910850655.0A CN110531939B (en) 2019-09-10 2019-09-10 Disk space optimization method for video-on-demand system

Publications (2)

Publication Number Publication Date
CN110531939A true CN110531939A (en) 2019-12-03
CN110531939B CN110531939B (en) 2022-09-02

Family

ID=68667845

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910850655.0A Active CN110531939B (en) 2019-09-10 2019-09-10 Disk space optimization method for video-on-demand system

Country Status (1)

Country Link
CN (1) CN110531939B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113965282A (en) * 2021-10-09 2022-01-21 福建新大陆通信科技股份有限公司 Emergency broadcasting method for multimedia IP outdoor terminal

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103297431A (en) * 2013-05-24 2013-09-11 南京邮电大学 Streaming media video-on-demand duplicate hybrid buffer strategy based on cloud server cluster
CN104202356A (en) * 2014-08-07 2014-12-10 西安交通大学 A video file deploying method of a video cloud on-demand system based on a multi-code-rate version
CN108271039A (en) * 2016-12-30 2018-07-10 中兴通讯股份有限公司 A kind of document sending method and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103297431A (en) * 2013-05-24 2013-09-11 南京邮电大学 Streaming media video-on-demand duplicate hybrid buffer strategy based on cloud server cluster
CN104202356A (en) * 2014-08-07 2014-12-10 西安交通大学 A video file deploying method of a video cloud on-demand system based on a multi-code-rate version
CN108271039A (en) * 2016-12-30 2018-07-10 中兴通讯股份有限公司 A kind of document sending method and device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113965282A (en) * 2021-10-09 2022-01-21 福建新大陆通信科技股份有限公司 Emergency broadcasting method for multimedia IP outdoor terminal
CN113965282B (en) * 2021-10-09 2023-05-12 福建新大陆通信科技股份有限公司 Emergency broadcasting method for multimedia IP outdoor terminal

Also Published As

Publication number Publication date
CN110531939B (en) 2022-09-02

Similar Documents

Publication Publication Date Title
US12132938B2 (en) Method and apparatus for capacity exchange
CN101977218B (en) Internet playing file transcoding method and system
WO2013008866A1 (en) Generation device, distribution server, generation method, playback device, playback method, playback system, generation program, playback program, recording medium and data structure
BR112014000597B1 (en) METHOD AND SYSTEM FOR DOWNLOADING A MULTIMEDIA FILE
CN104967861A (en) CDN video buffer system and method
CA2819249A1 (en) Media platform integration system
CN104469391B (en) A kind of digital TV contents dissemination system and method based on cloud platform
EP3471421B1 (en) Live broadcast video replay method, server, and system
CN103634616B (en) A kind of stream media ordering method and device based on cloud storage
EP2443606A2 (en) Synchronized distributed media assets
CN111787404B (en) Live stream playing method and device
CN101068341B (en) Stream media dispatching system and medium file scheduling method thereof
CN111083217A (en) Method and device for pushing Feed stream and electronic equipment
US9417969B2 (en) Distributed network backup of multimedia files
US20150319208A1 (en) Digital content supply system
CN110531939A (en) A kind of video on-demand system disk space optimization method
CN115022677B (en) Video playing method, device, equipment and medium
CN113645499A (en) Video editing method based on cloud
WO2021136823A1 (en) Techniques for providing a content stream based on a delivered stream of content
AU2010201610B2 (en) System for supplying digital content
US20170329831A1 (en) System and method for analyzing content usage events
CN104980792A (en) Method and device for testing video play
CN102438171A (en) Program source file processing method and device and network television system
JP2015510727A (en) Method and system for providing file data for media files
JP6258897B2 (en) Content acquisition device, content acquisition method, metadata distribution device, and metadata distribution method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant