0

I want to trim video into 30 seconds multiple segments in android studio.I have used the following command to trim video into 30 seconds but this is not the way i want,its just trimming video into 30 sec.Is there any FFmpeg command available to split video into multiple segments in android studio of specific duration like 30 secs?

  • 1
    you forgot to add the command you use here! – saeed foroughi Jan 22 '20 at 15:02
  • command = new String[]{"-ss", "" + starttime, "-y", "-i", original_path, "-t", "" +30 , "-s", "320x240", "-r", "15", "-vcodec", "mpeg4", "-b:v", "2097152", "-b:a", "48000", "-ac", "2", "-ar", "22050", dest.getAbsolutePath()}; using this command only just trim rather than split video. – Ayaz Qureshi Jan 22 '20 at 15:37
  • i want to split video in multiple segments like 0-30,31-60,61-90 sec and so on. – Ayaz Qureshi Jan 22 '20 at 15:38
  • 1
    if you edit your question and add this to it that will help you to get better answers :). also if you provide the code that you use to run this command, it would be great :) – saeed foroughi Jan 22 '20 at 15:39

1 Answers1

1

you can use this linux command in android:

ffmpeg -i source-file.foo -ss 0 -t 30 first-30-sec.m4v
ffmpeg -i source-file.foo -ss 30 -t 60 first-30-sec.m4v
...

with this you extract two parts one from second 0 to 30, and the other from 30 to 60. you can modify it as your need, like put it in a for or change the start and end seconds:

ffmpeg -i [source-file-address] -ss [start second] -t [end second] [output-file-name]
saeed foroughi
  • 1,662
  • 1
  • 13
  • 25