Non-MP4 video conversion to MP4 process based on ffmpeg teaching resource library

Source: Internet
Author: User

Non-MP4 video conversion to MP4 process based on ffmpeg teaching resource library

Operating Environment:

Win2003(or Win2008 64bit, priority this step),SQL Server 2005(or SQL Server2008 )

Execution mode:

Batch mode execution, converted video list, write database, error log write to the local execution program.

1. Conversion Step Description

1. Non- MP4 Video list

Connect the library database, find the non- MP4 Video resources of this machine, get the non- MP4 video list.

2, generate the original video MD5 code

Generate MD5 code for all original videos .

3. Determine if the video has been converted

Get a list of non-converted videos compared to the old and new two data tables.

4. Video Asynchronous Conversion

convert video to MP4 format asynchronously and in batches based on a non- MP4 video list . Before the conversion, you need to decide whether there is enough video storage space (whether the available space is larger than the original video size),whether theCPU usage reaches the threshold (60%), and whether the video has been converted.

5. Create a new video MD5

6. New Video List

Create a new database and save the converted video list. Includes SID, original address, new address, original MD5, new MD5, conversion duration, conversion finish time.

7. Exception Handling

The following conditions are encountered:

Insufficient space,CPU exceeded threshold,

Stop the conversion, generate an error log, and save the local server.

2. Conversion process1) Multiple storage servers asynchronous video conversion

Multiple storage servers Asynchronous video conversion

2) TeachingResource pool non-MP4 video list conversion process

Originally stored in the database of video (wmv format) is no MD5 Code, the program generates MD5 code.

Teaching Resource Library non-MP4 video list conversion process

3) One-time video conversion process

One-time video conversion process

3) List

List of converted Videos

Sid

Original address

New address

Hara MD5

New MD5

Conversion duration

Conversion Finish Time

Error log

Sid

Cause of error

Error time

Note: MD5 value is a password value, if the video content has not changed, then upload and download the video MD5 value is the same.

3. Specific implementation1, command-line logonSQL Server 2008r2

In the Command Line window under SQL code 1. Use osql >osql-slocalhost-usa-ppass >use database name >select * from sysobjects

2. use sqlcmd sqlcmd-u sa-p pass-s localhost

2, Video conversion

1) According to the original size, size conversion

Start

Ffmpeg.exe-i culture.wmv Iculture5.mp4

Exit

2)acc Code

Start

Ffmpeg.exe-i culture.wmv-vcodec libx264-preset ultrafast-profile:v baseline-acodec aac-strict experimental-s 640*48 0-b 568k-ab 128k Iculture.mp4

Exit

-vcodec libx264 using h264 conversion

-acodec AAC Audio codec with AAC

-B Video data traffic,-b xxx instructions Use fixed code rate, the number is random, above the above no effect; You can also use dynamic bitrate, such as:- Qscale 4,-qscale 6,4 of the quality is higher than 6 .

-S 640*480 video size

-ab 128k Audio Data traffic, General choice of

3, Code

Program execution steps

1, from the 202.205.161.177(sa,sa.net) of the mder_center_data Database [Mder_center]. [dbo]. The [Comm_sys_storageserver] table finds the corresponding server_id for this server IP. (Storagepath is the path to the video file store)

2, according to SERVER_ID, in [Mder_center]. [dbo]. The [Comm_media_info] database iterates through all wmv -formatted video files in the local database.

Get a video file of this server ID, not converted wmv format

"SELECT * from [Mder_center]. [dbo]. [Comm_media_info] where storage_serverid= ' "+ ServerID +

"' and resource_url like '%.wmv ' and media_id not in (select media_id from [mder_center].[ DBO]. [Comm_convertmp4_info]) ";

SELECT * FROM [Mder_center]. [dbo]. [Comm_media_info]

where storage_serverid= ' 22222222-2222-2222-2222-222222222222 '

Update [Mder_center]. [dbo]. [Comm_media_info]

Set storage_serverid= ' 88888888-44af-4310-9468-17ec508e838 '

where media_id= ' D2168944-c004-4df1-b572-7e5e90165ad8 '

Update [Mder_center]. [dbo]. [Comm_sys_storageserver]

Set storagepath= ' e:/video/'

where server_id= ' 22222222-2222-2222-2222-222222222222 '

Non-MP4 video conversion to MP4 process based on ffmpeg teaching resource library

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.