Skip to content

Commit cbca461

Browse files
committed
Output: HDR signal
MP4: store HDR SEI in first frame MKV: not yet tested or supported with HDR
1 parent 86e6d5e commit cbca461

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

source/encoder/encoder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3050,7 +3050,7 @@ void Encoder::configure(x265_param *p)
30503050

30513051
if (m_param->toneMapFile || p->bHDROpt || p->bEmitHDRSEI)
30523052
{
3053-
if (!p->bRepeatHeaders)
3053+
if (!p->bRepeatHeaders && p->bAnnexB)
30543054
{
30553055
p->bRepeatHeaders = 1;
30563056
x265_log(p, X265_LOG_WARNING, "Turning on repeat-headers for HDR compatibility\n");

source/output/mp4.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,15 +297,24 @@ int MP4Output::writeHeaders(const x265_nal* p_nal, uint32_t nalcount)
297297
i_sample_entry = lsmash_add_sample_entry(p_root, i_track, summary);
298298
MP4_FAIL_IF_ERR(!i_sample_entry,
299299
"failed to add sample entry for video.\n");
300+
301+
i_sei_size = 0;
300302
if(nalcount >= 4)
301303
{
302-
uint8_t *sei = p_nal[3].payload;
303-
i_sei_size = p_nal[3].sizeBytes;
304+
for (uint32_t i = 3; i < nalcount; i++)
305+
i_sei_size += p_nal[i].sizeBytes;
306+
304307
/* SEI */
305308
p_sei_buffer = new uint8_t[i_sei_size];
306309
MP4_FAIL_IF_ERR(!p_sei_buffer,
307310
"failed to allocate sei transition buffer.\n");
308-
memcpy(p_sei_buffer, sei, i_sei_size);
311+
312+
uint8_t *p_sei_pt = p_sei_buffer;
313+
for (uint32_t i = 3; i < nalcount; i++)
314+
{
315+
memcpy(p_sei_pt, p_nal[i].payload, p_nal[i].sizeBytes);
316+
p_sei_pt += p_nal[i].sizeBytes;
317+
}
309318
}
310319

311320
return vps_size + sps_size + pps_size;

0 commit comments

Comments
 (0)