This afternoon, I started the development of batch conversion of whole videos to FLV. First, I checked the relevant issues in the morning and was very happy to find a lot of information to explain: Using FFMPEG + mencoder to implement the video conversion function. Since you have not implemented your own batch conversion tools, you cannot express your experience and achievements. I will share some of the information I have collected with you. If you are interested, you can study it together ......
I. FFMPEG + mencoder knowledge popularization
"FFMPEG + mencoder can basically complete any audio/video processing operations on the current web-based podcast platform. if you still need to add something, it is the online video recording function, which can also be completed using FFMPEG + FMS, therefore, some visible functions similar to YouTube can be implemented in the background in FFMPEG + mencoder + FMS. this section does not describe because there is no practice in the FMS.
This document consists of three parts:
1) Build FFMPEG + mencoder Environment
2) Common Operations
3) personal experiences
1. Build FFMPEG + mencoder Environment
1) Overview
Many codec protocols and specialized formats defined by various companies in the audio and video industry make the current video and audio files complicated. The formats supported by FFMPEG alone do not fully include all types, at least SWF, the current version of rmvb (rv4) is not supported. at the same time, wma9 seems to be supported. but not tested. at the same time, mencoder supports RM, rmvb, and other formats, but obtaining a frame from a video can only be completed by FFMPEG. therefore, FFMPEG and mencoder can be used to compress and convert all popular formats of videos, set video information, and intercept images in videos. At the same time, other open-source tools such as mediainfo can be used to obtain video metadata.
2. Common Operations
For FFMPEG, you can convert the video/audio formats except SWF, rmvb, and wmav9 to FLV/MP3, and intercept the frame image at a certain time in these video files. these are actually part of a video podcast. for mencoder, you can convert videos/audios in various common formats to FLV/MP3. or convert them to Avi.
1) FFMPEG:
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)
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.
2) mencoder:
Mencoder is mainly used in video transcoding. after installing mplayer, mencoder also compiled and generated. you can use man mencoder to obtain 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/post/144.html.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."
From: http://wf.xplore.cn/read.php/90.htm
Ii. parameter settings
Previous Article:
"Reference
Main options:
-L show license
-H Show Help
-Version show version
-Formats show available formats, codecs, protocols ,...
-F fmt force format
-I filename input file name
-Y overwrite output files
-T duration set the recording time
-Fs limit_size set the limit File Size
-SS time_off set the Start Time Offset
-Itsoffset time_off set the input ts offset
-Title string set the title
-Timestamp time set the timestamp
-Author string set the author
-Copyright string set the Copyright
-Comment string set the comment
-Album string set the album
-V verbose control amount of Logging
-Target type Specify target file type ("VCD", "SVCD", "DVD", "DV", "dv50", "Pal-VCD ", "NTSC-SVCD ",...)
-Dframes number set the number of data frames to record
-Scodec codec force subtitle codec ('copy' to copy Stream)
-Newsubtitle Add a new subtitle stream to the current output stream
-Slang Code set the ISO 639 language code (3 letters) of the current subtitle stream
Video options:
-Vframes number set the number of video frames to record
-R rate set frame rate (HZ value, fraction or abbreviation)
-S size set frame size (WXH or abbreviation)
-Aspect set aspect ratio (, or 1.3333, 1.7777)
-Croptop size set top crop band size (in pixels)
-Cropbottom size set bottom crop band size (in pixels)
-Cropleft size set left crop band size (in pixels)
-Cropright size set right crop band size (in pixels)
-Padtop size set top pad band size (in pixels)
-Padbottom size set bottom pad band size (in pixels)
-Padleft size set left pad band size (in pixels)
-Padright size set right pad band size (in pixels)
-Padcolor color set color of pad bands (hex 000000 thru ffffff)
-VN disable video
-Vcodec codec force video codec ('copy' to copy Stream)
-Sameq Use same video quality as source (implies VBR)
-Pass n select the pass number (1 or 2)
-Passlogfile file select two pass Log File Name
-Newvideo Add a new video stream to the current output stream
Subtitle options:
-Scodec codec force subtitle codec ('copy' to copy Stream)
-Newsubtitle Add a new subtitle stream to the current output stream
-Slang Code set the ISO 639 language code (3 letters) of the current subtitle stream
Audio/Video grab options:
-VD device set video Grab device
-VC channel set video grab channel (dv1394 only)
-Tvstd standard set television standard (NTSC, Pal (SECAM ))
-Ad device set audio device
-Grab format request grabbing using
-Gd device set Grab device
Advanced options:
-Map File: stream [: syncfile: syncstream] set input stream Mapping
-Map_meta_data OUTFILE: infile set meta data information of OUTFILE from infile
-Benchmark add timings for benchmarking
-Dump each input Packet
-Hex when dumping packets, also dump the payload
-Re read input at native Frame Rate
-Loop_input loop (current only works with images)
-Loop_output number of times to loop output in formats that support looping (0 loops forever)
-Threads count thread count
-Vsync video sync Method
-Async audio Sync method
-Vglobal video global header storage type
-Copyts copy timestamps
-Shortest finish encoding within shortest Input
-Dts_delta_threshold timestamp discontinuity Delta threshold
-PS size set packet size in bits
-Muxdelay seconds set the maximum Demux-Decode Delay
-Muxpreload seconds set the initial Demux-Decode Delay
"
View the Chinese parameter description, can refer to: http://www.lougoo.com/blog/article.asp? Id = 649
Iii. Instances
Http://www.cnblogs.com/xiucai/archive/2007/06/19/788598.html
Http://hi.baidu.com/assassionman/blog/item/cc4082a18d914883471064ac.html
Http://hi.baidu.com/ligg/blog/item/03dd1dd5629123c350da4b54.html
Iv. Experience
"Possible difficulty: Because FFMPEG and mencoder are both command line tools (you can also downloadSource codeModify it to com by yourself). in C #, it can only be called using process, I mentioned earlier that to obtain the output information (obtain the video information, obtain the current conversion progress, and obtain when to complete the conversion), you must set the process. startinfo. useshellexecute = false; process. startinfo. createnowindow = true; then process must be obtained through asynchronous programming. standardoutput and process. the value of standarderror. For more information, see (MS-help: // Ms. msdnqtr.2003feb. 2052/cpref/html/frlrfsystemdiagnosticsprocessclassstandardoutputtopic.htm) (msdn must be installed for viewing )."
Http://www.cnblogs.com/csky/archive/2007/03/13/673140.html
5. Download link:
FFmpeg Latest Version: http://ffdshow.faireal.net/mirror/ffmpeg/
Mencoder New: http://www5.mplayerhq.hu/MPlayer/releases/win32/