kopia lustrzana https://github.com/kierank/libmpegts
Improve high-bitrate profile handling
rodzic
106fd8e5ba
commit
86dd0dd326
15
codecs.h
15
codecs.h
|
@ -67,6 +67,7 @@ const avc_level_t avc_levels[] =
|
||||||
{ 42, 50000, 62500 },
|
{ 42, 50000, 62500 },
|
||||||
{ 50, 135000, 135000 },
|
{ 50, 135000, 135000 },
|
||||||
{ 51, 240000, 240000 },
|
{ 51, 240000, 240000 },
|
||||||
|
{ 52, 240000, 240000 },
|
||||||
{ 0 }
|
{ 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -84,6 +85,20 @@ const uint8_t avc_profiles[] =
|
||||||
[AVC_CAVLC_444_INTRA] = 44,
|
[AVC_CAVLC_444_INTRA] = 44,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const int nal_factor[] =
|
||||||
|
{
|
||||||
|
[AVC_BASELINE] = 1200,
|
||||||
|
[AVC_MAIN] = 1200,
|
||||||
|
[AVC_HIGH] = 1500,
|
||||||
|
[AVC_HIGH_10] = 3600,
|
||||||
|
[AVC_HIGH_422] = 4800,
|
||||||
|
[AVC_HIGH_444_PRED] = 4800,
|
||||||
|
[AVC_HIGH_10_INTRA] = 3600,
|
||||||
|
[AVC_HIGH_422_INTRA] = 4800,
|
||||||
|
[AVC_HIGH_444_INTRA] = 4800,
|
||||||
|
[AVC_CAVLC_444_INTRA] = 4800,
|
||||||
|
};
|
||||||
|
|
||||||
/* Audio */
|
/* Audio */
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
|
11
libmpegts.c
11
libmpegts.c
|
@ -1151,14 +1151,15 @@ int ts_setup_mpegvideo_stream( ts_writer_t *w, int pid, int level, int profile,
|
||||||
}
|
}
|
||||||
else if( stream->stream_format == LIBMPEGTS_VIDEO_AVC )
|
else if( stream->stream_format == LIBMPEGTS_VIDEO_AVC )
|
||||||
{
|
{
|
||||||
bs_mux = 0.004 * MAX( 1200 * avc_levels[level_idx].bitrate, 2000000 );
|
int factor = (float)nal_factor[stream->mpegvideo_ctx->profile] * 1.2;
|
||||||
bs_oh = 1.0 * MAX( 1200 * avc_levels[level_idx].bitrate, 2000000 )/750.0;
|
bs_mux = 0.004 * MAX( factor * avc_levels[level_idx].bitrate, 2000000 );
|
||||||
|
bs_oh = 1.0 * MAX( factor * avc_levels[level_idx].bitrate, 2000000 )/750.0;
|
||||||
|
|
||||||
stream->mb.buf_size = bs_mux + bs_oh;
|
stream->mb.buf_size = bs_mux + bs_oh;
|
||||||
stream->eb.buf_size = 1200 * avc_levels[level_idx].cpb;
|
stream->eb.buf_size = nal_factor * avc_levels[level_idx].cpb;
|
||||||
|
|
||||||
stream->rx = 1200 * avc_levels[level_idx].bitrate;
|
stream->rx = factor * avc_levels[level_idx].bitrate;
|
||||||
stream->rbx = 1200 * avc_levels[level_idx].bitrate;
|
stream->rbx = factor * avc_levels[level_idx].bitrate;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Ładowanie…
Reference in New Issue