[Libav-user] How to change framerate for output stream

hatred adrozdoff at gmail.com
Mon Aug 6 06:15:49 CEST 2012

Hi all!

I write live transcoder (https://gitorious.org/live-transcoder) that can
accept input streams from web cams (and other live streams) and transcode
it into given formats and distribute it via different transports (currently
HTTP only).

On my work we plan to use this transcoder for transcode streams from Axis
cams to FLV and publish its ob our site. But it look like FLV players wants
FLV with 25 FPS but cams provide streams with FPS from 25 up to 30.

And I have trouble:
I set:
1. AVCodecContext::time_base to 1/25
2. AVStream::time_base to 1/25
3. AVStream::r_frame_rate to 25/1

After encoding packet I scale PTS:
Packet.pts = av_rescale_q(Frame.pts, FrameTimeBase, PacketTimeBase);

FrameTimeBase equal to input video stream time base
PacketTimeBase equal to output video stream time base

AVIOContext I alloc with avio_alloc_context() and write packets to HTTP
stream with av_write_frame()

All work well (in the first approximation) but if I try to play video
stream via ffplay it plays and ffplay shows
1k tbr, 1k tbn, 1k tbc
but I expect about 25 tbr

I dump FLV (with curl) to file, manualy parse header and view, that
framerate set to 25, so I can't understand how to correct change framerate
for output stream.

Thanks for any help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20120806/16583be5/attachment.html>

More information about the Libav-user mailing list