FFmpegFrameRecorder, how to set frame rate

581 views
Skip to first unread message

p...@seznam.cz

unread,
Nov 18, 2013, 6:21:21 PM11/18/13
to jav...@googlegroups.com
Hi,
I`m trying to use FFmpegFrameGrabber to get a video (*.mp4), make some changes and record it back, using FFmpegFrameRecorder. However, I`m still not able to get it right. I have issue with setting frame rate to the recorder. When I use " recorder.setFrameRate(grabber.getFrameRate()); " the recorder frame rate is set to value labelled " tbr " in video input. And the true value, which is labelled by "fps" is not accessible by any getter. 
When I set the frame rate manualy to the right value than the recorder works fine.

I`ve also used 

long timeStamp = grabber.getTimestamp();
recorder.setTimestamp(timeStamp);

to correct the time between frames. And it worked fine until I`ve tested on another android device where it triggered error:
av_interleaved_write_frame error -22 while writing interleaved video frame

I`m asking for advice, how to set up the frame rate for the FFmpegFrameRecorder right?

Thank`s 
Peter 

Samuel Audet

unread,
Nov 23, 2013, 6:52:16 PM11/23/13
to jav...@googlegroups.com
Hello,

On 11/19/2013 08:21 AM, p...@seznam.cz wrote:
> to correct the time between frames. And it worked fine until I`ve tested on another android device where it triggered error:
> av_interleaved_write_frame error -22 while writing interleaved video frame

You should try this instead:
long timeStamp = grabber.getTimestamp();
if (timeStamp > recorder.getTimestamp()) {
recorder.setTimestamp(timeStamp);
}

> I`m asking for advice, how to set up the frame rate for the FFmpegFrameRecorder right?

I'm not sure myself :) Could you please post an issue here:
http://code.google.com/p/javacv/issues/
and attach a small sample video file that doesn't work correctly so that
I may take a look for myself and fix this? Thanks!

Samuel

p...@seznam.cz

unread,
Dec 6, 2013, 5:51:43 AM12/6/13
to jav...@googlegroups.com
Hi,
thank you very much for reply and the advice. With the "If" I`m not getting the error anymore. I`ll post the issue, however with the setting the timestamp it should work fine.

Regards,
Petr

Dne úterý, 19. listopadu 2013 0:21:21 UTC+1 p...@seznam.cz napsal(a):
Reply all
Reply to author
Forward
0 new messages