@@ -154,37 +154,42 @@ exports.createResolvers = async (
154
154
155
155
// Analyze the resulting video and prepare field return values
156
156
async function processResult ( { publicPath } ) {
157
- const result = await ffmpeg . executeFfprobe ( publicPath )
158
-
159
- const {
160
- format_name : formatName ,
161
- format_long_name : formatLongName ,
162
- start_time : startTime ,
163
- duration : duration ,
164
- size : size ,
165
- bit_rate : bitRate ,
166
- } = result . format
167
-
168
- const { width, height } = result . streams [ 0 ]
169
-
170
- const path = publicPath . replace ( resolve ( rootDir , `public` ) , `` )
171
-
172
- const { name, ext } = parse ( publicPath )
173
-
174
- return {
175
- path,
176
- absolutePath : publicPath ,
177
- name,
178
- ext,
179
- formatName,
180
- formatLongName,
181
- startTime : startTime === `N/A` ? null : startTime ,
182
- duration : duration === `N/A` ? null : duration ,
183
- size : size === `N/A` ? null : size ,
184
- bitRate : bitRate === `N/A` ? null : bitRate ,
185
- width,
186
- height,
187
- aspectRatio : width / height ,
157
+ try {
158
+ const result = await ffmpeg . executeFfprobe ( publicPath )
159
+
160
+ const {
161
+ format_name : formatName ,
162
+ format_long_name : formatLongName ,
163
+ start_time : startTime ,
164
+ duration : duration ,
165
+ size : size ,
166
+ bit_rate : bitRate ,
167
+ } = result . format
168
+
169
+ const { width, height } = result . streams [ 0 ]
170
+
171
+ const path = publicPath . replace ( resolve ( rootDir , `public` ) , `` )
172
+
173
+ const { name, ext } = parse ( publicPath )
174
+
175
+ return {
176
+ path,
177
+ absolutePath : publicPath ,
178
+ name,
179
+ ext,
180
+ formatName,
181
+ formatLongName,
182
+ startTime : startTime === `N/A` ? null : startTime ,
183
+ duration : duration === `N/A` ? null : duration ,
184
+ size : size === `N/A` ? null : size ,
185
+ bitRate : bitRate === `N/A` ? null : bitRate ,
186
+ width,
187
+ height,
188
+ aspectRatio : width / height ,
189
+ }
190
+ } catch ( err ) {
191
+ reporter . error ( `Unable to analyze video file: ${ publicPath } ` )
192
+ throw err
188
193
}
189
194
}
190
195
0 commit comments