FFmpeg quick command usage

Source: Internet
Author: User
FFmpeg syntax

 
FFmpeg [[Options] ['-I' input_file]... {[Options] output_file }...

If there is no input file, the video and audio will be captured (only effective in Linux, because the audio and video devicesCompositionHandle. As a general rule, option 1 is used for the next specific file. If you select-B 64, the next video rate will be set. The format option may be required for the original input file. By default, FFMPEG tries to achieve lossless conversion as much as possible and uses the same audio video parameters as the input.

FFmpeg conversion involves many options. For details, see FFMPEG options.

FFmpeg supports multiple file formats and multiple audio and video encoders. For details, see ffmepg format (for details, see common video file formats)

Video Files

    • Take an image of the size of 352x240 in JPG format.
 
FFmpeg-I test. ASF-y-F image2-T 0.001-s 352x240 a.jpg
    • Converts the first 30 frames of a video into an animation GIF.
 
FFmpeg-I test. ASF-vframes 30-y-F GIF a.gif
    • Truncate a thumbnail at a specified time
 
FFmpeg-I test. Avi-y-F image2-SS 8-T 0.001-s 350x240 test.jpg
-SS followed by time in seconds
    • Convert the 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. wmv-Ac 1-acodec libamr_nb-ar 8000-AB 12200-s 176x144-B 128-R 15 test.3gp

Video Format Conversion

    • How to Use FFMPEG encoding to produce high-quality videos
 
Ffmpeg.exe-I "d: \ video \ fearless. Avi"-target film-DVD-s 720x352
-Padtop 64-padbottom 64-maxrate 7350000-B 3700000-SC _threshold 1000000000
-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 a specified file to the FLV format
Ffmpeg.exe-I testbench-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
    • Vob for transcoding and decryption
 
FFmpeg-I snatch_1.vob-F Avi-vcodec MPEG4-B 800-G 300-BF 2-acodec MP3-AB 128 snatch. Avi
The above command line will convert the vob file into an AVI file, MPEG4 video and MP3 audio. Note that the command uses B frames, so the MPEG4 stream is divx5 compatible. The GOP size is 300, which means that there is an intra frame every 10 seconds at a 29.97 frame rate. This ing is particularly useful in Audio-language DVD transcoding.
    • It is also encoded to several formats and mapped 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 64 kbits a.wav to A. MP2 '-map file: Index' of kbits to define which input stream is used for each output stream in the order of output streams.
    • Convert the 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 compilation. For details, see: Convert video to 3GPP format
    • Convert the file to MP4 format (iPhone/itouch supported)
 
FFmpeg-y-I input. wmv-F MP4-async 1-s 480x320-acodec libfaac-vcodec libxvid-qscale 7-dts_delta_threshold 1 output.mp4
FFmpeg-y-I source_video.avi input-acodec libfaac-AB 128000-vcodec MPEG4-B 1200000-mbd 2-flags + 4mv + trell-Aic 2-CMP 2-subcmp 2-s 320 X 180-Title X final_video.mp4
    • Mix a piece of audio with a piece of video
 
FFmpeg-I son.wav-I video_origine.avi video_finale.mpg
    • Convert a video to a DVD format
 
FFmpeg-I source_video.avi-target Pal-DVD-PS 2000000000-aspect finale_video.mpeg
Note: Target Pal-DVD: output format PS 2000000000 maximum size for the output file, in BITs (here, 2 GB) aspect: widescreen
    • Convert a video to the DivX format.
 
FFmpeg-I video_origine.avi-s 320x240-vcodec msmpeg4v2 video_finale.avi
    • Turn X images to a video sequence
 
FFmpeg-F image2-I image1_d.jpg video. mpg
Note: This command will transform all the images from the current directory (named image1.jpg, image2.jpg, Etc...) to a video file named video. mpg.
    • Turn a video to X images
 
FFmpeg-I video. mpg image1_d.jpg
Note: This command will generate the files named image1.jpg, image2.jpg ,...
The following image formats are also availables: PGM, ppm, Pam, pgmyuv, JPEG, GIF, PNG, Tiff, SGI.

Screen recording

    • Use FFMPEG video screen
FFmpeg-vcodec MPEG4-B 1000-R 10-G 300-VD X11: 1024-s 768 x ~ /Test. Avi

-VD X11: 1024 indicates that the offset used for recording is x = 0 and Y = 0.-S 768 × 1024 indicates that the video size is 768 ×. The recorded video file is test. Avi and is saved to the user's home directory.

If you only want to record an application ProgramA fixed area in the window or desktop, you can specify the offset position and area size. You can use the xwininfo-frame command to find the preceding parameters.
    • Resize the video.
 
FFmpeg-vcodec MPEG4-B 1000-R 10-G 300-I ~ /Test. Avi-s 800x600 ~ Test-800-600.avi
Note: The screen recording function of FFmpeg is only available in Linux.

Video collection

    • Recording the real-time video of the camera and storing it as a file
 
FFmpeg-F video4linux-s 320*240-R 10-I/dev/video0 test. ASF
For more information, refer to the FFMPEG Engineering Group forum discussion post: video collection for FFMPEG
Note: The video collection function of FFMPEG can only be used in Linux environments.

Use FFMPEG to suppress H.264 videos

FFmpeg-threads 4-I input-r 29.97-vcodec libx264-s 480X272-flags + loop-CMP + chroma-deblockalpha 0-deblockbeta 0-CRF 24
-BT 256 k-Refs 1-coder 0-Me umh-me_range 16-subq 5-partitions + parti4x4 + parti8x8 + partp8x8-G 250-keyint_min 25-level 30
-Qmin 10-Qmax 51-trellis 2-SC _threshold 40-I _qfactor 0.71-acodec libfaac-AB 128 K-Ar 48000-AC 2 output
Note: This command can be used to compress clear and small H.264 video files.

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.