Hi,
I am using Encoder to encoder H264 & H265 by slicelevelencode. Then I checked the metadata by ctx->enc->getMetadata(v4l2_buf->index, enc_metadata).
In the enc_metadata, the EndofFrame is always 0, and KeyFrame is sometimes 1.
What I want to get are the IDR frame and the actual end of frame flags.
DaneLLL
December 28, 2020, 5:50am
3
Hi,
Please refer to the case of 640x480 encoding:
nvidia@nvidia-desktop:~/jetson_multimedia_api/samples/01_video_encode$ ./video_encode a.yuv 640 480 H264 a.h264 -slt 1 -slen 300 --sle --report-metadata
Creating Encoder in blocking mode
Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 4
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4
875967048
842091865
H264: Profile = 66, Level = 51
Frame 0: isKeyFrame=0 AvgQP=0 MinQP=0 MaxQP=0 EncodedBits=0
Frame 1: isKeyFrame=0 AvgQP=0 MinQP=0 MaxQP=0 EncodedBits=0
Frame 2: isKeyFrame=0 AvgQP=0 MinQP=0 MaxQP=0 EncodedBits=0
Frame 3: isKeyFrame=1 AvgQP=13 MinQP=12 MaxQP=15 EncodedBits=186384
Frame 4: isKeyFrame=0 AvgQP=0 MinQP=0 MaxQP=0 EncodedBits=0
Frame 5: isKeyFrame=0 AvgQP=0 MinQP=0 MaxQP=0 EncodedBits=0
Frame 6: isKeyFrame=0 AvgQP=0 MinQP=0 MaxQP=0 EncodedBits=0
Frame 7: isKeyFrame=0 AvgQP=12 MinQP=12 MaxQP=14 EncodedBits=166944
Frame 8: isKeyFrame=0 AvgQP=0 MinQP=0 MaxQP=0 EncodedBits=0
Frame 9: isKeyFrame=0 AvgQP=0 MinQP=0 MaxQP=0 EncodedBits=0
Frame 10: isKeyFrame=0 AvgQP=0 MinQP=0 MaxQP=0 EncodedBits=0
Frame 11: isKeyFrame=0 AvgQP=12 MinQP=12 MaxQP=13 EncodedBits=171104
Frame 12: isKeyFrame=0 AvgQP=0 MinQP=0 MaxQP=0 EncodedBits=0
Frame 13: isKeyFrame=0 AvgQP=0 MinQP=0 MaxQP=0 EncodedBits=0
Frame 14: isKeyFrame=0 AvgQP=0 MinQP=0 MaxQP=0 EncodedBits=0
Frame 15: isKeyFrame=0 AvgQP=12 MinQP=12 MaxQP=13 EncodedBits=171856
Frame 16: isKeyFrame=0 AvgQP=0 MinQP=0 MaxQP=0 EncodedBits=0
Frame 17: isKeyFrame=0 AvgQP=0 MinQP=0 MaxQP=0 EncodedBits=0
Frame 18: isKeyFrame=0 AvgQP=0 MinQP=0 MaxQP=0 EncodedBits=0
Could not read complete frame from input file
Frame 19: isKeyFrame=0 AvgQP=13 MinQP=13 MaxQP=13 EncodedBits=171104
File read complete.
Frame 20: isKeyFrame=0 AvgQP=0 MinQP=0 MaxQP=0 EncodedBits=0
Frame 21: isKeyFrame=0 AvgQP=0 MinQP=0 MaxQP=0 EncodedBits=0
Frame 22: isKeyFrame=0 AvgQP=0 MinQP=0 MaxQP=0 EncodedBits=0
Frame 23: isKeyFrame=0 AvgQP=13 MinQP=13 MaxQP=13 EncodedBits=171192
Frame 24: isKeyFrame=0 AvgQP=0 MinQP=0 MaxQP=0 EncodedBits=0
Frame 25: isKeyFrame=0 AvgQP=0 MinQP=0 MaxQP=0 EncodedBits=0
Frame 26: isKeyFrame=0 AvgQP=0 MinQP=0 MaxQP=0 EncodedBits=0
Frame 27: isKeyFrame=0 AvgQP=14 MinQP=14 MaxQP=14 EncodedBits=164080
Frame 28: isKeyFrame=0 AvgQP=0 MinQP=0 MaxQP=0 EncodedBits=0
Frame 29: isKeyFrame=0 AvgQP=0 MinQP=0 MaxQP=0 EncodedBits=0
Frame 30: isKeyFrame=0 AvgQP=0 MinQP=0 MaxQP=0 EncodedBits=0
Frame 31: isKeyFrame=0 AvgQP=14 MinQP=14 MaxQP=14 EncodedBits=163472
Frame 32: isKeyFrame=0 AvgQP=0 MinQP=0 MaxQP=0 EncodedBits=0
Frame 33: isKeyFrame=0 AvgQP=0 MinQP=0 MaxQP=0 EncodedBits=0
Frame 34: isKeyFrame=0 AvgQP=0 MinQP=0 MaxQP=0 EncodedBits=0
Frame 35: isKeyFrame=0 AvgQP=14 MinQP=14 MaxQP=14 EncodedBits=163808
Frame 36: isKeyFrame=0 AvgQP=0 MinQP=0 MaxQP=0 EncodedBits=0
Frame 37: isKeyFrame=0 AvgQP=0 MinQP=0 MaxQP=0 EncodedBits=0
Frame 38: isKeyFrame=0 AvgQP=0 MinQP=0 MaxQP=0 EncodedBits=0
Frame 39: isKeyFrame=0 AvgQP=15 MinQP=15 MaxQP=15 EncodedBits=158208
Got 0 size buffer in capture
App run was successful
When the slice is end of frame, you will see the information of the frame:
Frame 3: isKeyFrame=1 AvgQP=13 MinQP=12 MaxQP=15 EncodedBits=186384
Frame 7: isKeyFrame=0 AvgQP=12 MinQP=12 MaxQP=14 EncodedBits=166944
Frame 11: isKeyFrame=0 AvgQP=12 MinQP=12 MaxQP=13 EncodedBits=171104
You can rely on the information to know if it is EndofFrame.