summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-01-27 13:35:27 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-01-27 13:35:31 +0100
commite5c28d4f9a72691daa788a252f9b06c758882cf2 (patch)
tree2727d0126d551e007881af6f8b0b63e8fa2afc5d /doc
parentd078d57fb769e83c00c402f2f34978c1cd50dce7 (diff)
parent3a70c0c95feacb3844d05eebd579fc8189a77eee (diff)
Merge commit '3a70c0c95feacb3844d05eebd579fc8189a77eee'
* commit '3a70c0c95feacb3844d05eebd579fc8189a77eee': examples/transcode_aac: generate proper PTS and set the muxer timebase Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'doc')
-rw-r--r--doc/examples/transcode_aac.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/doc/examples/transcode_aac.c b/doc/examples/transcode_aac.c
index 60cf2d9e35..339d65c71c 100644
--- a/doc/examples/transcode_aac.c
+++ b/doc/examples/transcode_aac.c
@@ -183,6 +183,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.
@@ -539,6 +543,9 @@ static int init_output_frame(AVFrame **frame,
return 0;
}
+/** Global timestamp for the audio frames */
+static int64_t pts = 0;
+
/** Encode one frame worth of audio to the output file. */
static int encode_audio_frame(AVFrame *frame,
AVFormatContext *output_format_context,
@@ -550,6 +557,12 @@ static int encode_audio_frame(AVFrame *frame,
int error;
init_packet(&output_packet);
+ /** Set a timestamp based on the sample rate for the container. */
+ 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.