diff --git a/src/main/java/net/knarcraft/ffmpegconverter/config/ConfigKey.java b/src/main/java/net/knarcraft/ffmpegconverter/config/ConfigKey.java index 69a72f2..31f5182 100644 --- a/src/main/java/net/knarcraft/ffmpegconverter/config/ConfigKey.java +++ b/src/main/java/net/knarcraft/ffmpegconverter/config/ConfigKey.java @@ -57,6 +57,11 @@ public class ConfigKey { */ public static final ConfigKey DE_INTERLACE_VIDEO = createKey("de-interlace-video", Boolean.class, false); + /** + * The configuration key for whether to copy attached cover images + */ + public static final ConfigKey COPY_ATTACHED_IMAGES = createKey("copy-attached-images", Boolean.class, false); + private final String configKey; private final T defaultValue; private final Class type; diff --git a/src/main/java/net/knarcraft/ffmpegconverter/config/Configuration.java b/src/main/java/net/knarcraft/ffmpegconverter/config/Configuration.java index 2f7b28b..5632c03 100644 --- a/src/main/java/net/knarcraft/ffmpegconverter/config/Configuration.java +++ b/src/main/java/net/knarcraft/ffmpegconverter/config/Configuration.java @@ -22,6 +22,7 @@ public class Configuration { private List animeSubtitleLanguages; private MinimalSubtitlePreference minimalSubtitlePreference; private boolean deInterlaceVideo; + private boolean copyAttachedImages; /** * Instantiates and loads a new configuration @@ -55,6 +56,7 @@ public class Configuration { animeAudioLanguages = ConfigHelper.asStringList(configHandler.getValue(ConfigKey.AUDIO_LANGUAGES_ANIME)); animeSubtitleLanguages = ConfigHelper.asStringList(configHandler.getValue(ConfigKey.SUBTITLE_LANGUAGES_ANIME)); deInterlaceVideo = ConfigHelper.asBoolean(configHandler.getValue(ConfigKey.DE_INTERLACE_VIDEO)); + copyAttachedImages = ConfigHelper.asBoolean(configHandler.getValue(ConfigKey.COPY_ATTACHED_IMAGES)); try { minimalSubtitlePreference = MinimalSubtitlePreference.valueOf(String.valueOf(configHandler.getValue( ConfigKey.MINIMAL_SUBTITLE_PREFERENCE))); @@ -158,4 +160,15 @@ public class Configuration { return this.deInterlaceVideo; } + /** + * Gets whether attached images should be copied + * + *

FFMpeg sometimes throws errors when including attached images.

+ * + * @return

True if attached images should be copied

+ */ + public boolean copyAttachedImages() { + return this.copyAttachedImages; + } + } diff --git a/src/main/java/net/knarcraft/ffmpegconverter/utility/FFMpegHelper.java b/src/main/java/net/knarcraft/ffmpegconverter/utility/FFMpegHelper.java index d200723..e7cb31c 100644 --- a/src/main/java/net/knarcraft/ffmpegconverter/utility/FFMpegHelper.java +++ b/src/main/java/net/knarcraft/ffmpegconverter/utility/FFMpegHelper.java @@ -1,5 +1,6 @@ package net.knarcraft.ffmpegconverter.utility; +import net.knarcraft.ffmpegconverter.FFMpegConvert; import net.knarcraft.ffmpegconverter.container.FFMpegCommand; import net.knarcraft.ffmpegconverter.container.ProcessResult; import net.knarcraft.ffmpegconverter.container.StreamProbeResult; @@ -313,7 +314,11 @@ public final class FFMpegHelper { case AUDIO -> parsedStreams.add(new AudioStream(streamInfo, 0, relativeAudioIndex++)); case SUBTITLE -> parsedStreams.add(new SubtitleStream(streamInfo, 0, relativeSubtitleIndex++)); case OTHER -> parsedStreams.add(new OtherStream(streamInfo, 0, false)); - case COVER_IMAGE -> parsedStreams.add(new OtherStream(streamInfo, 0, true)); + case COVER_IMAGE -> { + if (FFMpegConvert.getConfiguration().copyAttachedImages()) { + parsedStreams.add(new OtherStream(streamInfo, 0, true)); + } + } } } return parsedStreams; diff --git a/src/main/resources/audio_formats.txt b/src/main/resources/audio_formats.txt index badc645..2dab9b9 100644 --- a/src/main/resources/audio_formats.txt +++ b/src/main/resources/audio_formats.txt @@ -36,4 +36,5 @@ wav wma wv webm -8svx \ No newline at end of file +8svx +mka \ No newline at end of file diff --git a/src/main/resources/conf/config.properties b/src/main/resources/conf/config.properties index d562906..3f4d8ca 100644 --- a/src/main/resources/conf/config.properties +++ b/src/main/resources/conf/config.properties @@ -17,4 +17,6 @@ subtitle-languages-anime=eng,* # The preference for minimal subtitles, AKA Signs & Songs (REQUIRE/PREFER/NO_PREFERENCE/AVOID/REJECT) minimal-subtitle-preference=AVOID # The preference for whether video streams should be de-interlaced. It is recommended to only enable this when you notice that a video file is interlaced. -de-interlace-video=false \ No newline at end of file +de-interlace-video=false +# Whether to copy attached cover images. FFMpeg sometimes throws errors when including attached images. +copy-attached-images=false \ No newline at end of file