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?
Asked
Active
Viewed 1,734 times
0
-
1you 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
-
1if 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 Answers
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
-
I already done this thing but this is not break automatically split into 30 sec i want to create auto segment into 30 sec each with out take too much longer time. is their any way? – Ayaz Qureshi Jan 22 '20 at 15:44
-
1how about this command: ffmpeg -i in.wav -f segment -segment_time 5 -c copy frame-%d.wav – saeed foroughi Jan 22 '20 at 15:48
-
this might help you: https://stackoverflow.com/questions/4725773/ffmpeg-on-android – saeed foroughi Jan 23 '20 at 17:30