FFmpeg command Detailed

Source: Internet
Author: User
Tags benchmark
First, ffmpeg order detailed

FFmpeg is very powerful and you can finish your work with a few easy commands.

Put Darkdoor. [001-100].jpg sequence frames and 001.mp3 audio files synthesize video files using MPEG4 encoding Darkdoor.avi:
$ ffmpeg-i 001.mp3-i darkdoor.%3d.jpg-s 1024x768-author skypp-vcodec MPEG4

FFmpeg also supports the MOV format:
$ ffmpeg-i darkdoor.%3d.jpg Darkdoor.mov

To see what formats your ffmpeg supports, you can use the following command:
$ ffmpeg-formats | Less

You can also export the video file as a JPG sequence frame:
$ ffmpeg-i Bc-cinematic-en.avi example.%d.jpg

Installing FFmpeg under Debian is simple:
#apt-get Install FFmpeg

######################################

The following is the use of the instructions, slowly study it, hehe

######################################

ffmpeg using Syntax

FFmpeg Use Syntax:

ffmpeg [[options]['-i ' input_file]] ... {[options] output_file} ...

If there is no input file, the visual audio capture will work.

As a general rule, options are generally used for the next specific file. If you give –b 64 option, re-election will set the next video rate. For the original input file, the formatting options may be required.

By default, FFmpeg tries to do as much lossless conversion as possible, using the same audio video parameters as input to output.

3. Options

A) General Options

-L License

-H Help

-fromats display available format, codec, protocol ...

-F FMT forced to adopt format FMT

-I filename input file

-Y Overwrite output file

-t duration setting record time in HH:MM:SS[.XXX] format is also supported

-ss position search to the specified time [-]HH:MM:SS[.XXX] format also supports

-title String Set Caption

-author String Sets the author

-copyright String Set Copyright

-comment String Set Comment

-target type sets all of the format options (bit rate, codec, and buffer size) for the target file type (VCD,SVCD,DVD) automatically, and only needs to be entered as follows:
Ffmpeg-i Myfile.avi-target Vcd/tmp/vcd.mpg

-HQ Activate high quality settings

-itsoffset offset sets the time offset with a second base, which affects all subsequent input files. The offset is added to the timestamp of the input file, and defining a positive offset means that the corresponding stream is delayed by the offset second. The format of [-]hh:mm:ss[.xxx] also supports

b) Video Options

-B bitrate Set bit rate, default 200kb/s

-R fps Set frame frequency default 25

-S size sets the frame size format to WxH default 160x128. The following abbreviations can also be used directly:
SQCIF 128x96 qcif 176X144 CIF 252x288 4CIF 704x576

-aspect aspect Set horizontal longitudinal ratio 4:3 16:9 or 1.3333 1.7777

-croptop size set top cut with pixel units of size

-cropbottom size–cropleft size–cropright Size

-padtop size Sets the top-padded pixel units

-padbottom size–padleft size–padright size–padcolor color Set padded bar color (hex,6 number of 16, red: Green: Blue arrangement, such as 000000 for Black)

-VN does not make video recordings

-BT tolerance Set video bitrate tolerance kbit/s

-maxrate bitrate set maximum video bitrate tolerance

-minrate bitreate set minimum video bitrate tolerance

-bufsize size Set bit rate control buffer size

-VCODEC codec enforces the use of codec codec. If you use copy to indicate that the original codec data must be copied.

-sameq uses same video quality as source (VBR)

-pass N Select a process number (1 or 2). Two-pass coding is very useful. The first time to generate statistics, the second time to generate the exact rate of the requested code

-passlogfile file Select two times the name of the record files


c) Advanced video options

-G gop_size set image Group size

-intra only applies in-frame encoding

-qscale Q uses a fixed video quantization scale (VBR)

-qmin q Minimum Video quantization scale (VBR)

-qmax q Maximum Video quantization scale (VBR)

Maximum deviation between-qdiff Q quantization scale (VBR)

-qblur Blur Video quantization scaling (VBR)

-qcomp Compression Video quantization scale compression (VBR)

-RC_INIT_CPLX complexity The initial complexity of coding

