[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56494] trunk/blender/source/blender/ quicktime/apple/qtkit_export.m: Fix quicktime video export not properly supporting animation of audio properties like volume .

Brecht Van Lommel brechtvanlommel at pandora.be
Sat May 4 15:17:44 CEST 2013


Revision: 56494
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56494
Author:   blendix
Date:     2013-05-04 13:17:43 +0000 (Sat, 04 May 2013)
Log Message:
-----------
Fix quicktime video export not properly supporting animation of audio properties like volume.

Patch #35184 by James Yonan, see the report for a detailed explanation of why this failed.

Modified Paths:
--------------
    trunk/blender/source/blender/quicktime/apple/qtkit_export.m

Modified: trunk/blender/source/blender/quicktime/apple/qtkit_export.m
===================================================================
--- trunk/blender/source/blender/quicktime/apple/qtkit_export.m	2013-05-03 22:43:02 UTC (rev 56493)
+++ trunk/blender/source/blender/quicktime/apple/qtkit_export.m	2013-05-04 13:17:43 UTC (rev 56494)
@@ -648,14 +648,24 @@
 	
 	if (qtexport->audioFile) {
 		UInt32 audioPacketsConverted;
+
+		// Upper limit on total exported audio frames for this particular video frame
+		const UInt64 exportedAudioFrameLimit = (frame - rd->sfra) * qtexport->audioInputFormat.mSampleRate * rd->frs_sec_base / rd->frs_sec;
+
 		/* Append audio */
-		while (qtexport->audioTotalExportedFrames < qtexport->audioLastFrame) {
+		while (qtexport->audioTotalExportedFrames < exportedAudioFrameLimit) {
 
 			qtexport->audioBufferList.mNumberBuffers = 1;
 			qtexport->audioBufferList.mBuffers[0].mNumberChannels = qtexport->audioOutputFormat.mChannelsPerFrame;
 			qtexport->audioBufferList.mBuffers[0].mDataByteSize = AUDIOOUTPUTBUFFERSIZE;
 			qtexport->audioBufferList.mBuffers[0].mData = qtexport->audioOutputBuffer;
-			audioPacketsConverted = AUDIOOUTPUTBUFFERSIZE / qtexport->audioCodecMaxOutputPacketSize;
+
+			// Convert one audio packet at a time so that enclosing while loop can
+			// keep audio processing in sync with video frames.
+			// Previously, this was set to (AUDIOOUTPUTBUFFERSIZE / qtexport->audioCodecMaxOutputPacketSize),
+			// however this may cause AudioConverterFillComplexBuffer to convert audio spanning multiple
+			// video frames, which breaks animation of audio parameters such as volume for fade-in/out.
+			audioPacketsConverted = 1; 
 			
 			err = AudioConverterFillComplexBuffer(qtexport->audioConverter, AudioConverterInputCallback,
 			                                      NULL, &audioPacketsConverted, &qtexport->audioBufferList, qtexport->audioOutputPktDesc);




More information about the Bf-blender-cvs mailing list