GithubHelp home page GithubHelp logo

long-greg-c / ffmpeg-cli-wrapper Goto Github PK

View Code? Open in Web Editor NEW

This project forked from spikeify/ffmpeg-cli-wrapper

0.0 1.0 0.0 8.13 MB

Java wrapper around the FFmpeg command line tool

HTML 84.33% JavaScript 0.07% CSS 0.90% Java 14.71%

ffmpeg-cli-wrapper's Introduction

FFmpeg Java

ffmpeg-cli-wrapper by Andrew Brampton 2013-2014, upgraded dependencies and added additional features by Dean Gostiša and Roman Orač in 2015.

Added features

We added support for (check examples in unit tests):

  • additional transcoding parameters,
  • creating thumbnails from input video,
  • getting a dominant color of created thumbnail (with Color Thief),
  • trim videos,
  • stitching multiple videos with fade in, fade out effects, text, text box and video overlays.

Requirements

Install static build ffmpeg to use all added features.

##Setup com.spikeify ffmpeg check for latest version

##Usage

###Init FFmpeg FFmpeg ffmpeg = new FFmpeg("/path/to/ffmpeg"); FFprobe ffprobe = new FFprobe("/path/to/ffprobe");

###Create thumbnails FFmpegBuilder builder = new FFmpegBuilder().setInput("inputVideo") .setVideoTumbnails(10) //number of frames to extract .addOutput("thumbnail-%03d.jpg") .done();

FFmpegExecutor executor = new FFmpegExecutor(ffmpeg, ffprobe);
FFmpegJob job = executor.createJob(builder);
job.run();

###Get dominant color File img = new File("image.png"); BufferedImage image = ImageIO.read(img); String dominantHex = ColorThief.getDominantHex(image, 1, true);

Stitching multiple videos

List<VideoObject> videoObjectList = new ArrayList<>();

//settings for video 1
Caption caption1 = new Caption.CaptionBuilder("someFont.ttf", "Text").setColor("white").setSize(40).setX(50).setY(50).createCaption();
VideoObject videoObject1 = new VideoObject.VideoObjectBuilder("video1.mp4").setFadeIn(new FadeIn.FadeInBuilder(0, 1).createFadeIn()).setFadeOut(new FadeOut.FadeOutBuilder(1, 1).createFadeOut()).setCaption(caption1).createVideoObject();
videoObjectList.add(videoObject1);

//settings for video 2
VideoObject videoObject2 = new VideoObject.VideoObjectBuilder("video2.mp4").setFadeIn(new FadeIn.FadeInBuilder(0, 1).createFadeIn()).setFadeOut(new FadeOut.FadeOutBuilder(1, 1).createFadeOut()).createVideoObject();
videoObjectList.add(videoObject2);

ffprobe.setDuration(videoObjectList); //set duration to each video

FFmpegBuilder builder = new FFmpegBuilder().overrideOutputFiles(true).addOutput("output.mp4").stitchVideos(videoObjectList).done();
FFmpegExecutor executor = new FFmpegExecutor(this.ffmpeg, this.ffprobe);
FFmpegJob job = executor.createJob(builder);
job.run();

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.