Editor – Slidetalk https://slidetalk.net slidetalk Thu, 22 Jul 2021 13:23:10 +0000 en-US hourly 1 https://wordpress.org/?v=6.4.3 https://slidetalk.net/wp-content/uploads/2021/07/cropped-favicon-32x32.png Editor – Slidetalk https://slidetalk.net 32 32 The picture is superimposed on the video https://slidetalk.net/the-picture-is-superimposed-on-the-video/ https://slidetalk.net/the-picture-is-superimposed-on-the-video/#respond Thu, 22 Jul 2021 12:19:45 +0000 https://slidetalk.net/?p=90 overlay – allows you to overlay one stream on top of another. You can also use a picture as a …

The post The picture is superimposed on the video appeared first on Slidetalk.

]]>
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 on top of 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 bottom margin, we subtract the height of the superimposed stream from the height of the main stream and additionally subtract the offset itself.

With this example, we can demonstrate the use of several filters together. To separate the filter list, use “;”.

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

Take the second image, reduce it three times and place it in the lower right corner, making an indent from the edge equal horizontally and vertically to one twentieth of the width of this image.

P.S. I would like to say at the end that the final version was very different from how everything was seen at the beginning. Last but not least, this was influenced by many bugs, even in the most recent version. A version from the 0.8 branch is offered as a stable version, but, unfortunately, many interesting features are missing there. On the other hand, avconv from the 0.9 branch is very unstable and managed, in seemingly tested places, on some input files to eat up all the RAM in a few seconds and hang the server. Of course, memory usage can be limited to the current user, but this still does not solve the problem, since avconv crashes anyway. Sometimes individual clips from the video sequence disappeared, in some cases the time on the audio track and video sequence unexpectedly diverged – you had to look for other tools and other ways to perform the same tasks.

UPD: Add one picture to sound:

ffmpeg -r 1 -loop 1 -i aa.jpg -i aa.mp4 -acodec copy -vcodec mjpeg -t 326 -q 1 -y a.mp4

Who does not have avconv 0.9 on the system
1) clone git and configure

git clone git://git.libav.org/libav.git; ./configure

2) It is better to specify compilation in several threads to make it faster. Install it is better not to do so that later you do not have to restore anything in the system.

make -j 8

If there are no codecs:

./configure --help

And there just see what --enabled e.g. ./configure --enable-vdpau

The post The picture is superimposed on the video appeared first on Slidetalk.

]]>
https://slidetalk.net/the-picture-is-superimposed-on-the-video/feed/ 0
Arranging tracks from different files https://slidetalk.net/arranging-tracks-from-different-files/ https://slidetalk.net/arranging-tracks-from-different-files/#respond Thu, 22 Jul 2021 12:04:16 +0000 https://slidetalk.net/?p=85 -map – specifies the source track to be included in the output file (if no maps are specified, avconv will …

The post Arranging tracks from different files appeared first on Slidetalk.

]]>
avconv -i in1.mp4 -i in2.mp4 -map 0:a -map 1:v -y -q 1 out.mp4

-map – specifies the source track to be included in the output file (if no maps are 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.

New in version 0.9 -filter_complex

This option will determine the order of filters for complex (complex) operations.
Works fine with files when they have the same frame rate.

The filter is described by a line that looks something like this:
[in1] [in2] transform [out]

At the input, this is, in fact, the same thing that we write in -map, for example [0: a] [1: a] – the audio channels of the first and second clips.
At the output, we give a name to the newly created channel after the performed transformations, for example, mix_a. It can also be used in map in the future or as the name of the stream at the input of the next transformation.

By default, the transformation includes all incoming streams (or the first stream if the filter accepts only one), so they can be omitted. The resulting channel becomes the default channel for the resulting file, so in most cases, it can also be discarded.

Transformation operations can be conditionally divided into “generators” – they do not accept anything at the input, but only create a stream with specified properties, “filters” – take one stream as input and transform it and “mixers” – take several streams as input and connect them.

There may also be several streams at the output, for example, if the filter splits stereo into two mono tracks, they also need to be described with the [out1] [out2] list, etc.

The post Arranging tracks from different files appeared first on Slidetalk.

]]>
https://slidetalk.net/arranging-tracks-from-different-files/feed/ 0
An alternative way to mix audio tracks https://slidetalk.net/an-alternative-way-to-mix-audio-tracks/ https://slidetalk.net/an-alternative-way-to-mix-audio-tracks/#respond Tue, 22 Jun 2021 11:53:04 +0000 https://slidetalk.net/?p=82 There is a good, time-tested tool for processing audio, sox. Surprisingly, it managed to merge two audio tracks without any …

