Fix T38422: Error writing AAC frame when using FFmpeg compiled with vo_aacenc
Issue was caused by missing GLOBALHEADER flag set for audio stream. Also made it so frame is getting filled with default, that's what happening in ffmpeg.c.
This commit is contained in:
parent
280f9d3b39
commit
a61e3b9a9e
Notes:
blender-bot
2024-04-11 14:26:06 +02:00
Referenced by issue #38422, Error writing frame
|
@ -138,6 +138,7 @@ static int write_audio_frame(void)
|
|||
|
||||
#ifdef FFMPEG_HAVE_ENCODE_AUDIO2
|
||||
frame = avcodec_alloc_frame();
|
||||
avcodec_get_frame_defaults(frame);
|
||||
frame->pts = audio_time / av_q2d(c->time_base);
|
||||
frame->nb_samples = audio_input_samples;
|
||||
frame->format = c->sample_fmt;
|
||||
|
@ -710,6 +711,10 @@ static AVStream *alloc_audio_stream(RenderData *rd, int codec_id, AVFormatContex
|
|||
st->codec->sample_rate = best;
|
||||
}
|
||||
|
||||
if (of->oformat->flags & AVFMT_GLOBALHEADER) {
|
||||
c->flags |= CODEC_FLAG_GLOBAL_HEADER;
|
||||
}
|
||||
|
||||
set_ffmpeg_properties(rd, c, "audio");
|
||||
|
||||
if (avcodec_open2(c, codec, NULL) < 0) {
|
||||
|
|
Loading…
Reference in New Issue