-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using FFmpegFrameRecorder to merge multiple MP4 videos with different frame rates! #394
Comments
Try to call |
FYI, there's an example of this here: |
Thanks @saudet, setTimestamp() solved the problem! |
I have the same problem merge output video is slow down, have same frame rate with each video file `@SuppressWarnings("resource")
|
@DsrMedia how to solve your problem |
@holmes1491 Since all your files have the same frame rate, try to use packets instead, as shown here: |
thanks for the reply i will try this one and let you know... |
below my code `
` ` also explain what is significant of RECORD_LENGTH and how it gonna work with merge videos |
for first message rest of two i have no idea... |
The code for grabbing and recording packets uses deprecated functions, and it needs to be updated, see issue #818. If the current code doesn't work for you, feel free to fix it and send a pull request! If you have any questions regarding that, please post on that thread. RECORD_LENGTH is whatever you want. Remove it if you don't need it. |
sure!!! I have to bcoz I have a project related to video processing But as you suggested above FFmpegFrameRecorder.setTimestamp() gonna help and @DsrMedia also solve his problem please help me with this... Here is my output video (slow motion) link i have four video length of 0:19 so merged video length around 1:20 |
thanks for your support I succeed in merging video what I do is pick a file dynamically which I do hard-coded earlier but still i got slow issue [4 file = duration 0.19 || output file = duration 1.19 which must be 1.16] just want to you look into it once Below code work perfectaly fine for me
can you sugegest me if i miss something... |
@holmes1491 It looks like the problem you are facing is described in issue #1096 along with a fix. If you have any questions regarding that, please post on that thread, not here. |
@saudet could you please elaborate on how to use |
Something like this: while ((frame = grabber.grabFrame()) != null) {
recorder.setTimestamp(grabber.getTimestamp());
recorder.record(frame);
} |
@saudet thank you for your reply. I have attached the code below for your reference: `
I am getting this error:
Thank you for your assistance! |
Don't use InputStream, not many formats of FFmpeg can support that. |
You might also need to increase the frame rate. |
Video 1 has a frame rate of 30fps. Video 2 has a frame rate of 0.25 fps. If I increase the frame rate of the second video which is of 20 seconds long, the video gets over very quickly - within a few seconds, and nothing in the second part of the video will be seen. Please let me know if there is any solution to this |
As long as you set the timestamp manually and that you use a format that supports variable frame rates, that will not happen. |
@saudet which format that supports variable frame rates? |
I'm using FFmpegFrameRecorder and FFmpegFrameGrabber to merge multiple videos and it works perfectly for videos with same frame rate. But If I use videos with different FPS (30fps, 24fps and 17fps) it looks like some are in slow motion and others are speed up!
So, what do I have to do to make sure that audio and video are in sync throughout videos with different frame rates?
The text was updated successfully, but these errors were encountered: