We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parente644bb6 commitbd24d5bCopy full SHA for bd24d5b
src/AvTranscoder/transcoder/StreamTranscoder.cpp
@@ -588,6 +588,15 @@ void StreamTranscoder::preProcessCodecLatency()
588
wasARewrapCase =true;
589
}
590
591
+if(_offset >0) {
592
+constdouble fps =1.0 * _outputEncoder->getCodec().getAVCodecContext().time_base.den /
593
+ (_outputEncoder->getCodec().getAVCodecContext().time_base.num * _outputEncoder->getCodec().getAVCodecContext().ticks_per_frame);
594
+constdouble frame_duration =1.0 / fps;
595
+constdouble output_latency_duration = frame_duration * (latency -1);
596
+LOG_WARN("Compensate for offset with codec latency by" << output_latency_duration <<" seconds (fps=" << fps <<", latency=" << latency <<")");
597
+ _offset -= output_latency_duration;
598
+ }
599
+
600
while((latency--) >0)
601
{
602
processFrame();