On Thu, Sep 16, 2010 at 5:34 PM, Tomas Härdin <[email protected]>wrote:

> Please don't top post on this list. It makes it harder for people to
> read it.
>
> On Thu, 2010-09-16 at 17:02 +0400, Kulti wrote:
> > Hm... Thanks, I'm use flv-container, but how to set VFR? It's mean, that
> I
> > need to modify AVCodecContext.time_base before encoding every frames?
> >
> > On Thu, Sep 16, 2010 at 4:43 PM, Tomas Härdin <[email protected]
> >wrote:
> >
> > > On Thu, 2010-09-16 at 13:36 +0400, Kulti wrote:
> > > > Hi, all.
> > > >
> > > > I have a webcam and need to transcode mjpeg to any formats, but
> sometime
> > > > webcam lagged and fps fall down. Can ffmpeg atuo fill dropped frames
> to
> > > > constantly fps?
> > >
> > > Why do you want constant fps? Just use a container that handles VFR
> > > (avi, flv, mov etc.).
> > >
> > > Anyway, assuming the frames are timestamped correctly ffmpeg should
> > > behave correctly. If not, try forcing constant framerate with -r.
> > >
> > > /Tomas
> > >
>
> FLV has a fixed time base of 1 kHz, so it's always VFR. In other cases,
> like AVI, you can set time_base to be less than or equal to the inverse
> of the maximum fps.
>
> In other words, if you know your camera can't deliver more than 50 fps
> you can set time_base to 1/50, 1/123, 1/10000 or whatever. In the
> specific case of AVI you shouldn't set it too low though, since it pads
> with empty packets for the "missing" time stamps (IIRC something like
> 39*16 = 624 B overhead if you mux 25 fps with a time base of 1 kHz). FLV
> does not have this problem though.
>
> Hope that helps :)
>
> /Tomas
>
> _______________________________________________
> libav-user mailing list
> [email protected]
> https://lists.mplayerhq.hu/mailman/listinfo/libav-user
>
>
Sorry for top-post... and thanks for your help.

So, I set time_base to fixed value 1/25 (that I get from AVCodecContext for
mjpeg-decoder). Then I added timer and frame-counter before
av_write_frame(). I see, that fps is 19-21. But I need live-streaming. So, I
hardcoded time_base to 1/20, and all works fine before webcam is not lag,
but after fall down fps to 15 transcoding process broken.

Yes, I understand, that must be working for transcoding into file, but I
need real-time transoding for live streaming. I can't see any way instead
inserting frames, when some drops...
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to