Of course, install Gentoo first.
Emerge FFMPEG
Format conversion (convert file. Avi to output. FLV)
FFmpeg-I file. Avi
Output. FLV
-I indicates the input file
: Now there is a video. Avi, and an audio audioaudio, Which is merged into output. Avi.
Two commands (video2.avi is an intermediate file and can be deleted after use)
FFmpeg-I video. Avi-vcodec copy-An video2.avi
FFmpeg-I video2.avi-I audioaudio-vcodec copy-acodec copy output. Avi
-I indicates the input file
-Vcodec copy indicates force video codec ('copy' to copy stream). It is estimated that this is a direct copy.
-Acodec
Copy is about audio.
-An: indicates that the abbreviation of disable audio is estimated to be audio No. It indicates removing the original audio from video. Avi.
Method 2 it seems that you can directly specify two input files,
The order of FFMPEG-I/tmp/a.wav-I/tmp/a. AVI/tmp/a. AVI files is very heavy.
Extract sound from a video (separation of sound and video)
If FFMPEG-I is just like the first time. FLV-VN r133 extracts the sound from the FLV file and saves it as MP3
-VN: Indicates ignoring the abbreviation of a video, such as video No.
FFmpeg
-I. If you only see the first video in your life
-An: indicates
Ignore
Sound
Probably the abbreviation of audio No.
Extract images from videos ()
FFmpeg-I test. Avi-y-F image2-SS 8-T 0.001-s 350x240 test.jpg
-SS screenshot in 8th seconds
Compress MP3 files
If you think the MP3 file is a little large and you want to make it smaller, you can use the-AB option to change the audio bit rate.
(Bitrate)
FFmpeg-I input0000- AB 128 output0000
// Set the bit rate to 128
You can run the file command to view the source file information.
Zdio: audio file with ID3 version 2.3.0, contains: MPEG ADTs, layer III, V1, 192 kbps,
44.1 kHz, stereo
192 kbps is the same.
The bit rate in MP3 indicates that when the audio file is compressed to MP3, the digital file determined by the compression software is transmitted per second during playback.
The size of the video to be sent to the player. Unit: kilobytes/second. The English meaning is kbps-= kilobits per second. Currently, the maximum digital rate of MP3 files is 320.
Kbps. The size of such a file is very large, and the music per minute exceeds two MB. If the variable bit rate (VBR) encoding is used to generate an MP3 file
Kbps is equivalent to sound quality, and the file size will be reduced by 25 ~ 50%. Note: The playing time is the same, while the songs are different, and the obtained compressed MP3 files are generally different, because the VBR encoding generates
The size of an MP3 file depends not only on the playback duration, but also on other factors of the source audio file.
Recording (there must be an available microphone, and if ALSA is used, it seems like installing ALSA-OSS and restarting)
FFmpeg-f oss-I/dev/DSP out. AVI (shocould Hava OSS or ALSA-OSS)
FFmpeg-f alsa-AC 2-I HW: 0,
0 out. AVI (shocould)
FFmpeg
-F alsa-AC 2-I pulse (shocould Hava pulseaudio)
OSS is a sound-related thing in Linux. It is the same as ALSA, but OSS is commercial, while/dev/DSP is the mic device used by OSS.
Screen recording
FFmpeg-F x11grab-s XGA-R 10-I: 0.0 + 0 + 0 wheer. Avi
FFmpeg
-F x11grab
-S 320x240
-R 10-I: 0.0 + 100 + 200 wheer. Avi
: 0: 0 indicates the screen (for personal understanding, because the system variable $ display value is: 0.0) and 100, indicating that the screen is 100 pixels away from the left end, and 200 indicates that the screen is 200 from the top end.
-S: Set the window size
-R 10 seems to be the set frequency.
FFmpeg
-F x11grab-s XGA
-Qscale 5
-R 10-I: 0.0 + 0 + 0 wheer. Avi
-Qscale 8 sets the image quality. The smaller the value, the better.
Screen recording and simultaneous recording
FFmpeg-f oss-I/dev/DSP-F x11grab-R 30-s 1024x768-I: 0.0 output.mkv
FFmpeg-AC 2-f oss-I/dev/DSP-F x11grab-R 30-s 1024x768-I: 0.0-acodec pcm_s16le-vcodec libx264-vpre lossless_ultrafast-threads 0 output.mkv
Seeing this, you will find how powerful this command is,
If I open a window on the screen and only want to record the content of the window, how can I determine the coordinates of the window?
You can use another command
Xwininfo
Enter this command and click the target window,
The coordinates of the target window and a series of information such as width and height are displayed.
Absolute upper-left X: 276
Absolute upper-left Y: 57
Relative upper-left X: 2
Relative upper-left Y: 23
Width: 742
Height: 499
Depth: 24
Visual: 0x21
Visual class: truecolor
Border Width: 0
Class: InputOutput
Colormap: 0x20 (installed)
Bit gravity state: northwestgravity
Window gravity state: northwestgravity
Backing store state: notuseful
Save under State: No
Map state: isviewable
Override redirect state: No
Corners: + 276 + 57-262 + 57-262-244 + 276-244
-Geometry 80x24 + 274 + 34
No ()
For example, based on the above information
FFmpeg-f oss-I/dev/DSP-F x11grab-R 30-s 1280x752-I: 0.0 + 0 + 23 output. Avi
Another thing you can change is the video frame rate (FPS). In
Example above we used-R 30 which means capture at 30 FPS. You can
Change this value to whatever frame rate you want.
This-R 30 should be the number of sampling times per second. It is estimated that the screen is captured thirty times per second,
Head-to-end
FFmpeg-SS 00:00:10-T 00:01:22-I October 12-30 days-wish you had a good idea about output.pdf
As long as the screenshot starts from 10th seconds, a total of contents with a length of are intercepted.
Video file connection. For example, two FLV files are connected to one
It seems that you must convert the file to a file in the MPG or DV format before connecting.
- Example of connecting the complex AVI file (in this example, the AVI file must be temporarily converted to a MPEG-1 file (MPEG-1, MPEG-2 ps,
DV format can also be connected ))
FFmpeg-I input1.avi-sameq inputfile_01.mpg-R 20
FFmpeg-I input2.avi-sameq inputfile_02.mpg-R 20
Cat inputfile_01.mpg inputfile_02.mpg> inputfile_all.mpg
FFmpeg-I inputfile_all.mpg-sameq outputfile. Avi combines input1.avi input2.avi into outputfile. Avi-sameq to indicate the same quality (the picture may not be clear)
-R frequency
========================================================== ====================================== Below are the examples provided on the Wiki
Parameters
FFmpeg can use many parameters. The parameter content varies according to the FFMPEG version. Before using FFMPEG, we recommend that you refer to the parameters and the description of the codecs. In addition, parameter details are availableffmpeg
-h
Display; details such as the codec name are availableffmpeg -formats
Display.
The following are commonly used parameters.
[Edit
]
Main Parameters
- -I: Set the input file name.
- -F: Set the output format.
- -Y if the output file already exists, it overwrites the file.
- -If the value of FS exceeds the specified file size, the conversion ends.
- -SS conversion starts from the specified time.
- -Title: Set the title.
- -Timestamp: Specifies the timestamp.
- -Increase or decrease the frame value in vsync to synchronize audio and video.
[Edit
]
Image Parameters
- -B sets the image traffic. The default value is 200 kbit/s. (Note:
)
- -R sets the framerate value. The default value is 25.
- -S: Set the image width and height.
- -Aspect: Set the image proportion.
- -VN does not process images. It is used only for sound processing.
- -Vcodec sets the image and video codecs. If no video is set, the same decoder as the input file is used.
[Edit
]
Sound Parameters
- -AB settingsEach channel
(The latest SVN
The total traffic of all channels. (Unit
Please refer to the following considerations
)
- -Ar sets the sampling rate.
- -The AC sets the number of audio channels.
- -Acodec is used to set the sound codecs. If the sound codecs are not set, they must be the same as those of the image. The audio codecs must be the same as those of the input file.
- -An does not process sound. It is used only for image processing.
- -Vol: Set the volume to 256, which is the standard volume. (If you want to set the volume to two times, enter 512, and so on .)
[Edit
]
Notes
- When traffic is set using the-B and AB parameters, note that the unit is kbits/sec and bits/sec Based on the FFMPEG version used. (FFmpeg is available.
-H display instructions to confirm the unit .)
-
For example, if the unit is bits/sec, you need to enter '-AB 64 K' when you want to specify a traffic of 64 Kbps; if the unit is kbits/sec, you need to enter'
-AB 64 '.
- The name specified by-acodec and-vcodec varies depending on the FFMPEG version used. For example, when an AAC decoder is used
Libfaac. In addition, the codecs can be used only for decoding and only for encoding. Therefore, it must be used.ffmpeg -formats
Indeed
Check whether the input decoder can operate.
[Edit
]
Example
- An example of converting a MPEG-1 film to a MPEG-4 format
ffmpeg -i inputfile.mpg -f mp4 -acodec libfaac -vcodec mpeg4 -b 256k -ab 64k outputfile.mp4
- An example of converting MP3 sounds into MPEG-4 formats
ffmpeg -i inputfile.mp3 -f mp4 -acodec libaac -vn -ab 64k outputfile.mp4
- An example of converting a vob file of a DVD to a MPEG-1 file in videocd format
ffmpeg -i inputfile.vob -f mpeg -acodec mp2 -vcodec mpeg1video -s 352x240 -b 1152k -ab 128k outputfile.mpg
- An example of converting an AVI video into a H.264 format
- FFmpeg-I inputfile. Avi-F MP4-acodec libfaac-vcodec libx264-B 512 K-AB 320 k outputfile. m4v
- An example of converting any video into a recognizable MPEG2 format by Toshiba regza
- FFmpeg-I inputfile-target NTSC-SVCD-AB 128 K-aspect-s 720x480 outputfile. mpg
- Example of connecting the complex AVI file (in this example, the AVI file must be converted to a MPEG-1 file temporarily (MPEG-1, MPEG-2 PS
DV format can also be connected ),
FFmpeg-I input1.avi-sameq inputfile_01.mpg
FFmpeg-I input2.avi-sameq inputfile_02.mpg
Cat inputfile_01.mpg inputfile_02.mpg> inputfile_all.mpg
FFmpeg-I inputfile_all.mpg-sameq outputfile. Avi
========================================================== ============================================
Http://ffmpeg.org/ffmpeg-doc.html
Http://ubuntuforums.org/showthread.php? T = 1392026
Some problems at the same time
In the Alsa system, the sound card (or microphone) is HW:, while in the OSS system, it is/dev/DSP (the term may not be professional). After the sound card is installed in Linux, some device files are generated.
.
The
/Dev/DSP file for the mixer
/Dev/mixer file for the sequencer
/Dev/sequencer,
/Dev/audio file
Audio Device files based on compatibility considerations. As long
Input in/dev/Audio
. And
Read the/dev/DSP file.
Audio files in WAV file format
.