transcoding: fix encoder time_base again
This commit is contained in:
parent
e797e46129
commit
a69ee153d0
1 changed files with 9 additions and 2 deletions
|
@ -1027,10 +1027,17 @@ transcoder_stream_video(transcoder_t *t, transcoder_stream_t *ts, th_pkt_t *pkt)
|
|||
octx->width = vs->vid_width ? vs->vid_width : ictx->width;
|
||||
octx->height = vs->vid_height ? vs->vid_height : ictx->height;
|
||||
octx->gop_size = 25;
|
||||
octx->time_base.den = ictx->time_base.den;
|
||||
octx->time_base.num = ictx->time_base.num;
|
||||
octx->has_b_frames = ictx->has_b_frames;
|
||||
|
||||
// Encoder uses "time_base" for bitrate calculation, but "time_base" from decoder
|
||||
// will be deprecated in the future, therefore calculate "time_base" from "framerate" if available.
|
||||
octx->ticks_per_frame = ictx->ticks_per_frame;
|
||||
if (ictx->framerate.num != 0 && ictx->framerate.den != 0) {
|
||||
octx->time_base = av_inv_q(av_mul_q(ictx->framerate, av_make_q(ictx->ticks_per_frame, 1)));
|
||||
} else {
|
||||
octx->time_base = ictx->time_base;
|
||||
}
|
||||
|
||||
switch (ts->ts_type) {
|
||||
case SCT_MPEG2VIDEO:
|
||||
octx->codec_id = AV_CODEC_ID_MPEG2VIDEO;
|
||||
|
|
Loading…
Add table
Reference in a new issue