[FFmpeg-devel] Splitting H.264 stream at key packet, first frame is not an I-frame

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue Dec 17 20:55:57 CET 2013


On Tue, Dec 17, 2013 at 08:14:38PM +0100, Stefano Sabatini wrote:
> On date Wednesday 2013-12-18 02:56:34 +0900, Yusuke Nakamura encoded:
> > 2013/12/17 Stefano Sabatini <stefasab at gmail.com>
> [...]
> > For AVC and HEVC stream, IDR-picture or I-picture with
> > recovery_frame_cnt==0 themselves are not a Random Access Point (RAP).
> > The specification doesn't forbid that these pictures have no corresponding
> > parameter sets (VPS, SPS and PPS), but libavcodec/libavformat marks as a
> > keyframe even if the corresponding parameter sets are missing.
> 
> What I don't understand is how the VPS/SPS/PPS are processed in the
> FFmpeg framework, if they correspond to packets or if are stored
> somewhere else when processing the bitstream (e.g. as extradata
> used to decode the next frames).

The first encountered is extracted into extradata, which means that
for the common case seeking and everything will work well even with
MPEG-TS.
However if there are additional, different ones they will only be
parsed as they come.
The parser will ensure that they will be combined with the following
packet, which ideally should be an I-frame, thus splitting is supposed
to work just fine, too, both if either there is only one set of them
(and thus extradata contains the proper information) or if all I-frames
have them before.


More information about the ffmpeg-devel mailing list