use of org.fagu.fmv.ffmpeg.operation.OutputParameters in project fmv by f-agu.
the class FFMPEGExecutorBuilder method addMediaOutput.
/**
* @param output
* @return
*/
public OutputProcessor addMediaOutput(MediaOutput output) {
if (output instanceof Muxer) {
return mux((Muxer<?>) output);
}
Processor<?> processor = defaultFFMPEGOperation.getProcessor(output);
if (processor != null && !(processor instanceof OutputProcessor)) {
throw new IllegalArgumentException("Already defined: " + output);
}
OutputParameters outputParameters = defaultFFMPEGOperation.getOutputParameters();
return outputParameters.addOutput(output);
}
use of org.fagu.fmv.ffmpeg.operation.OutputParameters in project fmv by f-agu.
the class MP4TagCodecNotFoundFFExecFallback method prepare.
/**
* @see org.fagu.fmv.ffmpeg.executor.FFExecFallback#prepare(java.io.IOException)
*/
@Override
public boolean prepare(FFEnv ffEnv, IOException ioException) throws IOException {
FFExecutor<Object> executor = ffEnv.getExecutor();
Pattern pattern = Pattern.compile(".* stream #([0-9]+).*");
boolean change = false;
for (String line : executor.getOutputReadLine().getLines()) {
if (line.startsWith("[mp4 @") && line.contains("Could not find tag for codec")) {
Matcher matcher = pattern.matcher(line);
if (matcher.matches()) {
int stream = Integer.parseInt(matcher.group(1));
OutputParameters outputParameters = executor.getOperation().getOutputParameters();
for (IOEntity ioEntity : outputParameters.getIOEntities()) {
List<Parameter> parameters = outputParameters.getParameters(ioEntity, Way.BEFORE);
for (Parameter parameter : parameters) {
if ("-map".equals(parameter.getName()) && parameter.hasValue() && parameter.getValue().endsWith(":" + stream)) {
change = outputParameters.removeParameter(parameter);
}
}
}
}
}
}
return change;
}
use of org.fagu.fmv.ffmpeg.operation.OutputParameters in project fmv by f-agu.
the class MP4TagCodecNotFoundFFExecFallbackTestCase method test1.
/**
* @throws Exception
*/
@Test
@Ignore
public void test1() throws Exception {
List<String> l = new ArrayList<>();
l.add("[avi @ 0000000001c52cc0] scale/rate is 0/0 which is invalid. (This file has been generated by broken software.)");
l.add("[avi @ 0000000001c52cc0] non-interleaved AVI");
l.add("Input #0, avi, from 'D:\\Pe\\TO\\EN\\5\\La.avi':");
l.add(" Duration: 01:54:32.96, start: 0.000000, bitrate: 855 kb/s");
l.add(" Stream #0:0: Video: mpeg4 (DX50 / 0x30355844), yuv420p, 512x256 [SAR 1:1 DAR 2:1], 749 kb/s, 25 fps, 25 tbr, 25 tbn, 30k tbc");
l.add(" Metadata:");
l.add(" title : Main");
l.add(" Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p, 96 kb/s");
l.add(" Metadata:");
l.add(" title : Audio - fr;02");
l.add(" Stream #0:2: Subtitle: xsub (DXSB / 0x42535844), 640x480, 867 kb/s");
l.add(" Metadata:");
l.add(" title : Subtitle - fr");
l.add("[libx264 @ 0000000001d652c0] using SAR=1/1");
l.add("[libx264 @ 0000000001d652c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX");
l.add("[libx264 @ 0000000001d652c0] profile High, level 2.1");
l.add("[libx264 @ 0000000001d652c0] 264 - core 148 r2705 3f5ed56 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=8 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00");
l.add("[mp4 @ 00000000023400a0] Could not find tag for codec xsub in stream #2, codec not currently supported in container");
l.add("Output #0, mp4, to 'D:\\Pe\\TO\\EN\\5\\La.avi2725827522498285472.mp4':");
l.add(" Metadata:");
l.add(" encoder : Lavf57.50.100");
l.add(" Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 512x256 [SAR 1:1 DAR 2:1], q=-1--1, 25 fps, 12800 tbn, 25 tbc");
l.add(" Metadata:");
l.add(" title : Main");
l.add(" comment : fmvversion:0.5.3-SNAPSHOT");
l.add(" rotate : 0");
l.add(" encoder : Lavc57.58.100 libx264");
l.add(" Side data:");
l.add(" cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1");
l.add(" Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, 128 kb/s");
l.add(" Metadata:");
l.add(" title : Audio - fr;02");
l.add(" encoder : Lavc57.58.100 aac");
l.add(" Stream #0:2: Subtitle: xsub (DXSB / 0x42535844), 640x480, 867 kb/s");
l.add(" Metadata:");
l.add(" title : Subtitle - fr");
l.add("Stream mapping:");
l.add(" Stream #0:0 -> #0:0 (mpeg4 (native) -> h264 (libx264))");
l.add(" Stream #0:1 -> #0:1 (mp3 (native) -> aac (native))");
l.add(" Stream #0:2 -> #0:2 (copy)");
l.add("Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument");
l.add("[Parsed_volumedetect_0 @ 0000000001d86420] n_samples: 0");
l.add("[aac @ 0000000001d7f980] Qavg: nan");
FFEnv ffEnv = mock(FFEnv.class);
@SuppressWarnings("unchecked") FFExecutor<Object> executor = mock(FFExecutor.class);
BufferedReadLine outputReadLine = new BufferedReadLine(l);
@SuppressWarnings("unchecked") Operation<?, ?> operation = mock(Operation.class);
OutputParameters outputParameters = mock(OutputParameters.class);
doReturn(executor).when(ffEnv).getExecutor();
doReturn(operation).when(executor).getOperation();
doReturn(outputParameters).when(operation).getOutputParameters();
MP4TagCodecNotFoundFFExecFallback fb = new MP4TagCodecNotFoundFFExecFallback();
fb.prepare(ffEnv, null);
}
Aggregations