@@ -291,23 +291,22 @@ def initialize(
291291 # We also apply the desired pixel format to the video stream,
292292 # as well as set the display aspect ratio to the calculated aspect ratio
293293 # to resolve potential issues with different aspect ratios.
294- stream_filters =
294+ stream_filter_graphs =
295295 h264_presets . each_with_index . map do |h264_preset , index |
296296 fps_filter = Filters . fps ( adjusted_frame_rate ( h264_preset . frame_rate ) )
297+ format_filter = h264_preset . format_filter
297298 scale_filter = h264_preset . scale_filter ( media )
298299 dar_filter = Filters . set_dar ( media . calculated_aspect_ratio ) if media . calculated_aspect_ratio
299- format_filter = Filters . format ( pixel_formats : [ h264_preset . pixel_format ] )
300300
301- Filter . join ( *[
302- fps_filter . with_input_link! ( "v#{ index } " ) ,
303- scale_filter ,
304- dar_filter ,
305- format_filter . with_output_link! ( "v#{ index } out" )
306- ] . compact )
301+ stream_filters = [ fps_filter , format_filter , scale_filter , dar_filter ] . compact
302+ stream_filters . first . with_input_link! ( "v#{ index } " )
303+ stream_filters . last . with_output_link! ( "v#{ index } out" )
304+
305+ Filter . join ( *stream_filters )
307306 end
308307
309308 # Apply the generated filter complex to the output.
310- filter_complex split_filter , *stream_filters
309+ filter_complex split_filter , *stream_filter_graphs
311310
312311 # Force keyframes at the specified interval.
313312 force_key_frames "expr:gte(t,n_forced*#{ preset . keyframe_interval } )"
0 commit comments