@@ -305,13 +305,8 @@ public static String[] extractVideo(String inputPath, String outputPath) {
305305 * @return transform video success or not
306306 */
307307 public static String [] transformVideo (String inputPath , String outputPath ) {
308- //just copy codec
309- // String transformVideoCmd = "ffmpeg -i %s -vcodec copy -acodec copy %s";
310- // assign the frameRate, bitRate and resolution
311- // String transformVideoCmd = "ffmpeg -i %s -r 25 -b 200 -s 1080x720 %s";
312- // assign the encoder
313- // ffmpeg -i %s -vcodec libx264 -acodec libmp3lame %s
314- String transformVideoCmd = "ffmpeg -i -vcodec libx264 -acodec libmp3lame" ;
308+ // preset: ultrafast > superfast > veryfast > fast > medium > slow > veryslow
309+ String transformVideoCmd = "ffmpeg -i -vcodec libx264 -acodec libmp3lame -threads 8 -preset superfast" ;
315310 return insert (transformVideoCmd .split (" " ), 2 , inputPath , outputPath );
316311 }
317312
@@ -339,9 +334,9 @@ public static String[] transformVideoWithEncode(String inputPath, int width, int
339334 String transformVideoCmd ;
340335 if (width > 0 && height > 0 ) {
341336 String scale = "-vf scale=" + width + ":" + height ;
342- transformVideoCmd = "ffmpeg -i -vcodec libx264 -acodec aac " + scale ;
337+ transformVideoCmd = "ffmpeg -i -vcodec libx264 -threads 8 -preset superfast - acodec aac " + scale ;
343338 } else {
344- transformVideoCmd = "ffmpeg -i -vcodec libx264 -acodec aac" ;
339+ transformVideoCmd = "ffmpeg -i -vcodec libx264 -threads 8 -preset superfast - acodec aac" ;
345340 }
346341 return insert (transformVideoCmd .split (" " ), 2 , inputPath , outputPath );
347342 }
@@ -572,7 +567,6 @@ public static String[] multiVideo(String input1, String input2, String outputPat
572567 * @return reverse success or not
573568 */
574569 public static String [] reverseVideo (String inputPath , String outputPath ) {
575- //-vf reverse: only video reverse, -an: disable audio
576570 //tip: reverse will cost a lot of time, only short video are recommended
577571 String reverseVideo = "ffmpeg -i -vf reverse -an" ;
578572 return insert (reverseVideo .split (" " ), 2 , inputPath , outputPath );
0 commit comments