Melt framework - Add a background persisten between videos - mlt

I need to merge videos in a ratio of 16:9 with a png image to use instead of the black borders.
I'm running this command:
melt vid_1.mp4 vid_2.mp4 -mix 30 -mixer luma -consumer avformat:finish.mp4
I see the affine plugin but can make it work

melt -profile atsc_1080p_25 bg.png -filter affine transition.rect="-36.8976 -58 1953.17 1300 1" -track v1.mp4 v2.mp4 -transition affine
This command will get you started. You will need to customize transition.rect to meet the needs of how you want to crop/fit your background image. If your background image aspect ratio matches your profile aspect ratio, then you can exclude transition.rect.
You should also change the profile to be whatever profile you want.
See the melt documentation for other helpful parameters (like in/out points)
See Affine Filter and Affine Transition for details about the parameters for the image transformation.

Related

generate video containing scrolling image using MLT

I want to generate a video [let's say 1920x1020] from a 1920x10000 still image.
The image has to scroll, from top to bottom as if someone was actually scrolling a page.
Found answers how to make it with ffmpeg, but i need to scroll it in mlt as i have a lot of other tasks there.
melt -profile atsc_1080p_2997 1.jpg length=300 -filter affine transition.geometry="0=0,0:100%x100%;300=0,-500:100%x100%"
This scrolls, but image is centered and i need to calculate pixels...
Is there any way to make it like with ffmpeg? (generate video containing scrolling image) (just pass needed length)
MLT does not have a similar scroll filter. The method you used is the recommended/preferred way to scroll in MLT.
...i need to calculate pixels
You can use percent instead of pixels if that helps.
You can use the filter and filter service's name is affine.

how to scale an image with gimp and save the actual scale and all the white space

there are a ton of scaling instructions for GIMP but all of them tell you to scale and save easy peasy. I feel like I'm taking crazy pills.
This is what my save or export generates:
How can I simply export a selection? Shouldn't the GIMP instructions include this detail? Sorry for ranting.
In Gimp (and some other popular image editors) the image you work on is actually made of separate images (a.ka.a layers) held together on a "canvas". The "canvas" gives the size of the final image.
There are three different ways to scale things and you have to use the right one:
The Scale tool : scales the active layer by dragging corners. Doesn't change the size of the canvas. This is probably what you used.
Layer>Scale layer: scales the active layer by providing explicit dimensions. Doesn't change the size of the canvas.
Image>Scale image: scales the whole image contents and the canvas. This is probably what you should have used.
What happened to give you the image above is that you resized the layer using the Scale tool, so you got a tiny image in the corner of the canvas, which didn't change size. The uncovered part of the canvas was displayed as a checkerboard pattern. If you exported to a format that supports transparency such as PNG or GIF the image would have been transparent, but since you exported to JPG which doesn't support transparent images Gimp replaced the transparent part by the default background color.
Everything is well explained on their website. https://www.gimp.org/tutorials/GIMP_Quickies/

Premiere Pro black bars on export

I keep getting black bars on the sides and occasionally on the top and bottom as well. I've been troubleshooting the issue for at least 4 days to no avail. I tried, cropping on export pane, different settings/aspect ratios, new sequences with different settings and Scale to Fit/Fill.
The only settings that got rid of the black bars was changing the pixel ratio to 1.0 but that made my video very blurry.
My sequence settings are same FPS 1920/1080 with matching pixel ratio of 1.0 (to the imported clips). And original clips are all 1920/1080 I don't know what their pixel ratio is but when I import them to Premiere they are all 1.0
These are the export settings
https://i.gyazo.com/af4d2459228bfaad5d86864cb1263aa3.png
From the looks of your title I'm going to assume you're uploading to YouTube? If that's so, you might try using one of the 'Presets' other than custom. If you scroll all the way down, in the preset dropdown, I remember there being options to optimise for YouTube 240/480/720/1080 and so on. This might change what you need to change.
Alternatively, I've made the mistake before of aligning my clips to the 'focus lines' rather than to the edge of the screen. Your solution may be as simple as transforming your clips bigger.
I know this is pretty late to the party. I hope you found what you were looking for.

MLT, how to rotate a video 90 degrees and make the resulting height be the same as the original width?

I shot a video with my phone in portrait orientation (vertically), which now I need to edit to make it fit properly in a landscape (horizontal) layout. When playing it on my computer and in any of the video editors available on linux, it looks like this.
So what I want to do now, first and foremost, is rotate it 90 degrees and make it look like this.
Basically, I want the result to be as tall as the width of the original video. Optionally, I want it to be as wide as the height of the original video.
However, what I get is a video which has the same dimensions as the original, without rotation, which therefore gets letter-boxed (black bands on its sides) and has the upper and lower parts cropped, like shown in this picture.
From what I understood, I should play with profiles, however I don't seem to get it right no matter what I do.
I'm fine with letter-box, but I don't want the video cropped, and I don't want to zoom out so that the image fits by losing vertical resolution.
Any help would be appreciated.
If you don't mind using ffmpeg, you can do:
ffplay input -vf 'rotate=angle=PI/2:out_w=ih:out_h=iw'
Replace "ffplay" with "ffmpeg" to encode to an output file.
Replace "PI/2" with "-PI/2" to rotate counter clockwise.
Shotcut, a MLT-based editor has a Rotate filter with pan and zoom controls that works good for this purpose. You do not need to make a custom MLT profile (Settings > Video Mode > Custom... in Shotcut) unless you do want a portrait/tall output video resolution (which you said you don't).
I know this is an old question, but thought I'd add to it by saying.. if you ARE going to use ffmpeg then perhaps a combination of the following would bring about the (..I'm presuming) desired result.
ffmpeg -i video.mp4 -vf transpose=1 rotated.mp4
that rotates the video by 90 degrees clockwise, then,
ffmpeg -i rotated.mp4 -c:v h264 -s 1024x768 -aspect 16:9 output.mp4
this then stretches it out to the original dimensions, of course you might have to adapt the above for the file type and resolution/aspect ratio you have used.
The result might look a bit "squashed" though.

How to overlay text or markers on an bmp image

I'm working with an image processing project where I'm trying to locate features on a .bmp image. I'm writing the whole source code in C.
The algorithm I'm developing is going to search for some features, if a desired feature was found by the algorithm then it is going to create a point (x co-ord, y co-ord), now I want to overlay this point on the image with a green or red DOT.
As of now its only a point, later on I wish to draw a box around a group of features- for example a face.
I don't know how to do this, I'm developing this in Linux (Ubuntu 9.04) environment, can anyone suggest what I should do?
Vikram
Take a look at ImageMagick as well. I've used it in the past with Perl, but it has a C interface as well.
ImageMagick® is a software suite to create, edit, and compose bitmap images. It can read, convert and write images in a variety of formats (over 100) including DPX, EXR, GIF, JPEG, JPEG-2000, PDF, PhotoCD, PNG, Postscript, SVG, and TIFF. Use ImageMagick to translate, flip, mirror, rotate, scale, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.
I would recommend using Cairo for your drawing. What you can do is load the image into an Image Surface, do your processing on the image surface using direct pixel access, and then use a Cairo context to draw what you need. The library also supports text using libpango, and Ubuntu loves the use of Cairo since GTK uses it. There are many tutorials for Cairo as well if you search around. The main site has some already.

Resources