Range selector / range seekbar to trim video including thumbnails [closed]
Asked Answered
C

8

18

enter image description here

I am looking for a library or open source project that provides UI for trimming videos as you see in the screenshot. Including

  • Range selector with ability to increase, decrease and move the selection
  • Thumbnails
  • Current position of playback

Just the UI not the trimming itself.

If there is no ready solution available, then I'd like to now how to combine existing UI elements in a smart manner to achieve this or something similiar.

Here is what I finally implemented: Range selector / range seekbar to trim video including thumbnails

Ceyx answered 13/4, 2016 at 12:36 Comment(3)
I always appreciate downvotes without comment.Ceyx
you can use trimmer open source (github.com/uday-rayala/video-trimmer) which uses ffmpeg lib for video processing and it is best option for video editingFalzetta
I have tried it. It's not very stable.Ceyx
D
4

I think this library will fit your needs.

VideoTrimmer

Dramatize answered 26/8, 2016 at 14:27 Comment(4)
I installed the demo from android-arsenal.com/details/1/3714 and I think you are right. Great! The lib also includes the mp4 trimmer! But unfortunately too late for my project ;(Ceyx
@NikitaAxyonov can you help me for this question #48801658 please.Brainstorming
@Brainstorming , I am also stuck at showing the time frame of video being trimmed, have you found any solution with the Library mentioned in the answer ?Sculpturesque
@Sculpturesque try this github.com/a914-gowtham/Android-video-trimmer library.it supports on android 10 as wellBillhead
D
15

I couldn't find a specific library, but you could use the MediaMetadataRetriever to get the frames for the video specifying the exact time of the frame.

MediaMetadataRetriever retriever = new MediaMetadataRetriever();
retriever.setDataSource(videoFile.getAbsolutePath());
Bitmap bitmap = retriever.getFrameAtTime(timeInMiliSeconds * 1000,
                MediaMetadataRetriever.OPTION_CLOSEST_SYNC);

I hope this helps you.

Doit answered 21/4, 2016 at 21:1 Comment(0)
S
14

You can get the UI from TELEGRAM (messaging app) source code available at GitHub https://github.com/DrKLO/Telegram

Activity: VideoEditorActivity.java (https://github.com/DrKLO/Telegram/blob/master/TMessagesProj/src/main/java/org/telegram/ui/VideoEditorActivity.java)

Layout: video_editor_layout.xml (https://github.com/DrKLO/Telegram/blob/master/TMessagesProj/src/main/res/layout/video_editor_layout.xml)

They have implemented their custom UI components VideoSeekBarView and VideoTimelineView.

VideoSeekBarView (https://github.com/DrKLO/Telegram/blob/master/TMessagesProj/src/main/java/org/telegram/ui/Components/VideoSeekBarView.java)

VideoTimelineView (https://github.com/DrKLO/Telegram/blob/master/TMessagesProj/src/main/java/org/telegram/ui/Components/VideoTimelineView.java)

Attached is the Telegram VideoEditorActivity enter image description here

Suborn answered 22/4, 2016 at 5:47 Comment(7)
Great screenshot! But GPL license ;( ;( ;(Ceyx
this is the most promising solution. however, Due to the license I can't use it. If I'd try to get some ideas I'd probably and up copying the code;) I probably would reward the answer if the license would not be that strict.Ceyx
@Ceyx did you find any solution for this ? It'd be great help I am searching for same :)Coachwhip
@Coachwhip Hi! I initially thought about extracting the player code of the Telegram project into another app under GPL license and add some Intents that other apps could broadcast to pass a video for trimming. However, meanwhile I created my own video trim activity using github.com/oli107/material-range-bar. I dropped the requirement of thumbnails. It was still a lot of work! So, you could raise yourself a monument and go the way I initially planned and share it on github.Ceyx
@Ceyx Thanks for your reply, I have completed trimming functionality using seekbar, It woks fine. I just need UI like above or something similar to whats app or instagram if you have any suggestion/idea else If I'll find anything will update you :)Coachwhip
Not sure what classes you are refering to and if you comply to their license.Ceyx
@SagarHudge Hope this helps , just foundCoachwhip
D
4

I think this library will fit your needs.

VideoTrimmer

Dramatize answered 26/8, 2016 at 14:27 Comment(4)
I installed the demo from android-arsenal.com/details/1/3714 and I think you are right. Great! The lib also includes the mp4 trimmer! But unfortunately too late for my project ;(Ceyx
@NikitaAxyonov can you help me for this question #48801658 please.Brainstorming
@Brainstorming , I am also stuck at showing the time frame of video being trimmed, have you found any solution with the Library mentioned in the answer ?Sculpturesque
@Sculpturesque try this github.com/a914-gowtham/Android-video-trimmer library.it supports on android 10 as wellBillhead
G
2

I searched a lot for something similar without success. At the end I decided to stop the development of this feature.

But today, I found this HERE. I don't know if it's ok.

desc

range selector

enter image description here

Current play position travels on the rangeselector after user clicked "play". However, you can't move play position.

Another possibility is to read the source code of the official Android's application. I know that you are searching a library, but this can be another solution, and if you'll understand the google sourcecode you'll able to achieve the same quality of the Gallery application by Google.

Look here (Trim*.java classes): https://android.googlesource.com/platform/packages/apps/Gallery2/+/android-6.0.1_r31/src/com/android/gallery3d/app/

Sorry man, probably there isn't any opensource library to do that. I hope that this two links could be useful for you.

Gow answered 16/4, 2016 at 12:48 Comment(1)
tried it. worked OK. a little unstable. can't choose play position.Ceyx
B
2

Try the following example on Git to trime video like whatsapp .

this solution I have tried it's working perfectly this example includes the custom RangeSeekBarView , custom ProgressBarViewwith seekbar where you can select the video range of video you want trime and save to the destination

VideoTrimming Like Whatsapp

Brainstorming answered 14/2, 2018 at 9:37 Comment(4)
I'm not working on that feature anymore. But it's probably worth looking at for other users!Ceyx
@Ceyx I need help for this example ,I want to select maximum of 30s from total duration but I am not able to figure out this please help if you have any idea any help will be accepted..plaseBrainstorming
@Brainstorming are you serious? )) Just ask a new question or ask the author of the lib.Ceyx
need some update for saving video, then it should workHedgepeth
F
1

FFMPEG is best option if you are facing problem to compile ffmpeg use this link https://github.com/WritingMinds/ffmpeg-android and follow commands from https://github.com/antpersan/CutVideoAndroid and for range Seekbar https://github.com/anothem/android-range-seek-bar or use shanrais suggested VideoSeekBarView

Falzetta answered 22/4, 2016 at 9:27 Comment(1)
I don't look for trimming itselft. Just the UI. I already found a 2 thumbs rangebar for myself that works fine.Ceyx
S
1

Media-for-mobile

Video processing Library

Functions

  • Transcode video
  • Join Video
  • Cut Video
  • Video Effect
  • Audio Effect
  • Get Media File Info
  • Time Scaling
  • List item

You can use its function by customizing your interface.

Shaun answered 22/4, 2016 at 13:2 Comment(0)
S
0

thank you all for your help, i think to do that with c++ native code, i am not a professional on it, but still the best way to dealing with the UI especially when we have to create a professional timeline, for confirmation, the ffmpeg is one of the best libraries https://github.com/tanersener/mobile-ffmpeg to edit videos on android,

Sylviasylviculture answered 19/5, 2020 at 23:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.