@@ -116,7 +116,13 @@ private static String printEncoderError(String result) {
116116 String [] errorSplit = result .split ("Error" );
117117 if (errorSplit .length > 1 ) {
118118 return " Error" + errorSplit [1 ];
119- }else return result ;
119+ }else {
120+ return " " + result ;
121+ }
122+ }
123+
124+ private static boolean actualError (String result ) {
125+ return result .contains ("Error" ) || result .contains ("error" ) || result .contains ("unsupported" );
120126 }
121127
122128 public static void checkEncoders () {
@@ -127,30 +133,39 @@ public static void checkEncoders() {
127133 System .out .println ("Expecting libx264" );
128134 System .out .println ("Expecting libvpx_vp9" );
129135 try {
130- // System.out.println("Checking for h264_nvenc...");
131136 Process hwaccel = StreamedCommand .runCommand ("ffmpeg -i resources/videoResources/enCheck.webm -c:v h264_nvenc -frames 1 -f null NUL" );
132137 String result = StreamedCommand .returnErrorString (hwaccel , 2 );
133138 if (result .equals ("" )) {
134139 AVAILABLE_ENCODERS .add (Encoders .h264_nvenc );
135140 System .out .println ("Found h264_nvenc" );
141+ }else if (!actualError (result )){
142+ System .out .println ("Unable to determine if h264_nvenc is available.\n Assuming h264_nvenc is available: "
143+ + printEncoderError (result ));
144+ AVAILABLE_ENCODERS .add (Encoders .h264_nvenc );
136145 } else {
137146 System .out .println ("Failed to find h264_nvenc:" + printEncoderError (result ));
138147 }
139- // System.out.println("Checking for h264_amf...");
140148 hwaccel = StreamedCommand .runCommand ("ffmpeg -i resources/videoResources/enCheck.webm -c:v h264_amf -frames 1 -f null NUL" );
141149 result = StreamedCommand .returnErrorString (hwaccel , 2 );
142150 if (result .equals ("" )) {
143151 AVAILABLE_ENCODERS .add (Encoders .h264_amf );
144152 System .out .println ("Found h264_amf" );
153+ } else if (!actualError (result )){
154+ System .out .println ("Unable to determine if h264_amf is available.\n Assuming h264_amf is available: "
155+ + printEncoderError (result ));
156+ AVAILABLE_ENCODERS .add (Encoders .h264_amf );
145157 } else {
146158 System .out .println ("Failed to find h264_amf:" + printEncoderError (result ));
147159 }
148- // System.out.println("Checking for h264_qsv...");
149160 hwaccel = StreamedCommand .runCommand ("ffmpeg -i resources/videoResources/enCheck.webm -c:v h264_qsv -frames 1 -f null NUL" );
150161 result = StreamedCommand .returnErrorString (hwaccel , 2 );
151162 if (result .equals ("" )) {
152163 AVAILABLE_ENCODERS .add (Encoders .h264_qsv );
153164 System .out .println ("Found h264_qsv" );
165+ } else if (!actualError (result )){
166+ System .out .println ("Unable to determine if h264_qsv is available.\n Assuming h264_qsv is available\n "
167+ + printEncoderError (result ));
168+ AVAILABLE_ENCODERS .add (Encoders .h264_qsv );
154169 } else {
155170 System .out .println ("Failed to find h264_qsv:" + printEncoderError (result ));
156171 }
0 commit comments