diff options
author | Anton Khirnov <anton@khirnov.net> | 2014-07-23 11:09:16 +0000 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2014-07-26 14:57:45 +0000 |
commit | 884f7c975f0af25febe86660e87bf3b2165a0309 (patch) | |
tree | 4c4cf11aae2b6ef4a025fe2cd5bad598939d59a3 | |
parent | d8520d3ee032bf18f28897e0109f44b405caf5e3 (diff) | |
download | ffmpeg-884f7c975f0af25febe86660e87bf3b2165a0309.tar.gz |
output example: set the stream timebase
This is required by the new API.
-rw-r--r-- | doc/examples/output.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/doc/examples/output.c b/doc/examples/output.c index 883d55f0e2..239fe5b3eb 100644 --- a/doc/examples/output.c +++ b/doc/examples/output.c @@ -96,6 +96,8 @@ static void add_audio_stream(OutputStream *ost, AVFormatContext *oc, c->channels = 2; c->channel_layout = AV_CH_LAYOUT_STEREO; + ost->st->time_base = (AVRational){ 1, c->sample_rate }; + // some formats want stream headers to be separate if (oc->oformat->flags & AVFMT_GLOBALHEADER) c->flags |= CODEC_FLAG_GLOBAL_HEADER; @@ -239,8 +241,9 @@ static void add_video_stream(OutputStream *ost, AVFormatContext *oc, * of which frame timestamps are represented. For fixed-fps content, * timebase should be 1/framerate and timestamp increments should be * identical to 1. */ - c->time_base.den = STREAM_FRAME_RATE; - c->time_base.num = 1; + ost->st->time_base = (AVRational){ 1, STREAM_FRAME_RATE }; + c->time_base = ost->st->time_base; + c->gop_size = 12; /* emit one intra frame every twelve frames at most */ c->pix_fmt = STREAM_PIX_FMT; if (c->codec_id == AV_CODEC_ID_MPEG2VIDEO) { |