[Libav-user] SPS PPS header

John Stebbins stebbins at jetheaddev.com
Wed Nov 15 18:56:02 EET 2017

On 11/15/2017 07:49 AM, John Stebbins wrote:
> On 11/14/2017 09:07 AM, Carl Eugen Hoyos wrote:
>> 2017-11-14 16:07 GMT+01:00 John Stebbins <stebbins at jetheaddev.com>:
>>> There are 2 ways defined by the MP4 spec to include SPS and PPS.
>>> The first, most common, and supported by ffmpeg, is to put the
>>> parameter sets in the MP4 header *only*.  In this type of MP4, the
>>> sample entry type must be set to avc1.
>>> The second way allows the SPS and PPS to be in the MP4 header and
>>> inline in the stream.  In this case SPS and PPS may be repeated in
>>> the stream before each IDR.  This is useful for adaptive streaming
>>> scenarios where the characteristics of the video stream may change.
>>> In this type of MP4, the sample entry type must be avc3.
>> I believe this variant is not supported by FFmpeg's mov muxer and I
>> suspect that some / most players do not support it.
> I don't know about most, but many do support avc3.  The only players I've found so far that do not are those produced by
> Apple.
> A little off topic but related.  The default h.265 sample entry type that ffmpeg writes (hev1) *allows* inline parameter
> sets and doesn't work with Apple players.  I submitted a patch a while back to libav which is also in ffmpeg now that
> adds the ability to write the hvc1 sample entry type which is supported by Apple and means parameter sets are only in
> the header.
> The attached patch adds the ability to write avc3 sample entry type.  I was planning on submitting this patch to
> ffmpeg.  Just hadn't gotten around to it yet.
> The ffmpeg command line to transcode a file to avc3 format with this patch would be:
> ffmpeg -i input -flags:v +global_header -c:v libx264 -tag:v avc3 output.mp4

And of coarse I got the command line wrong.  global header must be disabled.  Correct command:

ffmpeg -i input -flags:v -global_header -c:v libx264 -tag:v avc3 output.mp4

John      GnuPG fingerprint: D0EC B3DB C372 D1F1 0B01  83F0 49F1 D7B2 60D4 D0F7

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20171115/42d2f13c/attachment.sig>

More information about the Libav-user mailing list