修复视频转码出现马赛克问题

修复视频转码出现马赛克问题
pull/107/head
frank 7 years ago
parent bc864c5e2f
commit d1ea481265
  1. 4
      app/src/main/java/com/frank/ffmpeg/activity/VideoHandleActivity.java
  2. 3
      app/src/main/java/com/frank/ffmpeg/util/FFmpegUtil.java

@ -138,8 +138,8 @@ public class VideoHandleActivity extends AppCompatActivity implements View.OnCli
private void doHandleVideo(int handleType){ private void doHandleVideo(int handleType){
String[] commandLine = null; String[] commandLine = null;
switch (handleType){ switch (handleType){
case 0://视频转码 case 0://视频转码:mp4转flv、wmv, 或者flv、wmv转Mp4
String transformVideo = PATH + File.separator + "transformVideo.wmv"; String transformVideo = PATH + File.separator + "transformVideo.flv";
commandLine = FFmpegUtil.transformVideo(srcFile, transformVideo); commandLine = FFmpegUtil.transformVideo(srcFile, transformVideo);
break; break;
case 1://视频剪切 case 1://视频剪切

@ -115,8 +115,9 @@ public class FFmpegUtil {
* @return 转码后的文件 * @return 转码后的文件
*/ */
public static String[] transformVideo(String srcFile, String targetFile){ public static String[] transformVideo(String srcFile, String targetFile){
//指定目标视频的帧率、码率、分辨率
// String transformVideoCmd = "ffmpeg -i %s -r 25 -b 200 -s 1080x720 %s"; // String transformVideoCmd = "ffmpeg -i %s -r 25 -b 200 -s 1080x720 %s";
String transformVideoCmd = "ffmpeg -i %s %s"; String transformVideoCmd = "ffmpeg -i %s -vcodec copy -acodec copy %s";
transformVideoCmd = String.format(transformVideoCmd, srcFile, targetFile); transformVideoCmd = String.format(transformVideoCmd, srcFile, targetFile);
return transformVideoCmd.split(" ");//以空格分割为字符串数组 return transformVideoCmd.split(" ");//以空格分割为字符串数组
} }

Loading…
Cancel
Save