|
|
|
@ -305,13 +305,8 @@ public class FFmpegUtil { |
|
|
|
|
* @return transform video success or not |
|
|
|
|
*/ |
|
|
|
|
public static String[] transformVideo(String inputPath, String outputPath) { |
|
|
|
|
//just copy codec
|
|
|
|
|
// String transformVideoCmd = "ffmpeg -i %s -vcodec copy -acodec copy %s";
|
|
|
|
|
// assign the frameRate, bitRate and resolution
|
|
|
|
|
// String transformVideoCmd = "ffmpeg -i %s -r 25 -b 200 -s 1080x720 %s";
|
|
|
|
|
// assign the encoder
|
|
|
|
|
// ffmpeg -i %s -vcodec libx264 -acodec libmp3lame %s
|
|
|
|
|
String transformVideoCmd = "ffmpeg -i -vcodec libx264 -acodec libmp3lame"; |
|
|
|
|
// preset: ultrafast > superfast > veryfast > fast > medium > slow > veryslow
|
|
|
|
|
String transformVideoCmd = "ffmpeg -i -vcodec libx264 -acodec libmp3lame -threads 8 -preset superfast"; |
|
|
|
|
return insert(transformVideoCmd.split(" "), 2, inputPath, outputPath); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -339,9 +334,9 @@ public class FFmpegUtil { |
|
|
|
|
String transformVideoCmd; |
|
|
|
|
if (width > 0 && height > 0) { |
|
|
|
|
String scale = "-vf scale=" + width + ":" + height; |
|
|
|
|
transformVideoCmd = "ffmpeg -i -vcodec libx264 -acodec aac " + scale; |
|
|
|
|
transformVideoCmd = "ffmpeg -i -vcodec libx264 -threads 8 -preset superfast -acodec aac " + scale; |
|
|
|
|
} else { |
|
|
|
|
transformVideoCmd = "ffmpeg -i -vcodec libx264 -acodec aac"; |
|
|
|
|
transformVideoCmd = "ffmpeg -i -vcodec libx264 -threads 8 -preset superfast -acodec aac"; |
|
|
|
|
} |
|
|
|
|
return insert(transformVideoCmd.split(" "), 2, inputPath, outputPath); |
|
|
|
|
} |
|
|
|
@ -572,7 +567,6 @@ public class FFmpegUtil { |
|
|
|
|
* @return reverse success or not |
|
|
|
|
*/ |
|
|
|
|
public static String[] reverseVideo(String inputPath, String outputPath) { |
|
|
|
|
//-vf reverse: only video reverse, -an: disable audio
|
|
|
|
|
//tip: reverse will cost a lot of time, only short video are recommended
|
|
|
|
|
String reverseVideo = "ffmpeg -i -vf reverse -an"; |
|
|
|
|
return insert(reverseVideo.split(" "), 2, inputPath, outputPath); |
|
|
|
|