Hi,
we had the same problems on an IMX53 device.
The plugin mp4mux needs the "codec_data" from the encoder plugin to create the avcC Box in the mp4 file.
This can be achieved by setting "h264-byte-stream" to "0".
But the mfw_vpuencoder has a bug in the function, which creates the "codec_data" from the SPS/PPS data.
Apply the following patch to mfw_gst_vpu_encoder.c
This worked for us.
Regards,
Uwe
--- a/gst-fsl-plugin-2.0.3/src/video/vpu_enc/src/mfw_gst_vpu_encoder.c
+++ b/gst-fsl-plugin-2.0.3/src/video/vpu_enc/src/mfw_gst_vpu_encoder.c
@@ -82,7 +82,7 @@ static MfwGstVPU_Enc *vpuenc_global_ptr = NULL;
#define VPU_PIC_TYPE ((vpu_enc->codec == STD_AVC) ? ((vpu_enc->outputInfo->picType>>1)&0x3) : ((vpu_enc->outputInfo->picType)&0x3) )
#define VPU_PIC_TYPE_IDR ( (vpu_enc->codec == STD_AVC) ? (!(vpu_enc->outputInfo->picType&0x1)) : (VPU_PIC_TYPE == 0))
#define VPU_PIC_TYPE_I ( VPU_PIC_TYPE_IDR || (VPU_PIC_TYPE == 0))
-#define NALU_HEADER_SIZE 5
+#define NALU_HEADER_SIZE 4
#define AVC_NALU_START_CODE 0x00000001
#ifdef SWAP
@@ -1390,19 +1390,19 @@ GstBuffer *
mfw_gst_vpuenc_packetize_avchdr (guint8 * sps_data, guint sps_size,
guint8 * pps_data, guint pps_size)
{
guint data_size = 6 + (2 + (sps_size - NALU_HEADER_SIZE)) +
1 + (2 + (pps_size - NALU_HEADER_SIZE));
GstBuffer *codec_data = gst_buffer_new_and_alloc (data_size);
guint8 *data = GST_BUFFER_DATA (codec_data);
gint8 i = 0;
/* unsigned int(8) configurationVersion = 1; */
data[i++] = 1;
/* unsigned int(8) AVCProfileIndication; */
- data[i++] = sps_data[NALU_HEADER_SIZE];
- /* unsigned int(8) profile_compatibility; */
data[i++] = sps_data[NALU_HEADER_SIZE + 1];
- /* unsigned int(8) AVCLevelIndication; */
+ /* unsigned int(8) profile_compatibility; */
data[i++] = sps_data[NALU_HEADER_SIZE + 2];
+ /* unsigned int(8) AVCLevelIndication; */
+ data[i++] = sps_data[NALU_HEADER_SIZE + 3];
/* bit(6) reserved = '111111'b;
* unsigned int(2) lengthSizeMinusOne; */
data[i++] = 0xFF; /* lengthSizeMinusOne = 3 */
@@ -1411,7 +1411,7 @@ mfw_gst_vpuenc_packetize_avchdr (guint8 * sps_data, guint sps_size,
data[i++] = 0xE1; /* numOfSequenceParameterSets = 1 */
/* unsigned int(16) sequenceParameterSetLength ; */
data[i++] = 0;
data[i++] = sps_size - NALU_HEADER_SIZE;
/* bit(8*sequenceParameterSetLength) sequenceParameterSetNALUnit; */
memcpy (data + i, sps_data + NALU_HEADER_SIZE, sps_size - NALU_HEADER_SIZE);
i += sps_size - NALU_HEADER_SIZE;