[Bf-blender-cvs] [1ace875] master: Fix T37198: Vorbis encoding is broken

Sergey Sharybin noreply at git.blender.org
Wed Jan 22 17:15:48 CET 2014


Commit: 1ace8753918b9cf067db75921fdb8d246abdd2e8
Author: Sergey Sharybin
Date:   Wed Jan 22 22:11:13 2014 +0600
https://developer.blender.org/rB1ace8753918b9cf067db75921fdb8d246abdd2e8

Fix T37198: Vorbis encoding is broken

Issue was caused by wrong PTS calculation. This commit
makes this calculation closer to what's happening in
FFmpeg itself.

Seems everything is working now including newer FFmpeg,
but there's one thing which still doesn't work: writing
avi files with h264 codec and Vorbis audio doesn't play
correct in mplayer here. But didn't manage to get this
working even using FFmpeg CLI, so this might be just a
bug in FFmpeg/mplayer. Since this file works fine in
blender just fine wouldn't consider this is crucial thing
to look into at this moment.

===================================================================

M	source/blender/blenkernel/intern/writeffmpeg.c

===================================================================

diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index 713f970..d975e60 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -141,6 +141,7 @@ static int write_audio_frame(void)
 
 #ifdef FFMPEG_HAVE_ENCODE_AUDIO2
 	frame = avcodec_alloc_frame();
+	frame->pts = audio_time / av_q2d(c->time_base);
 	frame->nb_samples = audio_input_samples;
 	frame->format = c->sample_fmt;
 #ifdef FFMPEG_HAVE_FRAME_CHANNEL_LAYOUT
@@ -188,10 +189,12 @@ static int write_audio_frame(void)
 #endif
 
 	if (got_output) {
-		if (c->coded_frame && c->coded_frame->pts != AV_NOPTS_VALUE) {
-			pkt.pts = av_rescale_q(c->coded_frame->pts, c->time_base, audio_stream->time_base);
-			PRINT("Audio Frame PTS: %d\n", (int) pkt.pts);
-		}
+		if (pkt.pts != AV_NOPTS_VALUE)
+			pkt.pts = av_rescale_q(pkt.pts, c->time_base, audio_stream->time_base);
+		if (pkt.dts != AV_NOPTS_VALUE)
+			pkt.dts = av_rescale_q(pkt.dts, c->time_base, audio_stream->time_base);
+		if (pkt.duration > 0)
+			pkt.duration = av_rescale_q(pkt.duration, c->time_base, audio_stream->time_base);
 
 		pkt.stream_index = audio_stream->index;




More information about the Bf-blender-cvs mailing list