From 74aede4d71aff4795178885ad5b82d4bfddadcb1 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 13 Jan 2012 09:20:13 +0000 Subject: Fix #29824: Error writing frame if 3D scene starts after first frame of animation and output is H264 Issue was caused by incorrectly set PTS value frames came form Scene strip renderer. This value used to be calculated from RenderData current and start frame which lead to non-uniformuly counting which totally confuses encoder. Switch append_avi and append_ffmpeg to use current frame from rendering scene (which was already passing to this functions and was used mostly for logging) and start frame of rendering scene (it's new parameter added). This allowed to calculate correct PTS value easily and get rid of global static sframe variable in writeavi.c file. --- source/blender/blenkernel/intern/writeavi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source/blender/blenkernel/intern/writeavi.c') diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c index da64c464dce..dbb37ad9c1d 100644 --- a/source/blender/blenkernel/intern/writeavi.c +++ b/source/blender/blenkernel/intern/writeavi.c @@ -52,7 +52,8 @@ /* callbacks */ static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportList *reports); static void end_avi(void); -static int append_avi(RenderData *rd, int frame, int *pixels, int rectx, int recty, ReportList *reports); +static int append_avi(RenderData *rd, int start_frame, int frame, int *pixels, + int rectx, int recty, ReportList *reports); static void filepath_avi(char *string, RenderData *rd); /* ********************** general blender movie support ***************************** */ @@ -121,7 +122,6 @@ bMovieHandle *BKE_get_movie_handle(const char imtype) static AviMovie *avi=NULL; -static int sframe; static void filepath_avi (char *string, RenderData *rd) { @@ -150,7 +150,6 @@ static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportL filepath_avi(name, rd); - sframe = (rd->sfra); x = rectx; y = recty; @@ -183,7 +182,8 @@ static int start_avi(Scene *scene, RenderData *rd, int rectx, int recty, ReportL return 1; } -static int append_avi(RenderData *UNUSED(rd), int frame, int *pixels, int rectx, int recty, ReportList *UNUSED(reports)) +static int append_avi(RenderData *UNUSED(rd), int start_frame, int frame, int *pixels, + int rectx, int recty, ReportList *UNUSED(reports)) { unsigned int *rt1, *rt2, *rectot; int x, y; @@ -212,8 +212,8 @@ static int append_avi(RenderData *UNUSED(rd), int frame, int *pixels, int rectx, } } - AVI_write_frame (avi, (frame-sframe), AVI_FORMAT_RGB32, rectot, rectx*recty*4); -// printf ("added frame %3d (frame %3d in avi): ", frame, frame-sframe); + AVI_write_frame (avi, (frame-start_frame), AVI_FORMAT_RGB32, rectot, rectx*recty*4); +// printf ("added frame %3d (frame %3d in avi): ", frame, frame-start_frame); return 1; } -- cgit v1.2.3