Include segment number in output file

for segment without any label
Fixed #536
pull/554/head
Mikael Finstad 2020-12-11 15:19:00 +01:00
rodzic 3cedc453e3
commit c7b04e99bc
2 zmienionych plików z 11 dodań i 5 usunięć

Wyświetl plik

@ -996,7 +996,8 @@ const App = memo(() => {
setExportConfirmVisible(false);
const filteredOutSegments = exportSingle ? [outSegments[currentSegIndexSafe]] : outSegments;
const outSegmentsWithOrder = outSegments.map((s, order) => ({ ...s, order }));
const filteredOutSegments = exportSingle ? [outSegmentsWithOrder[currentSegIndexSafe]] : outSegmentsWithOrder;
try {
setWorking(i18n.t('Exporting'));
@ -1011,6 +1012,7 @@ const App = memo(() => {
rotation: isRotationSet ? effectiveRotation : undefined,
copyFileStreams,
keyframeCut,
invertCutSegments,
segments: filteredOutSegments,
onProgress: setCutProgress,
appendFfmpegCommandLog,
@ -1576,7 +1578,7 @@ const App = memo(() => {
if (hasVideo) {
if (isDurationValid(await getDuration(filePath))) {
showToast();
await tryCreateDummyVideo();
await tryCreateDummyVideo();
}
} else if (hasAudio) {
showToast();

Wyświetl plik

@ -308,7 +308,7 @@ export async function cutMultiple({
customOutDir, filePath, segments, videoDuration, rotation,
onProgress, keyframeCut, copyFileStreams, outFormat, isCustomFormatSelected,
appendFfmpegCommandLog, shortestFlag, ffmpegExperimental, preserveMovData, avoidNegativeTs,
customTagsByFile, customTagsByStreamId,
customTagsByFile, customTagsByStreamId, invertCutSegments,
}) {
console.log('customTagsByFile', customTagsByFile);
console.log('customTagsByStreamId', customTagsByStreamId);
@ -323,10 +323,14 @@ export async function cutMultiple({
let i = 0;
// eslint-disable-next-line no-restricted-syntax,no-unused-vars
for (const { start, end, name } of segments) {
for (const { start, end, name, order } of segments) {
const cutFromStr = formatDuration({ seconds: start, fileNameFriendly: true });
const cutToStr = formatDuration({ seconds: end, fileNameFriendly: true });
const segNamePart = name ? `-${filenamify(name)}` : '';
let segNamePart = '';
if (!invertCutSegments) {
if (name) segNamePart = `-${filenamify(name)}`;
else segNamePart = `-seg${order + 1}`;
}
const cutSpecification = `${cutFromStr}-${cutToStr}${segNamePart}`.substr(0, 200);
const ext = getOutFileExtension({ isCustomFormatSelected, outFormat, filePath });
const fileName = `${cutSpecification}${ext}`;