'Trim/cut video file in android
I want to extract some portion of video when user is playing that video via my application. While playing a video user can give start and end duration to cut the video. so are there any way to cut the video based on duration and save to sd card ?
Solution 1:[1]
You may try to compile and integrate ffmpeg into your project. I used ffmpeg to cut video and audio, is very fast, no recording needed. I've NO experience on doing it on android, but It should work. Here you have the official wiki page about ffmpeg on android:
https://ffmpeg.org/trac/ffmpeg/wiki/How%20to%20compile%20FFmpeg%20for%20Android
Solution 2:[2]
Android uses Mp4Parser/isoParser for Trimming Videos here is the example to trim the video https://android.googlesource.com/platform/packages/apps/Gallery2/+/android-4.4.2_r2/src/com/android/gallery3d/app/TrimVideo.java and as mentioned he usees isoParser which u can get it from "git clone https://android.googlesource.com/platform/external/mp4parser"
Solution 3:[3]
I think that can be done using MP4Parser its purely written in java and can be used with android and also here is an example of doing video shorten in java By Sebastian-annies
Solution 4:[4]
Use this Android-video_trimmer library.it supports Android 10 as well
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | OriolJ |
| Solution 2 | surya |
| Solution 3 | |
| Solution 4 | gowtham6672 |
