@@ -717,20 +717,23 @@ def test__probe__extra_args():
717717 data = ffmpeg .probe (TEST_INPUT_FILE1 , show_frames = None )
718718 assert set (data .keys ()) == {'format' , 'streams' , 'frames' }
719719
720+
720721def get_filter_complex_input (flt , name ):
721722 m = re .search (r'\[([^]]+)\]{}(?=[[;]|$)' .format (name ), flt )
722723 if m :
723724 return m .group (1 )
724725 else :
725726 return None
726727
728+
727729def get_filter_complex_outputs (flt , name ):
728730 m = re .search (r'(^|[];]){}((\[[^]]+\])+)(?=;|$)' .format (name ), flt )
729731 if m :
730732 return m .group (2 )[1 :- 1 ].split ('][' )
731733 else :
732734 return None
733735
736+
734737def test__get_filter_complex_input ():
735738 assert get_filter_complex_input ("" , "scale" ) is None
736739 assert get_filter_complex_input ("scale" , "scale" ) is None
@@ -739,6 +742,7 @@ def test__get_filter_complex_input():
739742 assert get_filter_complex_input ("[s2]scale;etc" , "scale" ) == "s2"
740743 assert get_filter_complex_input ("[s2]scale[s3][s4];etc" , "scale" ) == "s2"
741744
745+
742746def test__get_filter_complex_outputs ():
743747 assert get_filter_complex_outputs ("" , "scale" ) is None
744748 assert get_filter_complex_outputs ("scale" , "scale" ) is None
@@ -750,17 +754,18 @@ def test__get_filter_complex_outputs():
750754 assert get_filter_complex_outputs ("[s5]scale[s1];x" , "scale" ) == ['s1' ]
751755 assert get_filter_complex_outputs ("y;[s5]scale[s1];x" , "scale" ) == ['s1' ]
752756
757+
753758def test__multi_output_edge_label_order ():
754- scale2ref = ffmpeg .filter_multi_output ([ ffmpeg . input ( 'x' ), ffmpeg . input ( 'y' )], 'scale2ref' )
755- out = (
756- ffmpeg . merge_outputs (
757- scale2ref [ 1 ]. filter ( 'scale' ). output ( 'a' ),
758- scale2ref [10000 ].filter ('hflip ' ).output ('b' )
759- )
759+ scale2ref = ffmpeg .filter_multi_output (
760+ [ ffmpeg . input ( 'x' ), ffmpeg . input ( 'y' )], 'scale2ref'
761+ )
762+ out = ffmpeg . merge_outputs (
763+ scale2ref [1 ].filter ('scale ' ).output ('a' ),
764+ scale2ref [ 10000 ]. filter ( 'hflip' ). output ( 'b' ),
760765 )
761766
762767 args = out .get_args ()
763- flt_cmpl = args [args .index ('-filter_complex' )+ 1 ]
768+ flt_cmpl = args [args .index ('-filter_complex' ) + 1 ]
764769 out1 , out2 = get_filter_complex_outputs (flt_cmpl , 'scale2ref' )
765770 assert out1 == get_filter_complex_input (flt_cmpl , 'scale' )
766771 assert out2 == get_filter_complex_input (flt_cmpl , 'hflip' )
0 commit comments