Add ffmpeg pre-input post-process parameters
This commit is contained in:
parent
92ef350ad6
commit
443a1b5893
|
@ -11,13 +11,16 @@ public class RemuxerPaneFactory extends AbstractPostProcessingPaneFactory {
|
|||
|
||||
@Override
|
||||
public Preferences doCreatePostProcessorPane(PostProcessor pp) {
|
||||
var preFfmpegParameters = new SimpleStringProperty(null, Remux.PRE_FFMPEG_ARGS, pp.getConfig().getOrDefault(Remux.PRE_FFMPEG_ARGS, ""));
|
||||
var ffmpegParams = new SimpleStringProperty(null, Remux.FFMPEG_ARGS, pp.getConfig().getOrDefault(Remux.FFMPEG_ARGS, "-c:v copy -c:a copy -movflags faststart -y -f mp4"));
|
||||
var fileExt = new SimpleStringProperty(null, Remux.FILE_EXT, pp.getConfig().getOrDefault(Remux.FILE_EXT, "mp4"));
|
||||
properties.add(preFfmpegParameters);
|
||||
properties.add(ffmpegParams);
|
||||
properties.add(fileExt);
|
||||
|
||||
return Preferences.of(new MapPreferencesStorage(),
|
||||
Category.of(pp.getName(),
|
||||
Setting.of("FFmpeg pre-input (Experimental)", preFfmpegParameters, "FFmpeg pre-input parameters used when post-processing\nExperimental! DO NOT USE unless you know what you are doing!!!"),
|
||||
Setting.of("FFmpeg parameters", ffmpegParams),
|
||||
Setting.of("File extension", fileExt)
|
||||
)
|
||||
|
|
|
@ -18,6 +18,7 @@ public class Remux extends AbstractPostProcessor {
|
|||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(Remux.class);
|
||||
|
||||
public static final String PRE_FFMPEG_ARGS = "preffmpeg.args";
|
||||
public static final String FFMPEG_ARGS = "ffmpeg.args";
|
||||
public static final String FILE_EXT = "file.ext";
|
||||
|
||||
|
@ -79,9 +80,14 @@ public class Remux extends AbstractPostProcessor {
|
|||
}
|
||||
|
||||
private String[] prepareCommandline(File inputFile, File remuxedFile) throws IOException {
|
||||
String[] argsPreFfmpeg = getConfig().get(PRE_FFMPEG_ARGS).isEmpty()
|
||||
? new String[] {} // If empty, create an empty array
|
||||
: getConfig().get(PRE_FFMPEG_ARGS).split(" ");
|
||||
String[] args = getConfig().get(FFMPEG_ARGS).split(" ");
|
||||
String[] argsPlusFile = new String[args.length + 3];
|
||||
String[] argsPlusFile = new String[argsPreFfmpeg.length + args.length + 3];
|
||||
int i = 0;
|
||||
System.arraycopy(argsPreFfmpeg, 0, argsPlusFile, i, argsPreFfmpeg.length);
|
||||
i += argsPreFfmpeg.length;
|
||||
argsPlusFile[i++] = "-i";
|
||||
argsPlusFile[i++] = inputFile.getCanonicalPath();
|
||||
System.arraycopy(args, 0, argsPlusFile, i, args.length);
|
||||
|
@ -92,6 +98,10 @@ public class Remux extends AbstractPostProcessor {
|
|||
@Override
|
||||
public String toString() {
|
||||
String s = getName();
|
||||
if(getConfig().containsKey(PRE_FFMPEG_ARGS)) {
|
||||
s = "[" + getConfig().get(PRE_FFMPEG_ARGS) + "] " + s;
|
||||
}
|
||||
|
||||
if(getConfig().containsKey(FFMPEG_ARGS)) {
|
||||
s += " [" + getConfig().get(FFMPEG_ARGS) + ']';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue