Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
3a70c0c9
Commit
3a70c0c9
authored
Jan 27, 2015
by
Andreas Unterweger
Committed by
Anton Khirnov
Jan 27, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
examples/transcode_aac: generate proper PTS and set the muxer timebase
Signed-off-by:
Anton Khirnov
<
anton@khirnov.net
>
parent
c9b19ac8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
transcode_aac.c
doc/examples/transcode_aac.c
+13
-0
No files found.
doc/examples/transcode_aac.c
View file @
3a70c0c9
...
@@ -182,6 +182,10 @@ static int open_output_file(const char *filename,
...
@@ -182,6 +182,10 @@ static int open_output_file(const char *filename,
/** Allow the use of the experimental AAC encoder */
/** Allow the use of the experimental AAC encoder */
(
*
output_codec_context
)
->
strict_std_compliance
=
FF_COMPLIANCE_EXPERIMENTAL
;
(
*
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
* Some container formats (like MP4) require global headers to be present
* Mark the encoder so that it behaves accordingly.
* Mark the encoder so that it behaves accordingly.
...
@@ -553,6 +557,9 @@ static int init_output_frame(AVFrame **frame,
...
@@ -553,6 +557,9 @@ static int init_output_frame(AVFrame **frame,
return
0
;
return
0
;
}
}
/** Global timestamp for the audio frames */
static
int64_t
pts
=
0
;
/** Encode one frame worth of audio to the output file. */
/** Encode one frame worth of audio to the output file. */
static
int
encode_audio_frame
(
AVFrame
*
frame
,
static
int
encode_audio_frame
(
AVFrame
*
frame
,
AVFormatContext
*
output_format_context
,
AVFormatContext
*
output_format_context
,
...
@@ -564,6 +571,12 @@ static int encode_audio_frame(AVFrame *frame,
...
@@ -564,6 +571,12 @@ static int encode_audio_frame(AVFrame *frame,
int
error
;
int
error
;
init_packet
(
&
output_packet
);
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.
* Encode the audio frame and store it in the temporary packet.
* The output audio stream encoder is used to do this.
* The output audio stream encoder is used to do this.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment