Adds a converter for web video and changes behavior of the normal video converter
All checks were successful
KnarCraft/FFmpegConvert/pipeline/head This commit looks good

The normal video converter now includes all streams
The web video converter selects the first of each stream
Changes some method names
Moves the convert command to the abstract converter
This commit is contained in:
2020-05-12 19:56:01 +02:00
parent a516cdcdff
commit f2b2de514e
8 changed files with 94 additions and 49 deletions

View File

@ -129,7 +129,7 @@ public final class FFMpegHelper {
* @param audioStream <p>The audio stream to be added.</p>
* @param toStereo <p>Whether to convert the audio stream to stereo.</p>
*/
public static void addAudioStreams(List<String> command, AudioStream audioStream, boolean toStereo) {
public static void addAudioStream(List<String> command, AudioStream audioStream, boolean toStereo) {
if (audioStream != null) {
command.add("-map");
command.add("0:" + audioStream.getAbsoluteIndex());
@ -149,12 +149,11 @@ public final class FFMpegHelper {
* @param videoStream <p>The video stream to be used.</p>
* @param file <p>The file to convert.</p>
*/
public static void addSubtitlesAndVideo(List<String> command, SubtitleStream subtitleStream,
VideoStream videoStream, File file) {
public static void addSubtitleAndVideoStream(List<String> command, SubtitleStream subtitleStream,
VideoStream videoStream, File file) {
//No appropriate subtitle was found. Just add the video stream.
if (subtitleStream == null) {
command.add("-map");
command.add(String.format("0:%d", videoStream.getAbsoluteIndex()));
addVideoStream(command, videoStream);
return;
}
@ -168,6 +167,17 @@ public final class FFMpegHelper {
}
}
/**
* Adds video mapping to a command
*
* @param command <p>The list containing the rest of the command.</p>
* @param videoStream <p>The video stream to be used.</p>
*/
private static void addVideoStream(List<String> command, VideoStream videoStream) {
command.add("-map");
command.add(String.format("0:%d", videoStream.getAbsoluteIndex()));
}
/**
* Adds subtitle commands to a command list
*