ffmpeg -i file.avi file.mp3
*** THIS PROGRAM IS DEPRECATED *** This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
ffmpeg
project had split up some time ago and some developers started creating the libav library, which is currently included in ubuntu by default. Of course, the compatibility of advanced features was sacrificed first. At the same time, and with the renaming of the project, the ffmpeg executable file was renamed to avconv, which was the above warning. avconv [ ] -i [ ]
-y
- overwrite the file without question-threads 8
- how many threads to perform the operation (in this case, 8, but not all codecs can parallelize)-s hd720
- video size (in this case, the standard hd720p-1280 * 720)-q 1
- sets the quality of coding (on different codecs acts differently). Do not forget this option, because by default, only the name of the quality.-q:a 1
- set the audio quality,-q:v 1
- respectively - video.-q:v:0 1
- the first video stream (counting from zero),-q:0 1
- the first stream in general, depends on the layout of the file - you must first look at the information that avconv gives relative to the contents of the input files. avconv -i in.mp4 -ss 00:00:30 -t 00:10:00 -q 1 -s hd720 -threads 8 -r 25 -y out.mp4
-ss 00:00:30
from what second -ss 00:00:30
and what's the length of time -t 00:10:00
to take the video. avconv -i in.mp4 -ss 00:00:22 -t 00:00:30 -vol 512 -vn -f u16le -ac 2 -ar 44100 -threads 8 -y out.raw
-vn
- exclude video stream on output-ss 00:00:22
- the beginning of the cut fragment-t 00:00:30
- the length of the cut fragment-vol 512
- volume, 256 is the normal volume, all that rises higher and below, respectively-ar 44100
- audio sample rate (audio stream sample rate) 44100 complies with cd quality and is standard-ac 2
- sets the number of audio channels (2 - means stereo)-f u16le
- sets the format of the output stream, u16le - saves raw data in a file without headers.cat
cat in1.raw in2.raw > out.raw
cat in1.raw in1.raw in1.raw > out.raw
avconv -q 1 -f u16le -ac 2 -ar 44100 -threads 8 -i in.raw -y out.wav
avconv -i in.avi -q 1 -s hd720 -threads 8 -y "out/%08d.jpg"
avconv -i "in/%08d.jpg" -q 1 -s hd720 -threads 8 -y out_v.avi
-loop
basically serves for this -loop
avconv -loop 1 -i in.jpg -t 00:00:05 -q 1 -s hd720 -threads 8 -y out.mp4
avconv -i file.mp4 -an -ss 00:00:30 -r 1 -vframes 1 -y -f mjpeg -q 1 file.jpg
-f mjpeg
- specify the codec for this operationsox
. Surprisingly, it was possible to merge two audio tracks after a series of unstable results with avconv without any surprises. For example, avconv
can merge two tracks that are identical in time, and at the exit one of them will complete earlier than the second. Accordingly, the sound can “move out” strongly when applied, especially on long rollers. sox -m in1.wav in2.wav out.wav
-m
- option specifying the mixing mode of input files. Without the options, sox simply scans the files, adding the second after the first. avconv -i in.mp4 -i in.mp3 -c:v copy -q 1 out.mp4
-c
- select codec, respectively-c:a
- audio codec-c:v
- video codec-c:v copy
- Do not recode using original data avconv -i "concat:in1.avi|in2.avi" -q 1 -b:a 128k -preset libvpx-720p -threads 8 -y {f_out}
-b
- select bitrate-b:a 128k
- we set a bitrate of 128 kbps for mp3 tracks-preset
- immediately sets the settings from the predefined-preset libvpx-720p
- installs the vpx video codec and frame size according to the hd720p standardconcat:
is a special “format” of input files with which lists are set. In practice, it works in the same way as cat in1.avi in2.avi
connected files. Correspondingly, like cat, it will put the files together, but the codec that parses them may not understand (this is what happens for most formats) and you need to choose a format that supports such a connection. Of these formats, it is worth mentioning mpeg, avi and raw video data, which could be devoted to a separate article and will not be dealt with here. avconv -i in1.mp4 -i in2.mp4 -map 0:a -map 1:v -y -q 1 out.mp4
-map
- indicates the source track to be included in the output file (if no map is specified, avconv will simply convert the first file to the output file format).-map 0:a
- audio track from the first file (counting from zero).-map 1:v
- video track from the second.-filter_complex
avconv -filter_complex 'color=white' -t 5 -q 1 out.mkv
color=white
- generates an image with pure white. This can be used, for example, to create a background for subtitles or as a pause between video clips. avconv -i in.avi -vf "hflip" out.avi
hflip
- mirror image horizontally avconv -i in.avi -vf "smooth=type=blur" -q 1 out.avi
smooth
- performs image blurring using one of several algorithms: “blur”, “blur_no_scale”, “median”, “gaussian”, “bilateral”. avconv -i in.avi -vf "scale=w=200:h=100" -q 1 out.avi
scale
- performs image scaling. On his example, we can consider how parameters are passed to filters. “Scale = ...” - if after the filter name, as in this example, an equal sign is indicated, then a list of parameters of the form “name = value” should follow. The parameters are also indicated with an equal sign, therefore, initially it is somewhat confusing, but you can get used to it. The parameters themselves in the list are separated by colons.w=200:h=100
- rigidly sets the height and width of the output image. Of course, with the hard way of setting the size, the image is obtained in a controlled size, but the proportions can be distorted.scale=w=iw/2:h=ih/2
- the size of the output image can be specified depending on the input. In this case, we specify to halve. By fitting the coefficients accordingly, you can adjust the proportions. This, by the way, allows you to achieve interesting effects, for example, a reduced image can be inserted as additional information into a corner or you can combine several video images as is done on video surveillance systems.ow=200:oh=200
- cuts the image to the specified size avconv -i in1.mp4 -i in2.mp4 -filter_complex amix=inputs=2 -q 1 -b:a 128k -preset libvpx-720p -threads 2 -y out.mp4
amix=inputs=2
Mix audio streams. Here we indicate how many streams at the input and discard the listing itself.duration
parameter, which allows you to adjust the length of the output stream and can take one of three values:longest
- by the duration of the largest mixed audio stream,shortest
- respectively, the shortest,first
- by the length of the first stream listed. avconv -i video.mkv -i logo.png -filter_complex overlay=x=10:y=main_h-overlay_h-10 -q 1 out.mkv
overlay
- allows you to overlay one stream over another. You can also use a picture as a stream. In the example above, we set the logo to be indented to the left and bottom by ten pixels. To calculate the indentation below, we subtract the height of the superposed stream from the height of the main stream and additionally subtract the indent itself. avconv -i in1.avi -i in2.avi -filter_complex "[1:v]scale=w=iw/3:h=ih/3[v_small];[0:v][v_small]overlay=x=main_w-overlay_w-main_w/20:y=main_h-overlay_h-main_w/20" -q 1 out.avi
ffmpeg -r 1 -loop 1 -i aa.jpg -i aa.mp4 -acodec copy -vcodec mjpeg -t 326 -q 1 -y a.mp4
git clone git://git.libav.org/libav.git; ./configure
make -j 8
./configure --help
--enabled
for example ./configure --enable-vdpau
-filter_complex
Source: https://habr.com/ru/post/192724/
All Articles