[FFmpeg-cvslog] fftools/ffmpeg_enc: set audio frame duration when encoding

Anton Khirnov git at videolan.org
Wed Apr 19 22:16:19 EEST 2023


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Fri Apr 14 11:24:39 2023 +0200| [af286f17a1c79b6d543c586cf020d08d4e84f0eb] | committer: Anton Khirnov

fftools/ffmpeg_enc: set audio frame duration when encoding

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=af286f17a1c79b6d543c586cf020d08d4e84f0eb
---

 fftools/ffmpeg_enc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c
index 45bf4b127f..a35c9f60e5 100644
--- a/fftools/ffmpeg_enc.c
+++ b/fftools/ffmpeg_enc.c
@@ -811,6 +811,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;



More information about the ffmpeg-cvslog mailing list