Re: [FFmpeg-devel] [PATCH v1] avformat/rtmpproto: support fourCcList property in enhanced rtmp
Marton Balint 于2023年8月24日周四 01:43写道: > > > > On Wed, 23 Aug 2023, Martin Storsjö wrote: > > > On Wed, 23 Aug 2023, Jean-Baptiste Kempf wrote: > > > >> Hello, > >> > >> On Mon, 21 Aug 2023, at 03:35, Steven Liu wrote: > >>> Jean-Baptiste Kempf 于2023年8月20日周日 16:29写道: > > Hello, > >>> Hi > > On Sun, 20 Aug 2023, at 06:10, Steven Liu wrote: > > As the enhanced rtmp Extending NetConnection connect Command section > > said, the rtmp should add a property named fourCcLive, but there > > should > > only one codec can be set for the video stream in rtmp+flv, so user > > can > > use the option rtmp_enhanced_flags to set the enhanced rtmp with av1, > > hevc or vp9. > > Technically, the protocol allows any type of FourCC, no? > >>> The protocol should allows any type of FourCC, i saw there have three > >>> codecs in the example["av01", "vp09", "hvc1"]. > >> > >> My question is then why have 0,1,2,3 and not a fourcc then? Or does this > >> question make no sense on the protocol level? > > > > Put another way, why map a string to a number and back to a string - why not > > just keep it a string throughout? > > Agreed. Plus it is actually list, so you eventually you might want to > support multiple fourcc-s by splitting the fourcc list. And the > type is a strict array, so simply putting a string wihtout array length > seems suspicious anyway. new version patchset is comming: https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2023-August/313444.html > > Regards, > Marton > ___ > 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 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 v1 2/2] avformat/rtmpproto: support enhanced rtmp
add option named rtmp_enhanced_codec, it would support hvc1,av01,vp09 now, the fourcc is using Array of strings. Signed-off-by: Steven Liu --- doc/protocols.texi | 6 ++ libavformat/rtmpproto.c | 38 ++ 2 files changed, 44 insertions(+) diff --git a/doc/protocols.texi b/doc/protocols.texi index b3fad55591..f2930fb3a2 100644 --- a/doc/protocols.texi +++ b/doc/protocols.texi @@ -896,6 +896,12 @@ be named, by prefixing the type with 'N' and specifying the name before the value (i.e. @code{NB:myFlag:1}). This option may be used multiple times to construct arbitrary AMF sequences. +@item rtmp_enhanced_codec +Specify that the media is an enhanced rtmp live stream. This option should +set a sting like @code{hvc1,av01,vp09} for multiple codecs, or @code{hvc1} +for only one codec, set codec fourcc into fourCcLive property into +Connect Command Message, + @item rtmp_flashver Version of the Flash plugin used to run the SWF player. The default is LNX 9,0,124,2. (When publishing, the default is FMLE/3.0 (compatible; diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index f0ef223f05..f7ce04244f 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -127,6 +127,7 @@ typedef struct RTMPContext { int nb_streamid;///< The next stream id to return on createStream calls doubleduration; ///< Duration of the stream in seconds as returned by the server (only valid if non-zero) int tcp_nodelay;///< Use TCP_NODELAY to disable Nagle's algorithm if set to 1 +char *enhanced; ///< codecs list in enhanced rtmp char username[50]; char password[50]; char auth_params[500]; @@ -336,6 +337,42 @@ static int gen_connect(URLContext *s, RTMPContext *rt) ff_amf_write_field_name(&p, "app"); ff_amf_write_string2(&p, rt->app, rt->auth_params); +if (rt->enhanced) { +uint32_t list_len = 0; +char *fourcc_data = rt->enhanced; +int fourcc_str_len = fourcc_data ? strlen(fourcc_data) : 0; + +// check the string, fourcc + ',' + ... + end fourcc correct length should be (4+1)*n+4 +if ((fourcc_str_len + 1) % 5 != 0) +return AVERROR(EINVAL); + +list_len = (fourcc_str_len + 1) / 5; +// write the fourCcList field name +ff_amf_write_field_name(&p, "fourCcList"); + +// write the fourcc array length +ff_amf_write_array(&p, list_len); + +while(fourcc_data) { +unsigned char fourcc[5]; +switch (*(uint32_t *)fourcc_data) { +case MKTAG('h', 'v', 'c', '1'): +case MKTAG('a', 'v', '0', '1'): +case MKTAG('v', 'p', '0', '9'): +strncpy(fourcc, fourcc_data, 4); +fourcc[4] = '\0'; +ff_amf_write_string(&p, fourcc); +break; +default: +return AVERROR(EINVAL); +} + +fourcc_data += (fourcc_str_len - (fourcc_data - rt->enhanced)) > 4 ? 5 : 4; +if (fourcc_data - rt->enhanced >= fourcc_str_len) +break; +} +} + if (!rt->is_input) { ff_amf_write_field_name(&p, "type"); ff_amf_write_string(&p, "nonprivate"); @@ -3104,6 +3141,7 @@ static const AVOption rtmp_options[] = { {"rtmp_conn", "Append arbitrary AMF data to the Connect message", OFFSET(conn), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, {"rtmp_flashver", "Version of the Flash plugin used to run the SWF player.", OFFSET(flashver), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, DEC|ENC}, {"rtmp_flush_interval", "Number of packets flushed in the same request (RTMPT only).", OFFSET(flush_interval), AV_OPT_TYPE_INT, {.i64 = 10}, 0, INT_MAX, ENC}, +{"rtmp_enhanced_codec", "Specify that the codec in enhanced rtmp live stream", OFFSET(enhanced), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, ENC}, {"rtmp_live", "Specify that the media is a live stream.", OFFSET(live), AV_OPT_TYPE_INT, {.i64 = -2}, INT_MIN, INT_MAX, DEC, "rtmp_live"}, {"any", "both", 0, AV_OPT_TYPE_CONST, {.i64 = -2}, 0, 0, DEC, "rtmp_live"}, {"live", "live stream", 0, AV_OPT_TYPE_CONST, {.i64 = -1}, 0, 0, DEC, "rtmp_live"}, -- 2.40.0 ___ 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 v1 1/2] avformat/rtmppkt: add ff_amf_write_array for write array strings
Signed-off-by: Steven Liu --- libavformat/rtmppkt.c | 6 ++ libavformat/rtmppkt.h | 8 2 files changed, 14 insertions(+) diff --git a/libavformat/rtmppkt.c b/libavformat/rtmppkt.c index 4b97c0833f..cd0c68ec8a 100644 --- a/libavformat/rtmppkt.c +++ b/libavformat/rtmppkt.c @@ -40,6 +40,12 @@ void ff_amf_write_number(uint8_t **dst, double val) bytestream_put_be64(dst, av_double2int(val)); } +void ff_amf_write_array(uint8_t **dst, uint32_t val) +{ +bytestream_put_byte(dst, AMF_DATA_TYPE_ARRAY); +bytestream_put_be32(dst, val); +} + void ff_amf_write_string(uint8_t **dst, const char *str) { bytestream_put_byte(dst, AMF_DATA_TYPE_STRING); diff --git a/libavformat/rtmppkt.h b/libavformat/rtmppkt.h index a15d2a5773..44c3420436 100644 --- a/libavformat/rtmppkt.h +++ b/libavformat/rtmppkt.h @@ -244,6 +244,14 @@ void ff_amf_write_null(uint8_t **dst); */ void ff_amf_write_object_start(uint8_t **dst); +/** + * Write marker and length for AMF array to buffer. + * + * @param dst pointer to the input buffer (will be modified) + * @param length value to write + */ +void ff_amf_write_array(uint8_t **dst, uint32_t val); + /** * Write string used as field name in AMF object to buffer. * -- 2.40.0 ___ 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] adpcm fixes and improvements
On Thu, Aug 24, 2023 at 12:36 AM Michael Niedermayer wrote: > On Wed, Aug 23, 2023 at 09:04:35PM +0200, Paul B Mahol wrote: > > On Wed, Aug 23, 2023 at 9:02 PM Michael Niedermayer < > mich...@niedermayer.cc> > > wrote: > > > > > On Wed, Aug 16, 2023 at 06:53:42PM +0200, Paul B Mahol wrote: > > > > On Wed, Aug 16, 2023 at 6:38 PM Michael Niedermayer < > > > mich...@niedermayer.cc> > > > > wrote: > > > > > > > > > On Tue, Aug 15, 2023 at 04:49:05PM +0200, Paul B Mahol wrote: > > > > > > Attached > > > > > > > > > > [...] > > > > > > adpcm.c |2 +- > > > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > 3305dbe07ca935958fa213f5cadc339ad3cc3592 > > > > > 0003-avcodec-adpcm-use-already-existing-pointer-for-4xm-d.patch > > > > > > From c6ad6dc7b8725d897e36399e5c7b8174caeb92e6 Mon Sep 17 00:00:00 > > > 2001 > > > > > > From: Paul B Mahol > > > > > > Date: Tue, 15 Aug 2023 14:18:47 +0200 > > > > > > Subject: [PATCH 3/4] avcodec/adpcm: use already existing pointer > for > > > 4xm > > > > > > decoder > > > > > > > > > > > > Signed-off-by: Paul B Mahol > > > > > > --- > > > > > > libavcodec/adpcm.c | 2 +- > > > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > > > > > diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c > > > > > > index b0c3b91a3b..9993c9e531 100644 > > > > > > --- a/libavcodec/adpcm.c > > > > > > +++ b/libavcodec/adpcm.c > > > > > > @@ -1211,7 +1211,7 @@ static int > adpcm_decode_frame(AVCodecContext > > > > > *avctx, AVFrame *frame, > > > > > > > > > > > > for (int i = 0; i < channels; i++) { > > > > > > ADPCMChannelStatus *cs = &c->status[i]; > > > > > > -samples = (int16_t *)frame->data[i]; > > > > > > +samples = samples_p[i]; > > > > > > for (int n = nb_samples >> 1; n > 0; n--) { > > > > > > int v = bytestream2_get_byteu(&gb); > > > > > > *samples++ = adpcm_ima_expand_nibble(cs, v & > 0x0F, > > > 4); > > > > > > > > > > should be ok if tested > > > > > > > > > > > > > > > > -- > > > > > > 2.39.1 > > > > > > > > > > > > > > > > > libavcodec/adpcm.c | 388 > > > > > + > > > > > > tests/ref/fate/adpcm-creative-8-2.6bit |2 > > > > > > tests/ref/fate/adpcm-creative-8-2bit |2 > > > > > > tests/ref/fate/adpcm-creative-8-4bit |2 > > > > > > tests/ref/fate/adpcm-ms-mono | 60 + > > > > > > 5 files changed, 227 insertions(+), 227 deletions(-) > > > > > > 1760df1de66b4227e71ffe942dedcf7d8a33ad48 > > > > > 0004-avcodec-adpcm-consume-all-input-when-decoding.patch > > > > > > From 19789bca53548d672bff30b88a8838edaa876bdb Mon Sep 17 00:00:00 > > > 2001 > > > > > > From: Paul B Mahol > > > > > > Date: Tue, 15 Aug 2023 15:25:22 +0200 > > > > > > Subject: [PATCH 4/4] avcodec/adpcm: consume all input when > decoding > > > > > > > > > > > > Stops multiple decoding calls for single packet. > > > > > > Also makes decoding faster. > > > > > > > > > > This increases latency, which can be problem if packets are > > > > > sufficiently large > > > > > > > > > > > > > Then reduce size at demuxer level. there is option for it. > > > > > > if that is so, then please explain exactly which option should be used > > > in the commit message > > > > > > > > ffmpeg -h demuxer=wav > > what about the demuxers that are not named "wav" ? > > I think you are blocking this just for sake of blocking because you have nothing more constructive to do. The delay is always present, unless packet size is exact as block align. And for ADPCM this is irrelevant. The ADPCM decoders could be transformed to receive frame API if you really care. git grep -l ADPCM libavformat/*c | wc -l > 88 > > thx > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > It is a danger to trust the dream we wish for rather than > the science we have, -- Dr. Kenneth Brown > ___ > 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 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] adpcm fixes and improvements
On Wed, Aug 23, 2023 at 09:04:35PM +0200, Paul B Mahol wrote: > On Wed, Aug 23, 2023 at 9:02 PM Michael Niedermayer > wrote: > > > On Wed, Aug 16, 2023 at 06:53:42PM +0200, Paul B Mahol wrote: > > > On Wed, Aug 16, 2023 at 6:38 PM Michael Niedermayer < > > mich...@niedermayer.cc> > > > wrote: > > > > > > > On Tue, Aug 15, 2023 at 04:49:05PM +0200, Paul B Mahol wrote: > > > > > Attached > > > > > > > > [...] > > > > > adpcm.c |2 +- > > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > 3305dbe07ca935958fa213f5cadc339ad3cc3592 > > > > 0003-avcodec-adpcm-use-already-existing-pointer-for-4xm-d.patch > > > > > From c6ad6dc7b8725d897e36399e5c7b8174caeb92e6 Mon Sep 17 00:00:00 > > 2001 > > > > > From: Paul B Mahol > > > > > Date: Tue, 15 Aug 2023 14:18:47 +0200 > > > > > Subject: [PATCH 3/4] avcodec/adpcm: use already existing pointer for > > 4xm > > > > > decoder > > > > > > > > > > Signed-off-by: Paul B Mahol > > > > > --- > > > > > libavcodec/adpcm.c | 2 +- > > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > > > diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c > > > > > index b0c3b91a3b..9993c9e531 100644 > > > > > --- a/libavcodec/adpcm.c > > > > > +++ b/libavcodec/adpcm.c > > > > > @@ -1211,7 +1211,7 @@ static int adpcm_decode_frame(AVCodecContext > > > > *avctx, AVFrame *frame, > > > > > > > > > > for (int i = 0; i < channels; i++) { > > > > > ADPCMChannelStatus *cs = &c->status[i]; > > > > > -samples = (int16_t *)frame->data[i]; > > > > > +samples = samples_p[i]; > > > > > for (int n = nb_samples >> 1; n > 0; n--) { > > > > > int v = bytestream2_get_byteu(&gb); > > > > > *samples++ = adpcm_ima_expand_nibble(cs, v & 0x0F, > > 4); > > > > > > > > should be ok if tested > > > > > > > > > > > > > -- > > > > > 2.39.1 > > > > > > > > > > > > > > libavcodec/adpcm.c | 388 > > > > + > > > > > tests/ref/fate/adpcm-creative-8-2.6bit |2 > > > > > tests/ref/fate/adpcm-creative-8-2bit |2 > > > > > tests/ref/fate/adpcm-creative-8-4bit |2 > > > > > tests/ref/fate/adpcm-ms-mono | 60 + > > > > > 5 files changed, 227 insertions(+), 227 deletions(-) > > > > > 1760df1de66b4227e71ffe942dedcf7d8a33ad48 > > > > 0004-avcodec-adpcm-consume-all-input-when-decoding.patch > > > > > From 19789bca53548d672bff30b88a8838edaa876bdb Mon Sep 17 00:00:00 > > 2001 > > > > > From: Paul B Mahol > > > > > Date: Tue, 15 Aug 2023 15:25:22 +0200 > > > > > Subject: [PATCH 4/4] avcodec/adpcm: consume all input when decoding > > > > > > > > > > Stops multiple decoding calls for single packet. > > > > > Also makes decoding faster. > > > > > > > > This increases latency, which can be problem if packets are > > > > sufficiently large > > > > > > > > > > Then reduce size at demuxer level. there is option for it. > > > > if that is so, then please explain exactly which option should be used > > in the commit message > > > > > ffmpeg -h demuxer=wav what about the demuxers that are not named "wav" ? git grep -l ADPCM libavformat/*c | wc -l 88 thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB It is a danger to trust the dream we wish for rather than the science we have, -- Dr. Kenneth Brown 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 v2] lsws/ppc/yuv2rgb_altivec: Fix build in non-VSX environments with Clang
On Fri, Aug 18, 2023 at 10:14:04PM -0400, Brad Smith wrote: > lsws/ppc/yuv2rgb_altivec: Fix build in non-VSX environments with Clang > > Add a check for the existence of the vec_xl() function. Clang provides > the function even with VSX not enabled. > > v2: test for function if AltiVec is enabled instead of with AltiVec and > without VSX > --- > configure| 8 > libswscale/ppc/yuv2rgb_altivec.c | 4 ++-- > 2 files changed, 10 insertions(+), 2 deletions(-) Has this been tested on an affected platform ? I mean the function is provided but does it also work ? thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Observe your enemies, for they first find out your faults. -- Antisthenes 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/5] avcodec/xvididct: Fix integer overflow in idct_row()
On Mon, Aug 07, 2023 at 02:49:47AM +0200, Michael Niedermayer wrote: > Fixes: signed integer overflow: -1403461578 + -843974775 cannot be > represented in type 'int' > Fixes: > 60868/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MPEG1VIDEO_fuzzer-4599793035378688 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/xvididct.c | 24 > 1 file changed, 12 insertions(+), 12 deletions(-) Will apply patches 3-5 [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB It is dangerous to be right in matters on which the established authorities are wrong. -- Voltaire 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] avfilter: add libvmaf_cuda
Hi, Thank you Timo for the review. Took your suggestions, updated patch attached. Thanks, Kyle 0001-avfilter-add-libvmaf_cuda.patch Description: Binary data ___ 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 3/3] avcodec/vulkan_decode: print also codec header name
Signed-off-by: Kacper Michajłow --- libavcodec/vulkan_decode.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c index 7607edf52e..0d561b7450 100644 --- a/libavcodec/vulkan_decode.c +++ b/libavcodec/vulkan_decode.c @@ -863,6 +863,9 @@ static int vulkan_decode_get_profile(AVCodecContext *avctx, AVBufferRef *frames_ caps->maxDpbSlots); av_log(avctx, AV_LOG_VERBOSE, "Maximum active references: %u\n", caps->maxActiveReferencePictures); +av_log(avctx, AV_LOG_VERBOSE, "Codec header name: '%s' (driver), '%s' (compiled)\n", + caps->stdHeaderVersion.extensionName, + dec_ext[avctx->codec_id]->extensionName); av_log(avctx, AV_LOG_VERBOSE, "Codec header version: %i.%i.%i (driver), %i.%i.%i (compiled)\n", CODEC_VER(caps->stdHeaderVersion.specVersion), CODEC_VER(dec_ext[avctx->codec_id]->specVersion)); -- 2.34.1 ___ 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 2/3] avcodec/vulkan_decode: check specVersion to avoid using incompatible implementations
Fixes: VUID-VkVideoSessionCreateInfoKHR-pStdHeaderVersion-07190 VUID-VkVideoSessionCreateInfoKHR-pStdHeaderVersion-07191 As a bonus avoids crashing AMD video driver on Windows, which currently doesn't advertise support. Signed-off-by: Kacper Michajłow --- libavcodec/vulkan_decode.c | 5 + 1 file changed, 5 insertions(+) diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c index 04350578f9..7607edf52e 100644 --- a/libavcodec/vulkan_decode.c +++ b/libavcodec/vulkan_decode.c @@ -881,6 +881,11 @@ static int vulkan_decode_get_profile(AVCodecContext *avctx, AVBufferRef *frames_ caps->flags & VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR ? " separate_references" : ""); +if (dec_ext[avctx->codec_id]->specVersion > caps->stdHeaderVersion.specVersion || +strncmp(caps->stdHeaderVersion.extensionName, +dec_ext[avctx->codec_id]->extensionName, VK_MAX_EXTENSION_NAME_SIZE)) +return AVERROR(EINVAL); + /* Check if decoding is possible with the given parameters */ if (avctx->width < caps->minCodedExtent.width || avctx->height < caps->minCodedExtent.height || -- 2.34.1 ___ 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 1/3] avcodec/vulkan_decode: fix struct type for h265_profile
Signed-off-by: Kacper Michajłow --- libavcodec/vulkan_decode.c | 2 +- libavcodec/vulkan_decode.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c index f20733fb39..04350578f9 100644 --- a/libavcodec/vulkan_decode.c +++ b/libavcodec/vulkan_decode.c @@ -682,7 +682,7 @@ static VkResult vulkan_setup_profile(AVCodecContext *avctx, VkVideoProfileListInfoKHR *profile_list = &prof->profile_list; VkVideoDecodeH264ProfileInfoKHR *h264_profile = &prof->h264_profile; -VkVideoDecodeH264ProfileInfoKHR *h265_profile = &prof->h265_profile; +VkVideoDecodeH265ProfileInfoKHR *h265_profile = &prof->h265_profile; VkVideoDecodeAV1ProfileInfoMESA *av1_profile = &prof->av1_profile; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->sw_pix_fmt); diff --git a/libavcodec/vulkan_decode.h b/libavcodec/vulkan_decode.h index 0aaa2e2de0..c50527e5f8 100644 --- a/libavcodec/vulkan_decode.h +++ b/libavcodec/vulkan_decode.h @@ -27,7 +27,7 @@ typedef struct FFVulkanDecodeProfileData { VkVideoDecodeH264ProfileInfoKHR h264_profile; -VkVideoDecodeH264ProfileInfoKHR h265_profile; +VkVideoDecodeH265ProfileInfoKHR h265_profile; VkVideoDecodeAV1ProfileInfoMESA av1_profile; VkVideoDecodeUsageInfoKHR usage; VkVideoProfileInfoKHR profile; -- 2.34.1 ___ 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] adpcm fixes and improvements
On Wed, Aug 23, 2023 at 9:02 PM Michael Niedermayer wrote: > On Wed, Aug 16, 2023 at 06:53:42PM +0200, Paul B Mahol wrote: > > On Wed, Aug 16, 2023 at 6:38 PM Michael Niedermayer < > mich...@niedermayer.cc> > > wrote: > > > > > On Tue, Aug 15, 2023 at 04:49:05PM +0200, Paul B Mahol wrote: > > > > Attached > > > > > > [...] > > > > adpcm.c |2 +- > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > 3305dbe07ca935958fa213f5cadc339ad3cc3592 > > > 0003-avcodec-adpcm-use-already-existing-pointer-for-4xm-d.patch > > > > From c6ad6dc7b8725d897e36399e5c7b8174caeb92e6 Mon Sep 17 00:00:00 > 2001 > > > > From: Paul B Mahol > > > > Date: Tue, 15 Aug 2023 14:18:47 +0200 > > > > Subject: [PATCH 3/4] avcodec/adpcm: use already existing pointer for > 4xm > > > > decoder > > > > > > > > Signed-off-by: Paul B Mahol > > > > --- > > > > libavcodec/adpcm.c | 2 +- > > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > > > diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c > > > > index b0c3b91a3b..9993c9e531 100644 > > > > --- a/libavcodec/adpcm.c > > > > +++ b/libavcodec/adpcm.c > > > > @@ -1211,7 +1211,7 @@ static int adpcm_decode_frame(AVCodecContext > > > *avctx, AVFrame *frame, > > > > > > > > for (int i = 0; i < channels; i++) { > > > > ADPCMChannelStatus *cs = &c->status[i]; > > > > -samples = (int16_t *)frame->data[i]; > > > > +samples = samples_p[i]; > > > > for (int n = nb_samples >> 1; n > 0; n--) { > > > > int v = bytestream2_get_byteu(&gb); > > > > *samples++ = adpcm_ima_expand_nibble(cs, v & 0x0F, > 4); > > > > > > should be ok if tested > > > > > > > > > > -- > > > > 2.39.1 > > > > > > > > > > > libavcodec/adpcm.c | 388 > > > + > > > > tests/ref/fate/adpcm-creative-8-2.6bit |2 > > > > tests/ref/fate/adpcm-creative-8-2bit |2 > > > > tests/ref/fate/adpcm-creative-8-4bit |2 > > > > tests/ref/fate/adpcm-ms-mono | 60 + > > > > 5 files changed, 227 insertions(+), 227 deletions(-) > > > > 1760df1de66b4227e71ffe942dedcf7d8a33ad48 > > > 0004-avcodec-adpcm-consume-all-input-when-decoding.patch > > > > From 19789bca53548d672bff30b88a8838edaa876bdb Mon Sep 17 00:00:00 > 2001 > > > > From: Paul B Mahol > > > > Date: Tue, 15 Aug 2023 15:25:22 +0200 > > > > Subject: [PATCH 4/4] avcodec/adpcm: consume all input when decoding > > > > > > > > Stops multiple decoding calls for single packet. > > > > Also makes decoding faster. > > > > > > This increases latency, which can be problem if packets are > > > sufficiently large > > > > > > > Then reduce size at demuxer level. there is option for it. > > if that is so, then please explain exactly which option should be used > in the commit message > > ffmpeg -h demuxer=wav > thx > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > If you think the mosad wants you dead since a long time then you are either > wrong or dead since a long time. > ___ > 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 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] adpcm fixes and improvements
On Wed, Aug 16, 2023 at 06:53:42PM +0200, Paul B Mahol wrote: > On Wed, Aug 16, 2023 at 6:38 PM Michael Niedermayer > wrote: > > > On Tue, Aug 15, 2023 at 04:49:05PM +0200, Paul B Mahol wrote: > > > Attached > > > > [...] > > > adpcm.c |2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > 3305dbe07ca935958fa213f5cadc339ad3cc3592 > > 0003-avcodec-adpcm-use-already-existing-pointer-for-4xm-d.patch > > > From c6ad6dc7b8725d897e36399e5c7b8174caeb92e6 Mon Sep 17 00:00:00 2001 > > > From: Paul B Mahol > > > Date: Tue, 15 Aug 2023 14:18:47 +0200 > > > Subject: [PATCH 3/4] avcodec/adpcm: use already existing pointer for 4xm > > > decoder > > > > > > Signed-off-by: Paul B Mahol > > > --- > > > libavcodec/adpcm.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c > > > index b0c3b91a3b..9993c9e531 100644 > > > --- a/libavcodec/adpcm.c > > > +++ b/libavcodec/adpcm.c > > > @@ -1211,7 +1211,7 @@ static int adpcm_decode_frame(AVCodecContext > > *avctx, AVFrame *frame, > > > > > > for (int i = 0; i < channels; i++) { > > > ADPCMChannelStatus *cs = &c->status[i]; > > > -samples = (int16_t *)frame->data[i]; > > > +samples = samples_p[i]; > > > for (int n = nb_samples >> 1; n > 0; n--) { > > > int v = bytestream2_get_byteu(&gb); > > > *samples++ = adpcm_ima_expand_nibble(cs, v & 0x0F, 4); > > > > should be ok if tested > > > > > > > -- > > > 2.39.1 > > > > > > > > libavcodec/adpcm.c | 388 > > + > > > tests/ref/fate/adpcm-creative-8-2.6bit |2 > > > tests/ref/fate/adpcm-creative-8-2bit |2 > > > tests/ref/fate/adpcm-creative-8-4bit |2 > > > tests/ref/fate/adpcm-ms-mono | 60 + > > > 5 files changed, 227 insertions(+), 227 deletions(-) > > > 1760df1de66b4227e71ffe942dedcf7d8a33ad48 > > 0004-avcodec-adpcm-consume-all-input-when-decoding.patch > > > From 19789bca53548d672bff30b88a8838edaa876bdb Mon Sep 17 00:00:00 2001 > > > From: Paul B Mahol > > > Date: Tue, 15 Aug 2023 15:25:22 +0200 > > > Subject: [PATCH 4/4] avcodec/adpcm: consume all input when decoding > > > > > > Stops multiple decoding calls for single packet. > > > Also makes decoding faster. > > > > This increases latency, which can be problem if packets are > > sufficiently large > > > > Then reduce size at demuxer level. there is option for it. if that is so, then please explain exactly which option should be used in the commit message thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you think the mosad wants you dead since a long time then you are either wrong or dead since a long time. 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 v2] avformat/mp3dec: Subtract known padding from duration
> This still fails fate-seek-extra-mp3 I noticed. Apologies for the noise, I'm unfamiliar with the FATE suite and failed to realize "make fate" won't run the _whole_ thing. I have just submitted a 3d revision of this patch, fixing the review comments and fully passing `make fate SAMPLES=./fate-sui te`. ___ 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 v3] avformat/mp3dec: Subtract known padding from duration
When an Info-tag is present, marking initial and trailing samples as padding, those samples should not be included in the calculation of track duration. This solves a surprising user experience where converting a WAV->MP3->WAV, ffprobe will show the duration of the mp3 as slightly longer than both the input and the output. As a result, the estimated duration and imprecise seek-results of some FATE-tests have been updated. --- libavformat/mp3dec.c | 19 +-- tests/ref/fate/gapless-mp3-side-data | 4 ++-- tests/ref/seek/extra-mp3 | 8 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c index 05c13228bc..24ec4dae06 100644 --- a/libavformat/mp3dec.c +++ b/libavformat/mp3dec.c @@ -51,6 +51,7 @@ typedef struct { int usetoc; unsigned frames; /* Total number of frames in file */ unsigned header_filesize; /* Total number of bytes in the stream */ +unsigned frame_duration; /* Frame duration in st->time_base */ int is_cbr; } MP3DecContext; @@ -339,6 +340,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) mp3->frames = 0; mp3->header_filesize = 0; +mp3->frame_duration = av_rescale_q(spf, (AVRational){1, c.sample_rate}, st->time_base); mp3_parse_info_tag(s, st, &c, spf); mp3_parse_vbri_tag(s, st, base); @@ -349,11 +351,17 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) /* Skip the vbr tag frame */ avio_seek(s->pb, base + vbrtag_size, SEEK_SET); -if (mp3->frames) -st->duration = av_rescale_q(mp3->frames, (AVRational){spf, c.sample_rate}, +if (mp3->frames) { +int64_t full_duration; + +full_duration = mp3->frames * (int64_t)spf; +st->duration = av_rescale_q(full_duration - mp3->start_pad - mp3->end_pad, +(AVRational){1, c.sample_rate}, st->time_base); -if (mp3->header_filesize && mp3->frames && !mp3->is_cbr) -st->codecpar->bit_rate = av_rescale(mp3->header_filesize, 8 * c.sample_rate, mp3->frames * (int64_t)spf); + +if (mp3->header_filesize && !mp3->is_cbr) +st->codecpar->bit_rate = av_rescale(mp3->header_filesize, 8 * c.sample_rate, full_duration); +} return 0; } @@ -589,8 +597,7 @@ static int mp3_seek(AVFormatContext *s, int stream_index, int64_t timestamp, return best_pos; if (mp3->is_cbr && ie == &ie1 && mp3->frames) { -int frame_duration = av_rescale(st->duration, 1, mp3->frames); -ie1.timestamp = frame_duration * av_rescale(best_pos - si->data_offset, mp3->frames, mp3->header_filesize); +ie1.timestamp = mp3->frame_duration * av_rescale(best_pos - si->data_offset, mp3->frames, mp3->header_filesize); } avpriv_update_cur_dts(s, st, ie->timestamp); diff --git a/tests/ref/fate/gapless-mp3-side-data b/tests/ref/fate/gapless-mp3-side-data index caf42068dc..495a5bb865 100644 --- a/tests/ref/fate/gapless-mp3-side-data +++ b/tests/ref/fate/gapless-mp3-side-data @@ -596,5 +596,5 @@ packet|codec_type=audio|stream_index=0|pts=218603520|pts_time=15.490612|dts=2186 packet|codec_type=audio|stream_index=0|pts=218972160|pts_time=15.516735|dts=218972160|dts_time=15.516735|duration=368640|duration_time=0.026122|size=418|pos=249718|flags=K__|data_hash=CRC32:3789f3cf|side_data|side_data_type=Skip Samples|skip_samples=0|discard_padding=1152|skip_reason=0|discard_reason=0 -stream|index=0|codec_name=mp3|profile=unknown|codec_type=audio|codec_tag_string=[0][0][0][0]|codec_tag=0x|sample_fmt=fltp|sample_rate=44100|channels=2|channel_layout=stereo|bits_per_sample=0|initial_padding=0|id=N/A|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/14112000|start_pts=353600|start_time=0.025057|duration_ts=219340800|duration=15.542857|bit_rate=128000|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=595|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:encoder=LAME3.93 -format|filename=gapless.mp3|nb_streams=1|nb_programs=0|format_name=mp3|start_time=0.025057|duration=15.542857|size=250264|bit_rate=128812|probe_score=51|tag:title=test +stream|index=0|codec_name=mp3|profile=unknown|codec_type=audio|codec_tag_string=[0][0][0][0]|codec_tag=0x|sample_fmt=fltp|sample_rate=44100|channels=2|channel_layout=stereo|bits_per_sample=0|initial_padding=0|id=N/A|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/14112000|start_pts=353600|start_time=0.025057|duration_ts=218521600|duration=
Re: [FFmpeg-devel] [PATCH v1] avformat/rtmpproto: support fourCcList property in enhanced rtmp
On Wed, 23 Aug 2023, Martin Storsjö wrote: On Wed, 23 Aug 2023, Jean-Baptiste Kempf wrote: Hello, On Mon, 21 Aug 2023, at 03:35, Steven Liu wrote: Jean-Baptiste Kempf 于2023年8月20日周日 16:29写道: Hello, Hi On Sun, 20 Aug 2023, at 06:10, Steven Liu wrote: > As the enhanced rtmp Extending NetConnection connect Command section > said, the rtmp should add a property named fourCcLive, but there > should > only one codec can be set for the video stream in rtmp+flv, so user > can > use the option rtmp_enhanced_flags to set the enhanced rtmp with av1, > hevc or vp9. Technically, the protocol allows any type of FourCC, no? The protocol should allows any type of FourCC, i saw there have three codecs in the example["av01", "vp09", "hvc1"]. My question is then why have 0,1,2,3 and not a fourcc then? Or does this question make no sense on the protocol level? Put another way, why map a string to a number and back to a string - why not just keep it a string throughout? Agreed. Plus it is actually list, so you eventually you might want to support multiple fourcc-s by splitting the fourcc list. And the type is a strict array, so simply putting a string wihtout array length seems suspicious anyway. Regards, Marton ___ 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] adpcm fixes and improvements
Will apply ASAP! ___ 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 v1] avformat/rtmpproto: support fourCcList property in enhanced rtmp
On Wed, 23 Aug 2023, Jean-Baptiste Kempf wrote: Hello, On Mon, 21 Aug 2023, at 03:35, Steven Liu wrote: Jean-Baptiste Kempf 于2023年8月20日周日 16:29写道: Hello, Hi On Sun, 20 Aug 2023, at 06:10, Steven Liu wrote: > As the enhanced rtmp Extending NetConnection connect Command section > said, the rtmp should add a property named fourCcLive, but there should > only one codec can be set for the video stream in rtmp+flv, so user can > use the option rtmp_enhanced_flags to set the enhanced rtmp with av1, > hevc or vp9. Technically, the protocol allows any type of FourCC, no? The protocol should allows any type of FourCC, i saw there have three codecs in the example["av01", "vp09", "hvc1"]. My question is then why have 0,1,2,3 and not a fourcc then? Or does this question make no sense on the protocol level? Put another way, why map a string to a number and back to a string - why not just keep it a string throughout? // Martin ___ 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 v1] avformat/rtmpproto: support fourCcList property in enhanced rtmp
Hello, On Mon, 21 Aug 2023, at 03:35, Steven Liu wrote: > Jean-Baptiste Kempf 于2023年8月20日周日 16:29写道: >> >> Hello, > Hi >> >> On Sun, 20 Aug 2023, at 06:10, Steven Liu wrote: >> > As the enhanced rtmp Extending NetConnection connect Command section >> > said, the rtmp should add a property named fourCcLive, but there should >> > only one codec can be set for the video stream in rtmp+flv, so user can >> > use the option rtmp_enhanced_flags to set the enhanced rtmp with av1, >> > hevc or vp9. >> >> Technically, the protocol allows any type of FourCC, no? > The protocol should allows any type of FourCC, i saw there have three > codecs in the example["av01", "vp09", "hvc1"]. My question is then why have 0,1,2,3 and not a fourcc then? Or does this question make no sense on the protocol level? -- Jean-Baptiste Kempf - President +33 672 704 734 ___ 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 v2] avformat/mp3dec: Subtract known padding from duration
ons 2023-08-23 klockan 11:55 +0200 skrev Ulrik Mikaelsson: > When an Info-tag is present, marking initial and trailing samples as > padding, those samples should not be included in the calculation of > track > duration. > > This solves a surprising user experience where converting a WAV->MP3- > >WAV, > ffprobe will show the duration of the mp3 as slightly longer than > both the > input and the output. > --- > libavformat/mp3dec.c | 3 ++- > tests/ref/fate/gapless-mp3-side-data | 4 ++-- > 2 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c > index 05c13228bc..54947f521e 100644 > --- a/libavformat/mp3dec.c > +++ b/libavformat/mp3dec.c > @@ -350,7 +350,8 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, > AVStream *st, int64_t base) > avio_seek(s->pb, base + vbrtag_size, SEEK_SET); > > if (mp3->frames) > - st->duration = av_rescale_q(mp3->frames, (AVRational){spf, > c.sample_rate}, > + st->duration = av_rescale_q(((uint64_t)mp3->frames * > (uint64_t)spf) - mp3->start_pad - mp3->end_pad, > + (AVRational){1, c.sample_rate}, > st->time_base); > if (mp3->header_filesize && mp3->frames && !mp3->is_cbr) > st->codecpar->bit_rate = av_rescale(mp3->header_filesize, 8 > * c.sample_rate, mp3->frames * (int64_t)spf); > diff --git a/tests/ref/fate/gapless-mp3-side-data > b/tests/ref/fate/gapless-mp3-side-data > index caf42068dc..495a5bb865 100644 > --- a/tests/ref/fate/gapless-mp3-side-data > +++ b/tests/ref/fate/gapless-mp3-side-data > @@ -596,5 +596,5 @@ > packet|codec_type=audio|stream_index=0|pts=218603520|pts_time=15.4906 > 12|dts=2186 > > packet|codec_type=audio|stream_index=0|pts=218972160|pts_time=15.516 > 735|dts=218972160|dts_time=15.516735|duration=368640|duration_time=0. > 026122|size=418|pos=249718|flags=K__|data_hash=CRC32:3789f3cf|side_da > ta|side_data_type=Skip > Samples|skip_samples=0|discard_padding=1152|skip_reason=0|discard_rea > son=0 > > - > stream|index=0|codec_name=mp3|profile=unknown|codec_type=audio|codec_t > ag_string=[0][0][0][0]|codec_tag=0x|sample_fmt=fltp|sample_rate=4 > 4100|channels=2|channel_layout=stereo|bits_per_sample=0|initial_paddi > ng=0|id=N/A|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/14112000| > start_pts=353600|start_time=0.025057|duration_ts=219340800|duration=1 > 5.542857|bit_rate=128000|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_ > frames=N/A|nb_read_frames=N/A|nb_read_packets=595|disposition:default > =0|disposition:dub=0|disposition:original=0|disposition:comment=0|dis > position:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposit > ion:hearing_impaired=0|disposition:visual_impaired=0|disposition:clea > n_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0 > |disposition:captions=0|disposition:descriptions=0|disposition:metada > ta=0|disposition:dependent=0|disposition:still_image=0|tag:encoder=LA > ME3.93 > - > format|filename=gapless.mp3|nb_streams=1|nb_programs=0|format_name=mp3 > |start_time=0.025057|duration=15.542857|size=250264|bit_rate=128812|p > robe_score=51|tag:title=test > +stream|index=0|codec_name=mp3|profile=unknown|codec_type=audio|codec > _tag_string=[0][0][0][0]|codec_tag=0x|sample_fmt=fltp|sample_rate > =44100|channels=2|channel_layout=stereo|bits_per_sample=0|initial_pad > ding=0|id=N/A|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/1411200 > 0|start_pts=353600|start_time=0.025057|duration_ts=218521600|duration > =15.484807|bit_rate=128000|max_bit_rate=N/A|bits_per_raw_sample=N/A|n > b_frames=N/A|nb_read_frames=N/A|nb_read_packets=595|disposition:defau > lt=0|disposition:dub=0|disposition:original=0|disposition:comment=0|d > isposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|dispos > ition:hearing_impaired=0|disposition:visual_impaired=0|disposition:cl > ean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails > =0|disposition:captions=0|disposition:descriptions=0|disposition:meta > data=0|disposition:dependent=0|disposition:still_image=0|tag:encoder= > LAME3.93 > +format|filename=gapless.mp3|nb_streams=1|nb_programs=0|format_name=m > p3|start_time=0.025057|duration=15.484807|size=250264|bit_rate=129295 > |probe_score=51|tag:title=test This still fails fate-seek-extra-mp3 /Tomas ___ 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] GSoC 2023: Add Audio Overlay Filter
1. Added af_aoverlay.c 2. Updated filter documentation 3. Included the filter in libavfilter/Makefile and libavfilter/allfilters.c Signed-off-by: Harshit Karwal --- doc/filters.texi | 40 +++ libavfilter/Makefile | 1 + libavfilter/af_aoverlay.c | 623 ++ libavfilter/allfilters.c | 1 + 4 files changed, 665 insertions(+) create mode 100644 libavfilter/af_aoverlay.c diff --git a/doc/filters.texi b/doc/filters.texi index cac1ee43810..f6a2ab9743e 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -2709,6 +2709,46 @@ This filter supports the same commands as options, excluding option @code{order} Pass the audio source unchanged to the output. +@section aoverlay + +Replace a specified section of an audio stream with another input audio stream. + +In case no enable option for timeline editing is specified, the second audio stream will +be output at sections of the first stream which have a gap in PTS (Presentation TimeStamp) values +such that the output stream's PTS values are monotonous. + +This filter also supports linear cross fading when transitioning from one +input stream to another. + +The filter accepts the following option: + +@table @option +@item cf_duration +Set duration (in seconds) for cross fade between the inputs. Default value is @code{100} milliseconds. +@end table + +@subsection Examples + +@itemize +@item +Replace the first stream with the second stream from @code{t=10} seconds to @code{t=20} seconds: +@example +ffmpeg -i first.wav -i second.wav -filter_complex "aoverlay=enable='between(t,10,20)'" output.wav +@end example + +@item +Do the same as above, but with crossfading for @code{2} seconds between the streams: +@example +ffmpeg -i first.wav -i second.wav -filter_complex "aoverlay=cf_duration=2:enable='between(t,10,20)'" output.wav +@end example + +@item +Introduce a PTS gap from @code{t=4} seconds to @code{t=8} seconds in the first stream and output the second stream during this gap: +@example +ffmpeg -i first.wav -i second.wav -filter_complex "[0]aselect='not(between(t,4,8))'[temp];[temp][1]aoverlay[out]" -map "[out]" output.wav +@end example +@end itemize + @section apad Pad the end of an audio stream with silence. diff --git a/libavfilter/Makefile b/libavfilter/Makefile index 2fe0033b218..c469380038f 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -80,6 +80,7 @@ OBJS-$(CONFIG_ANLMDN_FILTER) += af_anlmdn.o OBJS-$(CONFIG_ANLMF_FILTER) += af_anlms.o OBJS-$(CONFIG_ANLMS_FILTER) += af_anlms.o OBJS-$(CONFIG_ANULL_FILTER) += af_anull.o +OBJS-$(CONFIG_AOVERLAY_FILTER) += af_aoverlay.o OBJS-$(CONFIG_APAD_FILTER) += af_apad.o OBJS-$(CONFIG_APERMS_FILTER) += f_perms.o OBJS-$(CONFIG_APHASER_FILTER)+= af_aphaser.o generate_wave_table.o diff --git a/libavfilter/af_aoverlay.c b/libavfilter/af_aoverlay.c new file mode 100644 index 000..ea0759fc856 --- /dev/null +++ b/libavfilter/af_aoverlay.c @@ -0,0 +1,623 @@ +/* + * Copyright (c) 2023 Harshit Karwal + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/opt.h" +#include "libavutil/log.h" + +#include "audio.h" +#include "avfilter.h" +#include "filters.h" +#include "internal.h" +#include "formats.h" + +typedef struct FrameRingBuffer { +uint8_t *extended_data_buffer; +int capacity; +int start; +int end; +int size; +} FrameRingBuffer; + +static int ring_init(FrameRingBuffer **ring, unsigned int capacity, int size) +{ +*ring = av_malloc(sizeof(FrameRingBuffer)); +if (!*ring) +return AVERROR(ENOMEM); + +(*ring)->extended_data_buffer = av_malloc_array(capacity, size); + +if (!(*ring)->extended_data_buffer) +return AVERROR(ENOMEM); + +(*ring)->capacity = capacity; +(*ring)->start = 0; +(*ring)->end = 0; +(*ring)->size = 0; + +return 0; +} + +static int ring_empty(FrameRingBuffer *ring) +{ +return ring->size == 0; +} + +static int ring_full(FrameRingBuffer *ring) +{ +return ring->size == ring->capacity; +} + +static int ring_insert(FrameRingBuffer **sample_buffers, AVFrame *frame, AVFilterLink *inlink
[FFmpeg-devel] [PATCH v2] avformat/mp3dec: Subtract known padding from duration
When an Info-tag is present, marking initial and trailing samples as padding, those samples should not be included in the calculation of track duration. This solves a surprising user experience where converting a WAV->MP3->WAV, ffprobe will show the duration of the mp3 as slightly longer than both the input and the output. --- libavformat/mp3dec.c | 3 ++- tests/ref/fate/gapless-mp3-side-data | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c index 05c13228bc..54947f521e 100644 --- a/libavformat/mp3dec.c +++ b/libavformat/mp3dec.c @@ -350,7 +350,8 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) avio_seek(s->pb, base + vbrtag_size, SEEK_SET); if (mp3->frames) -st->duration = av_rescale_q(mp3->frames, (AVRational){spf, c.sample_rate}, +st->duration = av_rescale_q(((uint64_t)mp3->frames * (uint64_t)spf) - mp3->start_pad - mp3->end_pad, +(AVRational){1, c.sample_rate}, st->time_base); if (mp3->header_filesize && mp3->frames && !mp3->is_cbr) st->codecpar->bit_rate = av_rescale(mp3->header_filesize, 8 * c.sample_rate, mp3->frames * (int64_t)spf); diff --git a/tests/ref/fate/gapless-mp3-side-data b/tests/ref/fate/gapless-mp3-side-data index caf42068dc..495a5bb865 100644 --- a/tests/ref/fate/gapless-mp3-side-data +++ b/tests/ref/fate/gapless-mp3-side-data @@ -596,5 +596,5 @@ packet|codec_type=audio|stream_index=0|pts=218603520|pts_time=15.490612|dts=2186 packet|codec_type=audio|stream_index=0|pts=218972160|pts_time=15.516735|dts=218972160|dts_time=15.516735|duration=368640|duration_time=0.026122|size=418|pos=249718|flags=K__|data_hash=CRC32:3789f3cf|side_data|side_data_type=Skip Samples|skip_samples=0|discard_padding=1152|skip_reason=0|discard_reason=0 -stream|index=0|codec_name=mp3|profile=unknown|codec_type=audio|codec_tag_string=[0][0][0][0]|codec_tag=0x|sample_fmt=fltp|sample_rate=44100|channels=2|channel_layout=stereo|bits_per_sample=0|initial_padding=0|id=N/A|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/14112000|start_pts=353600|start_time=0.025057|duration_ts=219340800|duration=15.542857|bit_rate=128000|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=595|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:encoder=LAME3.93 -format|filename=gapless.mp3|nb_streams=1|nb_programs=0|format_name=mp3|start_time=0.025057|duration=15.542857|size=250264|bit_rate=128812|probe_score=51|tag:title=test +stream|index=0|codec_name=mp3|profile=unknown|codec_type=audio|codec_tag_string=[0][0][0][0]|codec_tag=0x|sample_fmt=fltp|sample_rate=44100|channels=2|channel_layout=stereo|bits_per_sample=0|initial_padding=0|id=N/A|r_frame_rate=0/0|avg_frame_rate=0/0|time_base=1/14112000|start_pts=353600|start_time=0.025057|duration_ts=218521600|duration=15.484807|bit_rate=128000|max_bit_rate=N/A|bits_per_raw_sample=N/A|nb_frames=N/A|nb_read_frames=N/A|nb_read_packets=595|disposition:default=0|disposition:dub=0|disposition:original=0|disposition:comment=0|disposition:lyrics=0|disposition:karaoke=0|disposition:forced=0|disposition:hearing_impaired=0|disposition:visual_impaired=0|disposition:clean_effects=0|disposition:attached_pic=0|disposition:timed_thumbnails=0|disposition:captions=0|disposition:descriptions=0|disposition:metadata=0|disposition:dependent=0|disposition:still_image=0|tag:encoder=LAME3.93 +format|filename=gapless.mp3|nb_streams=1|nb_programs=0|format_name=mp3|start_time=0.025057|duration=15.484807|size=250264|bit_rate=129295|probe_score=51|tag:title=test -- 2.39.2 ___ 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] avformat/mp3dec:Subtract known padding from duration
> > --- > > libavformat/mp3dec.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c > > index 05c13228bc..c8c3b298ab 100644 > > --- a/libavformat/mp3dec.c > > +++ b/libavformat/mp3dec.c > > @@ -350,7 +350,8 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, > > AVStream *st, int64_t base) > > avio_seek(s->pb, base + vbrtag_size, SEEK_SET); > > > > if (mp3->frames) > > -st->duration = av_rescale_q(mp3->frames, (AVRational){spf, > > c.sample_rate}, > > +st->duration = av_rescale_q((mp3->frames * spf) - mp3- > > >start_pad - mp3->end_pad, > > This can overflow. Casting to int64_t before multiplying should be > enough to fix it. Good catch! I also noticed a fate-test failed (due to it including padding-samples in the reference output for duration), and a formatting error in the patch itself. Will fix and resubmit. Den ons 23 aug. 2023 kl 11:18 skrev Tomas Härdin : > > tis 2023-08-22 klockan 14:03 +0200 skrev Ulrik Mikaelsson: > > When an Info-tag is present, marking initial and trailing samples as > > padding, those samples should not be included in the calculation of > > track > > duration. > > > > This solves a surprising user experience where converting a WAV->MP3- > > >WAV, > > ffprobe will show the duration of the mp3 as slightly longer than > > both the > > input and the output. > > I've had similar issues with burning gapless CDs. Hopefully this fixes > some downstream projects. > > > --- > > libavformat/mp3dec.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c > > index 05c13228bc..c8c3b298ab 100644 > > --- a/libavformat/mp3dec.c > > +++ b/libavformat/mp3dec.c > > @@ -350,7 +350,8 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, > > AVStream *st, int64_t base) > > avio_seek(s->pb, base + vbrtag_size, SEEK_SET); > > > > if (mp3->frames) > > -st->duration = av_rescale_q(mp3->frames, (AVRational){spf, > > c.sample_rate}, > > +st->duration = av_rescale_q((mp3->frames * spf) - mp3- > > >start_pad - mp3->end_pad, > > This can overflow. Casting to int64_t before multiplying should be > enough to fix it. > > /Tomas > ___ > 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 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] avformat/mp3dec:Subtract known padding from duration
tis 2023-08-22 klockan 14:03 +0200 skrev Ulrik Mikaelsson: > When an Info-tag is present, marking initial and trailing samples as > padding, those samples should not be included in the calculation of > track > duration. > > This solves a surprising user experience where converting a WAV->MP3- > >WAV, > ffprobe will show the duration of the mp3 as slightly longer than > both the > input and the output. I've had similar issues with burning gapless CDs. Hopefully this fixes some downstream projects. > --- > libavformat/mp3dec.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c > index 05c13228bc..c8c3b298ab 100644 > --- a/libavformat/mp3dec.c > +++ b/libavformat/mp3dec.c > @@ -350,7 +350,8 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, > AVStream *st, int64_t base) > avio_seek(s->pb, base + vbrtag_size, SEEK_SET); > > if (mp3->frames) > - st->duration = av_rescale_q(mp3->frames, (AVRational){spf, > c.sample_rate}, > + st->duration = av_rescale_q((mp3->frames * spf) - mp3- > >start_pad - mp3->end_pad, This can overflow. Casting to int64_t before multiplying should be enough to fix it. /Tomas ___ 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".