ghret.blogg.se

Ffmpeg filter stretching
Ffmpeg filter stretching










ffmpeg filter stretching
  1. FFMPEG FILTER STRETCHING HOW TO
  2. FFMPEG FILTER STRETCHING MOVIE

First, notice the new scale filter, which changes the scale of a video stream by taking a new width and height separated by a colon. You can solve this by adding a new filter and chaining it to overlay: ffmpeg -i example.mp4 -i LM_logo.png -filter_complex " scale=150:-1, overlay=W-w-10:H-h-10" -codec:a copy example_marked.mp4 The same goes for H-h-10, but in the vertical axis (see Figure 3).įigure 3: You can place your logo by passing the x and y position as parameters to overlay. This means that W-w-10 will place the top overlay layer 10 pixels from the left-most edge of the bottom video layer. In this case, you pass to overlay the horizontal position and then the vertical position, separated by a colon ( :), of the top layer (containing the logo).įFmpeg also provides a convenient way to pass the width and height of each layer to the overlay filter: W is the width of the first input (the bottom layer), and w is the width of the second input (the top layer).

ffmpeg filter stretching

When you pass a parameter to a filter, you do so using the = syntax. Instead of the upper-left corner, it would be better in the lower right, like most channel logos on TV.įortunately, most filters can take parameters, and overlay can too: ffmpeg -i example.mp4 -i LM_logo.png -filter_complex "overlay=W-w-10:H-h-10" -codec:a copy example_marked.mp4 Within -filter_complex, you can string filters together, and they will be applied one after the other to one stream, the other, or both.Īlthough this is a step in the right direction, the result isn't very subtle. Of interest is the -filter_complex construct, which sits between the inputs and the output.

FFMPEG FILTER STRETCHING MOVIE

I'll assume the video you'll be using is a 720p (1280x720) MP4 video called example.mp4.įigure 2: The movie marked with a gigantic watermark. It is a PNG with a transparent background.

FFMPEG FILTER STRETCHING HOW TO

To illustrate how filters work, I'll show you how to use a logo to watermark a video. You can apply filters to whole audio or video streams or only to certain parts, use them to merge several streams into one in interesting ways, and do much more. One of the most powerful FFmpeg features is its effects pipeline, or "filters," as they are known by FFmpeg users. It can be used to change the frame rate, switch in and out audio and subtitle tracks, and even cut up and re-arrange sequences within a movie. However, FFmpeg can do much more than that. The instruction ffmpeg -i input.mp4 output.webmĬonverts an MP4 video file into a WebM video file. In its simplest form, that is what it does. You've probably used FFmpeg before for converting video and audio files between formats. You can do dozens, nay, scores of things with your videos, without ever having to open a graphical video-editing application. The same goes, believe or not, for video editing. That would work if you only had one file, but what would you do if you had a filesystem with hundreds of files scattered all over the place? You would never consider seriously trawling through every directory and subdirectory, opening each file in turn, and clicking through the search-and-replace process, would you? A Bash script using find and sed would be the way to go. Say you have to change every instance of "Bill" in a 100-page text file to "Gary." Sure, you could use the search-and-replace feature in your text editor. How much better? Well, it makes stuff easier to batch process, for starters. Below is the video associated with this article.












Ffmpeg filter stretching