Seven Tips for using ffmeg

Source: Internet
Author: User

FFmpeg is a Swiss Army knife for audio and video applications, providing a wide range of options and flexibility. most of the time, users have installed ffmeg to watch videos and listen to music. for more details about ffmeg: Here, you can use FFMPEG-formats to view the video and audio formats supported by FFMPEG. If e is on the left, it can be encoded, and D indicates it can be decoded.

This article focuses on seven ffmeg skills under the command line:

1. Audio Conversion

ffmpeg -i my_audio.wav  my_audio.mp3

-I is the audio file to be converted, and my_audioaudio is the target audio file.

2. Video Conversion

ffmpeg -i my_video.mpeg -s 500×500 my_video.flv

-I is the source video file, and-s indicates setting the resolution of the target video file my_video.flv as the target video file

3. capture images from videos

ffmpeg -i test.mpg image%d.jpg

By default, 25 screenshots are captured in 1 s. You can use-R to set the number of screenshots captured per second.

-R fps: Specifies the frame rate, that is, the number of captured images per second (default value: 25)

ffmpeg -i test.mpg -r 1 image%d.jpg

In this way, one screenshot is taken every 1 second.

You can also set the intercept interval, starting and ending

-SS sets the time position. Syntax: hh: mm: ss [. xxx]

-T Duration: The time limit for transcoding/video capturing. Syntax: hh: mm: ss [. xxx]

ffmpeg -i test.mpg -r 25 -ss 00:00:10 -t 00:00:05 images%05d.png

At a rate of 25 screenshots per second starting from 10th seconds, screenshots of images with a length of 5 seconds are captured.

4. Collect audio from videos

ffmpeg -i video.avi -f mp3 audio.mp3

-F force select format

ffmpeg -i video.avi -vn audio.mp3

-VN: Cancel video capturing (that is, only output audio files)

5. Create a screenshot video

ffmpeg -f x11grab -r 25 -s wxga -i :0.0 /tmp/outputFile.mpg

Is 0.0 the screen display number of your X11 server, which is similar to that of display.

This command captures the wxga screen video at a rate of 25 frames per second. Of course, you can use-s to set the video resolution. The output file is/tmp/outputfile. mpg.

6. Use images to create videos

FFmpeg-F image2-I img0000d.jpg/tmp/a. mpg

Convert the image files in the order of 'img001.jpg 'and 'img002.jpg' into videos.

7. capture video from webcam

FFmpeg-F video4linux2-s 320x240-I/dev/video0 out. mpg

Capture audio and video simultaneously:

FFmpeg-f oss-I/dev/DSP-F video4linux2-s 320x240-I/dev/video0 out. mpg/dev/video0

Video device/dev/DSP as audio device

From: http://www.oschina.net/question/3307_21307

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.