Re: [FFmpeg-devel] [PATCH] avfilter/metadata: add intuitive labels for metadata values
Pushed as f53414a0382701b9bc984f657939d4227c7c568a On 2021-05-15 12:33, Gyan Doshi wrote: Plan to push tonight. On 2021-05-14 15:53, Gyan Doshi wrote: --- doc/filters.texi | 4 ++-- libavfilter/f_metadata.c | 8 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index ed0ffe91fc..1a8843fe4f 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -25296,10 +25296,10 @@ The expression is evaluated through the eval API and can contain the following constants: @table @option -@item VALUE1 +@item VALUE1, FRAMEVAL Float representation of @code{value} from metadata key. -@item VALUE2 +@item VALUE2, USERVAL Float representation of @code{value} as supplied by user in @code{value} option. @end table diff --git a/libavfilter/f_metadata.c b/libavfilter/f_metadata.c index 5fec7c3c56..e7c7b00118 100644 --- a/libavfilter/f_metadata.c +++ b/libavfilter/f_metadata.c @@ -61,12 +61,16 @@ enum MetadataFunction { static const char *const var_names[] = { "VALUE1", "VALUE2", + "FRAMEVAL", + "USERVAL", NULL }; enum var_name { VAR_VALUE1, VAR_VALUE2, + VAR_FRAMEVAL, + VAR_USERVAL, VAR_VARS_NB }; @@ -172,8 +176,8 @@ static int parse_expr(MetadataContext *s, const char *value1, const char *value2 if (sscanf(value1, "%lf", &f1) + sscanf(value2, "%lf", &f2) != 2) return 0; - s->var_values[VAR_VALUE1] = f1; - s->var_values[VAR_VALUE2] = f2; + s->var_values[VAR_VALUE1] = s->var_values[VAR_FRAMEVAL] = f1; + s->var_values[VAR_VALUE2] = s->var_values[VAR_USERVAL] = f2; return av_expr_eval(s->expr, s->var_values, NULL); } ___ 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] ffbuild/common.mak: Fix for windres in binutils-2.36.1
On Sat, May 15, 2021 at 8:15 PM James Almer wrote: > > On 5/15/2021 1:49 PM, Tee KOBAYASHI wrote: > > The attached patch fixes a problem when building for Mingw-w64 using > > binutils-2.36.1: > > > > x86_64-w64-mingw32-windres -I. -Isrc/ --preprocessor > > "x86_64-w64-mingw32-gcc -E -xc-header -DRC_INVOKED -MMD -MF > > libavdevice/avdeviceres.d -MT libavdevice/avdeviceres.o" -o > > libavdevice/avdeviceres.o > > /usr/x86_64-w64-mingw32/tmp/portage/media-video/ffmpeg-4.3.2/work/ffmpeg-4.3.2/libavdevice/avdeviceres.rc > > sh: line 1: x86_64-w64-mingw32-gcc -E -xc-header -DRC_INVOKED -MMD -MF > > libavdevice/avdeviceres.d -MT libavdevice/avdeviceres.o: No such file > > or directory > > x86_64-w64-mingw32-windres: preprocessing failed. > > make: *** > > [/usr/x86_64-w64-mingw32/tmp/portage/media-video/ffmpeg-4.3.2/work/ffmpeg-4.3.2/ffbuild/common.mak:85: > > libavdevice/avdeviceres.o] Error 1 > > I can't reproduce this on a msys2 environment. Is this problem only > affecting cross compiling scenarios? > > Your patch nonetheless also works on it, so it may be acceptable. Is > --preprocessor-arg available in old binutils' windres? --preprocessor-arg was added to binutils in 2011, so probably old enough. I am however puzzled by the problem, since the documentation clearly states that you can in fact use --preprocessor to pass any arguments. - Hendrik ___ 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 v2] avcodec/videotoolboxenc: #define TARGET_CPU_ARM64 to 0 if not provided by the SDK
Fixes build failure on older SDKs without it. Fixes #9242 Signed-off-by: Zane van Iperen --- libavcodec/videotoolboxenc.c | 4 1 file changed, 4 insertions(+) NB: This is untested, I do not have a Mac to try it on. diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index 58239e0ab9..f063a86e73 100644 --- a/libavcodec/videotoolboxenc.c +++ b/libavcodec/videotoolboxenc.c @@ -50,6 +50,10 @@ enum { kCVPixelFormatType_420YpCbCr10BiPlanarFullRange = 'xf20' }; enum { kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange = 'x420' }; #endif +#ifndef TARGET_CPU_ARM64 +# define TARGET_CPU_ARM64 0 +#endif + typedef OSStatus (*getParameterSetAtIndex)(CMFormatDescriptionRef videoDesc, size_t parameterSetIndex, const uint8_t **parameterSetPointerOut, -- 2.29.3 ___ 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] avcodec/videotoolboxenc: #define TARGET_CPU_ARM64 to 0 if not provided by the SDK
On 16/5/21 12:57 am, Carl Eugen Hoyos wrote: --- a/libavcodec/videotoolboxenc.c +++ b/libavcodec/videotoolboxenc.c @@ -50,6 +50,11 @@ enum { kCVPixelFormatType_420YpCbCr10BiPlanarFullRange = 'xf20' }; enum { kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange = 'x420' }; #endif +/* Older SDKs don't have this, make sure we can actually compile we're using one. */ Second half of that sentence is missing a word or has too many. Yeah, picked that up shortly after I posted it. It's meant to read: "Older SDKs don't have this, make sure we can actually compile if we're using one." Make it „Defined in macOS 10.x“ instead or remove the comment. I'll remove it, it's self-explanatory anyway. ___ 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] Questions about Codec
On Thu, May 13, 2021 at 11:41 AM Nicolas Frattaroli wrote: > On 13.05.21 10:16, Renvoi wrote: > > Dear ffmpeg-devel > > > > I want to encode a video or serial number file to the Grassvallay HQ > codec > > in AVI format and export it. Is there any way? Please help us. > > > > Grass Valley > > https://pro.grassvalley.jp/catalog/hqcodec/hq_codec.htm > > > > This is the development list, not the user support list. However, I can > tell > you that ffmpeg currently does not support this codec as far as I am aware, > as you can verify yourself with `ffmpeg -codecs | grep -i grass`. I do > however > suspect that it is not a very original codec and may in fact simply be a > variation of something else, so a sample file would be able to confirm > this. > Please keep silence if you are not knowledgeable enough about this subject in general and especially in this special case. If you inspect fourcc of videos produced by this encoder you will notice it is already supported from avi/mov container by FFmpeg. Codec name is just re-branded HQX of Canopus. There are 3 variants and all 3 are supported. Maybe it is not supported in MXF container, need samples for that case. > > For what it's worth, I suspect that any reasonably modern codec with a good > encoder will outclass this "HQ codec" in efficiency by orders of magnitude. > ___ > 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] lavf/flvdec: normalize exporting date metadata
Hi Anton! On 2021-05-14 10:09 +0200, Anton Khirnov wrote: > Quoting Alexander Strasser (2021-05-12 01:04:28) > > > > If the timezone data of an AMF 0 date type is non-zero, include that > > information as UTC offset in hours and minutes. > > --- > > libavformat/flvdec.c | 18 +++--- > > 1 file changed, 15 insertions(+), 3 deletions(-) > > > > diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c > > index ddaceaafe4..c941e62e23 100644 > > --- a/libavformat/flvdec.c > > +++ b/libavformat/flvdec.c > > @@ -688,9 +688,21 @@ static int amf_parse_object(AVFormatContext *s, > > AVStream *astream, > > time = date.milliseconds / 1000; // to seconds > > gmtime_r(&time, &t); > > > > -// timezone is ignored, since there is no easy way to offset > > the UTC > > -// timestamp into the specified timezone > > -strftime(datestr, sizeof(datestr), "%Y-%m-%dT%H:%M:%SZ", &t); > > +strftime(datestr, sizeof(datestr), "%Y-%m-%dT%H:%M:%S", &t); > > + > > +if (date.timezone) { > > +int off_tz = date.timezone; // offset in minutes > > +char ch_sign = '+'; > > +if (off_tz < 0) { > > +off_tz = -off_tz; > > +ch_sign = '-'; > > +} > > +if (off_tz > 99*60 + 59) > > +off_tz = 99*60 + 59; > > + > > +av_strlcatf(datestr, sizeof(datestr), "%c%02d%02d", > > ch_sign, off_tz / 60, off_tz % 60); > > I still believe this is wrong, since the spec says the timestamp is in > UTC. The code you quoted seems to conform to that. Not to my understanding and testing. This Ruby program t1 = Time.now() t2 = Time.now.utc() print t1, " - ", t1.to_f, "\n" print t2, " - ", t2.to_f, "\n" yields for example: 2021-05-15 20:05:19 +0200 - 1621101919.509961 2021-05-15 18:05:19 UTC - 1621101919.509966 Returning to the code I quoted before now and stating my understanding of if now. def write__AMF_date(time) write__UI8 11 write [(time.to_f * 1000.0)].pack('G') write__SI16( (Time.now.gmtoff / 60).to_i ) end This writes the time in micro seconds without offset as double. The GMT offset in minutes is written afterwards as signed 16 bit integer. def read__AMF_date utc_time = Time.at((read__AMF_double / 1000).to_i) utc_time + (read__SI16 * 60) - Time.now.gmtoff end This first reads the double and converts it into a Time object. In the following line it reads and adds the stored offset and subtracts the current offset to get rid of its influence. Alexander ___ 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] ffbuild/common.mak: Fix for windres in binutils-2.36.1
On 5/15/2021 1:49 PM, Tee KOBAYASHI wrote: The attached patch fixes a problem when building for Mingw-w64 using binutils-2.36.1: x86_64-w64-mingw32-windres -I. -Isrc/ --preprocessor "x86_64-w64-mingw32-gcc -E -xc-header -DRC_INVOKED -MMD -MF libavdevice/avdeviceres.d -MT libavdevice/avdeviceres.o" -o libavdevice/avdeviceres.o /usr/x86_64-w64-mingw32/tmp/portage/media-video/ffmpeg-4.3.2/work/ffmpeg-4.3.2/libavdevice/avdeviceres.rc sh: line 1: x86_64-w64-mingw32-gcc -E -xc-header -DRC_INVOKED -MMD -MF libavdevice/avdeviceres.d -MT libavdevice/avdeviceres.o: No such file or directory x86_64-w64-mingw32-windres: preprocessing failed. make: *** [/usr/x86_64-w64-mingw32/tmp/portage/media-video/ffmpeg-4.3.2/work/ffmpeg-4.3.2/ffbuild/common.mak:85: libavdevice/avdeviceres.o] Error 1 I can't reproduce this on a msys2 environment. Is this problem only affecting cross compiling scenarios? Your patch nonetheless also works on it, so it may be acceptable. Is --preprocessor-arg available in old binutils' windres? ___ 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]avfilter: add Intel IPP library based x86 optimized video scaling filter.
Victoria Zhislina Cloud Software Engineering, Senior Application Engineer, Intel Corp. Nizhny Novgorod, Russia; Office: (831)-2969-444 ext.2231; INET: 312-2231 Joint Stock Company Intel A/O Registered legal address: Krylatsky Hills Business Park, 17 Krylatskaya Str., Bldg 4, Moscow 121614, Russian Federation This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. 0001-avfilter-add-Intel-IPP-library-based-x86-optimized-v.patch Description: 0001-avfilter-add-Intel-IPP-library-based-x86-optimized-v.patch ___ 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] ffbuild/common.mak: Fix for windres in binutils-2.36.1
The attached patch fixes a problem when building for Mingw-w64 using binutils-2.36.1: x86_64-w64-mingw32-windres -I. -Isrc/ --preprocessor "x86_64-w64-mingw32-gcc -E -xc-header -DRC_INVOKED -MMD -MF libavdevice/avdeviceres.d -MT libavdevice/avdeviceres.o" -o libavdevice/avdeviceres.o /usr/x86_64-w64-mingw32/tmp/portage/media-video/ffmpeg-4.3.2/work/ffmpeg-4.3.2/libavdevice/avdeviceres.rc sh: line 1: x86_64-w64-mingw32-gcc -E -xc-header -DRC_INVOKED -MMD -MF libavdevice/avdeviceres.d -MT libavdevice/avdeviceres.o: No such file or directory x86_64-w64-mingw32-windres: preprocessing failed. make: *** [/usr/x86_64-w64-mingw32/tmp/portage/media-video/ffmpeg-4.3.2/work/ffmpeg-4.3.2/ffbuild/common.mak:85: libavdevice/avdeviceres.o] Error 1 diff --git a/ffbuild/common.mak b/ffbuild/common.mak index 32f5b997b5..3e545ab9cd 100644 --- a/ffbuild/common.mak +++ b/ffbuild/common.mak @@ -90,7 +90,7 @@ COMPILE_MSA = $(call COMPILE,CC,MSAFLAGS) -$(if $(ASMSTRIPFLAGS), $(STRIP) $(ASMSTRIPFLAGS) $@) %.o: %.rc - $(WINDRES) $(IFLAGS) --preprocessor "$(DEPWINDRES) -E -xc-header -DRC_INVOKED $(CC_DEPFLAGS)" -o $@ $< + $(WINDRES) $(IFLAGS) --preprocessor "$(DEPWINDRES)" $(patsubst %,--preprocessor-arg %,-E -xc-header -DRC_INVOKED $(CC_DEPFLAGS)) -o $@ $< %.i: %.c $(CC) $(CCFLAGS) $(CC_E) $< ___ 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] fate/integer.c: Connect test to fuzzer
Hi, Apologies for the trivial mistakes. I have fixed them in this patch. I have also added simple checks for overflow and underflow. Would this be sufficient or should I reduce the bits I read from the fuzzer? I will also submit a pull request to oss-fuzz as soon as this patch is applied. :) --- Makefile | 2 ++ libavutil/tests/integer.c | 21 ++ libavutil/tests/integer.h | 45 +++ tools/Makefile| 3 +++ tools/target_int_fuzzer.c | 39 + 5 files changed, 91 insertions(+), 19 deletions(-) create mode 100644 libavutil/tests/integer.h create mode 100644 tools/target_int_fuzzer.c diff --git a/Makefile b/Makefile index 7e9d8b08c3..92fe8cac65 100644 --- a/Makefile +++ b/Makefile @@ -62,6 +62,8 @@ tools/target_dem_fuzzer$(EXESUF): tools/target_dem_fuzzer.o $(FF_DEP_LIBS) tools/target_io_dem_fuzzer$(EXESUF): tools/target_io_dem_fuzzer.o $(FF_DEP_LIBS) $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH) +tools/target_int_fuzzer$(EXESUF): tools/target_int_fuzzer.o $(FF_DEP_LIBS) + $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(ELIBS) $(FF_EXTRALIBS) $(LIBFUZZER_PATH) tools/enum_options$(EXESUF): ELIBS = $(FF_EXTRALIBS) tools/enum_options$(EXESUF): $(FF_DEP_LIBS) diff --git a/libavutil/tests/integer.c b/libavutil/tests/integer.c index d2c8f2a903..02e1d9219c 100644 --- a/libavutil/tests/integer.c +++ b/libavutil/tests/integer.c @@ -18,31 +18,14 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include - -#include "libavutil/avassert.h" -#include "libavutil/integer.h" -#include "libavutil/intmath.h" +#include "libavutil/tests/integer.h" int main(void){ int64_t a,b; for(a=7; a<256*256*256; a+=13215){ for(b=3; b<256*256*256; b+=27118){ -AVInteger ai= av_int2i(a); -AVInteger bi= av_int2i(b); - -av_assert0(av_i2int(ai) == a); -av_assert0(av_i2int(bi) == b); -av_assert0(av_i2int(av_add_i(ai,bi)) == a+b); -av_assert0(av_i2int(av_sub_i(ai,bi)) == a-b); -av_assert0(av_i2int(av_mul_i(ai,bi)) == a*b); -av_assert0(av_i2int(av_shr_i(ai, 9)) == a>>9); -av_assert0(av_i2int(av_shr_i(ai,-9)) == a<<9); -av_assert0(av_i2int(av_shr_i(ai, 17)) == a>>17); -av_assert0(av_i2int(av_shr_i(ai,-17)) == a<<17); -av_assert0(av_log2_i(ai) == av_log2(a)); -av_assert0(av_i2int(av_div_i(ai,bi)) == a/b); +TestInteger(a,b); } } return 0; diff --git a/libavutil/tests/integer.h b/libavutil/tests/integer.h new file mode 100644 index 00..1e28c29787 --- /dev/null +++ b/libavutil/tests/integer.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2004 Michael Niedermayer + * + * 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 + */ +#ifndef AVUTIL_TESTS_INTEGER_H +#define AVUTIL_TESTS_INTEGER_H + +#include +#include "libavutil/avassert.h" +#include "libavutil/integer.h" +#include "libavutil/intmath.h" + +static inline void TestInteger(int64_t a, int64_t b) +{ +AVInteger ai= av_int2i(a); +AVInteger bi= av_int2i(b); + +av_assert0(av_i2int(ai) == a); +av_assert0(av_i2int(bi) == b); +av_assert0(av_i2int(av_add_i(ai,bi)) == a+b); +av_assert0(av_i2int(av_sub_i(ai,bi)) == a-b); +av_assert0(av_i2int(av_mul_i(ai,bi)) == a*b); +av_assert0(av_i2int(av_shr_i(ai, 9)) == a>>9); +av_assert0(av_i2int(av_shr_i(ai,-9)) == a<<9); +av_assert0(av_i2int(av_shr_i(ai, 17)) == a>>17); +av_assert0(av_i2int(av_shr_i(ai,-17)) == a<<17); +av_assert0(av_log2_i(ai) == av_log2(a)); +av_assert0(av_i2int(av_div_i(ai,bi)) == a/b); +} +#endif /* AVUTIL_TESTS_INTEGER_H */ diff --git a/tools/Makefile b/tools/Makefile index 82baa8eadb..fde7f08984 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -17,6 +17,9 @@ tools/target_dem_fuzzer.o: tools/target_dem_fuzzer.c tools/target_io_dem_fuzzer.o: tools/target_dem_fuzzer.c $(COMPILE_C) -DIO_FLAT=0 +tools/target_int_fuzzer.o: tools/target_int_fuzzer.c + $(COMPILE_C) + OUTDIRS += tools clean:: diff --git a/
[FFmpeg-devel] [PATCH v3] hwcontext_vaapi: Use PRIME_2 memory type for modifiers.
This way we can pass explicit modifiers in. Sometimes the modifier matters for the number of memory planes that libva accepts, in particular when dealing with driver-compressed textures. Furthermore the driver might not actually be able to determine the implicit modifier if all the buffer-passing has used explicit modifier. All these issues should be resolved by passing in the modifier, and for that we switch to using the PRIME_2 memory type. Tested with experimental radeonsi patches for modifiers and kmsgrab. Also tested with radeonsi without the patches to double-check it works without PRIME_2 support. v2: Cache PRIME_2 support to avoid doing two calls every time on libva drivers that do not support it. v3: Remove prime2_vas usage. --- libavutil/hwcontext_vaapi.c | 158 ++-- 1 file changed, 114 insertions(+), 44 deletions(-) diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c index 83e542876d..75acc851d6 100644 --- a/libavutil/hwcontext_vaapi.c +++ b/libavutil/hwcontext_vaapi.c @@ -79,6 +79,9 @@ typedef struct VAAPIFramesContext { unsigned int rt_format; // Whether vaDeriveImage works. int derive_works; +// Caches whether VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2 is unsupported for +// surface imports. +int prime_2_import_unsupported; } VAAPIFramesContext; typedef struct VAAPIMapping { @@ -1022,32 +1025,17 @@ static void vaapi_unmap_from_drm(AVHWFramesContext *dst_fc, static int vaapi_map_from_drm(AVHWFramesContext *src_fc, AVFrame *dst, const AVFrame *src, int flags) { +VAAPIFramesContext *src_vafc = src_fc->internal->priv; AVHWFramesContext *dst_fc = (AVHWFramesContext*)dst->hw_frames_ctx->data; AVVAAPIDeviceContext *dst_dev = dst_fc->device_ctx->hwctx; const AVDRMFrameDescriptor *desc; const VAAPIFormatDescriptor *format_desc; VASurfaceID surface_id; -VAStatus vas; +VAStatus vas = VA_STATUS_SUCCESS; +int use_prime2; uint32_t va_fourcc; -int err, i, j, k; - -unsigned long buffer_handle; -VASurfaceAttribExternalBuffers buffer_desc; -VASurfaceAttrib attrs[2] = { -{ -.type = VASurfaceAttribMemoryType, -.flags = VA_SURFACE_ATTRIB_SETTABLE, -.value.type= VAGenericValueTypeInteger, -.value.value.i = VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME, -}, -{ -.type = VASurfaceAttribExternalBufferDescriptor, -.flags = VA_SURFACE_ATTRIB_SETTABLE, -.value.type= VAGenericValueTypePointer, -.value.value.p = &buffer_desc, -} -}; +int err, i, j; desc = (AVDRMFrameDescriptor*)src->data[0]; @@ -1083,35 +1071,117 @@ static int vaapi_map_from_drm(AVHWFramesContext *src_fc, AVFrame *dst, format_desc = vaapi_format_from_fourcc(va_fourcc); av_assert0(format_desc); -buffer_handle = desc->objects[0].fd; -buffer_desc.pixel_format = va_fourcc; -buffer_desc.width= src_fc->width; -buffer_desc.height = src_fc->height; -buffer_desc.data_size= desc->objects[0].size; -buffer_desc.buffers = &buffer_handle; -buffer_desc.num_buffers = 1; -buffer_desc.flags= 0; - -k = 0; -for (i = 0; i < desc->nb_layers; i++) { -for (j = 0; j < desc->layers[i].nb_planes; j++) { -buffer_desc.pitches[k] = desc->layers[i].planes[j].pitch; -buffer_desc.offsets[k] = desc->layers[i].planes[j].offset; -++k; +use_prime2 = !src_vafc->prime_2_import_unsupported && + desc->objects[0].format_modifier != DRM_FORMAT_MOD_INVALID; +if (use_prime2) { +VADRMPRIMESurfaceDescriptor prime_desc; +VASurfaceAttrib prime_attrs[2] = { +{ +.type = VASurfaceAttribMemoryType, +.flags = VA_SURFACE_ATTRIB_SETTABLE, +.value.type= VAGenericValueTypeInteger, +.value.value.i = VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2, +}, +{ +.type = VASurfaceAttribExternalBufferDescriptor, +.flags = VA_SURFACE_ATTRIB_SETTABLE, +.value.type= VAGenericValueTypePointer, +.value.value.p = &prime_desc, +} +}; +prime_desc.fourcc = va_fourcc; +prime_desc.width = src_fc->width; +prime_desc.height = src_fc->height; +prime_desc.num_objects = desc->nb_objects; +for (i = 0; i < desc->nb_objects; ++i) { +prime_desc.objects[i].fd = desc->objects[i].fd; +prime_desc.objects[i].size = desc->objects[i].size; +prime_desc.objects[i].drm_format_modifier = +desc->objects[i].format_modifier; } -} -buffer_desc.num_planes = k; -if (format_desc->chroma_planes_swapped && -buffer_desc.num_planes == 3) { -
Re: [FFmpeg-devel] [PATCH] avcodec/videotoolboxenc: #define TARGET_CPU_ARM64 to 0 if not provided by the SDK
> Am 15.05.2021 um 14:12 schrieb Zane van Iperen : > > > >> On 15/5/21 10:11 pm, Timo Rothenpieler wrote: >>> On 15.05.2021 11:45, Zane van Iperen wrote: >>> Fixes build failure on older SDKs without it. >>> >>> Fixes #9242 >>> >>> Signed-off-by: Zane van Iperen >>> --- >>> libavcodec/videotoolboxenc.c | 5 + >>> 1 file changed, 5 insertions(+) >>> >>> NB: This is untested, I do not have a Mac to try it on. >>> >>> diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c >>> index 58239e0ab9..3d3677362a 100644 >>> --- a/libavcodec/videotoolboxenc.c >>> +++ b/libavcodec/videotoolboxenc.c >>> @@ -50,6 +50,11 @@ enum { kCVPixelFormatType_420YpCbCr10BiPlanarFullRange = >>> 'xf20' }; >>> enum { kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange = 'x420' }; >>> #endif >>> +/* Older SDKs don't have this, make sure we can actually compile we're >>> using one. */ >> Second half of that sentence is missing a word or has too many. > > Yeah, picked that up shortly after I posted it. It's meant to read: > "Older SDKs don't have this, make sure we can actually compile if we're using > one." Make it „Defined in macOS 10.x“ instead or remove the comment. Carl Eugen ___ 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] ffmpeg: add -fpsmin to clamp output framerate
I'll review this in a few days. On 2021-05-11 21:42, Matthias Neugebauer wrote: Add -fpsmin analogously to -fpsmax for setting a lower bound to the auto-set frame rate. Signed-off-by: Matthias Neugebauer --- doc/ffmpeg.texi | 7 +++ fftools/ffmpeg.c | 8 +++- fftools/ffmpeg.h | 3 +++ fftools/ffmpeg_opt.c | 26 +++--- 4 files changed, 40 insertions(+), 4 deletions(-) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 9feabe6517..5576508347 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -862,6 +862,13 @@ Clamps output frame rate when output framerate is auto-set and is higher than th Useful in batch processing or when input framerate is wrongly detected as very high. It cannot be set together with @code{-r}. It is ignored during streamcopy. +@item -fpsmin[:@var{stream_specifier}] @var{fps} (@emph{output,per-stream}) +Set minimum frame rate (Hz value, fraction or abbreviation). + +Clamps output frame rate when output framerate is auto-set and is lower than this value. +Useful in batch processing or when input framerate is wrongly detected as very low. +It cannot be set together with @code{-r}. It is ignored during streamcopy. + @item -s[:@var{stream_specifier}] @var{size} (@emph{input/output,per-stream}) Set frame size. diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 3ad11452da..696ba7d730 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -3390,7 +3390,8 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame) ost->frame_rate = ist->framerate; if (ist && !ost->frame_rate.num) ost->frame_rate = ist->st->r_frame_rate; -if (ist && !ost->frame_rate.num && !ost->max_frame_rate.num) { +if (ist && !ost->frame_rate.num && !ost->max_frame_rate.num && !ost->min_frame_rate.num) +{ ost->frame_rate = (AVRational){25, 1}; av_log(NULL, AV_LOG_WARNING, "No information " @@ -3400,6 +3401,11 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame) ost->file_index, ost->index); } +if (ost->min_frame_rate.num && +(av_q2d(ost->frame_rate) < av_q2d(ost->min_frame_rate) || +!ost->frame_rate.den)) +ost->frame_rate = ost->min_frame_rate; + if (ost->max_frame_rate.num && (av_q2d(ost->frame_rate) > av_q2d(ost->max_frame_rate) || !ost->frame_rate.den)) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 606f2afe0c..515d0c7a46 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -110,6 +110,8 @@ typedef struct OptionsContext { intnb_frame_rates; SpecifierOpt *max_frame_rates; intnb_max_frame_rates; +SpecifierOpt *min_frame_rates; +intnb_min_frame_rates; SpecifierOpt *frame_sizes; intnb_frame_sizes; SpecifierOpt *frame_pix_fmts; @@ -486,6 +488,7 @@ typedef struct OutputStream { /* video only */ AVRational frame_rate; AVRational max_frame_rate; +AVRational min_frame_rate; int is_cfr; int force_fps; int top_field_first; diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 849d24b16d..b0d7550ce6 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -56,6 +56,7 @@ static const char *const opt_name_audio_channels[]= {"ac", NULL}; static const char *const opt_name_audio_sample_rate[] = {"ar", NULL}; static const char *const opt_name_frame_rates[] = {"r", NULL}; static const char *const opt_name_max_frame_rates[] = {"fpsmax", NULL}; +static const char *const opt_name_min_frame_rates[] = {"fpsmin", NULL}; static const char *const opt_name_frame_sizes[] = {"s", NULL}; static const char *const opt_name_frame_pix_fmts[]= {"pix_fmt", NULL}; static const char *const opt_name_ts_scale[] = {"itsscale", NULL}; @@ -1694,7 +1695,7 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in AVStream *st; OutputStream *ost; AVCodecContext *video_enc; -char *frame_rate = NULL, *max_frame_rate = NULL, *frame_aspect_ratio = NULL; +char *frame_rate = NULL, *max_frame_rate = NULL, *min_frame_rate = NULL, *frame_aspect_ratio = NULL; ost = new_output_stream(o, oc, AVMEDIA_TYPE_VIDEO, source_index); st = ost->st; @@ -1712,14 +1713,30 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in exit_program(1); } +MATCH_PER_STREAM_OPT(min_frame_rates, str, min_frame_rate, oc, st); +if (min_frame_rate && av_parse_video_rate(&ost->min_frame_rate, min_frame_rate) < 0) { +av_log(NULL, AV_LOG_FATAL, "Invalid minimum framerate value: %s\n", min_frame_rate); +exit_program(1); +} + if (frame_rate && max_frame_rate) { av_log(NULL, AV_LOG_ERROR, "Only on
Re: [FFmpeg-devel] [PATCH] avcodec/videotoolboxenc: #define TARGET_CPU_ARM64 to 0 if not provided by the SDK
On 15/5/21 10:11 pm, Timo Rothenpieler wrote: On 15.05.2021 11:45, Zane van Iperen wrote: Fixes build failure on older SDKs without it. Fixes #9242 Signed-off-by: Zane van Iperen --- libavcodec/videotoolboxenc.c | 5 + 1 file changed, 5 insertions(+) NB: This is untested, I do not have a Mac to try it on. diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index 58239e0ab9..3d3677362a 100644 --- a/libavcodec/videotoolboxenc.c +++ b/libavcodec/videotoolboxenc.c @@ -50,6 +50,11 @@ enum { kCVPixelFormatType_420YpCbCr10BiPlanarFullRange = 'xf20' }; enum { kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange = 'x420' }; #endif +/* Older SDKs don't have this, make sure we can actually compile we're using one. */ Second half of that sentence is missing a word or has too many. Yeah, picked that up shortly after I posted it. It's meant to read: "Older SDKs don't have this, make sure we can actually compile if we're using one." ___ 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] avcodec/videotoolboxenc: #define TARGET_CPU_ARM64 to 0 if not provided by the SDK
On 15.05.2021 11:45, Zane van Iperen wrote: Fixes build failure on older SDKs without it. Fixes #9242 Signed-off-by: Zane van Iperen --- libavcodec/videotoolboxenc.c | 5 + 1 file changed, 5 insertions(+) NB: This is untested, I do not have a Mac to try it on. diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index 58239e0ab9..3d3677362a 100644 --- a/libavcodec/videotoolboxenc.c +++ b/libavcodec/videotoolboxenc.c @@ -50,6 +50,11 @@ enum { kCVPixelFormatType_420YpCbCr10BiPlanarFullRange = 'xf20' }; enum { kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange = 'x420' }; #endif +/* Older SDKs don't have this, make sure we can actually compile we're using one. */ Second half of that sentence is missing a word or has too many. +#ifndef TARGET_CPU_ARM64 +# define TARGET_CPU_ARM64 0 +#endif + typedef OSStatus (*getParameterSetAtIndex)(CMFormatDescriptionRef videoDesc, size_t parameterSetIndex, const uint8_t **parameterSetPointerOut, smime.p7s Description: S/MIME Cryptographic 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] [PATCH] avcodec/videotoolboxenc: #define TARGET_CPU_ARM64 to 0 if not provided by the SDK
Fixes build failure on older SDKs without it. Fixes #9242 Signed-off-by: Zane van Iperen --- libavcodec/videotoolboxenc.c | 5 + 1 file changed, 5 insertions(+) NB: This is untested, I do not have a Mac to try it on. diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index 58239e0ab9..3d3677362a 100644 --- a/libavcodec/videotoolboxenc.c +++ b/libavcodec/videotoolboxenc.c @@ -50,6 +50,11 @@ enum { kCVPixelFormatType_420YpCbCr10BiPlanarFullRange = 'xf20' }; enum { kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange = 'x420' }; #endif +/* Older SDKs don't have this, make sure we can actually compile we're using one. */ +#ifndef TARGET_CPU_ARM64 +# define TARGET_CPU_ARM64 0 +#endif + typedef OSStatus (*getParameterSetAtIndex)(CMFormatDescriptionRef videoDesc, size_t parameterSetIndex, const uint8_t **parameterSetPointerOut, -- 2.29.3 ___ 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] fftools/ffmpeg: fix -t inaccurate recording time
if input start time is not 0 -t is inaccurate doing stream copy, will record extra duration according to input start time. it should base on following cases: input video start time from 60s, duration is 300s, 1. stream copy: ffmpeg -ss 40 -t 60 -i in.mp4 -c copy -y out.mp4 open_input_file() will seek to 100 and set ts_offset to -100, process_input() will offset pkt->pts with ts_offset to make it 0, so when do_streamcopy() with -t, exits when ist->pts >= recording_time. 2. stream copy with -copyts: ffmpeg -ss 40 -t 60 -copyts -i in.mp4 -c copy -y out.mp4 open_input_file() will seek to 100 and set ts_offset to 0, process_input() will keep raw pkt->pts as ts_offset is 0, so when do_streamcopy() with -t, exits when ist->pts >= (recording_time+f->start_time+f->ctx->start_time). 3. stream copy with -copyts -start_at_zero: ffmpeg -ss 40 -t 60 -copyts -start_at_zero -i in.mp4 -c copy -y out.mp4 open_input_file() will seek to 120 and set ts_offset to -60 as start_to_zero option, process_input() will offset pkt->pts with input file start time, so when do_streamcopy() with -t, exits when ist->pts >= (recording_time+f->start_time). 0 60 40 60 360 |___|_|___|___| start -ss -t This fixes ticket #9141. Signed-off-by: Shiwang.Xie --- fftools/ffmpeg.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index b3658d8f65..309d9dfa6e 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -2082,9 +2082,11 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p } if (f->recording_time != INT64_MAX) { -start_time = f->ctx->start_time; -if (f->start_time != AV_NOPTS_VALUE && copy_ts) -start_time += f->start_time; +start_time = 0; +if (copy_ts) { +start_time += f->start_time != AV_NOPTS_VALUE ? f->start_time : 0; +start_time += start_at_zero ? 0 : f->ctx->start_time; +} if (ist->pts >= f->recording_time + start_time) { close_output_stream(ost); return; -- 2.18.5 ___ 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/metadata: add intuitive labels for metadata values
Plan to push tonight. On 2021-05-14 15:53, Gyan Doshi wrote: --- doc/filters.texi | 4 ++-- libavfilter/f_metadata.c | 8 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index ed0ffe91fc..1a8843fe4f 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -25296,10 +25296,10 @@ The expression is evaluated through the eval API and can contain the following constants: @table @option -@item VALUE1 +@item VALUE1, FRAMEVAL Float representation of @code{value} from metadata key. -@item VALUE2 +@item VALUE2, USERVAL Float representation of @code{value} as supplied by user in @code{value} option. @end table diff --git a/libavfilter/f_metadata.c b/libavfilter/f_metadata.c index 5fec7c3c56..e7c7b00118 100644 --- a/libavfilter/f_metadata.c +++ b/libavfilter/f_metadata.c @@ -61,12 +61,16 @@ enum MetadataFunction { static const char *const var_names[] = { "VALUE1", "VALUE2", +"FRAMEVAL", +"USERVAL", NULL }; enum var_name { VAR_VALUE1, VAR_VALUE2, +VAR_FRAMEVAL, +VAR_USERVAL, VAR_VARS_NB }; @@ -172,8 +176,8 @@ static int parse_expr(MetadataContext *s, const char *value1, const char *value2 if (sscanf(value1, "%lf", &f1) + sscanf(value2, "%lf", &f2) != 2) return 0; -s->var_values[VAR_VALUE1] = f1; -s->var_values[VAR_VALUE2] = f2; +s->var_values[VAR_VALUE1] = s->var_values[VAR_FRAMEVAL] = f1; +s->var_values[VAR_VALUE2] = s->var_values[VAR_USERVAL] = f2; return av_expr_eval(s->expr, s->var_values, NULL); } ___ 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".