Linux processing video for FLV format __linux

Source: Internet
Author: User
Tags flv file
Original paste: http://blog.csdn.net/crackcell/archive/2007/05/29/1629062.aspx
Http://blog.csdn.net/octverve/archive/2007/09/24/1798231.aspx

FLV Video Conversion Tool-Ffmpeg.exe

You should all know video-sharing sites like Youtobe and Google videos. All of their videos are played using Flash, and by exploring the actual address, they will find that the downloaded items are in the FLV format supported by Flash. This format of video, playback and conversion is very troublesome. However, there is a software ffmpeg from Linux that can easily convert FLV to other formats (AVI (MPEG4), ASF, MPEG) or convert other formats to FLV. =od ' Guq
FFmpeg as a LGPL open source program under Linux, compiling under Windows requires special tools. The Ffmpeg.exe I offer here is an old version of 2004, compiled using MinGW, with only one executable file that can be run directly (command-line programs). B<td|kk
An easy way to convert FLV to other formats (AVI (MPEG4), ASF, MPEG): (required in parentheses, optional in square brackets) Khog kh*
Convert into wmv/asf jzvqcf;$
Ffmpeg-i (the full path to the FLV file to convert)-F Asf-vcodec (WMV1 or wmv2) [-B video bit rate]-ACODEC mp3 [-ab audio bitrate] (output asf/wmv file full path)!. C1}wf
Convert to MPEG1 n Xa os&
Ffmpeg-i (full path to the FLV file to convert)-F mpeg-vcodec Mpeg1video [-B video bit rate]-acodec mp2 [-ab audio bitrate] (output of the MPG file full path) =mmbjg}0{
Convert to AVI (MSMPEG4) Z4%eycz '
Ffmpeg-i (full path to the FLV file to convert)-F Avi-vcodec (MSMPEG4 or Msmpeg4v1 or msmpeg4v2) [-B video bit rate]-ACODEC mp3 [-ab audio bitrate] (output AVI file full path) AIm Bkhok '
8J} ' S07
An easy way to convert other formats to FLV Qf1975fi
Ffmpeg-i (entered the full path of the file, RM/RMVB does not support, preferably MPEG4 avi or MPEG1 files, the new version of WMV support is not good)-f flv-vcodec flv [-B Video Rate]-ACODEC mp3 [-ab audio bitrate] (output of flv file) P ' P#kl
/WU3) RJK
FFmpeg actually has a lot of options. The description file is all embedded in the code. C (v+ej*! "
Download: Ffmpeg.zip v-d5$ +o
Http://freehost25.websamba.com/yksoft/download/ffmpeg.zip (%& "f_5q
Attachment: FLV Player s/99i*x0h
Http://freehost25.websamba.com/yksoft/download/rivaflvplayer.zip

trackback:http://tb.blog.csdn.net/trackback.aspx?postid=1798231
Solutions for FLV video conversion and flash playback from: http://blog.verycd.com/dash/showentry=35982
The author is the founder of the famous VERYCD.

When I took a bath 2 o'clock in the morning, I suddenly decided to study the problem of FLV video conversion and online playback. It then spent 2 hours on Google, and initially tested successfully before going to bed. This evening the information was collated and shared with you.

YouTube after the fire, a lot of follow-up at home and abroad, but there is no breakthrough in technology and process, basically is the server automatically to upload the user's video compression, compression can be played with flash online flv, reduce the size and reduce the rate of code. Then use Flash to create a player, you can play according to the parameters of the specified FLV video online, of course, some will add watermark and jump their own site functions.

The conversion tool can choose FFmpeg and mencoder, these 2 are GNU projects, and can be very perfect in linux/mac/win32 and other platforms to use. However, ffmpeg support video format is less (not easy to support Rmvb,mov, etc., but it is said that Google videos used this), and mencoder can not take screenshots, so you may consider the combination of 2, mencoder responsible for conversion, FFmpeg is responsible for screenshots.

About downloading and installing, ffmpeg annoying, the official website only provides SVN, need to compile their own. Specific reference to this article, Windows also need to install MinGW to Msys simulate the Linux environment, lazy words can directly find a compiled version, but the function may not be complete.

MEncoder is very simple, is a part of the MPlayer, will be installed MPlayer. Pay attention to all the codecs.


First, the normal video is converted to the FLV format via mencoder, and commands are as follows

Code mencoder test.avi-o test.flv-of LAVF-OAC mp3lame-lameopts ABR:BR=32:MODE=3-OVC lavc-lavcopts vcodec=flv:vbitrate= 150:mbd=2:mv0:trell:v4mv:cbp:last_pred=3-srate 22050-lavfopts I_certify_that_my_video_stream_does_not_use_b_ FRAMES-VF Scale=350:-3-sws 2

MEncoder parameter is extremely complex, depending on the audio compression itself is a very advanced knowledge, I scratch, the following only to understand some of their parameters to do some explanation, detailed explanation please read the manual

Referencing Test.avi
The input file path is the format that MPlayer can support

-O test.flv
Output path

-of LAVF
Output format LAVF represents libavcodec

-OAC Mp3lame
Output audio encoding mode, lame is the best MP3 encoder

-lameopts abr:br=32:mode=3
Options for Lame
ABR represents average bit rate, relative to CBR (fixed bit rate) and VBR (variable bit rate, seemingly not supported)
BR is the code rate of the audio, the higher the quality the better.
Mode=3,0-3 represent Stereo,joint Stereo,force Ms_stereo,mono (default is automatic, in fact 1 and 3 have no significant effect on file size)
Also optional vol. (volume, take a value of 0-10, the larger the volume, do not recommend modification), etc.

-srate 22050
Sound sampling frequency settings, you can also choose 11025, the file can be slightly smaller

-OVC LAVC
Output video encoding LAVC is Libavcodec

-lavcopts
Options for LAVC
CODEC=FLV FLV Format Compression
VBITRATE=150 Video Code Rate
A few other options are not understood, please read the manual (generally read or do not understand)

-VF Scale=350:-3-sws 2
Scales the video, specifying a width of 350 and a height proportional. The quality is controlled by the-SWS option, specifically read the manual

-ofps 23 Sets the frame number, reduces the frame number to save the file size effect is not obvious, and may cause the picture sound synchronization. Recommended not set

MEncoder compressed FLV generated after the lack of meta information, will cause playback without progress bar and other issues, need to use FLVMDI repair

Code Flvmdi test.flv

The generated FLV can be previewed through the MPC.

FFmpeg screenshot
Code ffmpeg-i test.flv-ss 10-vframes 1-r 1-ac 1-ab 2-s 320x240-f image2 test.jpg
-ss 10 means that frame in 1 seconds.

Then generate Flash video Player, the online examples are many, their own flash research is not deep, also not to say, to customize the viewer interface reference here

The only need to add is the smoothing properties of the video, now the online player size is generally back than the actual compressed video size larger, smoothing=true can ensure the quality of amplification (including full screen after), the specific article see here.


For a long time did not do some research in the technical aspects, rarely in the evening can be quiet. What I know is listed and will not be further studied, so don't ask me any other questions, Google will be more efficient than asking me.

trackback:http://tb.blog.csdn.net/trackback.aspx?postid=1629062

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.