[Libav-user] Encode variable framerate source
YIRAN LI
mrfun.china at gmail.com
Mon Jan 16 07:41:42 EET 2017
Hi guys,
I now have a sequence of variable duration video frames to encode. Say the
time stamps of video frames are 0, 0,1, 0,2, 0.3, 0,4, 0.6, 0.8, 1.0...
(duration 0.1 to duration 0.2).
Encoder is opened by avcodec_find_encoder. Frames are sent to encoder
using avcodec_encode_video. Encoded frame timestamp is got
from pVideoCodecCtx->coded_frame->pts.
Normally, when open an encoder, you need to
specify pVideoCodecCtx->time_base which can precisely present video frames
timestamps. If possible duration is not know, I can set it to 1/1000 (time
stamp is in ms).
With pVideoCodecCtx->time_base set to 1/1000, time stamp of encoded frames
I got is equal to time stamps of input frames.
So I just want to get confirm:
1. Is setting pVideoCodecCtx->time_base to 1/1000 the correct way to make
encoder accept frames of variable duration? If yes, can I do it to every
encoder in ffmpeg library?
2. Comment says "For fixed-fps content, timebase should be 1/framerate and
timestamp increments should be identically 1". If for fixed-fps content, I
also set time_base to 1/1000, and timestamp increment be 1000/fps, is it ok?
3. I saw someone saying some muxers require constant frame rate. Does that
mean if timestamps of frames sent to muxer is like 0, 0,1, 0,2, 0.3, 0,4,
0.6, 0.8, 1.0, some of them will be dropped by the muxer?
Thanks for help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20170116/02f1015f/attachment.html>
More information about the Libav-user
mailing list