@@ -5,6 +5,7 @@ use std::thread;
5
5
use ansi_term:: Style ;
6
6
use anyhow:: bail;
7
7
use av_scenechange:: decoder:: Decoder ;
8
+ use av_scenechange:: ffmpeg:: FfmpegDecoder ;
8
9
use av_scenechange:: vapoursynth:: VapoursynthDecoder ;
9
10
use av_scenechange:: { detect_scene_changes, DetectionOptions , SceneDetectionSpeed } ;
10
11
use ffmpeg:: format:: Pixel ;
@@ -263,19 +264,23 @@ fn build_decoder(
263
264
let input_pix_format = crate :: ffmpeg:: get_pixel_format ( path. as_ref ( ) )
264
265
. unwrap_or_else ( |e| panic ! ( "FFmpeg failed to get pixel format for input video: {e:?}" ) ) ;
265
266
bit_depth = encoder. get_format_bit_depth ( sc_pix_format. unwrap_or ( input_pix_format) ) ?;
266
- Decoder :: Y4m ( y4m:: Decoder :: new (
267
- Command :: new ( "ffmpeg" )
268
- . args ( [ "-r" , "1" , "-i" ] )
269
- . arg ( path)
270
- . args ( filters. as_ref ( ) )
271
- . args ( [ "-f" , "yuv4mpegpipe" , "-strict" , "-1" , "-" ] )
272
- . stdin ( Stdio :: null ( ) )
273
- . stdout ( Stdio :: piped ( ) )
274
- . stderr ( Stdio :: null ( ) )
275
- . spawn ( ) ?
276
- . stdout
277
- . unwrap ( ) ,
278
- ) ?)
267
+ if !filters. is_empty ( ) {
268
+ Decoder :: Y4m ( y4m:: Decoder :: new (
269
+ Command :: new ( "ffmpeg" )
270
+ . args ( [ "-r" , "1" , "-i" ] )
271
+ . arg ( path)
272
+ . args ( filters. as_ref ( ) )
273
+ . args ( [ "-f" , "yuv4mpegpipe" , "-strict" , "-1" , "-" ] )
274
+ . stdin ( Stdio :: null ( ) )
275
+ . stdout ( Stdio :: piped ( ) )
276
+ . stderr ( Stdio :: null ( ) )
277
+ . spawn ( ) ?
278
+ . stdout
279
+ . unwrap ( ) ,
280
+ ) ?)
281
+ } else {
282
+ Decoder :: Ffmpeg ( FfmpegDecoder :: new ( path) ?)
283
+ }
279
284
}
280
285
} ;
281
286
0 commit comments