diff --git a/Source/stream_parser_ffmpeg.c b/Source/stream_parser_ffmpeg.c index 94b207d..e27fe15 100644 --- a/Source/stream_parser_ffmpeg.c +++ b/Source/stream_parser_ffmpeg.c @@ -381,8 +381,11 @@ serprintf("untouched (!?) vrate=%d; vscale=%d\n", video->rate, video->scale); if( codecpar->extradata_size ) { if( codecpar->extradata_size <= sizeof( video->extraData ) ) { - video->extraDataSize = codecpar->extradata_size; - memcpy( video->extraData, codecpar->extradata, video->extraDataSize ); + // libavformat used to skip the first 4 bytes in av1 private data + // hw codecs and our implementation using libavcodec still want this + int offset = ( video->format == VIDEO_FORMAT_AV1 ) ? 4 : 0 ; + video->extraDataSize = codecpar->extradata_size - offset ; + memcpy( video->extraData, codecpar->extradata + offset , video->extraDataSize ); if( video->format == VIDEO_FORMAT_H264 && video->extraData[0] == 0x00 ) { serprintf("FF: parse H264 SPS\n"); // for non-AVCC H264, parse the SPS/PPS here