FFMPEG Use instructions

Source: Internet
Author: User
Tags set time sqoop
Original URL:Https://github.com/tonydeng/fmj/blob/master/ffmpeg.md# screenshot command
screenshot Command capture a picture of 352x240 size, format jpg
Ffmpeg-i input_file-y-F image2-t 0.001-s 352x240 output.jpg
convert the first 30 frames of the video into a animated Gif
Ffmpeg-i input_file-vframes 30-y-F gif output.gif
intercept the 230x240 thumbnail in the first 8.01 seconds of the video
Ffmpeg-i input_file-y-F mjpeg-ss 8-t 0.001-s 320x240 output.jpg
cut a picture every second .
Ffmpeg-i out.mp4-f IMAGE2-VF Fps=fps=1 out%d.png
cut a picture every 20 seconds .
Ffmpeg-i out.mp4-f IMAGE2-VF fps=fps=1/20 out%d.png
multiple screenshots merged into a file (2x3) every 1000 frames (seconds =1000/fps25) that is 40s cut a picture
Ffmpeg-i out.mp4-frames 3-vf "Select=not (mod (n\,1000)), scale=320:240,tile=2x3" Out.png
generate GIF pictures from video
Ffmpeg-i out.mp4-t 10-pix_fmt rgb24 out.gif
convert video to picture (one picture per frame)
Ffmpeg-i Out.mp4 Out%4d.png
convert picture to video
Ffmpeg-f image2-i out%4d.png-r Video.mp4
Note: The name of the image entered here must be out0001.png out0002.png ... out0010.png, must be starting from 1 and is a continuous number, or will not find the input picture error.
splitting video and generating m3u8 files
Ffmpeg-i input.mp4-c:v libx264-c:a aac-strict-2-F hls-hls_time 20-hls_list_size 0-hls_wrap 0 output.m3u8

Related parameter Description:

-I input video file
-c:v output video format
-c:a output audio format
-strict-
f HLS output video for HTTP Live Stream (m3u8)
-hls_time Set the length of each slice, The default is 2, the unit is seconds
-hls_list_size set the maximum number of entries saved by the playlist, set to 0 saves all information, defaults to 5
-hls_wrap set how many pieces to start overwriting, if set to 0 will not overwrite, the default value is 0. This option avoids storing too many slices on disk and can limit the maximum number of slices written to disk.

Note that the sequence number of the playlist must be unique for each segment, and it cannot be confused with the file name of the slice (when the wrap option is used, the filename may be reused). Detach video Audio stream

Ffmpeg-i input_file-vcodec Copy-an output_file_video    //Detach video stream ffmpeg-i input_file-acodec copy-vn output_file_
Audio    //detach audio stream
Video Solution multiplexing
Ffmpeg-i test.mp4-vcoder copy-an-f m4v test.264 ffmpeg-i test.avi-vcoder copy-an-f m4v test.264

Video Transfer Code
Ffmpeg-i test.mp4-vcoder h264-s 352*278-an-f m4v test.264    //transcoding for stream original file ffmpeg-i Test.mp4-vcoder h264-bf
0- G 25-s 352-278-an-f M4V test.264    //transcoding code stream original file Ffmpeg-i test.avi-vcoder mpeg4-vtag xvid-qsame test_xvid.avi
  //transcoding for encapsulated file-BF B frame number control, G-key frame interval control,-s resolution control
Video Encapsulation
Ffmpeg-i video_file-i audio_file-vcoder copy-acodec copy output_file
Video Clipping
Ffmpeg-i test.avi-r 1-f image2 image.jpeg//Video capture ffmpeg-i input.avi-ss 0:1:30-t 0:0:20-vcoder copy-acoder
Copy Output.avi//Cut video-R extract image frequency,-ss start time, T duration
Video Recording
Ffmpeg-i rtsp://hostname/test-vcoder Copy Out.avi
YUV Sequence Playback
Ffplay-f rawvideo-video_size 1920x1080 INPUT.YUV
YUV sequence turn avi
Ffmpeg-s w*h-pix_fmt yuv420p-i input.yuv-vcoder MPEG4 Output.avi
General parameter Description Main Parameters
-I set the input stream-
f to set the output format
-ss start time
Video Parameters
-B Set the video flow, the default is 200kbit/s-
s set the screen width and height
-aspect set the proportion of the screen
-VN does not deal with video
-vcoder set video encoder, not set time to use the same as the input stream codec
Audio Parameters
-ar set the sampling rate-ac set the
sound channel number
-ACODEC set the channel number in Shenyang
-an do not process audio
merging MP4 files using FFmpeg
Ffmpeg-i "Apache sqoop Tutorial part 1.mp4"-C copy-bsf:v h264_mp4toannexb-f mpegts intermediate1.ts
ffmpeg-i "Apa Che sqoop Tutorial part 2.mp4 "-C copy-bsf:v h264_mp4toannexb-f mpegts intermediate2.ts
ffmpeg-i" Apache sqoop Tuto Rial part 3.mp4 "-C copy-bsf:v h264_mp4toannexb-f mpegts intermediate3.ts ffmpeg-i
" Apache sqoop Tutorial part 4.MP 4 "-C copy-bsf:v h264_mp4toannexb-f mpegts intermediate4.ts
ffmpeg-i" concat:intermediate1.ts|intermediate2.ts| Intermediate3.ts|intermediate4.ts "-C copy-bsf:a aac_adtstoasc" Apache sqoop tutorial.mp4 "
convert FLV to MP4 using FFmpeg
Ffmpeg-i out.flv-vcodec copy-acodec Copy Out.mp4
Video Add Watermark in the Watermark Bureau
Ffmpeg-i out.mp4-i Sxyx2008@163.com.gif-filter_complex overlay= "(MAIN_W/2)-(OVERLAY_W/2):(MAIN_H/2)-(overlay_h)/2 "Output.mp4

Parameter Interpretation-I out.mp4 (video source)-I sxyx2008@163.com.gif (watermark picture) overlay watermark position Output.mp4 output file video flip and rotate flip Horizontal Flip language Method:-VF Hflip

Ffplay-i OUT.MP4-VF Hflip
Vertical Flip Syntax:-VF vflip
Ffplay-i OUT.MP4-VF Vflip
Rotate

Syntax: transpose={0,1,2,3}

0: Rotate 90° counterclockwise and flip vertically

1: Clockwise rotation 90°

2: Counterclockwise rotation 90°

3: Rotate the 90° clockwise and then flip horizontally to rotate the video clockwise 90 degrees

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.