Re: [FFmpeg-devel] [PATCH] avcodec/av1_vaapi: Enable AV1Profile2 VAAPI support.
David (Ming Qiang) Wu via ffmpeg-devel: > AV1Profile2 VAAPI is supported and tested on AMD VCN5. > > Signed-off-by: David (Ming Qiang) Wu > --- > libavcodec/av1dec.c | 3 +++ > libavcodec/vaapi_decode.c | 3 +++ > 2 files changed, 6 insertions(+) > > diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c > index 1d5b9ef4f4..77f63661a0 100644 > --- a/libavcodec/av1dec.c > +++ b/libavcodec/av1dec.c > @@ -599,6 +599,9 @@ static int get_pixel_format(AVCodecContext *avctx) > case AV_PIX_FMT_YUV420P12: > #if CONFIG_AV1_VULKAN_HWACCEL > *fmtp++ = AV_PIX_FMT_VULKAN; > +#endif > +#if CONFIG_AV1_VAAPI_HWACCEL > +*fmtp++ = AV_PIX_FMT_VAAPI; > #endif > break; > case AV_PIX_FMT_YUV422P: > diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c > index a59194340f..a077e47326 100644 > --- a/libavcodec/vaapi_decode.c > +++ b/libavcodec/vaapi_decode.c > @@ -448,6 +448,9 @@ static const struct { > MAP(AV1, AV1_MAIN,AV1Profile0), > MAP(AV1, AV1_HIGH,AV1Profile1), > #endif > +#if VA_CHECK_VERSION(1, 23, 0) > +MAP(AV1, AV1_PROFESSIONAL, AV1Profile2), > +#endif > > #undef MAP > }; What happens if the #if condition is false? Does the AV1 decoders get_format callback then advertise support for a pixel format that is actually unsupported? - Andreas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] Add enhanced rtmp codec vp8 to flv format
Fixes: Reading and writing of VP8 media in FLV files, to match existing enhanced codecs Signed-off-by: Paul Gregoire --- libavformat/flvdec.c | 12 +-- libavformat/flvenc.c | 51 +--- 2 files changed, 44 insertions(+), 19 deletions(-) diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index 22a9b9e4a7..2383682a63 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -340,6 +340,8 @@ static int flv_same_video_codec(AVCodecParameters *vpar, uint32_t flv_codecid) return vpar->codec_id == AV_CODEC_ID_AV1; case MKBETAG('v', 'p', '0', '9'): return vpar->codec_id == AV_CODEC_ID_VP9; +case MKBETAG('v', 'p', '0', '8'): +return vpar->codec_id == AV_CODEC_ID_VP8; case FLV_CODECID_H263: return vpar->codec_id == AV_CODEC_ID_FLV1; case FLV_CODECID_SCREEN: @@ -378,6 +380,10 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, par->codec_id = AV_CODEC_ID_VP9; vstreami->need_parsing = AVSTREAM_PARSE_HEADERS; break; +case MKBETAG('v', 'p', '0', '8'): +par->codec_id = AV_CODEC_ID_VP8; +vstreami->need_parsing = AVSTREAM_PARSE_HEADERS; +break; case FLV_CODECID_H263: par->codec_id = AV_CODEC_ID_FLV1; break; @@ -1443,7 +1449,8 @@ retry_duration: st->codecpar->codec_id == AV_CODEC_ID_MPEG4 || st->codecpar->codec_id == AV_CODEC_ID_HEVC || st->codecpar->codec_id == AV_CODEC_ID_AV1 || -st->codecpar->codec_id == AV_CODEC_ID_VP9) { +st->codecpar->codec_id == AV_CODEC_ID_VP9 || +st->codecpar->codec_id == AV_CODEC_ID_VP8) { int type = 0; if (enhanced_flv && stream_type == FLV_STREAM_TYPE_VIDEO) { type = flags & 0x0F; @@ -1481,7 +1488,8 @@ retry_duration: } if (type == 0 && (!st->codecpar->extradata || st->codecpar->codec_id == AV_CODEC_ID_AAC || st->codecpar->codec_id == AV_CODEC_ID_H264 || st->codecpar->codec_id == AV_CODEC_ID_HEVC || -st->codecpar->codec_id == AV_CODEC_ID_AV1 || st->codecpar->codec_id == AV_CODEC_ID_VP9)) { +st->codecpar->codec_id == AV_CODEC_ID_AV1 || st->codecpar->codec_id == AV_CODEC_ID_VP9 || +st->codecpar->codec_id == AV_CODEC_ID_VP8)) { AVDictionaryEntry *t; if (st->codecpar->extradata) { diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index f34df61c0e..32678e3136 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -54,6 +54,7 @@ static const AVCodecTag flv_video_codec_ids[] = { { AV_CODEC_ID_H264, FLV_CODECID_H264 }, { AV_CODEC_ID_HEVC, MKBETAG('h', 'v', 'c', '1') }, { AV_CODEC_ID_AV1, MKBETAG('a', 'v', '0', '1') }, +{ AV_CODEC_ID_VP8, MKBETAG('v', 'p', '0', '8') }, { AV_CODEC_ID_VP9, MKBETAG('v', 'p', '0', '9') }, { AV_CODEC_ID_NONE, 0 } }; @@ -497,7 +498,7 @@ static void flv_write_metadata_packet(AVFormatContext *s, AVCodecParameters *par if (flv->metadata_pkt_written) return; if (par->codec_id == AV_CODEC_ID_HEVC || par->codec_id == AV_CODEC_ID_AV1 || -par->codec_id == AV_CODEC_ID_VP9) { +par->codec_id == AV_CODEC_ID_VP8 || par->codec_id == AV_CODEC_ID_VP9) { int flags_size = 5; side_data = av_packet_side_data_get(par->coded_side_data, par->nb_coded_side_data, AV_PKT_DATA_CONTENT_LIGHT_LEVEL); @@ -519,12 +520,18 @@ static void flv_write_metadata_packet(AVFormatContext *s, AVCodecParameters *par put_timestamp(pb, ts); //ts = pkt->dts, gen avio_wb24(pb, flv->reserved); -if (par->codec_id == AV_CODEC_ID_HEVC) { -avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeMetadata| FLV_FRAME_VIDEO_INFO_CMD); // ExVideoTagHeader mode with PacketTypeMetadata +if (par->codec_id == AV_CODEC_ID_VP8) { +avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeMetadata | FLV_FRAME_VIDEO_INFO_CMD); // ExVideoTagHeader mode with PacketTypeMetadata +avio_write(pb, "vp08", 4); +} else if (par->codec_id == AV_CODEC_ID_VP9) { +avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeMetadata | FLV_FRAME_VIDEO_INFO_CMD); +avio_write(pb, "vp09", 4); +} else if (par->codec_id == AV_CODEC_ID_HEVC) { +avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeMetadata | FLV_FRAME_VIDEO_INFO_CMD); avio_write(pb, "hvc1", 4); -} else if (par->codec_id == AV_CODEC_ID_AV1 || par->codec_id == AV_CODEC_ID_VP9) { -avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeMetadata| FLV_FRAME_VIDEO_INFO_CMD); -avio_write(pb, par->codec_id == AV_CODEC_ID_AV1 ? "av01" : "vp09", 4); +} else if (par->codec_id == AV_CODEC_ID_AV1) { +avio_w8(pb, FLV_IS_EX_HEADER | PacketTypeMetadata | FLV_FRAME_VIDEO_INFO_CMD); +avio_write(pb, "av01", 4); } avio_w8(pb, AMF_DATA_
Re: [FFmpeg-devel] [PATCH v7 1/3] avcodec/jpeg2000dec: Add support for CAP and CPF markers
Hi Osamu, Below are suggested improvements to error messages. There are also a couple of errant trailing white spaces in jpeg2000htdec.c. Can you fix them? Best, -- Pierre On Sat, Aug 3, 2024 at 10:27 PM Osamu Watanabe wrote: > > This commit adds support for CAP and CPF markers. Decoding will exit when > encountering Ilegal input codestreams. > > The variable `Jpeg2000DecoderContext->HT_MAGB` has been changed to `HT_B` > according to the definition in the spec (ISO/IEC 15444-15). > > Signed-off-by: Osamu Watanabe > --- > libavcodec/jpeg2000.h| 8 +++ > libavcodec/jpeg2000dec.c | 128 ++- > libavcodec/jpeg2000dec.h | 7 +++ > 3 files changed, 142 insertions(+), 1 deletion(-) > > diff --git a/libavcodec/jpeg2000.h b/libavcodec/jpeg2000.h > index d004c08f10..4bdc38df7c 100644 > --- a/libavcodec/jpeg2000.h > +++ b/libavcodec/jpeg2000.h > @@ -37,12 +37,14 @@ > > enum Jpeg2000Markers { > JPEG2000_SOC = 0xff4f, // start of codestream > +JPEG2000_CAP = 0xff50, // extended capabilities > JPEG2000_SIZ = 0xff51, // image and tile size > JPEG2000_COD, // coding style default > JPEG2000_COC, // coding style component > JPEG2000_TLM = 0xff55, // tile-part length, main header > JPEG2000_PLM = 0xff57, // packet length, main header > JPEG2000_PLT, // packet length, tile-part header > +JPEG2000_CPF, // corresponding profile > JPEG2000_QCD = 0xff5c, // quantization default > JPEG2000_QCC, // quantization component > JPEG2000_RGN, // region of interest > @@ -58,6 +60,12 @@ enum Jpeg2000Markers { > JPEG2000_EOC = 0xffd9, // end of codestream > }; > > +enum JPEG2000_Ccap15_b14_15_params { > +HTJ2K_HTONLY = 0, // HTONLY, bit 14 and 15 are 0 > +HTJ2K_HTDECLARED, // HTDECLARED, bit 14 = 1 and bit 15 = 0 > +HTJ2K_MIXED = 3, // MIXED, bit 14 and 15 are 1 > +}; > + > #define JPEG2000_SOP_FIXED_BYTES 0xFF910004 > #define JPEG2000_SOP_BYTE_LENGTH 6 > > diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c > index 091931b1ff..44db131d77 100644 > --- a/libavcodec/jpeg2000dec.c > +++ b/libavcodec/jpeg2000dec.c > @@ -408,6 +408,73 @@ static int get_siz(Jpeg2000DecoderContext *s) > s->avctx->bits_per_raw_sample = s->precision; > return 0; > } > +/* get extended capabilities (CAP) marker segment */ > +static int get_cap(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c) > +{ > +uint32_t Pcap; > +uint16_t Ccap_i[32] = { 0 }; > +uint16_t Ccap_15; > +uint8_t P; > + > +if (bytestream2_get_bytes_left(&s->g) < 6) { > +av_log(s->avctx, AV_LOG_ERROR, "Insufficient space for CAP\n"); av_log(s->avctx, AV_LOG_ERROR, "Underflow while parsing the CAP marker\n"); > +return AVERROR_INVALIDDATA; > +} > + > +Pcap = bytestream2_get_be32u(&s->g); > +s->isHT = (Pcap >> (31 - (15 - 1))) & 1; > +for (int i = 0; i < 32; i++) { > +if ((Pcap >> (31 - i)) & 1) > +Ccap_i[i] = bytestream2_get_be16u(&s->g); > +} > +Ccap_15 = Ccap_i[14]; > +if (s->isHT == 1) { > +av_log(s->avctx, AV_LOG_INFO, "This is an HTJ2K codestream.\n"); av_log(s->avctx, AV_LOG_INFO, "This codestream contains HT codeblocks.\n"); > +// Bits 14-15 > +switch ((Ccap_15 >> 14) & 0x3) { > +case 0x3: > +s->Ccap15_b14_15 = HTJ2K_MIXED; > +break; > +case 0x1: > +s->Ccap15_b14_15 = HTJ2K_HTDECLARED; > +break; > +case 0x0: > +s->Ccap15_b14_15 = HTJ2K_HTONLY; > +break; > +default: > +av_log(s->avctx, AV_LOG_ERROR, "Unknown CCap value.\n"); > +return AVERROR(EINVAL); > +break; > +} > +// Bit 13 > +if ((Ccap_15 >> 13) & 1) { > +av_log(s->avctx, AV_LOG_ERROR, "MULTIHT set is not > supported.\n"); > +return AVERROR_PATCHWELCOME; > +} > +// Bit 12 > +s->Ccap15_b12 = (Ccap_15 >> 12) & 1; > +// Bit 11 > +s->Ccap15_b11 = (Ccap_15 >> 11) & 1; > +// Bit 5 > +s->Ccap15_b05 = (Ccap_15 >> 5) & 1; > +// Bit 0-4 > +P = Ccap_15 & 0x1F; > +if (!P) > +s->HT_B = 8; > +else if (P < 20) > +s->HT_B = P + 8; > +else if (P < 31) > +s->HT_B = 4 * (P - 19) + 27; > +else > +s->HT_B = 74; > + > +if (s->HT_B > 31) { > +av_log(s->avctx, AV_LOG_ERROR, "Available internal precision is > exceeded (MAGB> 31).\n"); av_log(s->avctx, AV_LOG_ERROR, "Codestream exceeds available internal precision (B > 31).\n"); > +return AVERROR_PATCHWELCOME; > +} > +} > +return 0; > +} > > /* get common part for COD and COC segments */ > static int get_cox(Jpeg2000DecoderContext *s, Jpeg2000Co
Re: [FFmpeg-devel] [PATCH 2/4] avformat/jpegxl_anim_dec: initialize bit buffer
On Mon, Aug 05, 2024 at 02:08:06AM +0200, Kacper Michajlow wrote: > On Sun, 4 Aug 2024 at 16:23, Michael Niedermayer > wrote: > > > > Fixes: use-of-uninitialized-value > > Fixes: > > 70837/clusterfuzz-testcase-minimized-ffmpeg_dem_JPEGXL_ANIM_fuzzer-5089407768526848 > > > > Found-by: continuous fuzzing process > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > > Signed-off-by: Michael Niedermayer > > --- > > libavformat/jpegxl_anim_dec.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/libavformat/jpegxl_anim_dec.c b/libavformat/jpegxl_anim_dec.c > > index ac95d3b9617..3045167e1f9 100644 > > --- a/libavformat/jpegxl_anim_dec.c > > +++ b/libavformat/jpegxl_anim_dec.c > > @@ -77,7 +77,7 @@ static int jpegxl_anim_read_header(AVFormatContext *s) > > JXLAnimDemuxContext *ctx = s->priv_data; > > AVIOContext *pb = s->pb; > > AVStream *st; > > -uint8_t head[256 + AV_INPUT_BUFFER_PADDING_SIZE]; > > +uint8_t head[256 + AV_INPUT_BUFFER_PADDING_SIZE] = {0}; > > const int sizeofhead = sizeof(head) - AV_INPUT_BUFFER_PADDING_SIZE; > > int headsize = 0, ret; > > FFJXLMetadata meta = { 0 }; > > -- > > 2.45.2 > > Not sure it is required to zero the whole buffer. I sent an > alternative patch some time ago, which clears only the relevant area. > https://patchwork.ffmpeg.org/project/ffmpeg/patch/20240627004037.1336-4-kaspe...@gmail.com/ ill apply yours then instead thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I am the wisest man alive, for I know one thing, and that is that I know nothing. -- Socrates signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 3/8] avformat/img2dec: Clear padding data after EOF
On Mon, Aug 05, 2024 at 02:10:18AM +0200, Kacper Michajlow wrote: > On Sun, 4 Aug 2024 at 23:01, Michael Niedermayer > wrote: > > > > Fixes: use-of-uninitialized-value > > Fixes: > > 70852/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5179190066872320 > > > > Found-by: continuous fuzzing process > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > > Signed-off-by: Michael Niedermayer > > --- > > libavformat/img2dec.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c > > index 20b1bc31f6a..3389fa818e9 100644 > > --- a/libavformat/img2dec.c > > +++ b/libavformat/img2dec.c > > @@ -563,6 +563,7 @@ int ff_img_read_packet(AVFormatContext *s1, AVPacket > > *pkt) > > } > > goto fail; > > } else { > > +memset(pkt->data + pkt->size, 0, AV_INPUT_BUFFER_PADDING_SIZE); > > s->img_count++; > > s->img_number++; > > s->pts++; > > -- > > 2.45.2 > > I've also had this one > (https://patchwork.ffmpeg.org/project/ffmpeg/patch/20240627004037.1336-3-kaspe...@gmail.com/), > but probably it is better to do it only in the else branch here. So, > LGTM. will apply thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The bravest are surely those who have the clearest vision of what is before them, glory and danger alike, and yet notwithstanding go out to meet it. -- Thucydides signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 4/8] avcodec/parser: clear padding in combine frame
On Mon, Aug 05, 2024 at 02:02:07AM +0200, Kacper Michajlow wrote: > On Sun, 4 Aug 2024 at 22:53, Michael Niedermayer > wrote: > > > > Fixes: use-of-uninitialized-value > > Fixes: > > 70852/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-5179190066872320 > > > > Found-by: continuous fuzzing process > > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > > Signed-off-by: Michael Niedermayer > > --- > > libavcodec/parser.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/libavcodec/parser.c b/libavcodec/parser.c > > index af17ee9c156..426cc314fb0 100644 > > --- a/libavcodec/parser.c > > +++ b/libavcodec/parser.c > > @@ -236,6 +236,7 @@ int ff_combine_frame(ParseContext *pc, int next, > > } > > pc->buffer = new_buffer; > > memcpy(&pc->buffer[pc->index], *buf, *buf_size); > > +memset(&pc->buffer[pc->index + *buf_size], 0, > > AV_INPUT_BUFFER_PADDING_SIZE); > > pc->index += *buf_size; > > return -1; > > } > > -- > > 2.45.2 > > We already had patch like that some time ago, > https://patchwork.ffmpeg.org/project/ffmpeg/patch/20240627004037.1336-2-kaspe...@gmail.com/ will apply yours, somehow i missed these thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB What does censorship reveal? It reveals fear. -- Julian Assange signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [FEATURE] Cut a video (-ss) with timings non-aligned on keyframes, with minimal re-encoding
Hi, Before trying to develop a new feature, and diving in the code base, I wanted to know if it currently exists, or is already in a work-in-progress task: When cutting a video with no re-encoding: ffmpeg -ss 120 -t 60 -i input.mp4 -c copy output.mp4 the result is often choppy or non-smooth in the first seconds, because the cut point doesn't necessarily coincide with a keyframe, at least on some players (such as Media Player Classic, etc.). Some more complex solutions involve reencoding just the beginning until the next keyframe, and then use copy codec for the rest of the video, and then concatenating, all of this requiring multiple calls of ffmpeg. Is there a feature already in development that would allow to do this in one single pass of ffmpeg, without multiple calls and concatenation? Something like: ffmpeg -ss 120 -t 60 -i input.mp4 -c copy -reencodebeforekeyframe output.mp4 Thanks, Basj ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] Add enhanced rtmp codec vp8 to flv format
On 05.08.2024 16:01, Mondain wrote: Fixes: Reading and writing of VP8 media in FLV files, to match existing enhanced codecs This will be part of the already finished enhanced rtmp v2 patch set, but the spec needs to be out of alpha first. VP8 is in fact missing, since I didn't think anyone would care about it specifically. If you like, send it as PR to https://github.com/BtbN/FFmpeg/blob/enhanced-flv ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH 4/4] avformat/wavdec: Check if there are 16 bytes before testing them
On Sun, Aug 04, 2024 at 04:23:15PM +0200, Michael Niedermayer wrote: > Fixes: use-of-uninitialized-value > Fixes: > 70839/clusterfuzz-testcase-minimized-ffmpeg_dem_W64_fuzzer-5212907590189056 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavformat/wavdec.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) will apply [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB What does censorship reveal? It reveals fear. -- Julian Assange signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] lavc/ffv1dec: fix races in accessing FFV1SliceContext.slice_damaged
ping -- Anton Khirnov ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".