Line
Link Here
|
0 |
-- a/src/plumbing/transcoding.c 2017-04-24 16:55:06.000000000 +0200 |
0 |
++ bsrc/plumbing/transcoding.c 2018-12-09 21:40:39.000000000 +0100 |
Lines 19-25
Link Here
|
19 |
#include <unistd.h> |
19 |
#include <unistd.h> |
20 |
#include <libavformat/avformat.h> |
20 |
#include <libavformat/avformat.h> |
21 |
#include <libavcodec/avcodec.h> |
21 |
#include <libavcodec/avcodec.h> |
22 |
#include <libavfilter/avfiltergraph.h> |
22 |
#include <libavfilter/avfilter.h> |
23 |
#include <libavfilter/buffersink.h> |
23 |
#include <libavfilter/buffersink.h> |
24 |
#include <libavfilter/buffersrc.h> |
24 |
#include <libavfilter/buffersrc.h> |
25 |
#include <libavutil/opt.h> |
25 |
#include <libavutil/opt.h> |
Lines 574-580
Link Here
|
574 |
octx->channels = as->aud_channels ? as->aud_channels : ictx->channels; |
574 |
octx->channels = as->aud_channels ? as->aud_channels : ictx->channels; |
575 |
octx->channel_layout = transcode_get_channel_layout(&octx->channels, ocodec); |
575 |
octx->channel_layout = transcode_get_channel_layout(&octx->channels, ocodec); |
576 |
octx->bit_rate = as->aud_bitrate ? as->aud_bitrate : 0; |
576 |
octx->bit_rate = as->aud_bitrate ? as->aud_bitrate : 0; |
577 |
octx->flags |= CODEC_FLAG_GLOBAL_HEADER; |
577 |
octx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; |
578 |
if (!octx->sample_rate) { |
578 |
if (!octx->sample_rate) { |
579 |
tvherror(LS_TRANSCODE, "%04X: audio encoder has no suitable sample rate!", shortid(t)); |
579 |
tvherror(LS_TRANSCODE, "%04X: audio encoder has no suitable sample rate!", shortid(t)); |
Lines 619-625
Link Here
|
619 |
break; |
619 |
break; |
620 |
case SCT_AAC: |
620 |
case SCT_AAC: |
621 |
octx->flags |= CODEC_FLAG_BITEXACT; |
621 |
octx->flags |= AV_CODEC_FLAG_BITEXACT; |
622 |
// use 64 kbit per channel as default |
622 |
// use 64 kbit per channel as default |
623 |
if (octx->bit_rate == 0) { |
623 |
if (octx->bit_rate == 0) { |
624 |
octx->bit_rate = octx->channels * 64000; |
624 |
octx->bit_rate = octx->channels * 64000; |
Lines 630-639
Link Here
|
630 |
// use vbr with quality setting as default |
630 |
// use vbr with quality setting as default |
631 |
// and also use a user specified bitrate < 16 kbit as quality setting |
631 |
// and also use a user specified bitrate < 16 kbit as quality setting |
632 |
if (octx->bit_rate == 0) { |
632 |
if (octx->bit_rate == 0) { |
633 |
octx->flags |= CODEC_FLAG_QSCALE; |
633 |
octx->flags |= AV_CODEC_FLAG_QSCALE; |
634 |
octx->global_quality = 4 * FF_QP2LAMBDA; |
634 |
octx->global_quality = 4 * FF_QP2LAMBDA; |
635 |
} else if (t->t_props.tp_abitrate < 16) { |
635 |
} else if (t->t_props.tp_abitrate < 16) { |
636 |
octx->flags |= CODEC_FLAG_QSCALE; |
636 |
octx->flags |= AV_CODEC_FLAG_QSCALE; |
637 |
octx->global_quality = t->t_props.tp_abitrate * FF_QP2LAMBDA; |
637 |
octx->global_quality = t->t_props.tp_abitrate * FF_QP2LAMBDA; |
638 |
octx->bit_rate = 0; |
638 |
octx->bit_rate = 0; |
639 |
} |
639 |
} |
Lines 1289-1300
Link Here
|
1289 |
else |
1289 |
else |
1290 |
octx->pix_fmt = AV_PIX_FMT_YUV420P; |
1290 |
octx->pix_fmt = AV_PIX_FMT_YUV420P; |
1291 |
octx->flags |= CODEC_FLAG_GLOBAL_HEADER; |
1291 |
octx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; |
1292 |
if (t->t_props.tp_vbitrate < 64) { |
1292 |
if (t->t_props.tp_vbitrate < 64) { |
1293 |
// encode with specified quality and optimize for low latency |
1293 |
// encode with specified quality and optimize for low latency |
1294 |
// valid values for quality are 2-31, smaller means better quality, use 5 as default |
1294 |
// valid values for quality are 2-31, smaller means better quality, use 5 as default |
1295 |
octx->flags |= CODEC_FLAG_QSCALE; |
1295 |
octx->flags |= AV_CODEC_FLAG_QSCALE; |
1296 |
octx->global_quality = FF_QP2LAMBDA * |
1296 |
octx->global_quality = FF_QP2LAMBDA * |
1297 |
(t->t_props.tp_vbitrate == 0 ? 5 : MINMAX(t->t_props.tp_vbitrate, 2, 31)); |
1297 |
(t->t_props.tp_vbitrate == 0 ? 5 : MINMAX(t->t_props.tp_vbitrate, 2, 31)); |
1298 |
} else { |
1298 |
} else { |
Lines 1340-1346
Link Here
|
1340 |
else |
1340 |
else |
1341 |
octx->pix_fmt = AV_PIX_FMT_YUV420P; |
1341 |
octx->pix_fmt = AV_PIX_FMT_YUV420P; |
1342 |
octx->flags |= CODEC_FLAG_GLOBAL_HEADER; |
1342 |
octx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; |
1343 |
// Default = "medium". We gain more encoding speed compared to the loss of quality when lowering it _slightly_. |
1343 |
// Default = "medium". We gain more encoding speed compared to the loss of quality when lowering it _slightly_. |
1344 |
// select preset according to system performance and codec type |
1344 |
// select preset according to system performance and codec type |
Lines 1371-1377
Link Here
|
1371 |
case SCT_HEVC: |
1371 |
case SCT_HEVC: |
1372 |
octx->pix_fmt = AV_PIX_FMT_YUV420P; |
1372 |
octx->pix_fmt = AV_PIX_FMT_YUV420P; |
1373 |
octx->flags |= CODEC_FLAG_GLOBAL_HEADER; |
1373 |
octx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; |
1374 |
// on all hardware ultrafast (or maybe superfast) should be safe |
1374 |
// on all hardware ultrafast (or maybe superfast) should be safe |
1375 |
// select preset according to system performance |
1375 |
// select preset according to system performance |
Lines 2151-2157
Link Here
|
2151 |
if (!WORKING_ENCODER(p->id)) |
2151 |
if (!WORKING_ENCODER(p->id)) |
2152 |
continue; |
2152 |
continue; |
2153 |
if (((p->capabilities & CODEC_CAP_EXPERIMENTAL) && !experimental) || |
2153 |
if (((p->capabilities & AV_CODEC_CAP_EXPERIMENTAL) && !experimental) || |
2154 |
(p->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE)) { |
2154 |
(p->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE)) { |
2155 |
continue; |
2155 |
continue; |
2156 |
} |
2156 |
} |
Lines 2166-2172
Link Here
|
2166 |
htsmsg_add_str(m, "name", p->name); |
2166 |
htsmsg_add_str(m, "name", p->name); |
2167 |
snprintf(buf, sizeof(buf), "%s%s", |
2167 |
snprintf(buf, sizeof(buf), "%s%s", |
2168 |
p->long_name ?: "", |
2168 |
p->long_name ?: "", |
2169 |
(p->capabilities & CODEC_CAP_EXPERIMENTAL) ? |
2169 |
(p->capabilities & AV_CODEC_CAP_EXPERIMENTAL) ? |
2170 |
" (Experimental)" : ""); |
2170 |
" (Experimental)" : ""); |
2171 |
if (buf[0] != '\0') |
2171 |
if (buf[0] != '\0') |
2172 |
htsmsg_add_str(m, "long_name", buf); |
2172 |
htsmsg_add_str(m, "long_name", buf); |