remove command of building flv index

pull/209/head
xufulong 3 years ago
parent 0e4819068c
commit b3b6d66d4a
  1. 22
      app/src/main/java/com/frank/ffmpeg/activity/VideoHandleActivity.kt
  2. 4
      app/src/main/java/com/frank/ffmpeg/util/FFmpegUtil.java
  3. 1
      app/src/main/res/values-en/strings.xml
  4. 1
      app/src/main/res/values/strings.xml

@ -119,7 +119,6 @@ class VideoHandleActivity : BaseActivity() {
getString(R.string.video_pip), getString(R.string.video_pip),
getString(R.string.video_moov), getString(R.string.video_moov),
getString(R.string.video_speed), getString(R.string.video_speed),
getString(R.string.video_flv),
getString(R.string.video_thumbnail), getString(R.string.video_thumbnail),
getString(R.string.video_subtitle), getString(R.string.video_subtitle),
getString(R.string.video_rotate), getString(R.string.video_rotate),
@ -231,7 +230,7 @@ class VideoHandleActivity : BaseActivity() {
} }
} }
} }
5 //Remove logo from video: suppress logo by a simple interpolation 5 //Remove logo from video, or use to mosaic video
-> { -> {
val removeLogoPath = PATH + File.separator + "removeLogo" + suffix val removeLogoPath = PATH + File.separator + "removeLogo" + suffix
val widthL = 64 val widthL = 64
@ -332,40 +331,31 @@ class VideoHandleActivity : BaseActivity() {
val speed = PATH + File.separator + "speed.mp4" val speed = PATH + File.separator + "speed.mp4"
commandLine = FFmpegUtil.changeSpeed(srcFile, speed, 2f, false) commandLine = FFmpegUtil.changeSpeed(srcFile, speed, 2f, false)
} }
15 //rebuild the keyframe index of flv 15 // insert thumbnail into video
-> {
if (!".flv".equals(FileUtil.getFileSuffix(srcFile)!!, ignoreCase = true)) {
Log.e(TAG, "It's not flv file, suffix=" + FileUtil.getFileSuffix(srcFile)!!)
return
}
val outputPath = PATH + File.separator + "frame_index.flv"
commandLine = FFmpegUtil.buildFlvIndex(srcFile, outputPath)
}
16 // insert thumbnail into video
-> { -> {
val thumbnailPath = PATH + File.separator + "thumb.jpg" val thumbnailPath = PATH + File.separator + "thumb.jpg"
val thumbVideoPath = PATH + File.separator + "thumbnailVideo" + suffix val thumbVideoPath = PATH + File.separator + "thumbnailVideo" + suffix
commandLine = FFmpegUtil.insertPicIntoVideo(srcFile, thumbnailPath, thumbVideoPath) commandLine = FFmpegUtil.insertPicIntoVideo(srcFile, thumbnailPath, thumbVideoPath)
} }
17 //add subtitle into video 16 //add subtitle into video
-> { -> {
val subtitlePath = PATH + File.separator + "test.ass" val subtitlePath = PATH + File.separator + "test.ass"
val addSubtitlePath = PATH + File.separator + "subtitle.mkv" val addSubtitlePath = PATH + File.separator + "subtitle.mkv"
commandLine = FFmpegUtil.addSubtitleIntoVideo(srcFile, subtitlePath, addSubtitlePath) commandLine = FFmpegUtil.addSubtitleIntoVideo(srcFile, subtitlePath, addSubtitlePath)
} }
18 // set the rotate degree of video 17 // set the rotate degree of video
-> { -> {
val rotateDegree = 90 val rotateDegree = 90
val addSubtitlePath = PATH + File.separator + "rotate" + rotateDegree + suffix val addSubtitlePath = PATH + File.separator + "rotate" + rotateDegree + suffix
commandLine = FFmpegUtil.rotateVideo(srcFile, rotateDegree, addSubtitlePath) commandLine = FFmpegUtil.rotateVideo(srcFile, rotateDegree, addSubtitlePath)
} }
19 // change the gop(key frame interval) of video 18 // change the gop(key frame interval) of video
-> { -> {
val gop = 30 val gop = 30
val gopPath = PATH + File.separator + "gop" + gop + suffix val gopPath = PATH + File.separator + "gop" + gop + suffix
commandLine = FFmpegUtil.changeGOP(srcFile, gop, gopPath) commandLine = FFmpegUtil.changeGOP(srcFile, gop, gopPath)
} }
20 // change video from RGB to gray 19 // change video from RGB to gray
-> { -> {
val grayPath = PATH + File.separator + "gray" + suffix val grayPath = PATH + File.separator + "gray" + suffix
commandLine = FFmpegUtil.toGrayVideo(srcFile, grayPath) commandLine = FFmpegUtil.toGrayVideo(srcFile, grayPath)

@ -414,7 +414,7 @@ public class FFmpegUtil {
/** /**
* Remove watermark from video: Suppress logo by a simple interpolation of the surrounding pixels. * Remove watermark from video: Suppress logo by a simple interpolation of the surrounding pixels.
* Just set a rectangle covering the logo and watch it disappear * On the other hand, it can be used to mosaic video
* *
* @return delogo cmd * @return delogo cmd
*/ */
@ -631,8 +631,6 @@ public class FFmpegUtil {
* @return probe success or not * @return probe success or not
*/ */
public static String[] probeFormat(String inputPath) { public static String[] probeFormat(String inputPath) {
//show format:ffprobe -i %s -show_format -print_format json
//show stream:ffprobe -i %s -show_streams
String ffprobeCmd = "ffprobe -i %s -show_streams -show_format -print_format json"; String ffprobeCmd = "ffprobe -i %s -show_streams -show_format -print_format json";
ffprobeCmd = String.format(Locale.getDefault(), ffprobeCmd, inputPath); ffprobeCmd = String.format(Locale.getDefault(), ffprobeCmd, inputPath);
return ffprobeCmd.split(" "); return ffprobeCmd.split(" ");

@ -63,7 +63,6 @@
<string name="video_preview">Video preview</string> <string name="video_preview">Video preview</string>
<string name="video_moov">MOOV move ahead</string> <string name="video_moov">MOOV move ahead</string>
<string name="video_speed">Playing speed</string> <string name="video_speed">Playing speed</string>
<string name="video_flv">FLV index</string>
<string name="video_thumbnail">Insert thumbnail</string> <string name="video_thumbnail">Insert thumbnail</string>
<string name="video_subtitle">add subtitle</string> <string name="video_subtitle">add subtitle</string>
<string name="video_gop">KeyFrame interval</string> <string name="video_gop">KeyFrame interval</string>

@ -63,7 +63,6 @@
<string name="video_preview">播放预览</string> <string name="video_preview">播放预览</string>
<string name="video_moov">MOOV前移</string> <string name="video_moov">MOOV前移</string>
<string name="video_speed">播放倍率</string> <string name="video_speed">播放倍率</string>
<string name="video_flv">FLV索引</string>
<string name="video_thumbnail">插入封面</string> <string name="video_thumbnail">插入封面</string>
<string name="video_subtitle">添加字幕</string> <string name="video_subtitle">添加字幕</string>
<string name="video_gop">关键帧间隔</string> <string name="video_gop">关键帧间隔</string>

Loading…
Cancel
Save