Skip to content

Java wrapper around the FFmpeg command line tool

Notifications You must be signed in to change notification settings

DavidPrice/ffmpeg-cli-wrapper

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FFmpeg Java

by Andrew Brampton 2013-2014

A fluent interface to running FFmpeg from Java.

GitHub | API docs

Usage

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

    FFmpegBuilder builder = new FFmpegBuilder()
    	.setInput(in)
    	.overrideOutputFiles(true)
    	.addOutput("output.mp4")
	        .setFormat("mp4")
	        .setTargetSize(250000)
	        
	        .disableSubtitle()
	        
	        .setAudioChannels(1)
	        .setAudioCodec("libfdk_aac")
	        .setAudioRate(48000)
	        .setAudioBitrate(32768)
	        
	        .setVideoCodec("libx264")
	        .setVideoFramerate(Fraction.getFraction(24, 1))
	        .setVideoResolution(640, 480)
	        
	        .setStrict(FFmpegBuilder.Strict.EXPERIMENTAL)
	        .done();

	FFmpegExecutor executor = new FFmpegExecutor(ffmpeg, ffprobe);
	executor.createTwoPassJob(builder).run();

Install FFmpeg on Ubuntu

FFmpeg is in Ubuntu's default repositories, however, it is a bit dated. Instead use a PPA of it:

$ sudo add-apt-repository ppa:jon-severinsson/ffmpeg
$ sudo apt-get update
$ sudo apt-get install ffmpeg
$ ffmpeg -version
    ffmpeg version 0.10.11-7:0.10.11-1~saucy1
    built on Feb  6 2014 16:55:15 with gcc 4.8.1

About

Java wrapper around the FFmpeg command line tool

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HTML 90.6%
  • Java 8.3%
  • Other 1.1%