[Libav-user] Extra VPS, SPS and PPS before ever I frame slice in h265 in mp4 written by ffmpeg.
staircase at sector-alpha.net
staircase at sector-alpha.net
Tue Mar 8 18:28:00 EET 2022
Hi all,
I am hoping someone may be able to help with this issue.
I am trying to generate an mp4 file using ffmpeg containing already encoded
H265 data. I am providing the H265 nal units to av_write_frame with the VPS,
SPS and PPS already in the stream before each I frame.
When I extract the nal units back out of the mp4 file and look at them,
there are extra VPS, SPS and PPS before each I frame. For most streams this
is inefficient but not a problem, however some of the streams use sliced I
frames and the extra nal units are inserted before each slice of the I frame
which causes only the first slice to be decodable as the VPS, SPS and PPS
are not allowed to be included between slices of the same frame.
We also process H264 video and ffmpeg does not add extra SPS or PPS in front
of I frames in H264 streams. We are not providing the VPS, SPS and PPS as
side data in the packets, but rather as individual packets for each nal
unit. We do use ffmpeg to scan the input to get the codec parameters to use
to configure but do not use ffmpeg to encode or decode the video or in any
other way process the nal units with ffmpeg.
I have a minimal sample program that shows the issue and have included the
code below. We are using different code to load and process the data before
passing the data to ffmpeg but I have hard coded the properties of the video
for this sample. The video file is also attached. If a different input is
required, the nalUnits array will need to be re-generated for the new input
file.
I am compiling in Visual Studio 2019 with ffmpeg version 4.4.1 from
www.gyan.dev <http://www.gyan.dev>
(https://github.com/FFmpeg/FFmpeg/commit/7e0d640edf)
I have tried ensuring that the read codec parameters do not include the
metadata frames and messing with the timestamps (so that all the slices have
the same pts but not dts) but with no progress.
Any suggestions of things to try or comments on the code would be very much
appreciated.
Thanks,
Simon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20220308/eef901af/attachment.htm>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: main.cpp
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20220308/eef901af/attachment.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stream_0.h265
Type: application/octet-stream
Size: 129216 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20220308/eef901af/attachment.obj>
More information about the Libav-user
mailing list