@@ -717,20 +717,23 @@ def test__probe__extra_args():
717
717
data = ffmpeg .probe (TEST_INPUT_FILE1 , show_frames = None )
718
718
assert set (data .keys ()) == {'format' , 'streams' , 'frames' }
719
719
720
+
720
721
def get_filter_complex_input (flt , name ):
721
722
m = re .search (r'\[([^]]+)\]{}(?=[[;]|$)' .format (name ), flt )
722
723
if m :
723
724
return m .group (1 )
724
725
else :
725
726
return None
726
727
728
+
727
729
def get_filter_complex_outputs (flt , name ):
728
730
m = re .search (r'(^|[];]){}((\[[^]]+\])+)(?=;|$)' .format (name ), flt )
729
731
if m :
730
732
return m .group (2 )[1 :- 1 ].split ('][' )
731
733
else :
732
734
return None
733
735
736
+
734
737
def test__get_filter_complex_input ():
735
738
assert get_filter_complex_input ("" , "scale" ) is None
736
739
assert get_filter_complex_input ("scale" , "scale" ) is None
@@ -739,6 +742,7 @@ def test__get_filter_complex_input():
739
742
assert get_filter_complex_input ("[s2]scale;etc" , "scale" ) == "s2"
740
743
assert get_filter_complex_input ("[s2]scale[s3][s4];etc" , "scale" ) == "s2"
741
744
745
+
742
746
def test__get_filter_complex_outputs ():
743
747
assert get_filter_complex_outputs ("" , "scale" ) is None
744
748
assert get_filter_complex_outputs ("scale" , "scale" ) is None
@@ -750,17 +754,18 @@ def test__get_filter_complex_outputs():
750
754
assert get_filter_complex_outputs ("[s5]scale[s1];x" , "scale" ) == ['s1' ]
751
755
assert get_filter_complex_outputs ("y;[s5]scale[s1];x" , "scale" ) == ['s1' ]
752
756
757
+
753
758
def 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' ),
760
765
)
761
766
762
767
args = out .get_args ()
763
- flt_cmpl = args [args .index ('-filter_complex' )+ 1 ]
768
+ flt_cmpl = args [args .index ('-filter_complex' ) + 1 ]
764
769
out1 , out2 = get_filter_complex_outputs (flt_cmpl , 'scale2ref' )
765
770
assert out1 == get_filter_complex_input (flt_cmpl , 'scale' )
766
771
assert out2 == get_filter_complex_input (flt_cmpl , 'hflip' )
0 commit comments