wysaid / android-gpuimage-plus

Android Image & Camera Filters Based on OpenGL.
MIT License
1.81k stars 475 forks source link

Record Video with high speed and slow speed #210

Open developerandroid123 opened 7 years ago

developerandroid123 commented 7 years ago

How to make 2 times faster and 2 times slower video while recording? Please help

developerandroid123 commented 7 years ago

Is there anyone to help me?

WyJong commented 7 years ago

I think you should handle it after record use FFmpeg.

https://trac.ffmpeg.org/wiki/How%20to%20speed%20up%20/%20slow%20down%20a%20video

developerandroid123 commented 7 years ago

Thanks for response : But I want it at realtime . i want to change the speed setting like fps or anything else that can change the speed of recorded video . @wysaid please give me your suggestions on this How to make 2 times faster and 2 times slower video while recording?

wysaid commented 7 years ago

Change this line from

int newPTS = round(decodeHandler->getCurrentTimestamp() / 1000.0 * ENCODE_FPS);

To

int newPTS = round(decodeHandler->getCurrentTimestamp() / 1000.0 ENCODE_FPS) 2.0;

Will make it 2 times slower. And change 2.0 to 0.5 will make it 2 times faster.

wysaid commented 7 years ago

But it's an after-recording operation. You can also add such multiply operation on pts when recording.

developerandroid123 commented 7 years ago

If i do same as you told above Then by changing int newPTS = round(decodeHandler->getCurrentTimestamp() / 1000.0 ENCODE_FPS) 2.0; Resultant video Will become 2 times slower??

developerandroid123 commented 7 years ago

I have changes as you told me in my code Then there is no change in resultant video

developerandroid123 commented 7 years ago

please suggest me any setting Which i can make before start recording Then that change will be reflected in output video @wysaid

wysaid commented 7 years ago

Change here: https://github.com/wysaid/android-gpuimage-plus/blob/master/library/src/main/jni/interface/cgeFrameRecorder.cpp#L281 And rebuild the JNI module.

developerandroid123 commented 7 years ago

if i do change here then how can i change at realtime in camera setting This is not userFriendly for users

wysaid commented 7 years ago

So why can't you make the multiply factor as a variable and can be set by some function? Please learn more about programming skills.

developerandroid123 commented 7 years ago

let me try

developerandroid123 commented 7 years ago

I have achieved what i want Now When i am speeding up video then 10 seconds videos played for 5 seconds and for other 5 seconds last frame is displaying

wysaid commented 7 years ago

Print the pts in console, and see if there're strange pts

wysaid commented 7 years ago

Your problem is that your audio is not at the same speed with the video, please mute the audio.

singhsegv commented 6 years ago

Hey @wysaid , Can you suggest how to go about slowing down and speeding up the audio along with the video ?

wysaid commented 6 years ago

@rajdeep1008 You may need remuxing & resample. I'm not very good at that. You may learn that from ffmpeg document...

singhsegv commented 6 years ago

@wysaid Can you point out which classes or files should be the ones i should be tinkering around ?

wysaid commented 6 years ago

@rajdeep1008 I think real time speed changing is not necessary, you can just record the origin video, and do it later. For example, save the video cut as 1.mp4 and mark as 0.5x, and go on recording the video as 2.mp4 at 2.0x. When finishing the recording, combine them together with specified argument using ffmpeg command