use of org.fagu.fmv.ffmpeg.metadatas.MovieMetadatas in project fmv by f-agu.
the class RipperTestCase method ffMPEGExecutorBuilder.
/**
* @return
* @throws IOException
*/
private FFMPEGExecutorBuilder ffMPEGExecutorBuilder() throws IOException {
FFMPEGExecutorBuilder builder = mock(FFMPEGExecutorBuilder.class);
doReturn(builder).when(builder).hideBanner();
doReturn(builder).when(builder).noStats();
InputProcessor inputProcessor = mock(InputProcessor.class);
doReturn(inputProcessor).when(builder).addMediaInputFile(any(File.class));
MovieMetadatas movieMetadatas = mock(MovieMetadatas.class);
doReturn(movieMetadatas).when(inputProcessor).getMovieMetadatas();
OutputProcessor outputProcessor = mock(OutputProcessor.class);
doReturn(outputProcessor).when(builder).addMediaOutputFile(any(File.class));
doReturn(outputProcessor).when(outputProcessor).codec(any(Coder.class));
return builder;
}
use of org.fagu.fmv.ffmpeg.metadatas.MovieMetadatas in project fmv by f-agu.
the class FFHelperTestCase method testOo_Rotate270.
/**
* @throws Exception
*/
@Test
public void testOo_Rotate270() throws Exception {
final MovieMetadatas movieMetadatas = mock(MovieMetadatas.class);
VideoStream videoStream = mock(VideoStream.class);
doReturn(videoStream).when(movieMetadatas).getVideoStream();
doReturn(Rotation.R_270).when(videoStream).rotate();
movieMetadatasSupplier = fileName -> movieMetadatas;
File inFile = new File("in.mp4");
File outFile = new File("out.mp4");
FFHelper.oo(inFile, outFile);
if (AutoRotate.isAutoRotateObsolete()) {
assertCmd("-hide_banner -i in.mp4 -filter:a \"aresample=sample_rate=44100\" -filter:v \"scale=w='if(gt(dar,930/500),930,trunc(oh*dar/2)*2)':h='if(gt(dar,930/500),trunc(ow/dar/2)*2,500)',format=yuv420p\" -movflags +faststart -f mp4 -codec:v libx264 -preset medium -profile:v baseline -level 3.0 -crf 22 -pix_fmt yuv420p -codec:a aac -ac 2 -b:a 128000 -y -metadata:s:v:0 \"rotate=0\" out.mp4");
} else {
assertCmd("-hide_banner -i in.mp4 -filter:a \"aresample=sample_rate=44100\" -filter:v \"transpose=dir=cclock,scale=w='if(gt(dar,930/500),930,trunc(oh*dar/2)*2)':h='if(gt(dar,930/500),trunc(ow/dar/2)*2,500)',format=yuv420p\" -movflags +faststart -f mp4 -codec:v libx264 -preset medium -profile:v baseline -level 3.0 -crf 22 -pix_fmt yuv420p -codec:a aac -ac 2 -b:a 128000 -y -metadata:s:v:0 \"rotate=0\" out.mp4");
}
}
use of org.fagu.fmv.ffmpeg.metadatas.MovieMetadatas in project fmv by f-agu.
the class TSTest method test.
@Test
@Ignore
public void test() throws IOException {
MovieMetadatas metadatas = MovieMetadatas.with(new File("d:\\tmp\\dvdout.ts")).extract();
List<Stream> streams = metadatas.getStreams();
System.out.println("count: " + streams.size());
for (Stream stream : streams) {
System.out.println(stream);
if (stream.is(Type.VIDEO)) {
VideoStream videoStream = (VideoStream) stream;
System.out.println(" " + videoStream);
} else if (stream.is(Type.AUDIO)) {
AudioStream audioStream = (AudioStream) stream;
System.out.println(" " + audioStream);
}
}
}
use of org.fagu.fmv.ffmpeg.metadatas.MovieMetadatas in project fmv by f-agu.
the class FFExceptionKnowAnalyzeTestCase method extractMetadatas.
// ****************************************************************
/**
* @param resource
* @param expectedMessage
* @throws IOException
*/
private void extractMetadatas(String resource, String expectedMessage) throws IOException {
File folder = new File(System.getProperty("java.io.tmpdir"), "ff-extractmetadatas-test");
try {
FileUtils.deleteDirectory(folder);
folder.mkdirs();
File file = resource != null ? ResourceUtils.extract(resource, folder) : folder;
try {
MovieMetadatas extract = MovieMetadatas.with(file).extract();
fail(expectedMessage + ": " + extract.toJSON());
} catch (FMVExecuteException e) {
if (e.isKnown()) {
assertEquals(expectedMessage, e.getExceptionKnown().toString());
} else {
throw e;
}
}
} finally {
FileUtils.deleteDirectory(folder);
}
}
use of org.fagu.fmv.ffmpeg.metadatas.MovieMetadatas in project fmv by f-agu.
the class FFHelperTestCase method testOo_Rotate180.
/**
* @throws Exception
*/
@Test
public void testOo_Rotate180() throws Exception {
final MovieMetadatas movieMetadatas = mock(MovieMetadatas.class);
VideoStream videoStream = mock(VideoStream.class);
doReturn(videoStream).when(movieMetadatas).getVideoStream();
doReturn(Rotation.R_180).when(videoStream).rotate();
movieMetadatasSupplier = fileName -> movieMetadatas;
File inFile = new File("in.mp4");
File outFile = new File("out.mp4");
FFHelper.oo(inFile, outFile);
if (AutoRotate.isAutoRotateObsolete()) {
assertCmd("-hide_banner -i in.mp4 -filter:a \"aresample=sample_rate=44100\" -filter:v \"scale=w='if(gt(dar,930/500),930,trunc(oh*dar/2)*2)':h='if(gt(dar,930/500),trunc(ow/dar/2)*2,500)',format=yuv420p\" -movflags +faststart -f mp4 -codec:v libx264 -preset medium -profile:v baseline -level 3.0 -crf 22 -pix_fmt yuv420p -codec:a aac -ac 2 -b:a 128000 -y -metadata:s:v:0 \"rotate=0\" out.mp4");
} else {
assertCmd("-hide_banner -i in.mp4 -filter:a \"aresample=sample_rate=44100\" -filter:v \"transpose=dir=clock,transpose=dir=clock,scale=w='if(gt(dar,930/500),930,trunc(oh*dar/2)*2)':h='if(gt(dar,930/500),trunc(ow/dar/2)*2,500)',format=yuv420p\" -movflags +faststart -f mp4 -codec:v libx264 -preset medium -profile:v baseline -level 3.0 -crf 22 -pix_fmt yuv420p -codec:a aac -ac 2 -b:a 128000 -y -metadata:s:v:0 \"rotate=0\" out.mp4");
}
}
Aggregations