running = false;
should_quit = true;
any_frames_to_be_encoded.notify_all();
+ any_frames_encoding.notify_all();
encoder_thread.join();
if (va_dpy != nullptr) {
va_receiver_thread.join();
pkt.size = jpeg.size();
pkt.stream_index = card_index;
pkt.flags = AV_PKT_FLAG_KEY;
- pkt.pts = pkt.dts = pts;
+ AVRational time_base = avctx->streams[pkt.stream_index]->time_base;
+ pkt.pts = pkt.dts = av_rescale_q(pts, AVRational{ 1, TIMEBASE }, time_base);
if (av_write_frame(avctx.get(), &pkt) < 0) {
fprintf(stderr, "av_write_frame() failed\n");