checkbox for merge all streams

pull/276/head
Mikael Finstad 6 years ago
parent e31e3bc53c
commit fc4c8873ac

@ -236,7 +236,7 @@ async function html5ifyDummy(filePath, outPath) {
await transferTimestamps(filePath, outPath);
}
async function mergeFiles({ paths, outPath }) {
async function mergeFiles({ paths, outPath, allStreams }) {
console.log('Merging files', { paths }, 'to', outPath);
// https://blog.yo1.dog/fix-for-ffmpeg-protocol-not-on-whitelist-error-for-urls/
@ -244,7 +244,7 @@ async function mergeFiles({ paths, outPath }) {
'-f', 'concat', '-safe', '0', '-protocol_whitelist', 'file,pipe', '-i', '-',
'-c', 'copy',
'-map', '0',
...(allStreams ? ['-map', '0'] : []),
'-map_metadata', '0',
// See https://github.com/mifi/lossless-cut/issues/170
@ -269,11 +269,11 @@ async function mergeFiles({ paths, outPath }) {
console.log(result.stdout);
}
async function mergeAnyFiles({ customOutDir, paths }) {
async function mergeAnyFiles({ customOutDir, paths, allStreams }) {
const firstPath = paths[0];
const ext = extname(firstPath);
const outPath = getOutPath(customOutDir, firstPath, `merged${ext}`);
return mergeFiles({ paths, outPath });
return mergeFiles({ paths, outPath, allStreams });
}
async function autoMergeSegments({ customOutDir, sourceFile, segmentPaths }) {

@ -17,6 +17,7 @@ async function showMergeDialog(paths, onMergeClick) {
let swalElem;
let outPaths = paths;
let allStreams = false;
const { dismiss } = await MySwal.fire({
width: '90%',
showCancelButton: true,
@ -25,12 +26,13 @@ async function showMergeDialog(paths, onMergeClick) {
html: (<SortableFiles
items={outPaths}
onChange={(val) => { outPaths = val; }}
onAllStreamsChange={(val) => { allStreams = val; }}
helperContainer={() => swalElem}
/>),
});
if (!dismiss) {
onMergeClick(outPaths);
onMergeClick({ paths: outPaths, allStreams });
}
}

@ -416,13 +416,13 @@ const App = memo(() => {
const offsetCurrentTime = (currentTime || 0) + startTimeOffset;
const mergeFiles = useCallback(async (paths) => {
const mergeFiles = useCallback(async ({ paths, allStreams }) => {
try {
setWorking(true);
// console.log('merge', paths);
await ffmpeg.mergeAnyFiles({
customOutDir, paths,
customOutDir, paths, allStreams,
});
} catch (err) {
errorToast('Failed to merge files. Make sure they are all of the exact same format and codecs');

Loading…
Cancel
Save