More accurate video pts calculation; may help with #1663.
authorCarl Hetherington <cth@carlh.net>
Sat, 30 Nov 2019 21:38:21 +0000 (21:38 +0000)
committerCarl Hetherington <cth@carlh.net>
Sat, 30 Nov 2019 21:38:21 +0000 (21:38 +0000)
src/lib/ffmpeg_file_encoder.cc

index abde0c153f433a754fc77c2ac253cfe2bdac67af..294b031621b91076606bc716b273096ade261d61 100644 (file)
@@ -260,7 +260,8 @@ FFmpegFileEncoder::video (shared_ptr<PlayerVideo> video, DCPTime time)
        frame->width = image->size().width;
        frame->height = image->size().height;
        frame->format = _pixel_format;
-       frame->pts = time.seconds() / av_q2d (_video_stream->time_base);
+       DCPOMATIC_ASSERT (_video_stream->time_base.num == 1);
+       frame->pts = time.get() * _video_stream->time_base.den / DCPTime::HZ;
 
        AVPacket packet;
        av_init_packet (&packet);