Search code examples
androidvideoffmpegtrim

Is their any way to split video into multiple segment using ffmpeg in android?


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?


Solution

  • 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]