Complete Solution for converting video files to FLV (FFMPEG and mencoder)

Source: Internet
Author: User
Tags benchmark flv file

If you understand this and have a programming foundation, you can participate in FFMPEG development. in fact, these stacked commands 95% are generally not used. here are some simple and Common commands:
-Fromats display available formats
-F fmt forced the FMT Format
-I filename input file
-Y overwrites the output file
-T Duration: set the record time in HH: mm: ss [. xxx] format (required)
-SS position: the specified time [-] hh: mm: ss [. xxx] format is also supported.
-Title string: Set the title
-Author string: Set the author.
-Copyright string sets Copyright
-Comment string: Set comments.
-Target type: sets the target file type (VCD, SVCD, and DVD). All format options (bit rate, codec, and buffer size) are automatically set. You only need to enter the following: FFmpeg-I myfile. avi-target VCD/tmp/VCD. MPG
-HQ activates high-quality settings

-B bitrate: bit rate. The default value is kb/s.
-R fps: Specifies the frame rate. The default value is 25.
-S size: Specifies the frame size. The format is WXH. The default value is 160x128. You can also use the following shorthand: sqcif 128x96 qcif 176x144 CIF 252x288 4cif 704x576.
-Set aspect to or 1.3333 1.7777
-Croptop/botton/left/right size: Specifies the size of the top slice, in pixels.
-Padtop/botton/left/right size: Set the padding size on the top, in pixels.
-Padcolor color: Fill in the color (Hex, six hexadecimal numbers, Red: Green: blue, for example, 000000 represents black)
-VN does not record videos
-BT tolerance: sets the video bit rate tolerance kbit/s.
-Maxrate bitrate: sets the maximum video bit rate tolerance.
-Minrate bitreate: sets the minimum video bit rate tolerance.
-Bufsize size: sets the bit rate to control the buffer size.
-Vcodec codec enforces codec encoding/decoding. If copy is used, the original codec data must be copied. (important)

-AB bitrate: Set the audio bit rate.
-Ar freq: Set the audio Sampling Rate
-AC channels: Specifies the channel. The default value is 1.
-An does not enable audio recording
-Acodec codec uses codec encoding/Decoding

-VD device: sets a video capture device, such as/dev/video0.
-VC channel: Specifies the dedicated video capture channel dv1394.
-Tvstd standard: sets the TV standard NTSC pal (SECAM)
-Set dv1394 to capture dv1394
-AV device: Set audio devices such as/dev/DSP

-Map File: stream sets the input stream ing.
-Debug: Print specific debugging information
-Benchmark indicates the benchmark test time.
-Hex dumping each input package
-Bitexact only uses a bit Precise Algorithm for Codec testing.
-PS size: Set the package size, in bits.
-Re reads data at a local frame rate, which is mainly used to simulate capturing devices.
-Loop input stream. Only works on image streams for ffserver Testing

Common Methods for FFMPEG operations:

1. Convert to FLV file: FFMPEG-I infile. *-y (-SS second_offset-Ar-AB AB-r VR-B Vb-s vsize) OUTFILE. FLV
Here, second_offset is how many seconds from the beginning. the **: ** format is supported. As for Ar, AB is the audio parameter. You can specify AR = 44100, 24000, 48000 (PAL), (NTSC ), the last two common types: AB = 56 (depending on the codec of the video/audio protocol. If you want to listen to high quality, 80 or more ). VR, VB, and vsize are video parameters. You can specify Vr = 15, 25 (PAL), 29 (NTSC), and VB = 200,500,800,150 0 (depending on the codec of the video protocol, you can refer to the professional codec instruction document. If you have a detailed codec instruction document, please provide it to me. Thank you very much .)
There are also some parameters-acodec ac-vcodec VC (AC can specify the audio codec, AR and AB, VC can specify the video codec, VR and VB can save, and the corresponding codec parameters are automatically used)
There are also many advanced parameters, such as-qmin and-qcale. Please refer to the detailed documentation.
The-An and-VN parameters are also used to extract pure video and audio from multimedia files.
In addition, if you are using shell batch processing, use the-y parameter to overwrite the FLV.

