[FFmpeg-devel] [PATCH] examples/muxing: simplify video PTS setting
Stefano Sabatini
stefasab at gmail.com
Fri Jan 10 11:08:42 CET 2014
Rely on frame_count. Also more consistent with audio path.
---
doc/examples/muxing.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/doc/examples/muxing.c b/doc/examples/muxing.c
index bbc66d6..c5f2240 100644
--- a/doc/examples/muxing.c
+++ b/doc/examples/muxing.c
@@ -432,6 +432,7 @@ static void write_video_frame(AVFormatContext *oc, AVStream *st)
av_init_packet(&pkt);
/* encode the image */
+ frame->pts = frame_count;
ret = avcodec_encode_video2(c, &pkt, frame, &got_packet);
if (ret < 0) {
fprintf(stderr, "Error encoding video frame: %s\n", av_err2str(ret));
@@ -546,8 +547,6 @@ int main(int argc, char **argv)
return 1;
}
- if (frame)
- frame->pts = 0;
for (;;) {
/* Compute current audio and video time. */
audio_time = audio_st ? audio_st->pts.val * av_q2d(audio_st->time_base) : 0.0;
@@ -562,7 +561,6 @@ int main(int argc, char **argv)
write_audio_frame(oc, audio_st);
} else {
write_video_frame(oc, video_st);
- frame->pts++;
}
}
--
1.8.1.2
More information about the ffmpeg-devel
mailing list