Git Product home page Git Product logo

Comments (8)

MaciekBaron avatar MaciekBaron commented on May 24, 2024

You can achieve this with ffmpeg:

ffmpeg -i video.mkv -i audio.mp3 -map 0 -map 1:a -c:v copy -shortest output.mkv

Where video.mkv is the video file and audio.mp3 is the audio file. You can then prepare a simple bash script to combine random videos with random audio files.

However, if you want to combine different video layers, then obviously you need some sort of alpha channel information, or a chroma key, which requires a lot more preparation on the video file side (you'd have to use the correct chroma key in your video files and then provide it to the script).

You can then use the colorkey filter:

ffmpeg -i video.mkv -i  overlay-video.mkv -filter_complex '[1:v]colorkey=0xYOUR_COLOR:YOUR_SIMILARITY_VALUE:YOUR_BLEND_VALUE[ckout];[0:v][ckout]overlay[out]' -map '[out]' output.mkv

So by combining the above you should be able to achieve what you want.

from hashlips_art_engine.

tunjimesh avatar tunjimesh commented on May 24, 2024

Hello, @MaciekBaron @HashLips

Is there a way to combine multiple animated GIF using the same script? The idea is to merge several animated GIF into one; resulting in an animated GIF with all the different looping sequences.

Any tip on how to get that done, please?

Thanks in advance.

TM.

from hashlips_art_engine.

MaciekBaron avatar MaciekBaron commented on May 24, 2024

If you mean merging GIFs sequentially there's Gifsicle that allows you to do it in the command line by simply doing:

gifsicle 1.gif 2.gif 3.gif > merged.gif

So all you need is a simple script that changes the order or the selection of the GIFs.

from hashlips_art_engine.

tunjimesh avatar tunjimesh commented on May 24, 2024

Thanks, for the feedback @MaciekBaron. Appreciate it.

I meant using GIFs with alpha channels in the art engine and combining them in layers, not sequentially.

So in this case, layer 1 will be 1.gif, layer 2 will be 2.gif and so on.

So we have 1 GIF with all the different animated GIFs on different layers.

Once again, thanks for the feedback.

from hashlips_art_engine.

MaciekBaron avatar MaciekBaron commented on May 24, 2024

I wouldn't necessarily recommend this, as GIFs have limited colour palettes and differ in frame rates.

However, you can also use ffmpeg for that, you could look into the overlay filter to overlay two source gifs on top of each other, similarly to what I did in the first example.

I think it could look something like this, although I haven't tried it:

ffmpeg -t DURATION_HERE -i gifone.gif -i giftwo.gif -filter_complex "[0][1]overlay=0:0" -vf "fps=10,scale=320:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 output.gif

It's best if you read the docs for this to get it right, but basically after -vf you want to use those options and set the appropriate framerate you want, and after -filter_complex you define your overlay.

from hashlips_art_engine.

tunjimesh avatar tunjimesh commented on May 24, 2024

Sounds Great. Thanks

from hashlips_art_engine.

PradhumnaPancholi avatar PradhumnaPancholi commented on May 24, 2024

I don't want videos but animated png or gifs as output. There's an issue about it #461. Do you think this solution can help around it in some way?

from hashlips_art_engine.

MaciekBaron avatar MaciekBaron commented on May 24, 2024

@PradhumnaPancholi: ffmpeg supports both apng and gif output. See my comment above.

from hashlips_art_engine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.