Open shitizenlism opened 10 months ago
Actually I do not know how to play svc-streaming. Choose a layer to play? Or play layer[0] + layer[1] + layer[2] + layer[3]? I believe it's the latter. The video is played layer plus layer to achieve the effect from blur to clarity. Am I right?
I modified wels_enc.cpp as follows: int FillSpecificParametersMerge (SEncParamExt& sParam) { / Test for temporal, spatial, SNR scalability / sParam.iUsageType = CAMERA_VIDEO_REAL_TIME; sParam.fMaxFrameRate = 30.0f; // input frame rate sParam.iPicWidth = 1920; // width of picture in samples sParam.iPicHeight = 1080; // height of picture in samples sParam.iTargetBitrate = 2000000; // target bitrate desired sParam.iMaxBitrate = UNSPECIFIED_BIT_RATE; sParam.iRCMode = RC_QUALITY_MODE; // rc mode control sParam.iTemporalLayerNum = 3; // layer number at temporal level sParam.iSpatialLayerNum = 4; // layer number at spatial level sParam.bEnableDenoise = 0; // denoise control sParam.bEnableBackgroundDetection = 1; // background detection control sParam.bEnableAdaptiveQuant = 1; // adaptive quantization control sParam.bEnableFrameSkip = 1; // frame skipping sParam.bEnableLongTermReference = 1; // long term reference control sParam.iLTRRefNum = 1; sParam.iLtrMarkPeriod = 15; sParam.uiIntraPeriod = 150; // period of Intra frame. GOP=5s sParam.eSpsPpsIdStrategy = SPS_PPS_LISTING; sParam.bPrefixNalAddingCtrl = 0; sParam.iComplexityMode = MEDIUM_COMPLEXITY; sParam.bSimulcastAVC = false; sParam.bFixRCOverShoot = true; sParam.iIdrBitrateRatio = IDR_BITRATE_RATIO * 100;
int iIndexLayer = 0; sParam.sSpatialLayers[iIndexLayer].uiProfileIdc = PRO_BASELINE; sParam.sSpatialLayers[iIndexLayer].iVideoWidth = 480; sParam.sSpatialLayers[iIndexLayer].iVideoHeight = 270; sParam.sSpatialLayers[iIndexLayer].fFrameRate = 7.5f; sParam.sSpatialLayers[iIndexLayer].iSpatialBitrate = 200000; sParam.sSpatialLayers[iIndexLayer].iMaxSpatialBitrate = UNSPECIFIED_BIT_RATE; sParam.sSpatialLayers[iIndexLayer].sSliceArgument.uiSliceMode = SM_SINGLE_SLICE;
iIndexLayer = 1; sParam.sSpatialLayers[iIndexLayer].uiProfileIdc = PRO_SCALABLE_BASELINE; sParam.sSpatialLayers[iIndexLayer].iVideoWidth = 960; sParam.sSpatialLayers[iIndexLayer].iVideoHeight = 540; sParam.sSpatialLayers[iIndexLayer].fFrameRate = 15.0f; sParam.sSpatialLayers[iIndexLayer].iSpatialBitrate = 400000; sParam.sSpatialLayers[iIndexLayer].iMaxSpatialBitrate = UNSPECIFIED_BIT_RATE; sParam.sSpatialLayers[iIndexLayer].sSliceArgument.uiSliceMode = SM_SINGLE_SLICE;
iIndexLayer = 2; sParam.sSpatialLayers[iIndexLayer].uiProfileIdc = PRO_SCALABLE_BASELINE; sParam.sSpatialLayers[iIndexLayer].iVideoWidth = 1280; sParam.sSpatialLayers[iIndexLayer].iVideoHeight = 720; sParam.sSpatialLayers[iIndexLayer].fFrameRate = 30.0f; sParam.sSpatialLayers[iIndexLayer].iSpatialBitrate = 600000; sParam.sSpatialLayers[iIndexLayer].iMaxSpatialBitrate = UNSPECIFIED_BIT_RATE; sParam.sSpatialLayers[iIndexLayer].sSliceArgument.uiSliceMode = SM_SINGLE_SLICE; sParam.sSpatialLayers[iIndexLayer].sSliceArgument.uiSliceNum = 1;
iIndexLayer = 3; sParam.sSpatialLayers[iIndexLayer].uiProfileIdc = PRO_SCALABLE_BASELINE; sParam.sSpatialLayers[iIndexLayer].iVideoWidth = 1920; sParam.sSpatialLayers[iIndexLayer].iVideoHeight = 1080; sParam.sSpatialLayers[iIndexLayer].fFrameRate = 30.0f; sParam.sSpatialLayers[iIndexLayer].iSpatialBitrate = 800000; sParam.sSpatialLayers[iIndexLayer].iMaxSpatialBitrate = UNSPECIFIED_BIT_RATE; sParam.sSpatialLayers[iIndexLayer].sSliceArgument.uiSliceMode = SM_SINGLE_SLICE; sParam.sSpatialLayers[iIndexLayer].sSliceArgument.uiSliceNum = 1;
return 0; }
And test result shows as below. $ ./svcEncodeYuv -sw 1920 -sh 1080 -frms 600 -org ./res/mixkit-camels_1920x1080.yuv -mfile 1 -bf ./out/mixkit-camels.264 -rw-r--r-- 1 admin staff 784127 Nov 10 14:54 mixkit-camel_layer0.264 -rw-r--r-- 1 admin staff 2341006 Nov 10 14:54 mixkit-camel_layer01.264 -rw-r--r-- 1 admin staff 3908420 Nov 10 14:54 mixkit-camel_layer012.264 -rw-r--r-- 1 admin staff 6824772 Nov 10 14:54 mixkit-camel_layer0123.264 -rw-r--r-- 1 admin staff 1556906 Nov 10 14:54 mixkit-camel_layer1.264 -rw-r--r-- 1 admin staff 1567441 Nov 10 14:55 mixkit-camel_layer2.264 -rw-r--r-- 1 admin staff 2916379 Nov 10 14:55 mixkit-camel_layer3.264
% ./ffplay ./out/mixkit-camel_layer01.264
Input #0, h264, from './out/mixkit-camel_layer01.264': Duration: N/A, bitrate: N/A Stream #0:0: Video: h264 (Constrained Baseline), yuv420p(progressive), 480x270, 25 fps, 25 tbr, 1200k tbn [h264 @ 0x7f802c2121c0] sps_id 1 out of range [h264 @ 0x7f802c2121c0] Error decoding the extradata [h264 @ 0x7f802c2121c0] sps_id 1 out of range [h264 @ 0x7f802c2121c0] sps_id 2 out of range [h264 @ 0x7f802c051a80] sps_id 1 out of range57KB sq= 0B f=0/0
[h264 @ 0x7f802c051a80] sps_id 2 out of range [h264 @ 0x7f802c066980] sps_id 1 out of range26KB sq= 0B f=0/0
[h264 @ 0x7f802c066980] sps_id 2 out of range nan M-V: nan fd= 0 aq= 0KB vq= 0KB sq= 0B f=0/0
% ./h264dec out/mixkit-camel_layer01.264 [OpenH264] this = 0x0x139808800, Warning:UpdateAccessUnit():::::Key frame lost.....CAN NOT find IDR from current AU. [OpenH264] this = 0x0x139808800, Warning:UpdateAccessUnit():::::Key frame lost.....CAN NOT find IDR from current AU. [OpenH264] this = 0x0x139808800, Warning:UpdateAccessUnit():::::Key frame lost.....CAN NOT find IDR from current AU. ... [OpenH264] this = 0x0x139808800, Warning:UpdateAccessUnit():::::Key frame lost.....CAN NOT find IDR from current AU.
iWidth: 960 height: 540 Frames: 300 decode time: 0.161631 sec FPS: 1856.079589 fps
Please experts kindly help me on this. Thanks in advance.