From 2afcf0d976dcba457fcfd8ec9b6fb67bc3161655 Mon Sep 17 00:00:00 2001
From: Andreas Unterweger <[email protected]>
Date: Sun, 25 Jan 2015 12:29:05 +0100
Subject: [PATCH 3/3] Generate proper PTS for the muxer and set the container
 time base to get rid of the newly introduced warning when only the
 container's codec time base is set

---
 doc/examples/transcode_aac.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/doc/examples/transcode_aac.c b/doc/examples/transcode_aac.c
index 3bc2f69..c7ed05c 100644
--- a/doc/examples/transcode_aac.c
+++ b/doc/examples/transcode_aac.c
@@ -184,6 +184,10 @@ static int open_output_file(const char *filename,
     /** Allow the use of the experimental AAC encoder */
     (*output_codec_context)->strict_std_compliance = 
FF_COMPLIANCE_EXPERIMENTAL;
+ /** Set the sample rate for the container */
+    stream->time_base.den = input_codec_context->sample_rate;
+    stream->time_base.num = 1;
+
     /**
      * Some container formats (like MP4) require global headers to be present
      * Mark the encoder so that it behaves accordingly.
@@ -565,6 +569,13 @@ static int encode_audio_frame(AVFrame *frame,
     int error;
     init_packet(&output_packet);
+ /** Set an artificial timestamp for the container later */
+    static long pts = 0;
+    if (frame) {
+        frame->pts = pts;
+        pts += frame->nb_samples;
+    }
+
     /**
      * Encode the audio frame and store it in the temporary packet.
      * The output audio stream encoder is used to do this.
--
1.9.1

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to