[x264-devel] Is it normal that a non-IDR slice is sometimes larger than an IDR slice?
Kuu Miyazaki
miyazaqui at gmail.com
Tue Aug 4 09:09:23 CEST 2015
Hello
I'm attempting to capture images from my laptop's built-in camera and
encode them into h.264 stream using libx264.
I was able to get h264 stream so I wrapped it in MP4 moof/mdat
sequence. But when I play it back, I can observe a significant
artifact.
(Attached is the broken MP file.)
It could have nothing to do with libx264, but I wanted to ask one thing.
I can observe the size of non-IDR slices sometimes excesses that of IDR slice.
But is it normal? I don't have enough knowledge of the codec.
Bellow are the size of the first 10 samples (I omitted SPS/PPS and SEI.)
=====
NAL unit [0] -----
i_ref_idc = HIGHEST
i_type = IDR slice
i_payload = 5524
NAL unit [1] -----
i_ref_idc = HIGH
i_type = non-IDR slice
i_payload = 2171
NAL unit [2] -----
i_ref_idc = HIGH
i_type = non-IDR slice
i_payload = 9108
NAL unit [3] -----
i_ref_idc = HIGH
i_type = non-IDR slice
i_payload = 3128
NAL unit [4] -----
i_ref_idc = HIGH
i_type = non-IDR slice
i_payload = 8788
NAL unit [5] -----
i_ref_idc = HIGH
i_type = non-IDR slice
i_payload = 7294
NAL unit [6] -----
i_ref_idc = HIGH
i_type = non-IDR slice
i_payload = 7245
NAL unit [7] -----
i_ref_idc = HIGH
i_type = non-IDR slice
i_payload = 5512
NAL unit [8] -----
i_ref_idc = HIGH
i_type = non-IDR slice
i_payload = 5384
NAL unit [9] -----
i_ref_idc = HIGH
i_type = non-IDR slice
i_payload = 7467
=====
The steps are:
1) Capture 1280 x 720 32-bit BGRA image at 30fps.
2) Convert the image into 640 x 360 YUV420p using libswscale.
3) Pass the image to x264_encoder_encode().
4) Repeat step 1-3 30 times.
5) Obtain the NAL units by passing NULL to x264_encoder_encode().
The source code is available here:
https://github.com/kuu/node-media-capture
(All the x264-related code is in
src/native/platform/osx/facetime_camera_controller.m)
Thanks in advance for your help.
Kuu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: broken.mp4
Type: video/mp4
Size: 547986 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x264-devel/attachments/20150804/1db31c07/attachment-0001.mp4>
More information about the x264-devel
mailing list