This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello,
i have a question again. I already created a forum entry ("DM385: Bad video stream quality for small GOP sizes"), which one I thought it was solved. But we figured out, that on very special video scenes we still have a bad video quality. So the last time we could only improved the quality by changing the profile but it is still not perfect.
We have used a generate test picture to have a high encoder load (This picture is still a video stream for the encoder 1080p @ 60fps). The effect is that for small GOP sizes on such a high load the quality gets worse. It seems that the effect directly corresponse to the GOP size. The stable test picture is changed on exactly the number of frames like the GOP size (see attachments), which means for example on a GOP size of 60 the effect occurs once per second, for 30 two times per second and so on. We could also see that this can happen on some special "real" video scenes like in https://www.youtube.com/watch?v=dVkK36KOcqs00:23 - 00:40 for example.
Does anyone have an idea what is causing that effect? Wrong configuration?
I have attached some videos with different GOP sizes using all the same target bitrate of 8000000, which are showing the issue.
And here are also my encoder configurations, which were used for generating that samples:
--------- Static Params -------
[m3video] Set dynamicParams VBR
[m3video] videnc2Params -> size : 312
[m3video] videnc2Params -> encodingPreset : 3
[m3video] videnc2Params -> rateControlPreset : 5
[m3video] videnc2Params -> maxHeight : 1080
[m3video] videnc2Params -> maxWidth : 1920
[m3video] videnc2Params -> dataEndianness : 1
[m3video] videnc2Params -> maxInterFrameInterval: 1
[m3video] videnc2Params -> maxBitRate : 8000000
[m3video] videnc2Params -> minBitRate : 0
[m3video] videnc2Params -> inputChromaFormat : 9
[m3video] videnc2Params -> inputContentType : 0
[m3video] videnc2Params -> operatingMode : 1
[m3video] videnc2Params -> profile : 77
[m3video] videnc2Params -> level : 42
[m3video] videnc2Params -> inputDataMode : 3
[m3video] videnc2Params -> outputDataMode : 3
[m3video] videnc2Params -> numInputDataUnits : 1
[m3video] videnc2Params -> numOutputDataUnits : 1
--------- Dynamic Params -------
[m3video]
[m3video] --------- CH 0 : H264 ENC : Dynamic Params -------
[m3video]
[m3video] videnc2DynamicParams -> inputHeight : 1080
[m3video] videnc2DynamicParams -> inputWidth : 1920
[m3video] videnc2DynamicParams -> refFrameRate : 25000
[m3video] videnc2DynamicParams -> targetFrameRate : 60000
[m3video] videnc2DynamicParams -> targetBitRate : 8000000
[m3video] videnc2DynamicParams -> intraFrameInterval : 5
[m3video] videnc2DynamicParams -> generateHeader : 0
[m3video] videnc2DynamicParams -> captureWidth : 1920
[m3video] videnc2DynamicParams -> forceFrame : -1
[m3video] videnc2DynamicParams -> interFrameInterval : 1
[m3video] videnc2DynamicParams -> mvAccuracy : 2
[m3video] videnc2DynamicParams -> sampleAspectRatioHeight : 1
[m3video] videnc2DynamicParams -> sampleAspectRatioWidth : 1
[m3video] videnc2DynamicParams -> ignoreOutbufSizeFlag : 1
[m3video] videnc2DynamicParams -> lateAcquireArg : -1
[m3video]
[m3video] rateControlParams -> rateControlParamsPreset : 1
[m3video] rateControlParams -> scalingMatrixPreset : 0
[m3video] rateControlParams -> rcAlgo : 0
[m3video] rateControlParams -> qpI : -1
[m3video] rateControlParams -> qpMaxI : 44
[m3video] rateControlParams -> qpMinI : 8
[m3video] rateControlParams -> qpP : -1
[m3video] rateControlParams -> qpMaxP : 44
[m3video] rateControlParams -> qpMinP : 8
[m3video] rateControlParams -> qpOffsetB : 4
[m3video] rateControlParams -> qpMaxB : 44
[m3video] rateControlParams -> qpMinB : 10
[m3video] rateControlParams -> allowFrameSkip : 1
[m3video] rateControlParams -> removeExpensiveCoeff : 0
[m3video] rateControlParams -> chromaQPIndexOffset : 0
[m3video] rateControlParams -> IPQualityFactor : 0
[m3video] rateControlParams -> initialBufferLevel : 16000000
[m3video] rateControlParams -> HRDBufferSize : 16000000
[m3video] rateControlParams -> minPicSizeRatioI : 0
[m3video] rateControlParams -> maxPicSizeRatioI : 96
[m3video] rateControlParams -> minPicSizeRatioP : 0
[m3video] rateControlParams -> maxPicSizeRatioP : 0
[m3video] rateControlParams -> minPicSizeRatioB : 0
[m3video] rateControlParams -> maxPicSizeRatioB : 0
[m3video] rateControlParams -> enablePRC : 1
[m3video] rateControlParams -> enablePartialFrameSkip : 1
[m3video] rateControlParams -> discardSavedBits : 1
[m3video] rateControlParams -> VBRDuration : 8
[m3video] rateControlParams -> VBRsensitivity : 0
[m3video] rateControlParams -> skipDistributionWindowLength : 5
[m3video] rateControlParams -> numSkipInDistributionWindow : 2
[m3video] rateControlParams -> enableHRDComplianceMode : 1
[m3video] rateControlParams -> frameSkipThMulQ5 : 0
[m3video] rateControlParams -> vbvUseLevelThQ5 : 0
[m3video]
[m3video] interCodingParams -> interCodingPreset : 0
[m3video] interCodingParams -> searchRangeHorP : 144
[m3video] interCodingParams -> searchRangeVerP : 32
[m3video] interCodingParams -> searchRangeHorB : 144
[m3video] interCodingParams -> searchRangeVerB : 16
[m3video] interCodingParams -> interCodingBias : 1
[m3video] interCodingParams -> skipMVCodingBias : 1
[m3video] interCodingParams -> minBlockSizeP : 0
[m3video] interCodingParams -> minBlockSizeB : 0
[m3video] interCodingParams -> meAlgoMode : 0
[m3video]
[m3video] intraCodingParams -> intraCodingPreset : 0
[m3video] intraCodingParams -> lumaIntra4x4Enable : 255
[m3video] intraCodingParams -> lumaIntra8x8Enable : 0
[m3video] intraCodingParams -> lumaIntra16x16Enable : 15
[m3video] intraCodingParams -> chromaIntra8x8Enable : 15
[m3video] intraCodingParams -> chromaComponentEnable : 1
[m3video] intraCodingParams -> intraRefreshMethod : 0
[m3video] intraCodingParams -> intraRefreshRate : 0
[m3video] intraCodingParams -> gdrOverlapRowsBtwFrames : 0
[m3video] intraCodingParams -> constrainedIntraPredEnable : 0
[m3video] intraCodingParams -> intraCodingBias : 0
[m3video]
[m3video] sliceCodingParams -> sliceCodingPreset : 1
[m3video] sliceCodingParams -> sliceMode : 416
[m3video] sliceCodingParams -> sliceUnitSize : 416
[m3video] sliceCodingParams -> sliceStartOffset : [-126 1 2]
[m3video] sliceCodingParams -> streamFormat : 0
[m3video]
[m3video] sliceGroupChangeCycle : 3072
[m3video] searchCenter : 0
[m3video] enableStaticMBCount : 0
[m3video] enableROI : 262400
[m3video]
[m3video]
Regards,
Andreas
Test picture with GOP 5:
Test picture with GOP 20:
Test picture with GOP 60:
Hi Andreas,
I have few questions & suggestions for you.
Q1. Do you want Baseline/Main Profile or Can you switch to HIGH PROFILE? If yes, I suggest you to switch to HIGH Profile.
Q2. In the streams I see, IDR frame. Will it be okay to use I frames instead IDR?
Q3. Can you brief me on your use case with GOP 5, In other words, why GOP5 is been used?
Q4. Can you share the input you used for encoding these streams, I can tune and provide you a better config.
Q5. Do you need Slices in the encoded frame? If yes, how many slices do you need? I see sliceCodingPreset Enabled.
Q6. Which SDK are you using? The version of H.264 Encoder? It can be found in the encoder Release Notes.
Hi Prashanth,
Thanks for that fast replay. Here are the answers to your questions:
A1. Yes we can and we will switch to the high profile. But I was a little bit confused, that a colleague wrote in his commit message that HIGH profile is not supported. Can you confirme that there is no problem with the HIGH profile for the DM385 with the used SDK (see A6)?
A2. A4. We have the following restrictions
Video Encoding Format
The SPS and PPS shall be sent every second to support fast switching of video inputs, resolutions and
framerates.
A3. There is no need to use GOP5. We used that only for testing purpose. We are not very familiar with video encoding and we were not sure what is a good value for GOP. I found many conversations about that, but we found out that for our most use cases a value between 30 and 60 returns good results. We need a configuration, with that ANY video stream with 1080p @ 60fps can be encoded with a data rate about 8 MBit and with the best quality under that constraints.
A5. I will provide the test picture to you when i have the agreement from the creator.
A6.
DVR Reference Design version GA-04.00.00.03.
H.264 Encoder 02.00.04.01 Yes (for M3 standalone apps)
H.264 Decoder 02.00.08.00 Yes (for M3 standalone apps)
Thanks,
Andreas
Hello Andreas,
Thanks for these details. Please find the replies below:
Great. Lets stick to HIGH PROFILE. Its supported.andreas.geissler said:A1. Yes we can and we will switch to the high profile. But I was a little bit confused, that a colleague wrote in his commit message that HIGH profile is not supported. Can you confirme that there is no problem with the HIGH profile for the DM385 with the used SDK (see A6)?
Sure. Not a problem.andreas.geissler said:A5. I will provide the test picture to you when i have the agreement from the creator.
andreas.geissler said:A6.
DVR Reference Design version GA-04.00.00.03.
H.264 Encoder 02.00.04.01 Yes (for M3 standalone apps)
H.264 Decoder 02.00.08.00 Yes (for M3 standalone apps)
A6. Says.. Encoder version 02.00.04.01 & Decoder 02.00.08.00 are pretty old.
I suggest you to switch to the latest versions and try them at your side and share me your observation. Lest concentrate on other points(A2-A4) after moving to latest codec versions.
Latest H.264 Encoder is 02.00.09.00 & H.264 Decoder is 02.00.20.00. Please contact your local FAE and he/she should provide you these packages.
Yes I am using this still image for Encoding. And of course you can use that as your input, but it is already compressed by our encoder so I am not sure how this effects the results.
That would be really nice if you could give us a configuration with better results, under considering the given requirements
Andreas,
60 fps @ 8MBPS bit-rate is a complex thing. Let me know if you are fine with 30fps.
Andreas,
For 1080p@60, its better if you have 16MBPS. If you are open to increase the bitrate still further quality will get better. For real time 1080p,60 you can use aroudn 16-20MBPS.
PFA for the configuration. Let me know if you need anything else.1080p_Quality_Tune.cfg
Hello Prashanth,
I have got the new encoder software now, extracted from the ipnc_rdk-3.9.1. But now I get the following error message when tring to compile to image:
fatal error: file
"/mnt/1424_LHT_Nice/dvrrdk_04.00.00.03/dvr_rdk/../ti_tools/codecs/REL.500.V.
H264AVC.E.IVAHD.02.00.09.01/500.V.H264AVC.E.IVAHD.02.00/IVAHD_001/Lib/h264en
c_ti_host.lib<H264BPEnc_ti_ires.obj>" has a Tag_ABI_PCS_wchar_t attribute
value of "4" that is different than one previously seen ("2"); combining
incompatible files
I have replaced the h264enc_DIR: REL.500.V.H264AVC.E.IVAHD.02.00.04.01 with REL.500.V.H264AVC.E.IVAHD.02.00.09.01 in the Rules.make. What does this error means? Are there any other dependencies?
And could you provide me your test results with your encoder environment. Just to see the difference between the results of our encoder and yours?
Regards,
Andreas
Hi Andreas,
Can you use H.264 Encoder version 02.00.09.00? This is the latest codec version compatible for your setup.
Version 02.00.09.01is compiled with different CG-Tools version.
I will share the encoded bit-stream shortly.
Hi Prashanth,
Thank you. With the H.264 Encoder version 02.00.09.00 I can build the image now. I will do some tests, to check the differences. I will report again, when I have the results.
Regards,
Andreas
Hi Andreas,
PFA for the sample encoded stream. This is elementary h264 stream. Rename it to .2641080p_Quality_Tune.264.txt
Hi Prashanth,
Thanks for the sample encoded stream. But also in that Video stream you can see that in the frequency of the GOP size the Frame is pulsing. Is there a possibility to avoid that pulsing?
We made also some test with the new Encoder Version, and with a part of the parameters adjusted. But the effect is not so big. We can see slightly differences, but the pulsing is still to be seen. It is better but not perfect.
I had some Problems to find all Parameters of the Encoder.
Some of the Parameters are not part of the EncLink_CreateParams structure in that dvrrdk Version and some paramters are also missing in the encLink_h264.c or I just can not find them.
All Parameters which I currently did not configured are in the attached file.
Regards,
Andreas
########################################################################################## # Encoder Control ########################################################################################## NumInputUnits = 600 # Total number of frames to encode NumOutputUnits = 1 # Number of units of output-data (ex. 1 Slice/Frame encoded stream). dataLayout = 0 # input data buffer layout 0=> interleaved, 1=> seprated. Applicable only for interlace content. captureHeight = 1080 # Image capture height captureTopLeftx = 0 # Exact source position of the pixel to encode in input buffer X direction captureTopLefty = 0 # Exact source position of the pixel to encode in input buffer Y direction ########################################################################################### # InterCoding Control ########################################################################################### searchCenter_x = 32767 # Search center for Motion estimation i.e global motion vector in X dir. For best video quality, set this to 32767 so that Codec will set searchCenter_x and searchCenter_y at internally computed global offset. searchCenter_y = 0 # Search center for Motion estimation i.e global motion vector in Y dir ############################################################################################ # Loop Filter Control ############################################################################################ loopfilterPreset = 0 # Preset value for loop filter operation parameters, 0 => deafult values, 1 => user defined loopfilterDisableIDC = 0 # Disable H.264 loop filter, (0=Filter, 1= NoFilter, 2 = No loop filter across slices) filterOffsetA = 0 # Alpha offset for loop filter filterOffsetB = 0 # Beta offset for loop filter ############################################################################################ # Entropy Coding Mode ############################################################################################ entropyCodingMode = 1 # Enropy coding type, (0 => CAVLC, 1 => CABAC) ################################################################################ # VUI Control Params ################################################################################ vuiCodingPreset = 0 # Preset value for VUI Control Params, 0 => deafult values, 1 => user defined aspectRatioInfoPresentFlag = 1 # Controls the insertion of aspect ratio information in VUI part of bit-stream aspectRatioIdc = 1 # Aspect ratio ID videoSignalTypePresentFlag = 0 # controls the insertion of video signal type in VUI part of bit-stream videoFormat = 2 # Video signal type videoFullRangeFlag = 0 # Flag to specigy Range of the pixels timingInfoPresentFlag = 1 # Controls the insertion of timing info related parameters in VUI part of bit-stream ################################################################################ # NALU Control Params ################################################################################ naluControlPreset = 0 # Preset value for NALU Control Params, 0 => deafult values, 1 => user defined naluPresentMaskStartOfSequence = 416 # Controls the insertion of different NALU at start of sequence naluPresentMaskIDRPicture = 416 # Controls the insertion of different NALU at IDR picture naluPresentMaskIntraPicture = 2 # Controls the insertion of different NALU at Intra picture(s) naluPresentMaskNonIntraPicture = 2 # Controls the insertion of different NALU at Non-intra pictures naluPresentMaskEndOfSequence = 3072 # Controls the insertion of different NALU at end of sequence ################################################################################ # STEREO INFO Control Params ################################################################################ stereoInfoPreset = 0 # Preset controls the Enable/Disable of Stereo Videoc Coding, 0 => Disable, 1 => Default Frame packing SEI parameters, 2 => User defined topFieldIsLeftViewFlag = 1 # Controls top field in video coded sequence as a left view or right view, 0 => Top field is Left View, Non-Zero => Top field is Right view viewSelfContainedFlag = 0 # Controls the Left/Right view should refer Left view or Right view, 0 => Leftview can refer to Rightview or Leftview & Rightview can refer to Rightview or Leftview, Non-Zero => Leftview can refer only to Leftview & Rightview can refer only to Rightview ################################################################################ # Frame Packing SEI Params ################################################################################ framePackingPreset = 0 # Preset controls the Enable/Disable of Frame packing SEI message encoding, 0 => Disable, 1 => Default Frame packing SEI parameters, 2 => User defined framePackingType = 3 # Indicates that frame packing arrangement type, 0 => Checker board arrangement of 2 views, 1 => Column interleaving arrangement of 2 views, 2 => Row interleaving arrangement of 2 views, 3 => Side by side arrangement of 2 views, 4=> Top-Bottom arrangement of 2 views frame0PositionX = 0 # Location of the upper left sample of frame 0(Left view) in horizontal direction frame0PositionY = 0 # Location of the upper left sample of frame 0(Left view) in vertical direction frame1PositionX = 0 # Location of the upper left sample of frame 1(Right view) in horizontal direction frame1PositionY = 0 # Location of the upper left sample of frame 1(Right view) in vertical direction reservedByte = 0 # Value of frame_packing_arrangement_reserved_byte syntax element ################################################################################ # H-P Coding Control Params ################################################################################ numTemporalLayer = 1 # 1 => 1layer , 2 => 2layers,3=> 3layers,4 => 4layers referencePicMarking = 1 # 0 =>Short-term referencing(Sliding Window),1=> Long term referencing(MMCO Commands) ################################################################################ # MISC ################################################################################ gopStructure = 0 # GOP structure, 0 => Open or Non uniform(IBBPBBP), 1 => Closed or Uniform (BBIBBPBB) IDRFrameInterval = 0 # Interval b/w two IDR frames bottomFieldIntra = 0 # 1 : Force bottom field of Intra frame as Intra field, 0: bottom field as inter (default) transformBlockSize = 2 # Tranform type, 0:4x4 only, 1: 8x8 only, 2:Adaptive (default) log2MaxFNumMinus4 = 8 # sliceParams::frame_num syntax element will be reset after every (1<< (log2MaxFNumMinus4 + 4)) frames picOrderCountType = 0 # Picture order count type, supported value 0,1 and 2 topFieldFirstFlag = 1 # Flag to indicate field order in interlaced content interlaceCodingType = 3 # Interlced field coding type selection, 2 => MRF 3=> ARF 4=> SPF forceIDRPeriod = 100000 # ForceIDRPeriod specified by user to control encoding forceSKIPPeriod = 100000 # Skip frame interval enableLongTermRefFrame = 0 # Parameter is used to support long-term reference frame, 0 => Disable, Non-Zero => Enable enableWatermark = 0 # Flag to enable water marking ########################################################################################## # ROI Parameters ########################################################################################## enableROI = 0 # 0->disable ROI 1-> enable ROI ROIcfg = "..\..\..\Test\TestVecs\Config\roiInputParams.cfg"
Hi Andreas,
andreas.geissler said:But also in that Video stream you can see that in the frequency of the GOP size the Frame is pulsing. Is there a possibility to avoid that pulsing?
Yes, Slight pulsing is seen initial 1 second(1st GOP Frequency) in the video shared. After that no pulsing is seen with 16MBPS bitrate @ 60fps. Will get back to you on this.
The params which you did not find can be ignored, because most of them will be set to default(preset values are set to 0,so the default settings will be set internally) by the codec itself. You can get the details of all the params in Client\test\src\h264enc_ti_config.c & also in inc\ih264enc.handreas.geissler said:Some of the Parameters are not part of the EncLink_CreateParams structure in that dvrrdk Version and some paramters are also missing in the encLink_h264.c or I just can not find them.
Hi Prashanth,
Thanks!
Yes this seems to improve the quality!
Old version (Targetbitrate 8MBit):
New version with encodingPreset = XDM_MED_SPEED_HIGH_QUALITY (Targetbitrate 8MBit):
It looks much better. But i need that confirmed by the customer. I will inform you, if this also improves his life stream video encoding.
Regards,
Andreas