From 18c948ad635d4678c009764d5513c493439d7106 Mon Sep 17 00:00:00 2001 From: xufulong <839789740@qq.com> Date: Wed, 15 Jan 2020 00:34:58 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=86=E9=A2=91=E8=BD=AC=E7=A0=81=EF=BC=9A?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E9=83=A8=E5=88=86=E8=A7=86=E9=A2=91=E5=8F=91?= =?UTF-8?q?=E7=94=9F=E6=97=8B=E8=BD=AC=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 视频转码:解决部分视频发生旋转问题 --- .../java/com/frank/ffmpeg/activity/VideoHandleActivity.java | 2 +- app/src/main/java/com/frank/ffmpeg/util/FFmpegUtil.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/frank/ffmpeg/activity/VideoHandleActivity.java b/app/src/main/java/com/frank/ffmpeg/activity/VideoHandleActivity.java index e054820..468113d 100644 --- a/app/src/main/java/com/frank/ffmpeg/activity/VideoHandleActivity.java +++ b/app/src/main/java/com/frank/ffmpeg/activity/VideoHandleActivity.java @@ -119,7 +119,7 @@ public class VideoHandleActivity extends BaseActivity { } switch (viewId) { case R.id.btn_video_transform://视频转码:mp4转flv、wmv, 或者flv、wmv转Mp4 - String transformVideo = PATH + File.separator + "transformVideo.flv"; + String transformVideo = PATH + File.separator + "transformVideo.mp4"; commandLine = FFmpegUtil.transformVideo(srcFile, transformVideo); break; case R.id.btn_video_cut://视频剪切 diff --git a/app/src/main/java/com/frank/ffmpeg/util/FFmpegUtil.java b/app/src/main/java/com/frank/ffmpeg/util/FFmpegUtil.java index 1ff40fa..c1ad06e 100644 --- a/app/src/main/java/com/frank/ffmpeg/util/FFmpegUtil.java +++ b/app/src/main/java/com/frank/ffmpeg/util/FFmpegUtil.java @@ -137,8 +137,10 @@ public class FFmpegUtil { * @return 转码后的文件 */ 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 -vcodec libx264 -acodec copy %s"; String transformVideoCmd = "ffmpeg -i %s -vcodec copy -acodec copy %s"; transformVideoCmd = String.format(transformVideoCmd, srcFile, targetFile); return transformVideoCmd.split(" ");