Basic commands for FFmpeg

Source: Internet
Author: User

1. Separating the video audio stream
Ffmpeg-i input_file-vcodec Copy-an output_file_video//split video stream
Ffmpeg-i input_file-acodec copy-vn output_file_audio//Split audio stream
2. Video re-use
Ffmpeg–i Test.mp4–vcodec copy–an–f M4V test.264
Ffmpeg–i Test.avi–vcodec copy–an–f M4V test.264
3. Video transcoding
Ffmpeg–i test.mp4–vcodec h264–s 352*278–an–f m4v test.264//transcoding to bitstream original file
Ffmpeg–i test.mp4–vcodec h264–bf 0–g 25–s 352*278–an–f m4v test.264//transcoding to bitstream original file
Ffmpeg–i test.avi-vcodec Mpeg4–vtag xvid–qsame Test_xvid.avi//transcoding to package file
-BF b Frame number control,-g key frame interval control,-s resolution control
4. Video Encapsulation
Ffmpeg–i video_file–i audio_file–vcodec copy–acodec copy output_file
5. Video Clipping
Ffmpeg–i test.avi–r 1–f image2 image-%3d.jpeg//Extract Pictures
Ffmpeg-ss 0:1:30-t 0:0:20-i input.avi-vcodec copy-acodec copy output.avi//Cut Video
-R Extract the frequency of the image,-ss start time,-t duration
6. Video recording
Ffmpeg–i Rtsp://192.168.3.205:5555/test–vcodec Copy Out.avi
7.YUV sequence Playback
Ffplay-f rawvideo-video_size 1920x1080 INPUT.YUV
8.YUV sequence turn avi
Ffmpeg–s w*h–pix_fmt yuv420p–i input.yuv–vcodec MPEG4 Output.avi
Common parameter Description:
Main parameters:-I set input stream-F Set output format-ss start time video parameter:-B Set Video traffic, default to 200KBIT/S-R set frame rate, default to 25-s setting screen width and height-aspect set screen ratio-vn do not process video-vcode C Set the video codec, without timing use the same codec audio parameters as the input stream:-ar Set sampling rate-AC set the channel number of sound-acodec set the sound codec, without timing the same codec with the input stream-an not processing audio
------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------
1. Send files to live as Live
Ffmpeg-re-i localfile.mp4-c copy-f flv rtmp://server/live/streamname
2. Save the live media to a local file

Ffmpeg-i rtmp://server/live/streamname-c Copy dump.flv
3, one of the live stream, video instead of H264 compression, audio unchanged, sent to another live streaming service

Ffmpeg-i rtmp://server/live/originalstream-c:a copy-c:v libx264-vpre slow-f flv rtmp://server/live/h264stream

4, one of the live stream, video instead of H264 compression, audio instead of FAAC compression, sent to another live streaming service
Ffmpeg-i rtmp://server/live/originalstream-c:a libfaac-ar 44100-ab 48k-c:v libx264-vpre slow-vpre baseline-f flv r Tmp://server/live/h264stream
5, one of the live stream, the video is unchanged, the audio instead of FAAC compression, sent to another live streaming service
Ffmpeg-i rtmp://server/live/originalstream-acodec libfaac-ar 44100-ab 48k-vcodec copy-f flv rtmp://server/live/h264_ Aac_stream
6, will a high stream, copied to several different video definition of the flow re-release, where the audio does not change
Ffmpeg-re-i rtmp://server/live/high_fmle_stream-acodec copy-vcodec x264lib-s 640x360-b 500k-vpre Medium-vpre Basel Ine Rtmp://server/live/baseline_500k-acodec copy-vcodec x264lib-s 480x272-b 300k-vpre medium-vpre Baseline rtmp://se Rver/live/baseline_300k-acodec copy-vcodec x264lib-s 320x200-b 150k-vpre medium-vpre Baseline Rtmp://server/live/bas Eline_150k-acodec Libfaac-vn-ab 48k rtmp://server/live/audio_only_aac_48k
7, the same function, just use the-x264opts option
Ffmpeg-re-i rtmp://server/live/high_fmle_stream-c:a copy-c:v x264lib-s 640x360-x264opts Bitrate=500:profile=baselin E:preset=slow rtmp://server/live/baseline_500k-c:a copy-c:v x264lib-s 480x272-x264opts bitrate=300:profile=baseline :p reset=slow rtmp://server/live/baseline_300k-c:a copy-c:v x264lib-s 320x200-x264opts bitrate=150:profile=baseline: Preset=slow rtmp://server/live/baseline_150k-c:a libfaac-vn-b:a 48k rtmp://server/live/audio_only_aac_48k
8, the current camera and audio through Dsshow acquisition, video H264, audio FAAC compressed after release
Ffmpeg-r 25-f dshow-s 640x480-i video= "video Source name": audio= "audio source name"-vcodec libx264-b 600k-vpre Slow -acodec libfaac-ab 128k-f flv rtmp://server/application/stream_name
9, a JPG image through the H264 compression cycle output to MP4 video
Ffmpeg.exe-i input.jpg-an-vcodec libx264-coder 1-flags +loop-cmp +chroma-subq 10-qcomp 0.6-qmin 10-qmax 51-qdif F 4-flags2 +dct8x8-trellis 2-partitions +parti8x8+parti4x4-crf 24-threads 0-r 25-g 25-y OUTPUT.mp4
10, the normal stream video instead of H264 compression, audio unchanged, sent to the HD service (new version of FMS live=1)
Ffmpeg-i rtmp://server/live/originalstream-c:a copy-c:v libx264-vpre slow-f flv "Rtmp://server/live/h264stream live=1 〃
------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------

1. Capture USB camera video commands:
Ffmpeg-t 20-f vfwcap-i 0-r 8-f mp4 cap1111.mp4

./ffmpeg-t 10-f vfwcap-i 0-r 8-f mp4 cap.mp4
The specific description is as follows: We collect 10 seconds, the acquisition device for the VFWCAP type equipment, the NO. 0 vfwcap acquisition Equipment (if the system has a number of VFW video capture equipment, can be selected through-I num), 8 frames per second, the output mode is a file, the format of MP4.

2. The simplest screen capture:
Ffmpeg-f gdigrab-i Desktop Out.mpg

3. Starting at the (10,20) point of the screen, grab the 640x480 screen and set the frame rate at 5:
Ffmpeg-f gdigrab-framerate 5-offset_x 10-offset_y 20-video_size 640x480-i Desktop Out.mpg

4.ffmpeg creating a GIF image from your video:
Ffmpeg-i capx.mp4-t 10-s 320x240-pix_fmt rgb24 jidu1.gif

5.ffmpeg convert a picture to a video:
Http://blog.sina.com.cn/s/blog_40d73279010113c2.html

Basic commands for FFmpeg

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.