Skip to content

Commit 8ee2a91

Browse files
Add option to map all stream and export status
1 parent 59bd934 commit 8ee2a91

File tree

4 files changed

+86
-30
lines changed

4 files changed

+86
-30
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
Fast Cut allows to visually cut and join videos then export them losslessly.
44

5-
> :warning: The project is still experimental.
6-
75
The main purposes are to
86
* join camcorder footages and
97
* clean a recording from the commercial breaks.

htdocs/fcut.css

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ div.overlay:hover {
108108
cursor: pointer;
109109
padding-left: 1%;
110110
height: 2rem;
111+
overflow-x: hidden;
111112
}
112113
span.part {
113114
height: 0.8rem;
@@ -137,3 +138,22 @@ div.console > pre {
137138
font-size: 0.9rem;
138139
margin: 0px;
139140
}
141+
142+
div.splash {
143+
position: absolute;
144+
margin: 0;
145+
height: 100%;
146+
width: 100%;
147+
background-color: inherit;
148+
font-size: 1.8rem;
149+
vertical-align: middle;
150+
text-align: center;
151+
z-index: 1000;
152+
}
153+
:not(.theme-boot) > div.splash {
154+
display: none;
155+
}
156+
157+
input[type="checkbox"] {
158+
transform: scale(1.25);
159+
}

htdocs/fcut.html

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
<script src="page.js" type="text/javascript"></script>
1616
<script src="FileChooser.js" type="text/javascript"></script>
1717
<script src="fcut-utils.js" type="text/javascript"></script>
18-
</head><body>
18+
</head><body class="theme-boot">
19+
<div class="splash">...</div>
1920
<div id="app" tabindex="0" v-on:keyup="pages.dispatchKey($event)">
2021
<page name="home">
2122
<div class="padded">
@@ -139,7 +140,25 @@ <h2>Fast FFmpeg Cutter (Preview)</h2>
139140
<button v-on:click="pages.navigateTo('console')" title="Show output"><i class="fas fa-terminal"></i></button>
140141
</div>
141142
<h2>Export</h2>
142-
<div v-if="!exportId">
143+
<div v-if="exportId === '$'">
144+
<p v-if="logExitCode > 0">{{ 'Export failed with exit code ' + logExitCode }}</p>
145+
<p v-else>Export completed !</p>
146+
<div class="button-bar">
147+
<button v-on:click="exportId = false" title="Dismiss export status"><i class="fas fa-times"></i> Ok</button>
148+
</div>
149+
</div>
150+
<div v-else-if="exportId">
151+
<p>Exported time: {{ formatHMS(Math.floor(logTime)) }}</p>
152+
<p>Total time: {{ formatHMS(Math.floor(logDuration)) }}</p>
153+
<p v-if="logPartIndex <= logPartCount">Part: {{ '' + logPartIndex + ' / ' + logPartCount }}</p>
154+
<p v-else>Concat parts</p>
155+
<div class="button-bar">
156+
<progress style="width: 80%; height: 2rem;" max="1000" v-bind:value="logPermil"></progress>
157+
<br /><br />
158+
<button v-on:click="stopExport()" title="Cancel export"><i class="fas fa-ban"></i> Cancel</button>
159+
</div>
160+
</div>
161+
<div v-else>
143162
<div class="input-bar">
144163
<label>Format:</label>
145164
<select v-model="exportFormat" title="Format">
@@ -209,8 +228,22 @@ <h2>Export</h2>
209228
</select>
210229
</div>
211230
<div class="input-bar">
212-
<input type="checkbox" v-model="exportEnableSubtitle" />
213-
<label>Enable Subtitle</label>
231+
<label>Subtitle Codec:</label>
232+
<select v-model="exportSubtitleCodec" title="Select Subtitle Codec">
233+
<option value="-">disable</option>
234+
<option value="copy">copy</option>
235+
<option value="ass">ASS (Advanced SSA) subtitle (decoders: ssa ass ) (encoders: ssa ass )</option>
236+
<option value="dvb_subtitle">DVB subtitles (decoders: dvbsub ) (encoders: dvbsub )</option>
237+
<option value="dvd_subtitle">DVD subtitles (decoders: dvdsub ) (encoders: dvdsub )</option>
238+
<option value="mov_text">MOV text</option>
239+
<option value="subrip">SubRip subtitle (decoders: srt subrip ) (encoders: srt subrip )</option>
240+
<option value="text">raw UTF-8 text</option>
241+
<option value="webvtt">WebVTT subtitle</option>
242+
<option value="xsub">XSUB</option>
243+
</select>
244+
</div>
245+
<div class="input-bar">
246+
<label><input type="checkbox" v-model="exportMapAllStreams" /> Map all streams</label>
214247
</div>
215248
<br />
216249
<div class="bar-flex-row">
@@ -223,17 +256,6 @@ <h2>Export</h2>
223256
<button v-bind:disabled="parts.length === 0" v-on:click="startExport()"><i class="fas fa-cogs"></i> Export</button>
224257
</div>
225258
</div>
226-
<div v-if="exportId">
227-
<p>Exported time: {{ formatHMS(Math.floor(logTime)) }}</p>
228-
<p>Total time: {{ formatHMS(Math.floor(logDuration)) }}</p>
229-
<p v-if="logPartIndex <= logPartCount">Part: {{ '' + logPartIndex + ' / ' + logPartCount }}</p>
230-
<p v-else>Concat parts</p>
231-
<div class="button-bar">
232-
<progress style="width: 80%; height: 2rem;" max="1000" v-bind:value="logPermil"></progress>
233-
<br /><br />
234-
<button v-on:click="stopExport()" title="Cancel export"><i class="fas fa-ban"></i> Cancel</button>
235-
</div>
236-
</div>
237259
</div>
238260
</page>
239261
<page name="console">
@@ -287,5 +309,6 @@ <h2>About</h2>
287309
</div>
288310
</page>
289311
</div>
290-
<script src="fcut.js" type="text/javascript"></script>
291-
</body></html>
312+
</body>
313+
<script src="fcut.js" type="text/javascript"></script>
314+
</html>

htdocs/fcut.js

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
var partRegExp = /^\n -- starting command ([0-9]+)\/([0-9]+)\s/;
33
var timeRegExp = /^frame=.*\stime=([0-9:.]+)\s/;
4+
var endRegExp = /^\n -- exit code ([0-9]+)\s/;
45

56
var DEFAULT_DESTINATION_FILENAME = 'fcut-out.mp4';
67
var DEFAULT_PROJECT_FILENAME = 'fcut-project.json';
@@ -37,7 +38,8 @@ var vm = new Vue({
3738
exportFormat: 'mp4',
3839
exportVideoCodec: 'copy',
3940
exportAudioCodec: 'copy',
40-
exportEnableSubtitle: false,
41+
exportSubtitleCodec: '-',
42+
exportMapAllStreams: true,
4143
duration: 0,
4244
parts: [],
4345
partIndex: 0,
@@ -53,6 +55,7 @@ var vm = new Vue({
5355
logPartCount: 0,
5456
logDuration: 0,
5557
logPermil: 0,
58+
logExitCode: -1,
5659
keepFileChooserPath: false,
5760
messageTitle: '',
5861
messageLines: []
@@ -376,7 +379,6 @@ var vm = new Vue({
376379
"Content-Type": "text/plain"
377380
},
378381
body: this.exportId
379-
}).then(function() {
380382
});
381383
},
382384
logMessage: function(content) {
@@ -400,6 +402,11 @@ var vm = new Vue({
400402
} else {
401403
this.logCompletedTime = 0;
402404
}
405+
} else {
406+
found = endRegExp.exec(content);
407+
if (found) {
408+
this.logExitCode = parseInt(found[1], 10);
409+
}
403410
}
404411
}
405412
var index = content.lastIndexOf('\n');
@@ -425,21 +432,26 @@ var vm = new Vue({
425432
return;
426433
}
427434
var options = [];
428-
if (this.exportFormat !== '-') {
435+
if (this.exportMapAllStreams) {
436+
options.push('-map', '0');
437+
}
438+
if ((this.exportFormat !== '-') && (this.exportFormat !== '')) {
429439
options.push('-f', this.exportFormat);
430440
}
431-
if (this.exportVideoCodec !== '-') {
432-
options.push('-vcodec', this.exportVideoCodec);
433-
} else {
441+
if (this.exportVideoCodec === '-') {
434442
options.push('-vn');
443+
} else if (this.exportVideoCodec !== '') {
444+
options.push('-vcodec', this.exportVideoCodec);
435445
}
436-
if (this.exportAudioCodec !== '-') {
437-
options.push('-acodec', this.exportAudioCodec);
438-
} else {
446+
if (this.exportAudioCodec === '-') {
439447
options.push('-an');
448+
} else if (this.exportAudioCodec !== '') {
449+
options.push('-acodec', this.exportAudioCodec);
440450
}
441-
if (!this.exportEnableSubtitle) {
451+
if (this.exportSubtitleCodec === '-') {
442452
options.push('-sn');
453+
} else if (this.exportSubtitleCodec !== '') {
454+
options.push('-scodec', this.exportSubtitleCodec);
443455
}
444456
var request = {
445457
filename: this.destinationFilename,
@@ -454,6 +466,7 @@ var vm = new Vue({
454466
this.logTime = 0;
455467
this.logCompletedTime = 0;
456468
this.logPermil = 0;
469+
this.logExitCode = -1;
457470
var that = this;
458471
return checkFile(this.destinationFilename).catch(function(filename) {
459472
return that.showMessage('The file exists.\n' + filename + '\nDo you want to overwrite?');
@@ -474,7 +487,7 @@ var vm = new Vue({
474487
that.logMessage(event.data);
475488
};
476489
webSocket.onclose = function() {
477-
that.exportId = false;
490+
that.exportId = '$';
478491
};
479492
});
480493
},
@@ -564,3 +577,5 @@ var vm = new Vue({
564577
});
565578

566579
vm.loadConfig(true);
580+
581+
document.getElementsByTagName('body')[0].setAttribute('class', 'theme-dark');

0 commit comments

Comments
 (0)