QP factors of-b_qfactor factor between p and B frames

QP factors of-i_qfactor factor between p and I frames

QP deviation of-b_qoffset offset between p and B frames

QP deviation of-i_qoffset offset between p and I frames

-rc_eq equation Set code rate control equation default Tex^qcomp

-rc_override override rate control overload at specific intervals

-me method to set motion estimation methods available there are zero Phods log x1 EPZs (default) full

-dct_algo Algo set DCT algorithm available with 0 ff_dct_auto default DCT 1 ff_dct_fastint 2 ff_dct_int 3 ff_dct_mmx 4 ff_dct_mlib 5 ff_dct_altive C

-idct_algo Algo set IDCT algorithm. Available with 0 ff_idct_auto default IDCT 1 ff_idct_int 2 ff_idct_simple 3 ff_idct_simplemmx 4 ff_idct_libmpeg2mmx 5 ff_idct_ps2 6 FF_ID Ct_mlib 7 Ff_idct_arm 8 Ff_idct_altivec 9 Ff_idct_sh4 ff_idct_simplearm

-er n Sets the error residue to n 1 ff_er_carefull default 2 ff_er_compliant 3 ff_er_aggressive 4 ff_er_very_aggressive

-ec Bit_mask set error masking to Bit_mask, which is the Bitmask 1 Ff_ec_guess_mvs (default=enabled) 2 Ff_ec_deblock (default=enabled) of the values below

-BF frames uses frames B frames to support MPEG1,MPEG2,MPEG4

-MBD mode macro Block decision 0 ff_mb_decision_simple use mb_cmp 1 ff_mb_decision_bits 2 ff_mb_decision_rd

-4MV uses 4 motion vectors only for MPEG4

-part uses data partitioning only for MPEG4

-bug param bypass The problem of not being automatically monitored to the encoder

-strict strictness and Standard rigor

-AIC enables advanced intra-frame coding h263+

-UMV enables infinite motion vector h263+

-deinterlace does not use interleaving method

The-interlace forced interleaving method is only valid for MPEG2 and MPEG4. Use this option when your input is interlaced and you want to keep interlaced with minimal image loss. The alternative is not interwoven, but the loss is greater

-psnr Psnr for calculating compressed frames

-vstats output Video Coding statistics to Vstats_hhmmss.log

-vhook Module Insert video-processing modules include module names and parameters, separated by spaces

D) Audio Options

-ab bitrate set Audio code rate

-ar freq Set Audio sample rate

-AC channels set channel defaults to 1

-an does not enable audio recording

-ACODEC codec using codec codec

E) Audio/video capture options

-VD device set up a video capture device. Like/dev/video0.

-VC Channel set video capture channel DV1394 dedicated

-TVSTD standard set TV standard NTSC PAL (SECAM)

-dv1394 Set DV1394 Capture

-AV device set up audio devices such as/DEV/DSP


F) Advanced Options

-map File:stream Set Input stream mapping

-debug Print specific debugging information

-benchmark join time for benchmark test

-hex dumping every input package

-bitexact only use bit exact algorithm for codec test

-ps size to set the package sizes, in bits

-re read data in local frame frequency, mainly for analog capture devices

-loop the loop input stream. Works only on image streams for ffserver testing

FFmpeg use grammar ffmpeg use grammar

ffmpeg [[options]['-i ' input_file]] ... {[options] output_file} ...

If there is no input file, the video audio capture (which is only valid under Linux) will work if the audio and video device is handled as a file handle under Linux. As a general rule, options are generally used for the next specific file. If you give –b 64 option, re-election will set the next video rate. For the original input file, the formatting options may be required. By default, FFmpeg tries to do as much lossless conversion as possible, using the same audio video parameters as input to output.


FFmpeg conversion involves more options, you can refer to the FFmpeg option detailed.


FFmpeg supports a variety of file formats and a variety of audio, video encoders, can refer to the FFMEPG format, (with: Common video file format detailed)

screenshot of video file intercept a picture of 352x240 size, format jpg

