Adds new converters

Adds a MKV to HEVC converter which aims to reduce file-sizes
Adds a MKV to MP4 transcoder which allows selection of each type of stream
This commit is contained in:
2023-11-14 17:10:45 +01:00
parent f81a21b9e9
commit 2346e651ef
9 changed files with 294 additions and 26 deletions

View File

@ -7,6 +7,7 @@ import net.knarcraft.ffmpegconverter.streams.VideoStream;
import net.knarcraft.ffmpegconverter.utility.FFMpegHelper;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
@ -34,7 +35,14 @@ public class MkvH264Converter extends AbstractConverter {
@Override
public String[] generateConversionCommand(String executable, File file, List<StreamObject> streams,
String outFile) {
List<String> command = FFMpegHelper.getFFMpegGeneralFileCommand(executable, file.getName());
List<String> command = new ArrayList<>();
command.add(executable);
command.add("-hwaccel");
command.add("cuda");
command.add("-hwaccel_output_format");
command.add("cuda");
command.add("-i");
command.add(file.getName());
if (this.debug) {
FFMpegHelper.addDebugArguments(command, 50, 120);
}
@ -43,8 +51,14 @@ public class MkvH264Converter extends AbstractConverter {
if (!filterStreamsByType(streams, VideoStream.class).isEmpty()) {
command.add("-map");
command.add("0:v");
command.add("-vcodec");
command.add("h264");
command.add("-crf");
command.add("28");
command.add("-codec:v");
command.add("h264_nvenc");
command.add("-preset");
command.add("slow");
command.add("-movflags");
command.add("+faststart");
}
// Map audio if present