Hello,
I am trying to encode a timecode as per:
processors.wiki.ti.com/.../DM36x_H.264_encoder_FAQ
I set the time code field to a value and then having encoded it using VIDENC1_process on the DM368 I am then trying to decode it with
ffmpeg. I am unable to extract the timecode I have set.
The parameters I am using are:
/* Encapsulate generic parameters inside the H264 specific parameters structures
* and pass to encoder init. */
h264params.videncParams = *params;
h264params.videncParams.size = sizeof(h264params);
h264params.numTemporalLayers = 0;
h264params.profileIdc = 66; /* base profile 66 */
h264params.entropyMode = 0;
h264params.transform8x8FlagInterFrame = 0;
h264params.transform8x8FlagIntraFrame = 0;
h264params.seqScalingFlag = 0;
h264params.levelIdc = 30;
h264params.encQuality = 2;
h264params.enableARM926Tcm = 0;
h264params.enableDDRbuff = 0;
h264params.enableVUIparams = 1;
h264dparams.videncDynamicParams = *dynParams;
h264dparams.videncDynamicParams.size = sizeof(h264dparams);
h264dparams.enableBufSEI = 1;
h264dparams.enablePicTimSEI = 1;
h264dparams.VUI_Buffer = &H264VENC_TI_VUIPARAMBUFFER; //&VUIPARAMBUFFER;
h264dparams.VUI_Buffer->numUnitsInTicks = 1;
h264dparams.VUI_Buffer->timeScale = 30;
h264dparams.VUI_Buffer->picStructPresentFlag = 1;
I have changed Venc1_process to give a constant timestamp:
inArgs.videncInArgs.size = sizeof(IH264VENC_InArgs);
inArgs.videncInArgs.inputID = GETID(Buffer_getId(hInBuf));
/* topFieldFirstFlag is hardcoded. Used only for interlaced content */
inArgs.videncInArgs.topFieldFirstFlag = 1;
outArgs.videncOutArgs.size = sizeof(IH264VENC_OutArgs);
inArgs.insertUserData = FALSE;
inArgs.lengthUserData = 0;
inArgs.timeStamp = 0xAABBCCDD;
/* Encode video buffer */
status = VIDENC1_process(hVe->hEncode, &inBufDesc, &outBufDesc, (VIDENC1_InArgs *)&inArgs,
(VIDENC1_OutArgs *)&outArgs);
I have tried to encode user unregistered data and I can decode this without issue using ffmpeg.
I am trying to do the same with SEI picture timing.
I recompiled ffmpeg to put in some debug to print out what is decoded. When I decode the stream I see the picture timing NAL
but the flag sps->pic_struct_present_flag is not set. Should it be set? How do I get the timecode out of the stream?
Can I expect to see 0xAABBCCDD somewhere?
I say "I see the picture timing NAL " - what this means is that a function called decode_picture_timing is called in ffmpeg when the frame
is decoded.
Is there something obvious wrong?
We want to be able to put a 32 bit timecode as per the STANAG 4609 spec that states:
The H.264 format, specified in [11] provides for an optional time stamp to be
defined in the Supplemental Enhancement Information (SEI) Message. The “picture
timing SEI message” (pic_timing) specifies the time as HH:MM:SS:FF. It is a persistent
time stamp that reflects the time of frame capture, and it also contains flags to specify
whether the video is drop-frame, and whether there is a discontinuity in the video time
line.
Also I read this:
http://processors.wiki.ti.com/index.php/DM36x_Interlace_Encoding_FAQs
We are using DM 368.
This section:
What all feature set of encoder is disabled when interlace encoding is enabled?
Following are the limitations of the encoder:
- No Baseline Profile: Fatal error (IH264VENC_ERR_INTERLACE_IN_BP) is returned during algInit() instance creation stage if application tries to encode interlaced content in Baseline Profile mode.
- Airrate: This feature is not supported for interlaced content
- EncoderLevel: If interlace encoding is enabled for levels less than 2,1 or level more than level 4.1 encoder will return fatal error during instance creation.
- Rate Control Algorithms: CBR and Custom CBR1 Rate Control algorithms are not supported for interlaced encoding and will be automatically disabled by encoder.
- Buffering period SEI: Buffering period SEI insertion is not supported for interlaced content
- Picture Timing SEI: Picture Timing SEI insertion is not supported for interlaced content
Is this the issue? I am pretty sure we are producing interlaced video, so this is an encoder limitation?