Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2014-01-22 20:11:13 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2014-01-22 20:15:40 +0400
commit1ace8753918b9cf067db75921fdb8d246abdd2e8 (patch)
tree3e7d7fcf16f1bdac5b2741299ce4943020f368bd /source/blender/blenkernel/intern/writeffmpeg.c
parente2cd654a3e53c8265a2a27f69b861dc2e44106c3 (diff)
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.
Diffstat (limited to 'source/blender/blenkernel/intern/writeffmpeg.c')
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index 713f970f1e5..d975e60146f 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;