其实我想从特定的时间剪切视频 这是我的下面的代码:
String args[] = new String[] {
"ffmpeg",
"-y",
"-ss",
"[start]"+start,// set start time in second
"-t",
"[duration]"+duration,// set duration in second
"-i",
Environment.getExternalStorageDirectory().getAbsoluteFile()//Curent Video path
+ SquareVideoPath1,
"-filter_complex",
"scale=item", // set widthxwidth, option
// 320x320,440x440,640x640(For
// Instagram),720x720, 1020x120
"-strict",
"experimental",
Environment.getExternalStorageDirectory().getAbsoluteFile()//Video Output path
+ "/tomp3/water2.mp4" +outputFilePath };
clsffmpeg.ffmpeg(args);
但问题是如何将开始时间和时间用于此。
答案 0 :(得分:-1)
我认为video trimmer code可以解决您的问题
修改强>
看看函数Java_net_video_trimmer_natives_VideoTrimmer_trim()
中的video-trimmer.c,你会发现它很有用(显示ffmpeg参数)。
<强>更新强>
String args[] = new String[] { "ffmpeg"
, "-i"
, inputFilePath
, "-ss"
, startTime
, "-t"
, duration
, "-vcodec"
,"copy"
, "-acodec"
, "copy"
, outputFilePath };
将inputFilePath
,startTime
,duration
,outputFilePath
替换为适当的值。