[Libav-user] AVPacket::duration from H.264 encoder is zero

Gavin Smith gcs584 at yahoo.com
Sun Jan 14 00:11:07 EET 2018


I am encoding H.264 and then wrapping it with HLS (ts files) - video only, no audio. To be clear, I'm using the 'avcodec_send_frame'/'avcodec_receive_packet' variation of the API. 
What I have noticed is that the HLSenc  is flooding the log with the warning message ""pkt->duration = 0, maybe the hls segment duration will not precise"'. I've confirmed that the AVPacket received from the encoder has a duration of zero. Even though this is only a warning, I'd like to heed the warning.
 The AVCodecContext has a time_base of 1/25 and the AVStream video index has a time_base of 1/90,000. If I set the AVPacket duration to 3,600, the warning disappears; however, I have concerns explicitly setting the duration of each AVPacket explicitly (especially if my life can be made easier by FFmpeg setting it).
1. Should the duration of AVPacket be populated automatically? (Note: The duration is currently _always_ zero). 2. Am I expected to populate the duration myself?3. Is the fact that the duration is being set to zero a symptom of incorrect values in the original AVFrame as passed to the encoder?
Gavin.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20180113/d1a5b810/attachment.html>


More information about the Libav-user mailing list