Request key frame in vpuenc (Freescale)
Carlos Rafael Giani
dv at pseudoterminal.org
Tue Oct 1 17:22:30 PDT 2013
On 2013-10-02 00:56, Javier Jardón wrote:
> On 30 September 2013 17:11, Chuck Crisler <ccrisler at mutualink.net> wrote:
>> I can't remember exactly, but there is an option in the encoder structure to
>> instruct the VPU encoder to generate an I-Frame. Just make sure that you
>> clear the flag after the I-Frame is generated. Of course, the structure item
>> name may vary depending on which VPU you are using. Your encoder element
>> probably already controls when to generate an I-Frame. When I worked with a
>> Freescale VPU we had to determine the I-Frame rate ourselves, the encoder
>> didn't count the frames.
> Hi Chuck,
>
> thanks for the hint. As you seggested, nForceIPicture=1 is the one
> needed to generate the keyframe.
> The problem I have now is that I think I have to send the SPS/PPS for
> any new segment I created, but currently I get this from the parser
> after the encoder:
>
> 0:00:20.366602668 23704 0x20120 WARN h264parse
> gsth264parse.c:926:gst_h264_parse_handle_frame:<h264parse0> no SPS/PPS
> yet, nal Type: 1 Slice, Size: 28105 will be dropped
>
> I checked and seems that the headers are generated only one time in
> the beggining of the stream, do you know if there is anything I can do
> to tell the vpu to generate new headers again?
>
> Thanks
>
>
To give additional details:
The VPU encoder can produce h.264 baseline content, in the Annex.B (=
"byte-stream") format. Access units do not seem to be generated, at
least I do not see typical au content in the NAL units.
The VPU generates the SPS/PPS headers during startup, and whenever it
deems it necessary later on. There is no apparent mechanism to trigger a
new SPS/PPS header generation.
The problem seems to be when a new segment occurs. Since the headers
were created only once, only the previous segment ever saw headers - the
new one didn't. h264parse apparently considers this an error, and
expects SPS/PPS data for every segment. But since the VPU output is
using the byte-stream format, the headers are part of the stream, and
cannot simply be set as codec-data caps (which would otherwise be an
easy and fully working solution).
I see two options:
1) Extract the SPS/PPS headers when they are generated, store them, and
install a set_event handler that looks for new_segment events. If such
an event occurs, set a flag. The next time a buffer is about to be sent
downstream, add the headers to this buffer's data (which contains a NAL
unit).
2) Remove the byte-stream wrapping, and sent the data downstream. Set
the codec-data caps field to whatever is the SPS/PPS content.
Perhaps it would also be possible to set the codec-data caps even though
Annex.B is sent downstream? Would this break something? If not, this
could be an option 3, perhaps the best of all.
Opinions?
More information about the gstreamer-devel
mailing list