]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/blobdiff - ffmpeg.c
set pkt duration for last smaller frame, should fix alac in m4a muxing
[frescor/ffmpeg.git] / ffmpeg.c
index 1a4fcfbc48cd743ab93b005dc6c6613285a904cb..4be4b9268196e997fb083d61260c6b60bc303a7f 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1469,6 +1469,8 @@ static int output_packet(AVInputStream *ist, int ist_index,
                                 enc->frame_size = fifo_bytes / (2 * enc->channels);
                                 av_fifo_generic_read(ost->fifo, samples, fifo_bytes, NULL);
                                 ret = avcodec_encode_audio(enc, bit_buffer, bit_buffer_size, samples);
+                                pkt.duration = av_rescale((int64_t)enc->frame_size*ost->st->time_base.den,
+                                                          ost->st->time_base.num, enc->sample_rate);
                                 enc->frame_size = fs_tmp;
                             }
                             if(ret <= 0) {