Is there a way to step through a video file frame by frame? I've tried using a VideoView and I've had minor success. I can get the video the step through key frames but not individual frames. I figured this would be the default settings, especially with the way video compression works. Is there a way to override this default behavior or a configuration I can change?
Video Frame by Frame seeking
Asked Answered
The default behaviour in stagefright media framework is always to seek to key frame. (As opposed to the earlier framework's - opencore whose default seeking behaviour was to seek to time.)
You cannot do frame by frame seeking by using the MediaPlayer API's provided by Android.
If you really want implement frame by frame seeking then you will have to use a 3rd party multimedia framework like FFMPEG or you will need to implement your own.
I guess I will implement my own and share it. –
Chastity
Yeah I ran into this problem too with video cameras and showing and frames when processing objects on screan, eventually we went to MJPG since we had tighter control of time and framerates. –
Quetzalcoatl
What if I record the video in such a way, that every frame is a key frame ? ;) –
Chosen
Unless you are writing your own encoder then its not possible, plus it defeats the whole purpose of encoding a video file, you might as well just zip the raw video frames! –
Plebs
Have you looked at MediaMetadataRetriever ? There you can use getFrameAtTime(long timeUs, int option)
and return a Bitmap
.
Depending of the use, maybe it's what you need.
I'll have to give it a try. Will only work for local media (not url based media) but it's a step in the right direction if it works. –
Chastity
In case you didn't know yet MediaPlayer Sourcecode .
getFrameAt
is unused and deprecated. It's a good source to watch the MediaPlayer implementation. As Ravi said: you may implement your own. –
Walli In my experience
getFrameAtTime(long timeUs, int option)
performs very poorly. I have not found a solution myself, but this does not seem like it. –
Velites © 2022 - 2024 — McMap. All rights reserved.