Ffmpeg-i test.asf-y-F image2-t 0.001-s 352x240 a.jpg
Convert the first 30 frames of the video into a animated Gif
Ffmpeg-i test.asf-vframes 30-y-F gif a.gif
Intercept a thumbnail for a specified time
Ffmpeg-i test.avi-y-F image2-ss 8-t 0.001-s 350x240 test.jpg
-ss the time unit followed by the seconds convert file to 3GP format

-acodec aac-ac 2-ar 22500-ab 24-f 3gp test.3gp
Or
Ffmpeg-y-I test.wmv-ac 1-acodec libamr_nb-ar 8000-ab 12200-s 176x144-b 128-r

Video format conversion How to use ffmpeg encoding to get high-quality video

Ffmpeg.exe-i "D:\Video\Fearless\Fearless.avi"-target film-dvd-s 720x352

-trellis-cgop-g 12-bf 2-qblur 0.3-qcomp 0.7-me full-dc 10-mbd 2
-aspect 16:9-pass 2-passlogfile "D:\Video\ffmpegencode"-an-f mpeg2video "D:\FEARLESS.M2V"
Convert the specified format file to FLV format

Ffmpeg.exe-i test.wmv-ab 56-ar 22050-b 500-r 15-s 320x240 f:\test.flv
VOB of transcoding and decoding
Ffmpeg-i snatch_1.vob-f avi-vcodec mpeg4-b 800-g 300-bf 2-acodec mp3-ab 128 Snatch.avi
The command line above converts the VOB file into an AVI file, MPEG4 video and MP3 audio. Note that frame B is used in the command, so the MPEG4 stream is divx5 compatible. A GOP size of 300 means that there are intra frames every 10 seconds at 29.97 frame frequencies. This mapping is especially useful when you are in the audio language for DVD transcoding. Encode into several formats at the same time and create a mapping between the input stream and the output stream
Ffmpeg-i/tmp/a.wav-ab 64/tmp/a.mp2-ab 128/tmp/b.mp2-map 0:0-map 0:0
The command line above converts a 64Kbits a.wav to 128kbits a.mp2 '-map file:index ' defines in the order of output flows which input stream is used for each output stream. Convert file to 3GP format
Ffmpeg-i test.avi-y-B 20-s sqcif-r 10-acodec amr_wb-ab 23.85-ac 1-ar 16000 test.3gp
Note: If you want to convert to 3GP format, ffmpeg must add –ENABLE-AMR_NB–ENABLE-AMR_WB at compile time, details can refer to: Convert video to 3GPP format

screen recording using ffmpeg video screen

Ffmpeg-vcodec mpeg4-b 1000-r 10-g 300-vd x11:0,0-s 1024x768 ~/test.avi

: where-VD x11:0,0 refers to the offset used by the recording for X=0 and y=0,-s 1024x768 The size of the recorded video is 1024x768. The recorded video file is Test.avi and will be saved to the user's home directory if you only want to record an application window or a fixed area on the desktop, you can specify the offset position and the area size. You can use the Xwininfo-frame command to find the above parameters. Resize Video size

Ffmpeg-vcodec mpeg4-b 1000-r 10-g 300-i ~/test.avi-s 800x600 ~/test-800-600.avi
Note: The FFmpeg screen recording function can only be effective in a Linux environment.

Video capture The real-time video recording of the camera, stored as a file

FFmpeg-  F video4linux-s 320*240-r 10-i/dev/video0  test.asf
Iii. Use of FFMEPG

For a variety of conversion examples, see:
FFmpeg Howto
Program Download:
Unofficial FFmpeg Win32 builds (need to use proxy access)
Or:
FFMPEG Full SDK V3.0

The generic syntax is:

ffmpeg [[infile options]['-i ' infile]] ... {[outfile options] outfile} ...

As a, the options are applied to the next specified file. Therefore, order was important, and you can have the same option to the command line multiple times. Each occurrence are then applied to the next input or output file.

* To set the "video bitrate of the" output file to 64kbit/s:

Ffmpeg-i Input.avi-b 64k Output.avi

* To force the frame rate of the input and output file to FPS:

Ffmpeg-r 24-i Input.avi Output.avi

* To force the frame rate of the output file to FPS:

