diff --git a/src/components/OutputFormatSelect.jsx b/src/components/OutputFormatSelect.jsx
index bdb1dce8..e6cde817 100644
--- a/src/components/OutputFormatSelect.jsx
+++ b/src/components/OutputFormatSelect.jsx
@@ -1,30 +1,32 @@
import React, { memo, useMemo } from 'react';
import i18n from 'i18next';
-import fromPairs from 'lodash/fromPairs';
import allOutFormats from '../outFormats';
import { withBlur } from '../util';
import Select from './Select';
-const commonFormats = ['mov', 'mp4', 'matroska', 'webm', 'mp3', 'ipod'];
+const commonVideoAudioFormats = ['matroska', 'mov', 'mp4', 'mpegts', 'ogv', 'webm'];
+const commonAudioFormats = ['flac', 'ipod', 'mp3', 'oga', 'ogg', 'opus', 'wav'];
+const commonSubtitleFormats = ['ass', 'srt', 'sup', 'webvtt'];
-function renderFormatOptions(map) {
- return Object.entries(map).map(([f, name]) => (
-
+function renderFormatOptions(formats) {
+ return formats.map((format) => (
+
));
}
const OutputFormatSelect = memo(({ style, detectedFileFormat, fileFormat, onOutputFormatUserChange }) => {
- const commonFormatsMap = useMemo(() => fromPairs(commonFormats.map(format => [format, allOutFormats[format]])
- .filter(([f]) => f !== detectedFileFormat)), [detectedFileFormat]);
+ const commonVideoAudioFormatsExceptDetectedFormat = useMemo(() => commonVideoAudioFormats.filter((f) => f !== detectedFileFormat), [detectedFileFormat]);
+ const commonAudioFormatsExceptDetectedFormat = useMemo(() => commonAudioFormats.filter((f) => f !== detectedFileFormat), [detectedFileFormat]);
+ const commonSubtitleFormatsExceptDetectedFormat = useMemo(() => commonSubtitleFormats.filter((f) => f !== detectedFileFormat), [detectedFileFormat]);
+ const commonFormatsAndDetectedFormat = useMemo(() => new Set([...commonVideoAudioFormats, ...commonAudioFormats, commonSubtitleFormats, detectedFileFormat]), [detectedFileFormat]);
- const otherFormatsMap = useMemo(() => fromPairs(Object.entries(allOutFormats)
- .filter(([f]) => ![...commonFormats, detectedFileFormat].includes(f))), [detectedFileFormat]);
+ const otherFormats = useMemo(() => Object.keys(allOutFormats).filter((format) => !commonFormatsAndDetectedFormat.has(format)), [commonFormatsAndDetectedFormat]);
return (
// eslint-disable-next-line react/jsx-props-no-spreading
-