Add --keepAllVideos option

If set to true, it will keep all videos in the merge process, rather than discarding the extra videos.
This commit is contained in:
AnimeDL 2023-07-13 14:28:44 -07:00
parent 1816c2521d
commit 9d8665dfbe
6 changed files with 18 additions and 1 deletions

View file

@ -42,6 +42,7 @@ export type CurnchyMultiDownload = {
export type CrunchyMuxOptions = {
output: string,
skipSubMux?: boolean
keepAllVideos?: bolean
novids?: boolean,
mp4: boolean,
forceMuxer?: 'ffmpeg'|'mkvmerge',

View file

@ -1457,6 +1457,7 @@ export default class Crunchy implements ServiceClass {
};
}),
simul: false,
keepAllVideos: options.keepAllVideos,
fonts: Merger.makeFontsList(this.cfg.dir.fonts, data.filter(a => a.type === 'Subtitle') as sxItem[]),
videoAndAudio: data.filter(a => a.type === 'Video').map((a) : MergerInput => {
if (a.type === 'Subtitle')

View file

@ -747,6 +747,7 @@ export default class Hidive implements ServiceClass {
onlyVid: [],
skipSubMux: options.skipSubMux,
inverseTrackOrder: true,
keepAllVideos: options.keepAllVideos,
onlyAudio: [],
output: `${options.output}.${options.mp4 ? 'mp4' : 'mkv'}`,
subtitles: data.filter(a => a.type === 'Subtitle').map((a) : SubtitleInput => {

View file

@ -66,6 +66,7 @@ let argvC: {
dlVideoOnce: boolean;
removeBumpers: boolean;
originalFontSize: boolean;
keepAllVideos: boolean;
};
export type ArgvType = typeof argvC;

View file

@ -407,6 +407,18 @@ const args: TAppArg<boolean|number|string|unknown[]>[] = [
default: false
}
},
{
name: 'keepAllVideos',
group: 'mux',
describe: 'Keeps all videos when merging instead of discarding extras',
docDescribe: 'If set to true, it will keep all videos in the merge process, rather than discarding the extra videos.',
service: ['crunchy','hidive'],
type: 'boolean',
usage: '',
default: {
default: false
}
},
{
name: 'skipmux',
describe: 'Skip muxing video, audio and subtitles',

View file

@ -36,6 +36,7 @@ export type MergerOptions = {
videoTitle?: string,
simul?: boolean,
inverseTrackOrder?: boolean,
keepAllVideos?: boolean,
fonts?: ParsedFont[],
skipSubMux?: boolean,
options: {
@ -163,7 +164,7 @@ class Merger {
for (const vid of this.options.videoAndAudio) {
const audioTrackNum = this.options.inverseTrackOrder ? '0' : '1';
const videoTrackNum = this.options.inverseTrackOrder ? '1' : '0';
if (!hasVideo) {
if (!hasVideo || this.options.keepAllVideos) {
args.push(
`--video-tracks ${videoTrackNum}`,
`--audio-tracks ${audioTrackNum}`