The post An alternative way to mix audio tracks appeared first on Slidetalk.

]]>
There is a good, time-tested tool for processing audio, sox. Surprisingly, it managed to merge two audio tracks without any surprises after a series of unstable results with avconv. For example, avconv can merge two tracks of the same time, and one of them exits before the other. Accordingly, when overdubbing, the sound can “move out” a lot, especially on long rollers.

sox -m in1.wav in2.wav out.wav

-m – an option specifying the mixing mode for input files. Without options, sox will simply concatenate the files, adding the second one after the first.

The post An alternative way to mix audio tracks appeared first on Slidetalk.

]]>
https://slidetalk.net/an-alternative-way-to-mix-audio-tracks/feed/ 0
Duplicating or cloning files https://slidetalk.net/duplicating-or-cloning-files/ https://slidetalk.net/duplicating-or-cloning-files/#respond Sat, 22 May 2021 11:49:04 +0000 https://slidetalk.net/?p=79 If you need to connect audio tracks, you can use a simple cat Likewise, you can connect as many files …

The post Duplicating or cloning files appeared first on Slidetalk.

]]>
If you need to connect audio tracks, you can use a simple cat

cat in1.raw in2.raw > out.raw

Likewise, you can connect as many files as you like, and you can in portions in several passes, creating intermediate ones.

cat in1.raw in1.raw in1.raw > out.raw

Thus, we can replicate a fragment (for example, silence or a monotone signal) for the time we need, or loop a small audio fragment.

The post Duplicating or cloning files appeared first on Slidetalk.

]]>
https://slidetalk.net/duplicating-or-cloning-files/feed/ 0
Creating a video editor https://slidetalk.net/creating-a-video-editor/ https://slidetalk.net/creating-a-video-editor/#respond Thu, 22 Apr 2021 11:14:32 +0000 https://slidetalk.net/?p=65 Recently I needed to write a small video editor with a web interface.Before that, I had occasionally used commands like …

The post Creating a video editor appeared first on Slidetalk.

]]>
Recently I needed to write a small video editor with a web interface.
Before that, I had occasionally used commands like

ffmpeg -i file.avi file.mp3

Mainly for converting from one format to another. Everything was always more or less smooth and it was difficult to imagine how many nuances there really are for working with video and audio.
But let’s start from the beginning. For some time now, my ubuntu began to issue:

*** THIS PROGRAM IS DEPRECATED *** This program is only provided <strong>for</strong> compatibility and will be removed <strong>in</strong> a future release. Please use avconv instead.

In general, while it was used in small ways, it was not very important, but it was somehow “not it” to put an already obsolete feature into the project. I had to google what’s what and it turned out that the ffmpeg project had split some time ago and some of the developers started creating the libav library, which is currently included in ubuntu by default. Of course, the interoperability of the advanced features was sacrificed first. At the same time, with the renaming of the project, the ffmpeg executable file was renamed to avconv, which was the above warning.

avconv [input file options] -i input file [conversion options] output file

there can be several input files, respectively, and -i options are written before each of them

But in reality, everything turned out to be a little more complicated.
Further, a set of useful recipes and along the description, small comments about the options.

Basic options commonly found in commands

-y – overwrite file without question
-threads 8 – how many threads to perform the operation (in this case 8, but not all codecs are able to parallelize)
-s hd720 – video size (in this case, according to the hd720p-1280 * 720 standard)
-q 1 – sets the encoding quality (affects different codecs differently). Do not forget this option, because by default only the name is from the quality.
For options setting stream properties, it is possible to specify this stream directly in the option itself (without this, the option applies to all streams). This is done as follows:
-q: a 1 – sets the audio quality,
-q: v 1 – respectively – video.
The number will mean the stream numbered
-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 need to first look at the information that avconv gives about the contents of the input files.

Cutting a large file into pieces

avconv -i in.mp4 -ss 00:00:30 -t 00:10:00 -q 1 -s hd720 -threads 8 -r 25 -y out.mp4

We say from what second -ss 00:00:30 and what length of time -t 00:10:00 to take the video.

Separation of audio from video at the desired volume and length

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 – excludes the video stream from the output
-ss 00:00:22 – the beginning of the cut fragment
-t 00:00:30 – length of the cut fragment
-vol 512 – the volume, 256 is the normal volume, everything higher increases that lower, respectively
-ar 44100 – audio sample rate (audio stream sampling frequency) 44100 corresponds to cd quality and is a 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.


You can export data in another format, but raw is useful for us if we want to concatenate a lot of audio fragments, which will be easy to do just by connecting the files one by one.

The post Creating a video editor appeared first on Slidetalk.

]]>
https://slidetalk.net/creating-a-video-editor/feed/ 0