1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-28 20:53:54 +02:00

avformat/flvenc: use extract_extradata bsf when necessary

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
This commit is contained in:
Zhao Zhili 2023-03-16 00:27:51 +08:00
parent 639ded10e3
commit 34b8af7963

View File

@ -1023,13 +1023,15 @@ fail:
static int flv_check_bitstream(AVFormatContext *s, AVStream *st, static int flv_check_bitstream(AVFormatContext *s, AVStream *st,
const AVPacket *pkt) const AVPacket *pkt)
{ {
int ret = 1;
if (st->codecpar->codec_id == AV_CODEC_ID_AAC) { if (st->codecpar->codec_id == AV_CODEC_ID_AAC) {
if (pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) if (pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0)
ret = ff_stream_add_bitstream_filter(st, "aac_adtstoasc", NULL); return ff_stream_add_bitstream_filter(st, "aac_adtstoasc", NULL);
} }
return ret; if (!st->codecpar->extradata_size &&
(st->codecpar->codec_id == AV_CODEC_ID_H264 ||
st->codecpar->codec_id == AV_CODEC_ID_MPEG4))
return ff_stream_add_bitstream_filter(st, "extract_extradata", NULL);
return 1;
} }
static void flv_deinit(AVFormatContext *s) static void flv_deinit(AVFormatContext *s)