2. screenshot: FFMPEG-I infile. *-y (-SS second_offset)-T 0.001-s msize (-F image_fmt) outfile.jpg
Here, second_offset is the same as above, and msize is the same as vsize. The image size. image_fmt = image2 is forced to use JPG, image_fmt = GIF, and forced to use GIF.
You can also use-vframes FN to specify a frame to intercept an image. fn =, 3 ,...

2) mencoder:
Mencoder is mainly used in video transcoding. After mplayer is installed, mencoder also generates a compilation. Man mencoder can get mencoder instructions.
Mencoder parameters are more complex, but they are nothing more than audio processing video. For more information, see the network example http://www.masoncn.com/pos...here.

Mencoder: mencoder infile. *-o outfile. * [-OVC target video format] [-OAC target audio format] [-of target file format]

1. convert to FLV file: mencoder infile. *-o outfile. FLV-of lavf-OAC mp3lame-lameopts ABR: Br = 56-OVC lavc-lavcopts vcodec = FLV: vbitrate = 150: mbd = 2: mv0: trell: v4mv: CBP: last_pred = 3-srate 22050
Mencoder infile. rmvb-o outfile. FLV-VF scale =--ofps 12-OAC mp3lame-OVC XviD-xvidencopts bitrate = 112

2. convert to an AVI file: mencoder infile. *-o outfile. Avi-of Avi-OAC mp3lame-lameopts preset = 64-OVC XviD-xvidencopts bitrate = 600

3. convert to a WMV file (complex writing method, where advanced parameters can be omitted): mencoder infile. *-o outfile. wmusic-of lavf-ofps 25-OAC mp3lame-lameopts CBR: preset = 128-OVC lavc-lavcopts vcodec = MPEG4: vbitrate = 768: mbd = 2: mv0: trell: v4mv: CBP: last_pred = 3-VF scale = 320: 240-srate 22050-SWS 9-subcp cp936-subpos 0-subalign 0-subfont-text-scale 3-lavfopts I _certify_that_my_video_strea

4.: mplayer infile-SS start_time-noframedrop-nosound-vo JPEG-frames n

Among them,-OVC,-OAC and-of are required.-OVC specifies the video codec. After OVC is specified, it usually carries an opt parameter of the codec.-OAC specifies the audio codec, it will also include the OPT parameter of codec. you can specify details to determine the video audio quality and conversion rate. for details, refer to the professional technical documents.

3. Some personal experiences
On the video podcast website, there are several problems with the audio and video itself:
1) Some formats of audio and video files are not supported. They cannot be fully implemented.
2) the same content uploaded, but the audio and video deduplication in different formats. There are different levels of Solutions to describe the problem from the storage and application aspects.
3) for audio and video files in some formats, they may be either pure audio or pure video files, such as RM format. How to differentiate such files for ease of application.
4) for Audio/Video Retrieval, whether the video description can be implemented in the content mode rather than the keyword mode defined by the user.
5) use and Process audio and video similarity.
6) download and obtain audio and video files.

FFmpeg + mencoder can be used to obtain an acceptable solution to the first problem. the third problem is that you can install a front-end filter program after uploading to distinguish between audio files and video files. You already have open-source tools and code to do this. for the second problem, the first is to unify the format, and then calculate the hash of audio and video files. The storage part adopts the distributed CAS Technology for storage, and the application architecture is above the CAS. the fourth question is to be further studied. for the sixth question, we can consider the P2P approach, but this is not very important.

This article from: ASP. NET learning portal (http://www.aspx1.com) detailed source reference: http:// I .aspx1.com/showtree.aspx? Postid = 2206

 

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.