Yes, it's possible.
You will need to pass the content of the avcC
box to AVCodecContext::extradata which will be parsed by the decoder to get the PPS and SPS NALUs necessary for decoding.
Here's an example of how to do that:
// `avcC` box retrieved from an MP4
char avcC[] = "...";
// Create codec parameters and copy the avcC box as extradata
codec_params = avcodec_parameters_alloc();
memcpy(codec_params.extradata, &avcC, sizeof(avcC));
codec_params.extradata_size = sizeof(avcC);
// Create the codec context and initialize it with codec parameters
codec_context = avcodec_alloc_context3();
avcodec_parameters_to_context(codec_context, codec_params);
// Create the codec and initialize it
codec = avcodec_find_decoder(AV_CODEC_ID_H264);
avcodec_open2(codec_context, codec, NULL);
The AVCC format assumes that PPS and SPS NALUs are provided "out of band", meaning they are not part of the stream like in the Annex B format. This excellent SO answer gives more details about the differences.
In an MP4 container, these NALUs are located in the avcC
box, located at the following path in the MP4 box hierarchy:
moov > trak > mdia > minf > stbl > stsd > avc1 > avcC