On Mon, Nov 20, 2017 at 2:33 PM, Carl Eugen Hoyos <ceffm...@gmail.com>
wrote:

> 2017-11-20 23:12 GMT+01:00 Tyler Brooks <tylerjbro...@gmail.com>:
>
> > My encoder gives me a timestamp on every frame (int64_t in microseconds).
> > The hardware is pretty good and the timestamps are very nearly always
> > separated to 1/framerate.  In my case the framerate is 30fps so the
> frames
> > come out of the encoder about every 30ms (lets just say for easy math for
> > now).
> >
> > Of course, I could use those timestamps for my pts/dts.  Indeed, I have
> > tried.
> >
> > But here is the root of my problem.  The key frames are handed to me as
> four
> > NAL packets (SPS, PPS, SEI, key_frame) all at the same time and all with
> the
> > same timestamp.  That makes sense.  The metadata meant for the decoder
> (SPS,
> > PPS and SEI) should to be associated with the leading key_frame and they
> > should all share the same timestamp.  My problem is I don't know how to
> make
> > a multi-packet 'AVPacket' to submit as a single frame to the
> > 'av_write_frame' call.
>
> Did you try to concatenate SPS, PPS and SEI with
> the first key-frame?
>
> Carl...
I tried concatenating the meta data with the key frame but no joy.

So, a friend pointed out to me that I might be going at this the wrong
way.  The basic problem I am having is that I don't have an input context
so there is no h264 parser that can take the SPS, PPS and SEI packets and
do anything with them.  I suspect that my loop appears to be working
because I am writing to an 'mpegts' file which, I think, is just h264
packets with the leading NAL zeroes replace with length words (some
bit-stream filter must be doing that).  But that would mean that there
isn't much chance that I can get the timestamps right because I have to
submit them as frames. I can't submit them as 'extradata/sidedata' because
there is no codec to catch them.

Apparently I am supposed to write a custom IO context for the output of my
encoder and then do a normal input context.  I have done some experiments
with this approach and it seems to work.

Thank you for your help Carl.
_______________________________________________
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user

Reply via email to