H264 Packets from Multimedia API Video Encode vs ffmpeg libavcodec missing codec parameters

In regards to running the samples in the jetson_multimedia_api, specifically 01_video_encode on the nvidia jetson.

I have noticed there is a difference between the H264 packets created by libavcodec and the jetson multimedia api.

By default, libavcodec appears to put in all the necessary codec parameters in every packet or at least every so often.

So if the first several H264 packets from the libavcodec are not written to disk, the packet stream can still be decoded.

But I cannot get jetson_multimedia_api video_encode sample to do this.

So, if the first packets from the sample are not written to disk using the jetson, decoding by vlc or ffprobe fails.

When running this ./video_encode …/…/data/Video/sample_outdoor_car_1080p_10fps.yuv 1920 1080 H264 sample_outdoor_car_1080p_10fps.h264
both vlc and ffprobe read the resulting file in succesfully.

If, I modify video_encode_main.cpp and I make a modification to skip writing the first few files,


  • Write encoded frame data.

  • @param stream : output stream

  • @param buffer : output nvbuffer
    static int
    write_encoder_output_frame(ofstream * stream, NvBuffer * buffer)

    static int skip = 0;

    if(skip > 10)
    stream->write((char *) buffer->planes[0].data, buffer->planes[0].bytesused);


    return 0;

VLC cannot play the file, and ffprobe returns this error

[h264 @ 0x559a30be80] decode_slice_header error
[h264 @ 0x559a30be80] no frame!
[h264 @ 0x559a30be80] non-existing PPS 0 referenced
[h264 @ 0x559a30aed0] decoding for stream 0 failed
[h264 @ 0x559a30aed0] Could not find codec parameters for stream 0 (Video: h264, none): unspecified size
Consider increasing the value for the ‘analyzeduration’ and ‘probesize’ options

How can I get the codec paramters into the H264 packets to acheive the same as libavcodec?

Please set this option:

        --insert-spspps-idr   Insert SPS PPS at every IDR [Default = disabled]

The decoding begins from IDR frames and needs SPS/PPS. By default it is only sent in very beginning. For streaming use-cases, please enable it to be put with all IDR frames.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.