diff --git a/src/ffmpeg.js b/src/ffmpeg.js index 2aa0f1c6..a2ceeff7 100644 --- a/src/ffmpeg.js +++ b/src/ffmpeg.js @@ -57,7 +57,7 @@ function handleProgress(process, cutDuration, onProgress) { async function cut({ customOutDir, filePath, format, cutFrom, cutTo, videoDuration, rotation, includeAllStreams, - onProgress, + onProgress, stripAudio, }) { const ext = path.extname(filePath) || `.${format}`; const cutSpecification = `${util.formatDuration(cutFrom, true)}-${util.formatDuration(cutTo, true)}`; @@ -72,7 +72,10 @@ async function cut({ const rotationArgs = rotation !== undefined ? ['-metadata:s:v:0', `rotate=${rotation}`] : []; const ffmpegArgs = [ - '-i', filePath, '-y', '-vcodec', 'copy', '-acodec', 'copy', '-scodec', 'copy', + '-i', filePath, '-y', + ...(stripAudio ? ['-an'] : ['-acodec', 'copy']), + '-vcodec', 'copy', + '-scodec', 'copy', ...cutFromArgs, ...cutToArgs, ...(includeAllStreams ? ['-map', '0'] : []), '-map_metadata', '0', diff --git a/src/renderer.jsx b/src/renderer.jsx index f0ab694f..27ed650d 100644 --- a/src/renderer.jsx +++ b/src/renderer.jsx @@ -98,6 +98,7 @@ class App extends React.Component { rotation: 360, cutProgress: undefined, includeAllStreams: false, + stripAudio: false, }; this.state = _.cloneDeep(defaultState); @@ -315,6 +316,7 @@ class App extends React.Component { const videoDuration = this.state.duration; const rotation = this.isRotationSet() ? this.getRotation() : undefined; const includeAllStreams = this.state.includeAllStreams; + const stripAudio = this.state.stripAudio; if (!this.areCutTimesSet()) { return alert('Please select both start and end time'); @@ -334,6 +336,7 @@ class App extends React.Component { videoDuration, rotation, includeAllStreams, + stripAudio, onProgress: progress => this.onCutProgress(progress), }); } catch (err) { @@ -545,6 +548,13 @@ class App extends React.Component { {this.state.includeAllStreams ? 'all' : 'ps'} + +