diff mbox series

[FFmpeg-devel,6/7] fftools/ffmpeg_enc: set audio frame duration when encoding

Message ID 20230414164244.15264-6-anton@khirnov.net
State Accepted
Commit af286f17a1c79b6d543c586cf020d08d4e84f0eb
Headers show
Series [FFmpeg-devel,1/7] lavfi: ensure audio frame durations match the sample count | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov April 14, 2023, 4:42 p.m. UTC
---
 fftools/ffmpeg_enc.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c
index a0779c45ae..00cccef65b 100644
--- a/fftools/ffmpeg_enc.c
+++ b/fftools/ffmpeg_enc.c
@@ -795,6 +795,8 @@  static void do_audio_out(OutputFile *of, OutputStream *ost,
             av_rescale_q(start_time, AV_TIME_BASE_Q,   enc->time_base);
     }
     frame->time_base = enc->time_base;
+    frame->duration  = av_rescale_q(frame->nb_samples, (AVRational){1, frame->sample_rate},
+                                    enc->time_base);
 
     if (!check_recording_time(ost, frame->pts, frame->time_base))
         return;