@@ -282,8 +282,8 @@ function useSegments({ filePath, workingRef, setWorking, setCutProgress, videoSt
282
282
const { mode, startOrEnd } = response ;
283
283
284
284
if ( filePath == null ) throw new Error ( ) ;
285
- const frameTime = 1 / ( getStreamFps ( videoStream ) || 1000 ) ;
286
- const duration = await getDuration ( filePath ) ;
285
+ const frameTime = 1 / ( getStreamFps ( videoStream ) || 1000 ) ;
286
+ const duration = await getDuration ( filePath ) ;
287
287
288
288
await modifySelectedSegmentTimes ( async ( segment ) => {
289
289
const newSegment = { ...segment } ;
@@ -292,34 +292,34 @@ function useSegments({ filePath, workingRef, setWorking, setCutProgress, videoSt
292
292
const time = newSegment [ key ] ;
293
293
if ( filePath == null ) throw new Error ( ) ;
294
294
let keyframe = await findKeyframeNearTime ( { filePath, streamIndex : videoStream . index , time, mode } ) ;
295
- if ( keyframe == null ) {
296
- if ( mode != 'consistent' ) {
295
+ if ( keyframe == null ) {
296
+ if ( mode != 'consistent' ) {
297
297
throw new Error ( `Cannot find any keyframe within 60 seconds of frame ${ time } ` ) ;
298
298
}
299
- keyframe = duration ;
300
- }
299
+ keyframe = duration ;
300
+ }
301
301
newSegment [ key ] = keyframe ;
302
302
}
303
- if ( startOrEnd . includes ( 'start' ) ) {
304
- if ( mode == 'consistent' ) {
305
- newSegment . start += frameTime * 0.3 ;
303
+ if ( startOrEnd . includes ( 'start' ) ) {
304
+ if ( mode == 'consistent' ) {
305
+ newSegment . start += frameTime * 0.3 ;
306
306
}
307
307
await align ( 'start' ) ;
308
- if ( mode == 'consistent' ) {
309
- newSegment . start -= frameTime * 0.7 ;
308
+ if ( mode == 'consistent' ) {
309
+ newSegment . start -= frameTime * 0.7 ;
310
310
}
311
- }
311
+ }
312
312
if ( startOrEnd . includes ( 'end' ) ) {
313
313
await align ( 'end' ) ;
314
- if ( mode == 'consistent' && newSegment . end != duration ) {
315
- newSegment . end -= frameTime * 0.3 ;
314
+ if ( mode == 'consistent' && newSegment . end != duration ) {
315
+ newSegment . end -= frameTime * 0.3 ;
316
316
}
317
317
}
318
- if ( startOrEnd . includes ( 'start' ) ) {
319
- newSegment . start = Math . min ( newSegment . start , newSegment . end - frameTime * 0.99 ) ; //don't know how ffmpeg interprets cuts between frames
318
+ if ( startOrEnd . includes ( 'start' ) ) {
319
+ newSegment . start = Math . min ( newSegment . start , newSegment . end - frameTime * 0.99 ) ; //don't know how ffmpeg interprets cuts between frames
320
320
}
321
321
else {
322
- newSegment . end = Math . max ( newSegment . start + frameTime * 0.99 , newSegment . end ) ;
322
+ newSegment . end = Math . max ( newSegment . start + frameTime * 0.99 , newSegment . end ) ;
323
323
}
324
324
325
325
0 commit comments