Skip to content

Commit 7046ba1

Browse files
committed
Display error if ffmpegd encode fails. Updates to Queue table's _showDetails.
1 parent 94363e8 commit 7046ba1

File tree

4 files changed

+56
-12
lines changed

4 files changed

+56
-12
lines changed

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
1-
# ffmpeg-commander
2-
> `ffmpeg-commander` is a simple web UI for generating common FFmpeg commands.
3-
4-
*Generated options may vary based on your FFmpeg version and build configuration. Tested on version 4.3.1*
1+
# `ffmpeg-commander`
2+
A simple web UI for generating common FFmpeg encoding operations.
53

64
https://alfg.github.io/ffmpeg-commander/
75

6+
Check out [docker-ffmpeg](https://github.com/alfg/docker-ffmpeg) for a customized Docker build of FFmpeg.
7+
88
![github pages](https://github.com/alfg/ffmpeg-commander/workflows/github%20pages/badge.svg)
99
[![Build Status](https://travis-ci.org/alfg/ffmpeg-commander.svg?branch=master)](https://travis-ci.org/alfg/ffmpeg-commander)
1010

11-
Check out [docker-ffmpeg](https://github.com/alfg/docker-ffmpeg) for a customized Docker build of FFmpeg.
11+
12+
## Why?
13+
`FFmpeg` has many simple and complex options, which can be intimidating at first. I wanted to create a simple interface for generating common encoding operations for video and audio, inspired by [HandBrake](https://handbrake.fr/).
14+
15+
This tool does NOT cover all options of FFmpeg and some assumptions are made when generating the output. So adjustments may be necessary. Generated options may also vary based on your FFmpeg version and build configuration.
16+
17+
If you feel some options can be improved, feel free to open an issue or pull request.
1218

1319
## Development
1420
`ffmpeg-commander` is built with [Vue.js](https://vuejs.org) and [Bootstrap Vue](https://bootstrap-vue.org/).

src/components/Editor.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ export default {
336336
status: 'queued',
337337
input: inputFile ? inputFile.name : input,
338338
output,
339+
_showDetails: false,
339340
});
340341
this.$emit('onEncode');
341342
},

src/components/Queue.vue

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
</template>
3131

3232
<template v-slot:cell(details)="row">
33-
<b-button size="sm" @click="row.toggleDetails" class="mr-2">
33+
<b-button size="sm" @click="toggleDetails(row.item.id, row.item._showDetails)" class="mr-2">
3434
{{ row.detailsShowing ? 'Hide' : 'Show'}}
3535
</b-button>
3636
</template>
@@ -71,6 +71,21 @@
7171
</div>
7272
</b-col>
7373
</b-row>
74+
75+
<!-- Display error if recieved from message -->
76+
<b-row class="mb-2" v-if="row.item.error">
77+
<b-col sm="2" class="text-sm-right"><b>Error:</b></b-col>
78+
<b-col>
79+
<div class="code">
80+
<b-form-textarea
81+
rows="3"
82+
max-rows="3"
83+
:value="JSON.stringify(row.item.error)"
84+
></b-form-textarea>
85+
</div>
86+
</b-col>
87+
</b-row>
88+
7489
</template>
7590
</b-table>
7691
<h2 class="text-center" v-if="items.length === 0">No Jobs Found</h2>
@@ -126,11 +141,18 @@ export default {
126141
this.percent = data.percent;
127142
this.speed = data.speed;
128143
this.fps = data.fps;
144+
this.err = data.err;
129145
130146
if (this.percent === 100) {
131147
this.setJobStatus(this.job.id, Status.COMPLETED);
132148
store.setIsEncoding(false);
133149
}
150+
151+
if (this.err) {
152+
this.setJobStatus(this.job.id, Status.ERROR);
153+
store.setIsEncoding(false);
154+
storage.set('queue', this.job.id, 'error', this.err);
155+
}
134156
};
135157
this.$ws.conn.onerror = () => {
136158
if (this.job.status !== Status.COMPLETED) {
@@ -164,12 +186,6 @@ export default {
164186
},
165187
getQueue() {
166188
this.items = storage.getAll('queue');
167-
this.items.forEach((o) => {
168-
if (o.status === Status.ENCODING) {
169-
// eslint-disable-next-line no-param-reassign
170-
o._showDetails = true; // eslint-disable-line no-underscore-dangle
171-
}
172-
});
173189
},
174190
getNextJob() {
175191
const filtered = this.items.filter(
@@ -204,6 +220,11 @@ export default {
204220
this.setJobStatus(id, Status.QUEUED);
205221
this.getQueue();
206222
},
223+
toggleDetails(id, enabled) {
224+
// eslint-disable-next-line no-underscore-dangle
225+
storage.toggleDetails('queue', id, !enabled);
226+
this.getQueue();
227+
},
207228
},
208229
};
209230
</script>

src/storage.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ const storage = {
1515
return q.find((item) => item.id === id);
1616
},
1717

18+
set(key, id, k, v) {
19+
const items = storage.getAll(key);
20+
const item = items.find((o) => o.id === id);
21+
item[k] = v;
22+
window.localStorage.setItem(key, JSON.stringify(items));
23+
return item;
24+
},
25+
1826
updateStatus(key, id, value) {
1927
const items = storage.getAll(key);
2028
const item = items.find((o) => o.id === id);
@@ -23,6 +31,14 @@ const storage = {
2331
return item;
2432
},
2533

34+
toggleDetails(key, id, value) {
35+
const items = storage.getAll(key);
36+
const item = items.find((o) => o.id === id);
37+
item._showDetails = value; // eslint-disable-line no-underscore-dangle
38+
window.localStorage.setItem(key, JSON.stringify(items));
39+
return item;
40+
},
41+
2642
deleteAll(key) {
2743
window.localStorage.removeItem(key);
2844
},

0 commit comments

Comments
 (0)