Fixes subtitle mapping for video with only external subtitles
All checks were successful
KnarCraft/FFmpegConvert/pipeline/head This commit looks good
All checks were successful
KnarCraft/FFmpegConvert/pipeline/head This commit looks good
This commit is contained in:
@ -56,7 +56,7 @@ public class MkvH264Converter extends AbstractConverter {
|
||||
}
|
||||
|
||||
// Map subtitles if present
|
||||
if (!filterStreamsByType(streams, SubtitleStream.class).isEmpty()) {
|
||||
if (hasInternalStreams(streams)) {
|
||||
command.add("-map");
|
||||
command.add("0:s");
|
||||
command.add("-c:s");
|
||||
@ -72,4 +72,20 @@ public class MkvH264Converter extends AbstractConverter {
|
||||
return command.toArray(new String[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the processed file has any internal subtitle streams
|
||||
*
|
||||
* @param streams <p>All parsed streams for the video file</p>
|
||||
* @return <p>True if the file has at least one internal subtitle stream</p>
|
||||
*/
|
||||
private boolean hasInternalStreams(List<StreamObject> streams) {
|
||||
for (StreamObject subtitleStream : filterStreamsByType(streams, SubtitleStream.class)) {
|
||||
if (((SubtitleStream) subtitleStream).isInternalSubtitle()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user