Ffmpeg-i Input.avi-r Output.avi

* To force the frame rate of input file to 1 fps and the output file to FPS:

Ffmpeg-r 1-i input.avi-r Output.avi

The format option may is needed for raw input files.

By default, FFmpeg tries to convert as losslessly as Possible:it uses the same audio and video parameters for the outputs As the one specified for the inputs.

Convert file to 3GP format
Ffmpeg-y-I test.mpeg-bitexact-vcodec h263-b 128-r 15-s 176x144-acodec aac-ac 2-ar 22500-ab 24-f 3gp test.3gp
Or
Ffmpeg-y-I test.mpeg-ac 1-acodec amr_nb-ar 8000-s 176x144-b 128-r

Convert the specified format file to FLV format

Ffmpeg.exe-i test.mp3-ab 56-ar 22050-b 500-r 15-s 320x240 f:\test.flv
Ffmpeg.exe-i test.wmv-ab 56-ar 22050-b 500-r 15-s 320x240 f:\test.flv
***************************************************************************
Ffmpeg-i F:\tools\ffmpeg.rev10464\test.avi-ab 56-ar 22050-b 500-r 15-s 320x240 F:\tools\ffmpeg.rev10464\test.flv
Ffmpeg-i "F:\tools\ffmpeg.rev10464\test.flv"-y-f image2-ss 8-t 0.001-s 350x240 "Test.jpg"


Ffmpeg.exe-i F:\ The home of the Flash guest song. Mp3-ab 56-ar 22050-b 500-r 15-s 320x240. flv
Ffmpeg-i F:\01.wmv-ab 56-ar 22050-b 500-r 15-s. flv
Using the-SS parameter action (Time_off set the start time offset), you can start the transformation task from a specified point-in-time. Such as:
To transform the file format while grasping thumbnails:
Ffmpeg-i "Test.avi"-y-f image2-ss 8-t 0.001-s 350x240 ' test.jpg '
For an existing FLV capture diagram:
Ffmpeg-i "Test. flv "-y-f image2-ss 8-t 0.001-s 350x240 ' test.jpg '
The time unit followed by the-SS is seconds
FFmpeg conversion Command
Ffmpeg-y-I test.mpeg-bitexact-vcodec h263-b 128-r 15-s 176x144-acodec aac-ac 2-ar 22500
-ab 24-f 3gp test.3gp
Or
Ffmpeg-y-I test.mpeg-ac 1-acodec amr_nb-ar 8000-s 176x144-b 128-r


FFmpeg parameter Setting explanation
-bitexact using standard bit rate
-vcodec xvid using XviD compression
-S 320x240 specified resolution
-R 29.97 Frame rate (can be changed to confirm that non-standard frames will lead to a different tone painting, so can only be set to 15 or 29.97)
Screen part, choose one
-b < bit rate > Specify the compression bit rate, it seems that ffmpeg is automatic VBR, which specifies the average bit rate, such as 768,1500
It's the original default project.
-qscale < numerical > with < value > quality based VBR, values 0.01-255, about small quality better
-qmin < value > set minimum quality, share with-qmax (set maximum quality), such as-qmin 10-qmax 31
-sameq use the same quality as the source
Sound part
-ACODEC AAC Set Sound coding
-ac < value > Set the number of channels, 1 is mono, 2 is stereo, the conversion of mono TVRip can be 1 (save half the capacity), high quality
The DVDRip can be used 2
-ar < sampling rate > Set sound sampling rate, PSP only 24000
-ab < bit rate > set the sound bit rate, the front-ac set to stereo in half bit rate to set, such as 192kbps is set to 96, conversion
June default bit rate is small, to hear a higher quality sound is recommended to set to 160kbps (80) or more
-vol <% > Set volume, some DVDRip AC3 track volume is very small, conversion can use this to increase the volume, such as 200 is the original twice times
In this way, to get a high quality, low volume MP4, first the screen is best not to use fixed bit rate, but with the VBR parameter let the program go
Judgment, and the sound quality parameters can be raised on the basis of the original point, it sounds more comfortable and not too big (see the situation adjustment

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.