FFmpeg Common Commands---turn

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. ffmpeg–i test.avi–vcodec copy–an–f m4v test. the

3. Video transcoding

Ffmpeg–i Test.mp4–vcodec H264–s352*278–an–f M4V test.264 // transcode to stream original file Ffmpeg–i test.mp4–vcodec h264–bf 0–g 25–s 278–an–f m4v test.< Span style= "line-height:1.5!important;" >264 // Transcode to stream original file Ffmpeg–i test.avi-vcodec mpeg4–vtag xvid–qsame test_xvid.avi //< Span style= "line-height:1.5!important;" > transcoding for package file //-BF B-Frame number control,-g Keyframe 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–r1–f image2 image-%3d.jpeg // extract pictures Ffmpeg-ss 0:1:30-t 0:20-i input.avi-vcodec copy-acodec copy output.avi //< Span style= "line-height:1.5!important;" > cut video //-r the frequency of extracting images,-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-V Codec set video codec, without timing use the same codec audio parameters as the input stream :-ar set the sample rate-AC set the channel number of the sound-acodec set the sound codec, without timing the same codec with the input stream-an do not process audio

------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------

1. Send files to live as Live

[Plain]View Plain copy
    1. Ffmpeg-re-i localfile.mp4-c copy-f flv rtmp://server/live/streamname

2. Save the live media to a local file

[Plain]View Plain copy
    1. 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

[Plain]View Plain copy
    1. 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

[Plain]View Plain copy
    1. 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

[Plain]View Plain copy
    1. 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

[Plain]View Plain copy
    1. ffmpeg -re -i rtmp://server/live/high_fmle_stream -acodec  copy -vcodec x264lib -s 640x360 -b 500k -vpre medium -vpre  baseline rtmp://server/live/baseline_500k -acodec copy -vcodec x264lib -s  480x272 -b 300k -vpre medium -vpre baseline rtmp://server/live/ baseline_300k -acodec copy -vcodec x264lib -s 320x200 -b 150k - Vpre medium -vpre baseline rtmp://server/live/baseline_150k -acodec libfaac  -vn -ab 48k rtmp://server/live/audio_only_aac_48k  

7, the same function, just use the-x264opts option

[Plain]View Plain copy
    1. ffmpeg -re -i rtmp://server/live/high_fmle_stream -c:a  Copy -c:v x264lib -s 640x360 -x264opts bitrate=500:profile=baseline:preset=slow  rtmp://server/live/baseline_500k -c:a copy -c:v x264lib -s 480x272 - x264opts bitrate=300:profile=baseline:preset=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

[Plain]View Plain copy
    1. 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

[Plain]View Plain copy
    1. 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)

[Plain]View Plain copy
    1. Ffmpeg-i rtmp://server/live/originalstream-c:a copy-c:v libx264-vpre slow-f flv "rtmp://server/live/h264stream Live =1〃<br style= "Box-sizing:border-box;"/><br style= "Box-sizing:border-box;/><br style=" box-sizing: Border-box; "/>

------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------

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

FFmpeg Common Commands---turn

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.