Re: [FFmpeg-devel] [PATCH 1/9] configure: [loongson] revert no-expensive-optimizations
>-Original Message- >From: ffmpeg-devel-boun...@ffmpeg.org [mailto:ffmpeg-devel-boun...@ffmpeg.org] >On Behalf Of >Shiyou Yin >Sent: Saturday, August 25, 2018 11:04 AM >To: 'FFmpeg development discussions and patches' >Subject: Re: [FFmpeg-devel] [PATCH 1/9] configure: [loongson] revert >no-expensive-optimizations > >>> Hi Michael, please help to review the following updates. >>> >>> >>> diff --git a/configure b/configure >>> index b9c9d0b..08cf48e 100755 >>> --- a/configure >>> +++ b/configure >>> @@ -4796,15 +4796,24 @@ elif enabled mips; then >>> disable mipsfpu >>> disable mipsdsp >>> disable mipsdspr2 >>> +# When gcc version less than 5.3.0, add >>> -fno-expensive-optimizations flag. >>> +if [ $cc == gcc ]; then >>> +gcc_version=$(gcc -dumpversion) >>> +if [ "$(echo "$gcc_version 5.3.0" | tr " " "\n" >>> + | sort -rV | head -n 1)" == >>> "$gcc_version" ]; then >>> +expensive_optimization_flag="" >>> +else >>> + >>> expensive_optimization_flag="-fno-expensive-optimizations" >>> +fi >>> +fi >> >>This patch looks corrupted (by a newline) >> >>[...] > > >Hi Michael, has repasted below, To avoid being corrupted again, I add an >attachment. > >diff --git a/configure b/configure >index b9c9d0b..08cf48e 100755 >--- a/configure >+++ b/configure >@@ -4796,15 +4796,24 @@ elif enabled mips; then > disable mipsfpu > disable mipsdsp > disable mipsdspr2 >+# When gcc version less than 5.3.0, add >-fno-expensive-optimizations flag. >+if [ $cc == gcc ]; then >+gcc_version=$(gcc -dumpversion) >+if [ "$(echo "$gcc_version 5.3.0" | tr " " "\n" | sort >-rV | head -n 1)" >=="$gcc_version" ]; then >+expensive_optimization_flag="" >+else >+ >expensive_optimization_flag="-fno-expensive-optimizations" >+fi >+fi > case $cpu in > loongson3*) >-cpuflags="-march=loongson3a -mhard-float >-fno-expensive-optimizations" >+cpuflags="-march=loongson3a -mhard-float >$expensive_optimization_flag" > ;; > loongson2e) >-cpuflags="-march=loongson2e -mhard-float >-fno-expensive-optimizations" >+cpuflags="-march=loongson2e -mhard-float >$expensive_optimization_flag" > ;; > loongson2f) >-cpuflags="-march=loongson2f -mhard-float >-fno-expensive-optimizations" >+cpuflags="-march=loongson2f -mhard-float >$expensive_optimization_flag" > ;; > esac > ;; >-- >2.1.0 Is there any other comment for this patch? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavc/qsvenc: dump BufferSizeInKB message
Signed-off-by: Zhong Li --- libavcodec/qsvenc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index c2c2911..611449c 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -160,8 +160,8 @@ static void dump_video_param(AVCodecContext *avctx, QSVEncContext *q, #endif ) { av_log(avctx, AV_LOG_VERBOSE, - "InitialDelayInKB: %"PRIu16"; TargetKbps: %"PRIu16"; MaxKbps: %"PRIu16"\n", - info->InitialDelayInKB, info->TargetKbps, info->MaxKbps); + "BufferSizeInKB: %"PRIu16"; InitialDelayInKB: %"PRIu16"; TargetKbps: %"PRIu16"; MaxKbps: %"PRIu16"\n", + info->BufferSizeInKB, info->InitialDelayInKB, info->TargetKbps, info->MaxKbps); } else if (info->RateControlMethod == MFX_RATECONTROL_CQP) { av_log(avctx, AV_LOG_VERBOSE, "QPI: %"PRIu16"; QPP: %"PRIu16"; QPB: %"PRIu16"\n", info->QPI, info->QPP, info->QPB); -- 2.7.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/3] configure: speedup x2-x8
On 8/25/2018 6:15 PM, Michael Niedermayer wrote: > On Sat, Aug 25, 2018 at 06:11:10PM +, avih wrote: >> For overview see: >> http://ffmpeg.org/pipermail/ffmpeg-devel/2018-August/233665.html >> >> Attached is patch 3/3 which was at "main.patch" of that message. >> >> After the previous speedups, configure spent 20-60% of its runtime >> at check_deps(). It's particularly slow with bash. After some local >> optimizations - mainly avoid pushvar/popvar and abort early in one >> notable case (empty deps), it's now x4-x25 faster. >> > > patches 1-3 work here fine on linux x86-64 / 32, arm, mips, wine+mingw32/64 Just pushed them. Thanks a lot Avi for this! Configure slowness has been pretty discouraging for devs for some time now. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/3] configure: speedup x2-x8
Thanks. I was similarly frustrated with the long runtime of configure, hence I decided to try and do something about it. Luckily, it it was only about 50 LOC which were responsible for it. It could have been much more daunting if the slowness was all over the place. Finding those 50 lines was another matter though. I had to build a nice magnet (time.sh) to find the needles in this haystack ;) Glad others like it too. Avi On Monday, August 27, 2018 5:49 PM, James Almer wrote: On 8/25/2018 6:15 PM, Michael Niedermayer wrote: > On Sat, Aug 25, 2018 at 06:11:10PM +, avih wrote: >> For overview see: >> http://ffmpeg.org/pipermail/ffmpeg-devel/2018-August/233665.html >> >> Attached is patch 3/3 which was at "main.patch" of that message. >> >> After the previous speedups, configure spent 20-60% of its runtime >> at check_deps(). It's particularly slow with bash. After some local >> optimizations - mainly avoid pushvar/popvar and abort early in one >> notable case (empty deps), it's now x4-x25 faster. >> > > patches 1-3 work here fine on linux x86-64 / 32, arm, mips, wine+mingw32/64 Just pushed them. Thanks a lot Avi for this! Configure slowness has been pretty discouraging for devs for some time now. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] decklink: Add support for output of Active Format Description (AFD)
On Wed, Aug 22, 2018 at 9:53 PM, Devin Heitmueller < dheitmuel...@ltnglobal.com> wrote: > Implement support for including AFD in decklink output. This > includes making sure the AFD data is preserved when going from > an AVFrame to a V210 packet (needed for 10-bit support). > > Updated to reflect feedback from Marton Balint , > Carl Eugen Hoyos and Aaron Levinson > . > > Signed-off-by: Devin Heitmueller > --- > libavcodec/avcodec.h | 6 + > libavcodec/v210enc.c | 8 +++ > libavdevice/decklink_enc.cpp | 54 ++ > -- > 3 files changed, 66 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h > index 31e50d5a94..192e15746d 100644 > --- a/libavcodec/avcodec.h > +++ b/libavcodec/avcodec.h > @@ -1362,6 +1362,12 @@ enum AVPacketSideDataType { > AV_PKT_DATA_ENCRYPTION_INFO, > > /** > + * Active Format Description data consisting of a single byte as > specified > + * in ETSI TS 101 154 using AVActiveFormatDescription enum. > + */ > +AV_PKT_DATA_AFD, > + > +/** > * The number of side data types. > * This is not part of the public API/ABI in the sense that it may > * change when new side data types are added. > I think you should add an entry in ff_decode_frame_props() so that pkt side data can propagate to frame side data -- Vittorio ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] decklink: Add support for output of Active Format Description (AFD)
Hello Vittorio, Thanks for the feedback. > > I think you should add an entry in ff_decode_frame_props() so that pkt side > data can propagate to frame side data > -- > Vittorio I’ve got a whole patch series related to capture of AFD from decklink and getting it through the pipeline (to be encoded by libx264), which includes a patch which makes the entry you have suggested. I’ve got about 40 ffmpeg related patches I am trying to get merged upstream (many dealing with side data on both the capture and output side), so for the moment I’m focused on getting the first few output related patches merged. In some cases it’s been more energy carving up the patch series in different ways to get it merged than the actual engineering required to do the work in the first place. Thanks, Devin ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] decklink: Add support for output of Active Format Description (AFD)
> On Aug 26, 2018, at 11:34 AM, Marton Balint wrote: > > Hello Marton, Ok, I’ll take another pass and send an updated patch. Devin --- Devin Heitmueller - LTN Global Communications dheitmuel...@ltnglobal.com ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter/vf_interlace: fix numerical options
Am Fr., 24. Aug. 2018 um 15:05 Uhr schrieb Paul B Mahol : > On 8/23/18, Thomas Mundt wrote: > > Currently numerical option values are misinterpreted in vf_interlace > > filter. > > Patch attached. > > > > Regards, > > Thomas > > > > ok > Thanks. Can you please push it? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter/vf_interlace: fix numerical options
On 8/27/18, Thomas Mundt wrote: > Am Fr., 24. Aug. 2018 um 15:05 Uhr schrieb Paul B Mahol : > >> On 8/23/18, Thomas Mundt wrote: >> > Currently numerical option values are misinterpreted in vf_interlace >> > filter. >> > Patch attached. >> > >> > Regards, >> > Thomas >> > >> >> ok >> > > Thanks. Can you please push it? Does this breaks tinterlace numerical options? Anyway numerical options are not supported, and is free to change. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavf/movenc: Fail when codec tag is invalid for format
On Sat, Aug 25, 2018 at 09:04:44AM -0700, John Stebbins wrote: > Fixes ticket #6897 > --- > libavformat/movenc.c | 40 +--- > 1 file changed, 29 insertions(+), 11 deletions(-) breaks make -j12 fate-mov-gpmf-remux [mp4 @ 0x26a5b40] Could not find tag for codec none in stream #1, codec not currently supported in container Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy) Last message repeated 1 times make: *** [fate-mov-gpmf-remux] Error 1 [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB During times of universal deceit, telling the truth becomes a revolutionary act. -- George Orwell signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/3] lavc/vaapi_encode_h264: respect "slices" option in h264 vaapi encoder
On 21/08/18 01:51, myp...@gmail.com wrote: > On Tue, Aug 21, 2018 at 8:05 AM Mark Thompson wrote: >> >> On 30/07/18 12:42, Jun Zhao wrote: >>> Enable multi-slice support in AVC/H.264 vaapi encoder. >>> >>> Signed-off-by: Wang, Yi A >>> Signed-off-by: Jun Zhao >>> --- >>> libavcodec/vaapi_encode_h264.c | 31 +-- >>> 1 files changed, 25 insertions(+), 6 deletions(-) >>> >>> diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c >>> index 905c507..70c89e8 100644 >>> --- a/libavcodec/vaapi_encode_h264.c >>> +++ b/libavcodec/vaapi_encode_h264.c >>> @@ -581,6 +581,7 @@ static int >>> vaapi_encode_h264_init_picture_params(AVCodecContext *avctx, >>> H264RawSPS *sps = &priv->sps; >>> VAEncPictureParameterBufferH264 *vpic = pic->codec_picture_params; >>> int i; >>> +int slices; >>> >>> memset(&priv->current_access_unit, 0, >>> sizeof(priv->current_access_unit)); >>> @@ -690,7 +691,17 @@ static int >>> vaapi_encode_h264_init_picture_params(AVCodecContext *avctx, >>> vpic->pic_fields.bits.idr_pic_flag = (pic->type == >>> PICTURE_TYPE_IDR); >>> vpic->pic_fields.bits.reference_pic_flag = (pic->type != >>> PICTURE_TYPE_B); >>> >>> -pic->nb_slices = 1; >>> +slices = 1; >>> +if (ctx->max_slices) { >>> +if (avctx->slices <= FFMIN(ctx->max_slices, priv->mb_height)) { >>> +slices = FFMAX(avctx->slices, slices); >>> +} else { >>> +av_log(avctx, AV_LOG_ERROR, "The max slices number per frame " >>> + "cannot be more than %d.\n", FFMIN(ctx->max_slices, >>> priv->mb_height)); >>> +return AVERROR_INVALIDDATA; >> >> AVERROR(EINVAL) for invalid user parameters. > Will follow the comment. >> >>> +} >>> +} >>> +pic->nb_slices = slices; >>> >>> return 0; >>> } >>> @@ -716,8 +727,7 @@ static int >>> vaapi_encode_h264_init_slice_params(AVCodecContext *avctx, >>> sh->nal_unit_header.nal_ref_idc = pic->type != PICTURE_TYPE_B; >>> } >>> >>> -// Only one slice per frame. >>> -sh->first_mb_in_slice = 0; >>> +sh->first_mb_in_slice = !!slice->index; The problem is here. This is not what first_mb_in_slice means - it should be set to the same value as macroblock_address. >>> sh->slice_type= priv->slice_type; >>> >>> sh->pic_parameter_set_id = pps->pic_parameter_set_id; >>> @@ -738,14 +748,19 @@ static int >>> vaapi_encode_h264_init_slice_params(AVCodecContext *avctx, >>> sh->slice_qp_delta = priv->fixed_qp_idr - >>> (pps->pic_init_qp_minus26 + 26); >>> >>> >>> -vslice->macroblock_address = sh->first_mb_in_slice; >>> -vslice->num_macroblocks= priv->mb_width * priv->mb_height; >>> +vslice->macroblock_address = slice->index * priv->mb_width * >>> (priv->mb_height / pic->nb_slices); >>> +if (slice->index == pic->nb_slices - 1) { >>> +vslice->num_macroblocks = priv->mb_width * priv->mb_height >>> + - slice->index * priv->mb_width * >>> (priv->mb_height / pic->nb_slices); >>> +priv->idr_pic_count++; >>> +} else >>> +vslice->num_macroblocks = priv->mb_width * (priv->mb_height / >>> pic->nb_slices); >> >> This dumps all of the rounding error in the last slice. E.g. 1080p with 8 >> slices gives you 68 macroblocks high, so you get seven slices with 68/8 = 8 >> macroblock height and the last one has 12 macroblock height. >> >> It should be balanced so that all slices are roughly the same size (8-slice >> 1080p -> four slices of 9 + four slices of 8). It might make sense to put >> the residual rounding error away from the middle of the frame too (so 9, 9, >> 8, 8, 8, 8, 9, 9), though that's probably second-order. > I agree with the comment, as my point, how about change the slice number as : > > 68 / 8 = 8 .. 4, and we give (9, 9, 9, 9, 8, 8, 8, 8) in this case? Is it the size constraint mentioned below which is causing you to make that choice? Intuitively I would place the larger slices at the top and bottom of the frame, hence (9, 9, 8, 8, 8, 8, 9, 9). >> >>> >>> vslice->macroblock_info = VA_INVALID_ID; >>> >>> vslice->slice_type = sh->slice_type % 5; >>> vslice->pic_parameter_set_id = sh->pic_parameter_set_id; >>> -vslice->idr_pic_id = sh->idr_pic_id; >>> +vslice->idr_pic_id = priv->idr_pic_count; >>> >>> vslice->pic_order_cnt_lsb = sh->pic_order_cnt_lsb; >>> >>> @@ -855,6 +870,10 @@ static av_cold int >>> vaapi_encode_h264_configure(AVCodecContext *avctx) >>> } >>> }< >> >>> +if (!ctx->max_slices && avctx->slices > 0) >>> +av_log(avctx, AV_LOG_WARNING, "The encode slice option is not " >>> + "supported with the driver.\n"); >> >> Maybe this should fail in the same way as the above case where you ask for >> too many slices? If the user requests them it is probably
Re: [FFmpeg-devel] [PATCH V2] examples/vaapi_dec_scaling: add a vaapi decoding/scaling sample
On 23/08/18 14:08, Jun Zhao wrote: > add a vaapi decoding/scaling sample. > > Signed-off-by: Jun Zhao > --- > configure|2 + > doc/examples/Makefile|1 + > doc/examples/vaapi_dec_scaling.c | 377 > ++ > 3 files changed, 380 insertions(+), 0 deletions(-) > create mode 100644 doc/examples/vaapi_dec_scaling.c Looking at this, it seems like it copies a lot of code from hw_decode.c and filtering_video.c and combines it in a reasonably straightforward (?) way, but doesn't really any anything on top of that. I'm not convinced that adding an extra example like this for a specific combination of things already covered is necessarily helpful, though I could certainly be convinced if you have some reason for it. So, would you care to argue for why this example in particular is useful? Thanks, - Mark ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] avcodec: add MatchWare Screen Capture Codec
On Sat, 25 Aug 2018 at 21:04, Paul B Mahol wrote: > Signed-off-by: Paul B Mahol > --- > configure | 1 + > libavcodec/Makefile | 1 + > libavcodec/allcodecs.c | 1 + > libavcodec/avcodec.h| 1 + > libavcodec/codec_desc.c | 7 ++ > libavcodec/mwsc.c | 192 > libavformat/riff.c | 1 + > 7 files changed, 204 insertions(+) > create mode 100644 libavcodec/mwsc.c > > diff --git a/configure b/configure > index b9c9d0b307..0c1f6a79a7 100755 > --- a/configure > +++ b/configure > @@ -2679,6 +2679,7 @@ msmpeg4v3_decoder_select="h263_decoder" > msmpeg4v3_encoder_select="h263_encoder" > mss2_decoder_select="mpegvideo qpeldsp vc1_decoder" > mts2_decoder_select="mss34dsp" > +mwsc_decoder_deps="zlib" > mxpeg_decoder_select="mjpeg_decoder" > nellymoser_decoder_select="mdct sinewin" > nellymoser_encoder_select="audio_frame_queue mdct sinewin" > diff --git a/libavcodec/Makefile b/libavcodec/Makefile > index 9a309c348e..aee4f5431a 100644 > --- a/libavcodec/Makefile > +++ b/libavcodec/Makefile > @@ -482,6 +482,7 @@ OBJS-$(CONFIG_MSZH_DECODER)+= lcldec.o > OBJS-$(CONFIG_MTS2_DECODER)+= mss4.o > OBJS-$(CONFIG_MVC1_DECODER)+= mvcdec.o > OBJS-$(CONFIG_MVC2_DECODER)+= mvcdec.o > +OBJS-$(CONFIG_MWSC_DECODER)+= mwsc.o > OBJS-$(CONFIG_MXPEG_DECODER) += mxpegdec.o > OBJS-$(CONFIG_NELLYMOSER_DECODER) += nellymoserdec.o nellymoser.o > OBJS-$(CONFIG_NELLYMOSER_ENCODER) += nellymoserenc.o nellymoser.o > diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c > index b1d1ef26c0..d41868c591 100644 > --- a/libavcodec/allcodecs.c > +++ b/libavcodec/allcodecs.c > @@ -212,6 +212,7 @@ extern AVCodec ff_mszh_decoder; > extern AVCodec ff_mts2_decoder; > extern AVCodec ff_mvc1_decoder; > extern AVCodec ff_mvc2_decoder; > +extern AVCodec ff_mwsc_decoder; > extern AVCodec ff_mxpeg_decoder; > extern AVCodec ff_nuv_decoder; > extern AVCodec ff_paf_video_decoder; > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h > index 86a658a233..be41b8cf0e 100644 > --- a/libavcodec/avcodec.h > +++ b/libavcodec/avcodec.h > @@ -449,6 +449,7 @@ enum AVCodecID { > AV_CODEC_ID_FITS, > AV_CODEC_ID_IMM4, > AV_CODEC_ID_PROSUMER, > +AV_CODEC_ID_MWSC, > > /* various PCM "codecs" */ > AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at > the start of audio codecs > diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c > index e611183599..129d0f1aac 100644 > --- a/libavcodec/codec_desc.c > +++ b/libavcodec/codec_desc.c > @@ -1668,6 +1668,13 @@ static const AVCodecDescriptor codec_descriptors[] > = { > .long_name = NULL_IF_CONFIG_SMALL("Brooktree ProSumer Video"), > .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, > }, > +{ > +.id= AV_CODEC_ID_MWSC, > +.type = AVMEDIA_TYPE_VIDEO, > +.name = "mwsc", > +.long_name = NULL_IF_CONFIG_SMALL("MatchWare Screen Capture > Codec"), > +.props = AV_CODEC_PROP_LOSSLESS, > +}, > > /* various PCM "codecs" */ > { > diff --git a/libavcodec/mwsc.c b/libavcodec/mwsc.c > new file mode 100644 > index 00..c1a5aca3c0 > --- /dev/null > +++ b/libavcodec/mwsc.c > @@ -0,0 +1,192 @@ > +/* > + * MatchWare Screen Capture Codec decoder > + * > + * Copyright (c) 2018 Paul B Mahol > + * > + * 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 > +#include > +#include > + > +#include "avcodec.h" > +#include "bytestream.h" > +#include "internal.h" > + > +#include > + > +typedef struct MWSCContext { > +unsigned int decomp_size; > +uint8_t *decomp_buf; > +z_stream zstream; > +AVFrame *prev_frame; > +} MWSCContext; > + > +static int rle_uncompress(GetByteContext *gb, PutByteContext *pb, > GetByteContext *gbp, > + int width, int height, int stride, int > pb_linesize, int gbp_linesize) > +{ > +int intra = 1, w = 0; > + > +bytestream2_seek_p(pb, (height - 1) * pb_linesize, SEEK_SET); > + > +while (bytestream2_get_bytes_left(gb) > 0) { > +uint32_t fill
Re: [FFmpeg-devel] [PATCH v3 00/41] VAAPI encode and related stuff
On 23/08/18 00:44, Mark Thompson wrote: > I think patches 1-8 are uncontentious, I'll push them in a few days if there > are no objections. Applied these. Thanks, - Mark ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] avcodec: add WinCAM Motion Video decoder
On Sat, 25 Aug 2018 at 21:12, Paul B Mahol wrote: > Signed-off-by: Paul B Mahol > --- > configure | 1 + > libavcodec/Makefile | 1 + > libavcodec/allcodecs.c | 1 + > libavcodec/avcodec.h| 1 + > libavcodec/codec_desc.c | 7 ++ > libavcodec/wcmv.c | 247 > libavformat/riff.c | 1 + > 7 files changed, 259 insertions(+) > create mode 100644 libavcodec/wcmv.c > > diff --git a/configure b/configure > index 0c1f6a79a7..469797935e 100755 > --- a/configure > +++ b/configure > @@ -2750,6 +2750,7 @@ vp6f_decoder_select="vp6_decoder" > vp7_decoder_select="h264pred videodsp vp8dsp" > vp8_decoder_select="h264pred videodsp vp8dsp" > vp9_decoder_select="videodsp vp9_parser vp9_superframe_split_bsf" > +wcmv_decoder_deps="zlib" > webp_decoder_select="vp8_decoder exif" > wmalossless_decoder_select="llauddsp" > wmapro_decoder_select="mdct sinewin wma_freqs" > diff --git a/libavcodec/Makefile b/libavcodec/Makefile > index aee4f5431a..f8673f0121 100644 > --- a/libavcodec/Makefile > +++ b/libavcodec/Makefile > @@ -677,6 +677,7 @@ OBJS-$(CONFIG_VP9_V4L2M2M_DECODER) += > v4l2_m2m_dec.o > OBJS-$(CONFIG_VQA_DECODER) += vqavideo.o > OBJS-$(CONFIG_WAVPACK_DECODER) += wavpack.o > OBJS-$(CONFIG_WAVPACK_ENCODER) += wavpackenc.o > +OBJS-$(CONFIG_WCMV_DECODER)+= wcmv.o > OBJS-$(CONFIG_WEBP_DECODER)+= webp.o > OBJS-$(CONFIG_WEBVTT_DECODER) += webvttdec.o ass.o > OBJS-$(CONFIG_WEBVTT_ENCODER) += webvttenc.o ass_split.o > diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c > index d41868c591..42d98f9b0a 100644 > --- a/libavcodec/allcodecs.c > +++ b/libavcodec/allcodecs.c > @@ -338,6 +338,7 @@ extern AVCodec ff_vp9_v4l2m2m_decoder; > extern AVCodec ff_vqa_decoder; > extern AVCodec ff_bitpacked_decoder; > extern AVCodec ff_webp_decoder; > +extern AVCodec ff_wcmv_decoder; > extern AVCodec ff_wrapped_avframe_encoder; > extern AVCodec ff_wrapped_avframe_decoder; > extern AVCodec ff_wmv1_encoder; > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h > index be41b8cf0e..b6688b7af3 100644 > --- a/libavcodec/avcodec.h > +++ b/libavcodec/avcodec.h > @@ -450,6 +450,7 @@ enum AVCodecID { > AV_CODEC_ID_IMM4, > AV_CODEC_ID_PROSUMER, > AV_CODEC_ID_MWSC, > +AV_CODEC_ID_WCMV, > > /* various PCM "codecs" */ > AV_CODEC_ID_FIRST_AUDIO = 0x1, ///< A dummy id pointing at > the start of audio codecs > diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c > index 129d0f1aac..46dfe3f5e5 100644 > --- a/libavcodec/codec_desc.c > +++ b/libavcodec/codec_desc.c > @@ -1675,6 +1675,13 @@ static const AVCodecDescriptor codec_descriptors[] > = { > .long_name = NULL_IF_CONFIG_SMALL("MatchWare Screen Capture > Codec"), > .props = AV_CODEC_PROP_LOSSLESS, > }, > +{ > +.id= AV_CODEC_ID_WCMV, > +.type = AVMEDIA_TYPE_VIDEO, > +.name = "wcmv", > +.long_name = NULL_IF_CONFIG_SMALL("WinCAM Motion Video"), > +.props = AV_CODEC_PROP_LOSSLESS, > +}, > > /* various PCM "codecs" */ > { > diff --git a/libavcodec/wcmv.c b/libavcodec/wcmv.c > new file mode 100644 > index 00..74cb1166bb > --- /dev/null > +++ b/libavcodec/wcmv.c > @@ -0,0 +1,247 @@ > +/* > + * WinCAM Motion Video decoder > + * > + * Copyright (c) 2018 Paul B Mahol > + * > + * 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 > +#include > +#include > + > +#include "avcodec.h" > +#include "bytestream.h" > +#include "internal.h" > + > +#include > + > +typedef struct WCMVContext { > +z_streamzstream; > +AVFrame*prev_frame; > +uint8_t block_data[65536*8]; > +} WCMVContext; > + > +static int decode_frame(AVCodecContext *avctx, > +void *data, int *got_frame, > +AVPacket *avpkt) > +{ > +WCMVContext *s = avctx->priv_data; > +AVFrame *frame = data; > +int skip, blocks, zret, ret, intra = 0; > +GetByteContext gb; > +uint8_t *dst; > + > +ret = inflateReset(&s->zstream); > +if (ret != Z_OK) { > +av_log(avctx, AV_LOG_ERRO
Re: [FFmpeg-devel] [PATCH 1/2] avcodec: add MatchWare Screen Capture Codec
On Mon, 27 Aug 2018 at 19:20, Rostislav Pehlivanov wrote: > > > On Sat, 25 Aug 2018 at 21:04, Paul B Mahol wrote: > >> Signed-off-by: Paul B Mahol >> --- >> configure | 1 + >> libavcodec/Makefile | 1 + >> libavcodec/allcodecs.c | 1 + >> libavcodec/avcodec.h| 1 + >> libavcodec/codec_desc.c | 7 ++ >> libavcodec/mwsc.c | 192 >> libavformat/riff.c | 1 + >> 7 files changed, 204 insertions(+) >> create mode 100644 libavcodec/mwsc.c >> >> +static int decode_frame(AVCodecContext *avctx, >> +void *data, int *got_frame, >> +AVPacket *avpkt) >> +{ >> +MWSCContext *s = avctx->priv_data; >> +AVFrame *frame = data; >> +uint8_t *buf = avpkt->data; >> +int buf_size = avpkt->size; >> +GetByteContext gb; >> +GetByteContext gbp; >> +PutByteContext pb; >> +int ret; >> > > Can you check that avpkt->size isn't larger than the deflate buffer you've > allocated? > If zlib checks that the buffer size is smaller than what it has to unpack don't, same as the wincam decoder. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] ffmpeg: correct units for raw pts in -progress report
On 26-08-2018 11:53 AM, Gyan Doshi wrote: On 09-08-2018 10:09 AM, Gyan Doshi wrote: On 08-08-2018 12:47 AM, Nicolas George wrote: Gyan Doshi (2018-08-08): That will just defer the breaking change. That will leave people time to notice the change and allow old and new scripts to work during the transition. Will do it this way. Revised patch attached. Plan to push in the morning. Gyan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter/vf_interlace: fix numerical options
Am Mo., 27. Aug. 2018 um 19:40 Uhr schrieb Paul B Mahol : > On 8/27/18, Thomas Mundt wrote: > > Am Fr., 24. Aug. 2018 um 15:05 Uhr schrieb Paul B Mahol < > one...@gmail.com>: > > > >> On 8/23/18, Thomas Mundt wrote: > >> > Currently numerical option values are misinterpreted in vf_interlace > >> > filter. > >> > Patch attached. > >> > > >> > Regards, > >> > Thomas > >> > > >> > >> ok > >> > > > > Thanks. Can you please push it? > > Does this breaks tinterlace numerical options? > > Anyway numerical options are not supported, and is free to change. > Indeed the numerical usage of the tinterlace option "flags" is changed. But, as you say, numerical usage is not supported or even documented in this case. The "mode" option is unchanged and can be used numerical as documented. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavf/movenc: Fail when codec tag is invalid for format
On 08/27/2018 10:59 AM, Michael Niedermayer wrote: > On Sat, Aug 25, 2018 at 09:04:44AM -0700, John Stebbins wrote: >> Fixes ticket #6897 >> --- >> libavformat/movenc.c | 40 +--- >> 1 file changed, 29 insertions(+), 11 deletions(-) > breaks make -j12 fate-mov-gpmf-remux > [mp4 @ 0x26a5b40] Could not find tag for codec none in stream #1, codec not > currently supported in container > Could not write header for output file #0 (incorrect codec parameters ?): > Invalid argument > Stream mapping: > Stream #0:0 -> #0:0 (copy) > Stream #0:1 -> #0:1 (copy) > Last message repeated 1 times > make: *** [fate-mov-gpmf-remux] Error 1 > > Yeah, I ran a fate test this morning and saw the same thing. Sorry I didn't run it first, I should know better... Preparing a fix as we speak. -- John GnuPG fingerprint: D0EC B3DB C372 D1F1 0B01 83F0 49F1 D7B2 60D4 D0F7 signature.asc Description: OpenPGP digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/3] configure: speedup x2-x8
On Mon, Aug 27, 2018 at 11:41:26AM -0300, James Almer wrote: > On 8/25/2018 6:15 PM, Michael Niedermayer wrote: > > On Sat, Aug 25, 2018 at 06:11:10PM +, avih wrote: > >> For overview see: > >> http://ffmpeg.org/pipermail/ffmpeg-devel/2018-August/233665.html > >> > >> Attached is patch 3/3 which was at "main.patch" of that message. > >> > >> After the previous speedups, configure spent 20-60% of its runtime > >> at check_deps(). It's particularly slow with bash. After some local > >> optimizations - mainly avoid pushvar/popvar and abort early in one > >> notable case (empty deps), it's now x4-x25 faster. > >> > > > > patches 1-3 work here fine on linux x86-64 / 32, arm, mips, wine+mingw32/64 > > Just pushed them. thanks! [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you fake or manipulate statistics in a paper in physics you will never get a job again. If you fake or manipulate statistics in a paper in medicin you will get a job for life at the pharma industry. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/4] lavf/movenc: Add GoPro metadata to permitted mp4 "codecs"
--- libavformat/movenc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 72a6e12d52..8a3b651514 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -6778,6 +6778,7 @@ const AVCodecTag codec_mp4_tags[] = { { AV_CODEC_ID_EVRC, MKTAG('m', 'p', '4', 'a') }, { AV_CODEC_ID_DVD_SUBTITLE, MKTAG('m', 'p', '4', 's') }, { AV_CODEC_ID_MOV_TEXT, MKTAG('t', 'x', '3', 'g') }, +{ AV_CODEC_ID_BIN_DATA, MKTAG('g', 'p', 'm', 'd') }, { AV_CODEC_ID_NONE,0 }, }; -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/4] lavf/mov: add AVCodecTag entry for GoPro metadata
This allows for validation of the track type --- libavformat/isom.c | 5 + libavformat/isom.h | 1 + libavformat/mov.c | 3 +++ 3 files changed, 9 insertions(+) diff --git a/libavformat/isom.c b/libavformat/isom.c index ce66d1bcd4..ca9d22e4f7 100644 --- a/libavformat/isom.c +++ b/libavformat/isom.c @@ -374,6 +374,11 @@ const AVCodecTag ff_codec_movsubtitle_tags[] = { { AV_CODEC_ID_NONE, 0 }, }; +const AVCodecTag ff_codec_movdata_tags[] = { +{ AV_CODEC_ID_BIN_DATA, MKTAG('g', 'p', 'm', 'd') }, +{ AV_CODEC_ID_NONE, 0 }, +}; + /* map numeric codes from mdhd atom to ISO 639 */ /* cf. QTFileFormat.pdf p253, qtff.pdf p205 */ /* http://developer.apple.com/documentation/mac/Text/Text-368.html */ diff --git a/libavformat/isom.h b/libavformat/isom.h index 51abea52de..f3a7a8633d 100644 --- a/libavformat/isom.h +++ b/libavformat/isom.h @@ -41,6 +41,7 @@ extern const AVCodecTag ff_mp4_obj_type[]; extern const AVCodecTag ff_codec_movvideo_tags[]; extern const AVCodecTag ff_codec_movaudio_tags[]; extern const AVCodecTag ff_codec_movsubtitle_tags[]; +extern const AVCodecTag ff_codec_movdata_tags[]; int ff_mov_iso639_to_lang(const char lang[4], int mp4); int ff_mov_lang_to_iso639(unsigned code, char to[4]); diff --git a/libavformat/mov.c b/libavformat/mov.c index d66f4e338c..8915e3b9e0 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2034,6 +2034,8 @@ static int mov_codec_id(AVStream *st, uint32_t format) id = ff_codec_get_id(ff_codec_movsubtitle_tags, format); if (id > 0) st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE; +else +id = ff_codec_get_id(ff_codec_movdata_tags, format); } } @@ -2507,6 +2509,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) mov_parse_stsd_subtitle(c, pb, st, sc, size - (avio_tell(pb) - start_pos)); } else { +st->codecpar->codec_id = id; ret = mov_parse_stsd_data(c, pb, st, sc, size - (avio_tell(pb) - start_pos)); if (ret < 0) -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/4] lavf/movenc: Fail when codec tag is invalid for format
Fixes ticket #6897 --- libavformat/movenc.c | 40 +--- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 8a3b651514..dd6281d210 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1589,6 +1589,26 @@ static const AVCodecTag codec_cover_image_tags[] = { { AV_CODEC_ID_NONE, 0 }, }; +static int validate_codec_tag(const AVCodecTag *const *tags, + unsigned int tag, int codec_id) +{ +int i; + +/** + * Check that tag + id is in the table + */ +for (i = 0; tags && tags[i]; i++) { +const AVCodecTag *codec_tags = tags[i]; +while (codec_tags->id != AV_CODEC_ID_NONE) { +if (codec_tags->tag == tag && codec_tags->id == codec_id) { +return 1; +} +codec_tags++; +} +} +return 0; +} + static int mov_find_codec_tag(AVFormatContext *s, MOVTrack *track) { int tag; @@ -1596,23 +1616,21 @@ static int mov_find_codec_tag(AVFormatContext *s, MOVTrack *track) if (is_cover_image(track->st)) return ff_codec_get_tag(codec_cover_image_tags, track->par->codec_id); -if (track->mode == MODE_MP4 || track->mode == MODE_PSP) -tag = track->par->codec_tag; -else if (track->mode == MODE_ISM) -tag = track->par->codec_tag; -else if (track->mode == MODE_IPOD) { +if (track->mode == MODE_IPOD) if (!av_match_ext(s->url, "m4a") && !av_match_ext(s->url, "m4v") && !av_match_ext(s->url, "m4b")) av_log(s, AV_LOG_WARNING, "Warning, extension is not .m4a nor .m4v " "Quicktime/Ipod might not play the file\n"); -tag = track->par->codec_tag; -} else if (track->mode & MODE_3GP) -tag = track->par->codec_tag; -else if (track->mode == MODE_F4V) -tag = track->par->codec_tag; -else + +if (track->mode == MODE_MOV) tag = mov_get_codec_tag(s, track); +else +if (!validate_codec_tag(s->oformat->codec_tag, track->par->codec_tag, +track->par->codec_id)) +tag = 0; +else +tag = track->par->codec_tag; return tag; } -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] ffmpeg: correct units for raw pts in -progress report
On Sun, Aug 26, 2018 at 11:53:16AM +0530, Gyan Doshi wrote: > On 09-08-2018 10:09 AM, Gyan Doshi wrote: > > > > > >On 08-08-2018 12:47 AM, Nicolas George wrote: > >>Gyan Doshi (2018-08-08): > >>>That will just defer the breaking change. > >> > >>That will leave people time to notice the change and allow old and new > >>scripts to work during the transition. > > > >Will do it this way. > > Revised patch attached. > > Gyan > ffmpeg.c |2 ++ > 1 file changed, 2 insertions(+) > cfd96a95728f4dd9c873985b872be949b0495aea > 0001-ffmpeg-add-correct-field-for-raw-pts-in-progress-rep.patch > From 397591ae236cd19f2c50772ea8f7288b80705c89 Mon Sep 17 00:00:00 2001 > From: Gyan Doshi > Date: Sun, 5 Aug 2018 12:34:21 +0530 > Subject: [PATCH] ffmpeg: add correct field for raw pts in -progress report > > PTS is in microseconds, so correct field name is out_time_us. > > Old field out_time_ms kept for now - will be removed after a suitable > transition > period. > > Fixes #7345 > --- > fftools/ffmpeg.c | 2 ++ > 1 file changed, 2 insertions(+) LGTM thanks PS: these fields seem not documented anywhere, neither the new nor the old or iam looking at the wrong places [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB You can kill me, but you cannot change the truth. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavf/mov: Fix PCM audio w/ bit depth > 16
This type of audio is defined by the QT spec, but can be found in non-QT branded files in the wild. Fixes ticket #7376 --- libavformat/mov.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/libavformat/mov.c b/libavformat/mov.c index 8915e3b9e0..3d4f6bcb21 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2100,6 +2100,18 @@ static void mov_parse_stsd_video(MOVContext *c, AVIOContext *pb, } } +static int mov_pcm_gt16(enum AVCodecID codec_id) +{ +return codec_id == AV_CODEC_ID_PCM_S24LE || + codec_id == AV_CODEC_ID_PCM_S32LE || + codec_id == AV_CODEC_ID_PCM_F32LE || + codec_id == AV_CODEC_ID_PCM_F64LE || + codec_id == AV_CODEC_ID_PCM_S24BE || + codec_id == AV_CODEC_ID_PCM_S32BE || + codec_id == AV_CODEC_ID_PCM_F32BE || + codec_id == AV_CODEC_ID_PCM_F64BE; +} + static void mov_parse_stsd_audio(MOVContext *c, AVIOContext *pb, AVStream *st, MOVStreamContext *sc) { @@ -2120,8 +2132,10 @@ static void mov_parse_stsd_audio(MOVContext *c, AVIOContext *pb, st->codecpar->sample_rate = ((avio_rb32(pb) >> 16)); // Read QT version 1 fields. In version 0 these do not exist. +// PCM with bitdepth > 16 is only defined by QT version 1. av_log(c->fc, AV_LOG_TRACE, "version =%d, isom =%d\n", version, c->isom); if (!c->isom || +mov_pcm_gt16(st->codecpar->codec_id) || (compatible_brands && strstr(compatible_brands->value, "qt "))) { if (version == 1) { -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/4] lavf/movenc: Fail when codec tag is invalid for format
On 8/27/2018 4:57 PM, John Stebbins wrote: > Fixes ticket #6897 > --- > libavformat/movenc.c | 40 +--- > 1 file changed, 29 insertions(+), 11 deletions(-) > > diff --git a/libavformat/movenc.c b/libavformat/movenc.c > index 8a3b651514..dd6281d210 100644 > --- a/libavformat/movenc.c > +++ b/libavformat/movenc.c > @@ -1589,6 +1589,26 @@ static const AVCodecTag codec_cover_image_tags[] = { > { AV_CODEC_ID_NONE, 0 }, > }; > > +static int validate_codec_tag(const AVCodecTag *const *tags, > + unsigned int tag, int codec_id) > +{ > +int i; > + > +/** > + * Check that tag + id is in the table > + */ > +for (i = 0; tags && tags[i]; i++) { > +const AVCodecTag *codec_tags = tags[i]; > +while (codec_tags->id != AV_CODEC_ID_NONE) { > +if (codec_tags->tag == tag && codec_tags->id == codec_id) { Make both tag checks case insensitive using avpriv_toupper4(), then return codec_tags->tag instead of 1 if the check succeeds. > +return 1; > +} > +codec_tags++; > +} > +} > +return 0; > +} > + > static int mov_find_codec_tag(AVFormatContext *s, MOVTrack *track) > { > int tag; Take the opportunity to change this, the ones in mov_get_codec_tag() and in validate_codec_tag() to unsigned int, including the return types. Codec tags in AVCodecTag are unsigned after all. > @@ -1596,23 +1616,21 @@ static int mov_find_codec_tag(AVFormatContext *s, > MOVTrack *track) > if (is_cover_image(track->st)) > return ff_codec_get_tag(codec_cover_image_tags, > track->par->codec_id); > > -if (track->mode == MODE_MP4 || track->mode == MODE_PSP) > -tag = track->par->codec_tag; > -else if (track->mode == MODE_ISM) > -tag = track->par->codec_tag; > -else if (track->mode == MODE_IPOD) { > +if (track->mode == MODE_IPOD) > if (!av_match_ext(s->url, "m4a") && > !av_match_ext(s->url, "m4v") && > !av_match_ext(s->url, "m4b")) > av_log(s, AV_LOG_WARNING, "Warning, extension is not .m4a nor > .m4v " > "Quicktime/Ipod might not play the file\n"); > -tag = track->par->codec_tag; > -} else if (track->mode & MODE_3GP) > -tag = track->par->codec_tag; > -else if (track->mode == MODE_F4V) > -tag = track->par->codec_tag; > -else > + > +if (track->mode == MODE_MOV) > tag = mov_get_codec_tag(s, track); > +else > +if (!validate_codec_tag(s->oformat->codec_tag, track->par->codec_tag, > +track->par->codec_id)) > +tag = 0; > +else > +tag = track->par->codec_tag; And of course make this simply tag = validate_codec_tag(...); Thanks. > > return tag; > } > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/4] lavf/movenc: Fail when codec tag is invalid for format
On 08/27/2018 01:29 PM, James Almer wrote: > On 8/27/2018 4:57 PM, John Stebbins wrote: >> Fixes ticket #6897 >> --- >> libavformat/movenc.c | 40 +--- >> 1 file changed, 29 insertions(+), 11 deletions(-) >> >> diff --git a/libavformat/movenc.c b/libavformat/movenc.c >> index 8a3b651514..dd6281d210 100644 >> --- a/libavformat/movenc.c >> +++ b/libavformat/movenc.c >> @@ -1589,6 +1589,26 @@ static const AVCodecTag codec_cover_image_tags[] = { >> { AV_CODEC_ID_NONE, 0 }, >> }; >> >> +static int validate_codec_tag(const AVCodecTag *const *tags, >> + unsigned int tag, int codec_id) >> +{ >> +int i; >> + >> +/** >> + * Check that tag + id is in the table >> + */ >> +for (i = 0; tags && tags[i]; i++) { >> +const AVCodecTag *codec_tags = tags[i]; >> +while (codec_tags->id != AV_CODEC_ID_NONE) { >> +if (codec_tags->tag == tag && codec_tags->id == codec_id) { > Make both tag checks case insensitive using avpriv_toupper4(), then > return codec_tags->tag instead of 1 if the check succeeds. I've never seen mismatched case in these tags, but sure, why not... there's plenty I haven't seen. > >> +return 1; >> +} >> +codec_tags++; >> +} >> +} >> +return 0; >> +} >> + >> static int mov_find_codec_tag(AVFormatContext *s, MOVTrack *track) >> { >> int tag; > Take the opportunity to change this, the ones in mov_get_codec_tag() and > in validate_codec_tag() to unsigned int, including the return types. > Codec tags in AVCodecTag are unsigned after all. > >> @@ -1596,23 +1616,21 @@ static int mov_find_codec_tag(AVFormatContext *s, >> MOVTrack *track) >> if (is_cover_image(track->st)) >> return ff_codec_get_tag(codec_cover_image_tags, >> track->par->codec_id); >> >> -if (track->mode == MODE_MP4 || track->mode == MODE_PSP) >> -tag = track->par->codec_tag; >> -else if (track->mode == MODE_ISM) >> -tag = track->par->codec_tag; >> -else if (track->mode == MODE_IPOD) { >> +if (track->mode == MODE_IPOD) >> if (!av_match_ext(s->url, "m4a") && >> !av_match_ext(s->url, "m4v") && >> !av_match_ext(s->url, "m4b")) >> av_log(s, AV_LOG_WARNING, "Warning, extension is not .m4a nor >> .m4v " >> "Quicktime/Ipod might not play the file\n"); >> -tag = track->par->codec_tag; >> -} else if (track->mode & MODE_3GP) >> -tag = track->par->codec_tag; >> -else if (track->mode == MODE_F4V) >> -tag = track->par->codec_tag; >> -else >> + >> +if (track->mode == MODE_MOV) >> tag = mov_get_codec_tag(s, track); >> +else >> +if (!validate_codec_tag(s->oformat->codec_tag, >> track->par->codec_tag, >> +track->par->codec_id)) >> +tag = 0; >> +else >> +tag = track->par->codec_tag; > And of course make this simply > > tag = validate_codec_tag(...); > > Thanks. > >> >> return tag; >> } >> All good suggestions, thanks. -- John GnuPG fingerprint: D0EC B3DB C372 D1F1 0B01 83F0 49F1 D7B2 60D4 D0F7 signature.asc Description: OpenPGP digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/3] lavf/movenc: Fail when codec tag is invalid for format
Fixes ticket #6897 --- libavformat/movenc.c | 46 +--- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 8a3b651514..bce7ad0939 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1535,9 +1535,9 @@ static int mov_get_rawvideo_codec_tag(AVFormatContext *s, MOVTrack *track) return tag; } -static int mov_get_codec_tag(AVFormatContext *s, MOVTrack *track) +static unsigned int mov_get_codec_tag(AVFormatContext *s, MOVTrack *track) { -int tag = track->par->codec_tag; +unsigned int tag = track->par->codec_tag; if (!tag || (s->strict_std_compliance >= FF_COMPLIANCE_NORMAL && (track->par->codec_id == AV_CODEC_ID_DVVIDEO || @@ -1589,31 +1589,45 @@ static const AVCodecTag codec_cover_image_tags[] = { { AV_CODEC_ID_NONE, 0 }, }; -static int mov_find_codec_tag(AVFormatContext *s, MOVTrack *track) +static unsigned int validate_codec_tag(const AVCodecTag *const *tags, + unsigned int tag, int codec_id) { -int tag; +int i; + +/** + * Check that tag + id is in the table + */ +for (i = 0; tags && tags[i]; i++) { +const AVCodecTag *codec_tags = tags[i]; +while (codec_tags->id != AV_CODEC_ID_NONE) { +if (avpriv_toupper4(codec_tags->tag) == avpriv_toupper4(tag) && +codec_tags->id == codec_id) +return tag; +codec_tags++; +} +} +return 0; +} + +static unsigned int mov_find_codec_tag(AVFormatContext *s, MOVTrack *track) +{ +unsigned int tag; if (is_cover_image(track->st)) return ff_codec_get_tag(codec_cover_image_tags, track->par->codec_id); -if (track->mode == MODE_MP4 || track->mode == MODE_PSP) -tag = track->par->codec_tag; -else if (track->mode == MODE_ISM) -tag = track->par->codec_tag; -else if (track->mode == MODE_IPOD) { +if (track->mode == MODE_IPOD) if (!av_match_ext(s->url, "m4a") && !av_match_ext(s->url, "m4v") && !av_match_ext(s->url, "m4b")) av_log(s, AV_LOG_WARNING, "Warning, extension is not .m4a nor .m4v " "Quicktime/Ipod might not play the file\n"); -tag = track->par->codec_tag; -} else if (track->mode & MODE_3GP) -tag = track->par->codec_tag; -else if (track->mode == MODE_F4V) -tag = track->par->codec_tag; -else -tag = mov_get_codec_tag(s, track); +if (track->mode == MODE_MOV) +tag = mov_get_codec_tag(s, track); +else +tag = validate_codec_tag(s->oformat->codec_tag, track->par->codec_tag, + track->par->codec_id); return tag; } -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/4] lavf/movenc: Fail when codec tag is invalid for format
On 8/27/2018 5:48 PM, John Stebbins wrote: > On 08/27/2018 01:29 PM, James Almer wrote: >> On 8/27/2018 4:57 PM, John Stebbins wrote: >>> Fixes ticket #6897 >>> --- >>> libavformat/movenc.c | 40 +--- >>> 1 file changed, 29 insertions(+), 11 deletions(-) >>> >>> diff --git a/libavformat/movenc.c b/libavformat/movenc.c >>> index 8a3b651514..dd6281d210 100644 >>> --- a/libavformat/movenc.c >>> +++ b/libavformat/movenc.c >>> @@ -1589,6 +1589,26 @@ static const AVCodecTag codec_cover_image_tags[] = { >>> { AV_CODEC_ID_NONE, 0 }, >>> }; >>> >>> +static int validate_codec_tag(const AVCodecTag *const *tags, >>> + unsigned int tag, int codec_id) >>> +{ >>> +int i; >>> + >>> +/** >>> + * Check that tag + id is in the table >>> + */ >>> +for (i = 0; tags && tags[i]; i++) { >>> +const AVCodecTag *codec_tags = tags[i]; >>> +while (codec_tags->id != AV_CODEC_ID_NONE) { >>> +if (codec_tags->tag == tag && codec_tags->id == codec_id) { >> Make both tag checks case insensitive using avpriv_toupper4(), then >> return codec_tags->tag instead of 1 if the check succeeds. > > I've never seen mismatched case in these tags, but sure, why not... there's > plenty I haven't seen. AV1 in IVF is AV01, wheres in mp4 it's av01. That's the case i had in mind when requesting this. > >> >>> +return 1; >>> +} >>> +codec_tags++; >>> +} >>> +} >>> +return 0; >>> +} >>> + >>> static int mov_find_codec_tag(AVFormatContext *s, MOVTrack *track) >>> { >>> int tag; >> Take the opportunity to change this, the ones in mov_get_codec_tag() and >> in validate_codec_tag() to unsigned int, including the return types. >> Codec tags in AVCodecTag are unsigned after all. >> >>> @@ -1596,23 +1616,21 @@ static int mov_find_codec_tag(AVFormatContext *s, >>> MOVTrack *track) >>> if (is_cover_image(track->st)) >>> return ff_codec_get_tag(codec_cover_image_tags, >>> track->par->codec_id); >>> >>> -if (track->mode == MODE_MP4 || track->mode == MODE_PSP) >>> -tag = track->par->codec_tag; >>> -else if (track->mode == MODE_ISM) >>> -tag = track->par->codec_tag; >>> -else if (track->mode == MODE_IPOD) { >>> +if (track->mode == MODE_IPOD) >>> if (!av_match_ext(s->url, "m4a") && >>> !av_match_ext(s->url, "m4v") && >>> !av_match_ext(s->url, "m4b")) >>> av_log(s, AV_LOG_WARNING, "Warning, extension is not .m4a nor >>> .m4v " >>> "Quicktime/Ipod might not play the file\n"); >>> -tag = track->par->codec_tag; >>> -} else if (track->mode & MODE_3GP) >>> -tag = track->par->codec_tag; >>> -else if (track->mode == MODE_F4V) >>> -tag = track->par->codec_tag; >>> -else >>> + >>> +if (track->mode == MODE_MOV) >>> tag = mov_get_codec_tag(s, track); >>> +else >>> +if (!validate_codec_tag(s->oformat->codec_tag, >>> track->par->codec_tag, >>> +track->par->codec_id)) >>> +tag = 0; >>> +else >>> +tag = track->par->codec_tag; >> And of course make this simply >> >> tag = validate_codec_tag(...); >> >> Thanks. >> >>> >>> return tag; >>> } >>> > > > All good suggestions, thanks. > > > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/4] lavf/movenc: Fail when codec tag is invalid for format
On 08/27/2018 02:03 PM, James Almer wrote: > On 8/27/2018 5:48 PM, John Stebbins wrote: >> On 08/27/2018 01:29 PM, James Almer wrote: >>> On 8/27/2018 4:57 PM, John Stebbins wrote: Fixes ticket #6897 --- libavformat/movenc.c | 40 +--- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 8a3b651514..dd6281d210 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1589,6 +1589,26 @@ static const AVCodecTag codec_cover_image_tags[] = { { AV_CODEC_ID_NONE, 0 }, }; +static int validate_codec_tag(const AVCodecTag *const *tags, + unsigned int tag, int codec_id) +{ +int i; + +/** + * Check that tag + id is in the table + */ +for (i = 0; tags && tags[i]; i++) { +const AVCodecTag *codec_tags = tags[i]; +while (codec_tags->id != AV_CODEC_ID_NONE) { +if (codec_tags->tag == tag && codec_tags->id == codec_id) { >>> Make both tag checks case insensitive using avpriv_toupper4(), then >>> return codec_tags->tag instead of 1 if the check succeeds. >> I've never seen mismatched case in these tags, but sure, why not... there's >> plenty I haven't seen. > AV1 in IVF is AV01, wheres in mp4 it's av01. That's the case i had in > mind when requesting this. Hmm, I should probably return codec_tags->tag in this case rather than tag since it is the expected capitalization for the container. I'll have to fix that (again). > +return 1; +} +codec_tags++; +} +} +return 0; +} + static int mov_find_codec_tag(AVFormatContext *s, MOVTrack *track) { int tag; >>> Take the opportunity to change this, the ones in mov_get_codec_tag() and >>> in validate_codec_tag() to unsigned int, including the return types. >>> Codec tags in AVCodecTag are unsigned after all. >>> @@ -1596,23 +1616,21 @@ static int mov_find_codec_tag(AVFormatContext *s, MOVTrack *track) if (is_cover_image(track->st)) return ff_codec_get_tag(codec_cover_image_tags, track->par->codec_id); -if (track->mode == MODE_MP4 || track->mode == MODE_PSP) -tag = track->par->codec_tag; -else if (track->mode == MODE_ISM) -tag = track->par->codec_tag; -else if (track->mode == MODE_IPOD) { +if (track->mode == MODE_IPOD) if (!av_match_ext(s->url, "m4a") && !av_match_ext(s->url, "m4v") && !av_match_ext(s->url, "m4b")) av_log(s, AV_LOG_WARNING, "Warning, extension is not .m4a nor .m4v " "Quicktime/Ipod might not play the file\n"); -tag = track->par->codec_tag; -} else if (track->mode & MODE_3GP) -tag = track->par->codec_tag; -else if (track->mode == MODE_F4V) -tag = track->par->codec_tag; -else + +if (track->mode == MODE_MOV) tag = mov_get_codec_tag(s, track); +else +if (!validate_codec_tag(s->oformat->codec_tag, track->par->codec_tag, +track->par->codec_id)) +tag = 0; +else +tag = track->par->codec_tag; >>> And of course make this simply >>> >>> tag = validate_codec_tag(...); >>> >>> Thanks. >>> return tag; } >> >> All good suggestions, thanks. >> >> >> >> ___ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >> > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel -- John GnuPG fingerprint: D0EC B3DB C372 D1F1 0B01 83F0 49F1 D7B2 60D4 D0F7 signature.asc Description: OpenPGP digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/3] lavf/movenc: Fail when codec tag is invalid for format
Fixes ticket #6897 --- libavformat/movenc.c | 46 +--- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 8a3b651514..3ebc7abd8b 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1535,9 +1535,9 @@ static int mov_get_rawvideo_codec_tag(AVFormatContext *s, MOVTrack *track) return tag; } -static int mov_get_codec_tag(AVFormatContext *s, MOVTrack *track) +static unsigned int mov_get_codec_tag(AVFormatContext *s, MOVTrack *track) { -int tag = track->par->codec_tag; +unsigned int tag = track->par->codec_tag; if (!tag || (s->strict_std_compliance >= FF_COMPLIANCE_NORMAL && (track->par->codec_id == AV_CODEC_ID_DVVIDEO || @@ -1589,31 +1589,45 @@ static const AVCodecTag codec_cover_image_tags[] = { { AV_CODEC_ID_NONE, 0 }, }; -static int mov_find_codec_tag(AVFormatContext *s, MOVTrack *track) +static unsigned int validate_codec_tag(const AVCodecTag *const *tags, + unsigned int tag, int codec_id) { -int tag; +int i; + +/** + * Check that tag + id is in the table + */ +for (i = 0; tags && tags[i]; i++) { +const AVCodecTag *codec_tags = tags[i]; +while (codec_tags->id != AV_CODEC_ID_NONE) { +if (avpriv_toupper4(codec_tags->tag) == avpriv_toupper4(tag) && +codec_tags->id == codec_id) +return codec_tags->tag; +codec_tags++; +} +} +return 0; +} + +static unsigned int mov_find_codec_tag(AVFormatContext *s, MOVTrack *track) +{ +unsigned int tag; if (is_cover_image(track->st)) return ff_codec_get_tag(codec_cover_image_tags, track->par->codec_id); -if (track->mode == MODE_MP4 || track->mode == MODE_PSP) -tag = track->par->codec_tag; -else if (track->mode == MODE_ISM) -tag = track->par->codec_tag; -else if (track->mode == MODE_IPOD) { +if (track->mode == MODE_IPOD) if (!av_match_ext(s->url, "m4a") && !av_match_ext(s->url, "m4v") && !av_match_ext(s->url, "m4b")) av_log(s, AV_LOG_WARNING, "Warning, extension is not .m4a nor .m4v " "Quicktime/Ipod might not play the file\n"); -tag = track->par->codec_tag; -} else if (track->mode & MODE_3GP) -tag = track->par->codec_tag; -else if (track->mode == MODE_F4V) -tag = track->par->codec_tag; -else -tag = mov_get_codec_tag(s, track); +if (track->mode == MODE_MOV) +tag = mov_get_codec_tag(s, track); +else +tag = validate_codec_tag(s->oformat->codec_tag, track->par->codec_tag, + track->par->codec_id); return tag; } -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/9] configure: [loongson] revert no-expensive-optimizations
On Mon, Aug 27, 2018 at 04:10:01PM +0800, Shiyou Yin wrote: > > > >-Original Message- > >From: ffmpeg-devel-boun...@ffmpeg.org > >[mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of > >Shiyou Yin > >Sent: Saturday, August 25, 2018 11:04 AM > >To: 'FFmpeg development discussions and patches' > >Subject: Re: [FFmpeg-devel] [PATCH 1/9] configure: [loongson] revert > >no-expensive-optimizations > > > >>> Hi Michael, please help to review the following updates. > >>> > >>> > >>> diff --git a/configure b/configure > >>> index b9c9d0b..08cf48e 100755 > >>> --- a/configure > >>> +++ b/configure > >>> @@ -4796,15 +4796,24 @@ elif enabled mips; then > >>> disable mipsfpu > >>> disable mipsdsp > >>> disable mipsdspr2 > >>> +# When gcc version less than 5.3.0, add > >>> -fno-expensive-optimizations flag. > >>> +if [ $cc == gcc ]; then > >>> +gcc_version=$(gcc -dumpversion) > >>> +if [ "$(echo "$gcc_version 5.3.0" | tr " " "\n" > >>> + | sort -rV | head -n 1)" == > >>> "$gcc_version" ]; then > >>> +expensive_optimization_flag="" > >>> +else > >>> + > >>> expensive_optimization_flag="-fno-expensive-optimizations" > >>> +fi > >>> +fi > >> > >>This patch looks corrupted (by a newline) > >> > >>[...] > > > > > >Hi Michael, has repasted below, To avoid being corrupted again, I add an > >attachment. > > > >diff --git a/configure b/configure > >index b9c9d0b..08cf48e 100755 > >--- a/configure > >+++ b/configure > >@@ -4796,15 +4796,24 @@ elif enabled mips; then > > disable mipsfpu > > disable mipsdsp > > disable mipsdspr2 > >+# When gcc version less than 5.3.0, add > >-fno-expensive-optimizations flag. > >+if [ $cc == gcc ]; then > >+gcc_version=$(gcc -dumpversion) > >+if [ "$(echo "$gcc_version 5.3.0" | tr " " "\n" | sort > >-rV | head -n 1)" > >=="$gcc_version" ]; then > >+expensive_optimization_flag="" > >+else > >+ > >expensive_optimization_flag="-fno-expensive-optimizations" > >+fi > >+fi > > case $cpu in > > loongson3*) > >-cpuflags="-march=loongson3a -mhard-float > >-fno-expensive-optimizations" > >+cpuflags="-march=loongson3a -mhard-float > >$expensive_optimization_flag" > > ;; > > loongson2e) > >-cpuflags="-march=loongson2e -mhard-float > >-fno-expensive-optimizations" > >+cpuflags="-march=loongson2e -mhard-float > >$expensive_optimization_flag" > > ;; > > loongson2f) > >-cpuflags="-march=loongson2f -mhard-float > >-fno-expensive-optimizations" > >+cpuflags="-march=loongson2f -mhard-float > >$expensive_optimization_flag" > > ;; > > esac > > ;; > >-- > >2.1.0 > > Is there any other comment for this patch? no, will apply thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB You can kill me, but you cannot change the truth. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [FFmpeg-cvslog] avcodec/mscc: fix several bugs
2018-08-26 18:05 GMT+02:00, Paul B Mahol : > switch (avctx->bits_per_coded_sample) { > -case 8: avctx->pix_fmt = AV_PIX_FMT_GRAY8; break; > +case 8: avctx->pix_fmt = AV_PIX_FMT_PAL8; break; Do you have a sample that looks correct with this particular change? Can you share it? Thank you, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] avcodec: add WinCAM Motion Video decoder
Hi On Mon, Aug 27, 2018 at 07:31:21PM +0100, Rostislav Pehlivanov wrote: > On Sat, 25 Aug 2018 at 21:12, Paul B Mahol wrote: [...] > > + > > +blocks = bytestream2_get_le16(&gb); > > +if (blocks > 5) { > > +GetByteContext bgb; > > +int x = 0, size; > > + > > +if (blocks * 8 >= 0x) { > > +size = bytestream2_get_le24(&gb); > > +} else if (blocks * 8 >= 0xFF) { > > +size = bytestream2_get_le16(&gb); > > +} else { > > +size = bytestream2_get_byte(&gb); > > +} > > > > No need for brackets here, they're all one line expressions. You are correct. The extra brackets simplify any future additions to the branches though (which was why this style was often prefered long ago) It may not apply here, but for example what the {} do to changes is that: if (blocks * 8 >= 0x) { size = bytestream2_get_le24(&gb); + if (size == whatever) + return AVERROR_INVALIDDATA; } else if (blocks * 8 >= 0xFF) { size = bytestream2_get_le16(&gb); } else { size = bytestream2_get_byte(&gb); } vs: - if (blocks * 8 >= 0x) + if (blocks * 8 >= 0x) { size = bytestream2_get_le24(&gb); - else if (blocks * 8 >= 0xFF) + if (size == whatever) + return AVERROR_INVALIDDATA; + } else if (blocks * 8 >= 0xFF) size = bytestream2_get_le16(&gb); else size = bytestream2_get_byte(&gb); The first diff is easier & quicker to read, aka it helps with future maintaince also, extra {} often cost no vertical space I just now realized you often recommand to remove {}, which is why i wrote above. This is not meant as opposition for this specific change, just wanted to explain the reasoning that iam aware of behind the use of {} in cases that seemingly dont benefit from them. [...] > > > > + > > +bytestream2_skip(&gb, size); > > +bytestream2_init(&bgb, s->block_data, blocks * 8); > > + > > +for (int i = 0; i < blocks; i++) { > > +int w, h; > > + > > +bytestream2_skip(&bgb, 4); > > +w = bytestream2_get_le16(&bgb); > > +h = bytestream2_get_le16(&bgb); > > +x += 3 * w * h; > > +} > > + > > +if (x >= 0x) { > > +bytestream2_skip(&gb, 3); > > +} else if (x >= 0xFF) { > > +bytestream2_skip(&gb, 2); > > +} else { > > +bytestream2_skip(&gb, 1); > > +} > > > > Same, oneliners so no need for brackets. > > > + > > +skip = bytestream2_tell(&gb); > > + > > +s->zstream.next_in = avpkt->data + skip; > > +s->zstream.avail_in = avpkt->size - skip; > > + > > +bytestream2_init(&gb, s->block_data, blocks * 8); > > +} else { > > +int x = 0; > > + > > +bytestream2_seek(&gb, 2, SEEK_SET); > > + > > +for (int i = 0; i < blocks; i++) { > > +int w, h; > > + > > +bytestream2_skip(&gb, 4); > > +w = bytestream2_get_le16(&gb); > > +h = bytestream2_get_le16(&gb); > > +x += 3 * w * h; > > +} > > + > > +if (x >= 0x) { > > +bytestream2_skip(&gb, 3); > > +} else if (x >= 0xFF) { > > +bytestream2_skip(&gb, 2); > > +} else { > > +bytestream2_skip(&gb, 1); > > +} > > > > Same. > > > > > + > > +skip = bytestream2_tell(&gb); > > + > > +s->zstream.next_in = avpkt->data + skip; > > +s->zstream.avail_in = avpkt->size - skip; This code is identical, and could maybe be factored out [...] -- 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 http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avformat/vpcc: fix values in VP9 level detection heuristics
The levels are stored as decimal values, not hexadecimal. Signed-off-by: James Almer --- libavformat/vpcc.c | 28 ++-- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/libavformat/vpcc.c b/libavformat/vpcc.c index 79514483af..e0b7f288a6 100644 --- a/libavformat/vpcc.c +++ b/libavformat/vpcc.c @@ -81,33 +81,33 @@ static int get_vp9_level(AVCodecParameters *par, AVRational *frame_rate) { if (picture_size <= 0) { return 0; } else if (sample_rate <= 829440 && picture_size <= 36864) { -return 0x10; +return 10; } else if (sample_rate <= 2764800&& picture_size <= 73728) { -return 0x11; +return 11; } else if (sample_rate <= 4608000&& picture_size <= 122880) { -return 0x20; +return 20; } else if (sample_rate <= 9216000&& picture_size <= 245760) { -return 0x21; +return 21; } else if (sample_rate <= 20736000 && picture_size <= 552960) { -return 0x30; +return 30; } else if (sample_rate <= 36864000 && picture_size <= 983040) { -return 0x31; +return 31; } else if (sample_rate <= 83558400 && picture_size <= 2228224) { -return 0x40; +return 40; } else if (sample_rate <= 160432128 && picture_size <= 2228224) { -return 0x41; +return 41; } else if (sample_rate <= 311951360 && picture_size <= 8912896) { -return 0x50; +return 50; } else if (sample_rate <= 588251136 && picture_size <= 8912896) { -return 0x51; +return 51; } else if (sample_rate <= 1176502272 && picture_size <= 8912896) { -return 0x52; +return 52; } else if (sample_rate <= 1176502272 && picture_size <= 35651584) { -return 0x60; +return 60; } else if (sample_rate <= 2353004544 && picture_size <= 35651584) { -return 0x61; +return 61; } else if (sample_rate <= 4706009088 && picture_size <= 35651584) { -return 0x62; +return 62; } else { return 0; } -- 2.18.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH V2] examples/vaapi_dec_scaling: add a vaapi decoding/scaling sample
On Tue, Aug 28, 2018 at 2:14 AM Mark Thompson wrote: > > On 23/08/18 14:08, Jun Zhao wrote: > > add a vaapi decoding/scaling sample. > > > > Signed-off-by: Jun Zhao > > --- > > configure|2 + > > doc/examples/Makefile|1 + > > doc/examples/vaapi_dec_scaling.c | 377 > > ++ > > 3 files changed, 380 insertions(+), 0 deletions(-) > > create mode 100644 doc/examples/vaapi_dec_scaling.c > > Looking at this, it seems like it copies a lot of code from hw_decode.c and > filtering_video.c and combines it in a reasonably straightforward (?) way, > but doesn't really any anything on top of that. I'm not convinced that > adding an extra example like this for a specific combination of things > already covered is necessarily helpful, though I could certainly be convinced > if you have some reason for it. > > So, would you care to argue for why this example in particular is useful? > > Thanks, > > - Mark > ___ > Hi, Mark: 1. Because we want to build a pipe for Media Analytic with HWaccel decoder + scaling/csc(color space conversion) + clDNN (https://github.com/intel/clDNN) or OpenVINO (https://software.intel.com/en-us/openvino-toolkit) based on GPU with FFmpeg (with buffer sharing), and If we consider the whole pipeline of the media analytic as described above, we need to use the HW media decoder/scaling/color space conversion and inference engine (clDNN or OpenVINO) 2. The other thing is we don't have an example to demo how to enable HWaccel in AVFilter in API level (we have hw_decode for HWAccel decoding, vaapi_encode for HWAccel encoding, vaapi_transcode for HWaccel transcoding, but miss a HWAccel AVFilter example) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/3] lavc/vaapi_encode_h264: respect "slices" option in h264 vaapi encoder
On Tue, Aug 28, 2018 at 2:07 AM Mark Thompson wrote: > > On 21/08/18 01:51, myp...@gmail.com wrote: > > On Tue, Aug 21, 2018 at 8:05 AM Mark Thompson wrote: > >> > >> On 30/07/18 12:42, Jun Zhao wrote: > >>> Enable multi-slice support in AVC/H.264 vaapi encoder. > >>> > >>> Signed-off-by: Wang, Yi A > >>> Signed-off-by: Jun Zhao > >>> --- > >>> libavcodec/vaapi_encode_h264.c | 31 +-- > >>> 1 files changed, 25 insertions(+), 6 deletions(-) > >>> > >>> diff --git a/libavcodec/vaapi_encode_h264.c > >>> b/libavcodec/vaapi_encode_h264.c > >>> index 905c507..70c89e8 100644 > >>> --- a/libavcodec/vaapi_encode_h264.c > >>> +++ b/libavcodec/vaapi_encode_h264.c > >>> @@ -581,6 +581,7 @@ static int > >>> vaapi_encode_h264_init_picture_params(AVCodecContext *avctx, > >>> H264RawSPS *sps = &priv->sps; > >>> VAEncPictureParameterBufferH264 *vpic = pic->codec_picture_params; > >>> int i; > >>> +int slices; > >>> > >>> memset(&priv->current_access_unit, 0, > >>> sizeof(priv->current_access_unit)); > >>> @@ -690,7 +691,17 @@ static int > >>> vaapi_encode_h264_init_picture_params(AVCodecContext *avctx, > >>> vpic->pic_fields.bits.idr_pic_flag = (pic->type == > >>> PICTURE_TYPE_IDR); > >>> vpic->pic_fields.bits.reference_pic_flag = (pic->type != > >>> PICTURE_TYPE_B); > >>> > >>> -pic->nb_slices = 1; > >>> +slices = 1; > >>> +if (ctx->max_slices) { > >>> +if (avctx->slices <= FFMIN(ctx->max_slices, priv->mb_height)) { > >>> +slices = FFMAX(avctx->slices, slices); > >>> +} else { > >>> +av_log(avctx, AV_LOG_ERROR, "The max slices number per frame > >>> " > >>> + "cannot be more than %d.\n", FFMIN(ctx->max_slices, > >>> priv->mb_height)); > >>> +return AVERROR_INVALIDDATA; > >> > >> AVERROR(EINVAL) for invalid user parameters. > > Will follow the comment. > >> > >>> +} > >>> +} > >>> +pic->nb_slices = slices; > >>> > >>> return 0; > >>> } > >>> @@ -716,8 +727,7 @@ static int > >>> vaapi_encode_h264_init_slice_params(AVCodecContext *avctx, > >>> sh->nal_unit_header.nal_ref_idc = pic->type != PICTURE_TYPE_B; > >>> } > >>> > >>> -// Only one slice per frame. > >>> -sh->first_mb_in_slice = 0; > >>> +sh->first_mb_in_slice = !!slice->index; > > The problem is here. This is not what first_mb_in_slice means - it should be > set to the same value as macroblock_address. > > >>> sh->slice_type= priv->slice_type; > >>> > >>> sh->pic_parameter_set_id = pps->pic_parameter_set_id; > >>> @@ -738,14 +748,19 @@ static int > >>> vaapi_encode_h264_init_slice_params(AVCodecContext *avctx, > >>> sh->slice_qp_delta = priv->fixed_qp_idr - > >>> (pps->pic_init_qp_minus26 + 26); > >>> > >>> > >>> -vslice->macroblock_address = sh->first_mb_in_slice; > >>> -vslice->num_macroblocks= priv->mb_width * priv->mb_height; > >>> +vslice->macroblock_address = slice->index * priv->mb_width * > >>> (priv->mb_height / pic->nb_slices); > >>> +if (slice->index == pic->nb_slices - 1) { > >>> +vslice->num_macroblocks = priv->mb_width * priv->mb_height > >>> + - slice->index * priv->mb_width * > >>> (priv->mb_height / pic->nb_slices); > >>> +priv->idr_pic_count++; > >>> +} else > >>> +vslice->num_macroblocks = priv->mb_width * (priv->mb_height / > >>> pic->nb_slices); > >> > >> This dumps all of the rounding error in the last slice. E.g. 1080p with 8 > >> slices gives you 68 macroblocks high, so you get seven slices with 68/8 = > >> 8 macroblock height and the last one has 12 macroblock height. > >> > >> It should be balanced so that all slices are roughly the same size > >> (8-slice 1080p -> four slices of 9 + four slices of 8). It might make > >> sense to put the residual rounding error away from the middle of the frame > >> too (so 9, 9, 8, 8, 8, 8, 9, 9), though that's probably second-order. > > I agree with the comment, as my point, how about change the slice number as > > : > > > > 68 / 8 = 8 .. 4, and we give (9, 9, 9, 9, 8, 8, 8, 8) in this case? > > Is it the size constraint mentioned below which is causing you to make that > choice? Intuitively I would place the larger slices at the top and bottom of > the frame, hence (9, 9, 8, 8, 8, 8, 9, 9). > Yes, this is the reason causing me to make that choice like (9, 9, 9, 9, 8, 8, 8, 8), than we can avoid some mutil-slice encoding issue when use a old driver (i965 or iHD). > >> > >>> > >>> vslice->macroblock_info = VA_INVALID_ID; > >>> > >>> vslice->slice_type = sh->slice_type % 5; > >>> vslice->pic_parameter_set_id = sh->pic_parameter_set_id; > >>> -vslice->idr_pic_id = sh->idr_pic_id; > >>> +vslice->idr_pic_id = priv->idr_pic_count; > >>> > >>> vslice->pic_order_cnt_lsb = sh->pic_order_c
[FFmpeg-devel] [PATCH] ffmpeg: block output == input for files
With some regularity, we have users trying to update input files using ffmpeg, usually for the purposes of tagging, but occasionally for changing the encoding or something else. Other apps like mp4box or taggers edit the files in-place i.e. destination file is same as the source. FFmpeg cannot do this. But since these users don't realize that, they will answer Yes to the overwrite prompt and then discover their source has been destroyed. Attached patch checks the URL for file protocol outputs against inputs and aborts upon a match. An option is provided for the user to force the operation. The check isn't robust. In particular, it looks for exact url string matches, so a command like ffmpeg -i file:somefile -some_op somefile will still pass through. But I consider such invocations rare. Most times I've seen users trying this (on Stackexchange or other support forums), the command is typically of the form, for i; do ffmpeg -i $i -some_op -y $i Such a scenario was filed as a bug in #4655 but it was marked as wontfix since some protocols/services can manage bidir ops to the same endpoint. For that reason, everything other than file protocol sources/sinks are exempt i.e. http, pipes, devices..etc. This patch doesn't affect the semantics of '-y' and adds the check after it. Thanks, Gyan From deb97d9b5dd1f50a7e6b560c77b81b9cd707b7c1 Mon Sep 17 00:00:00 2001 From: Gyan Doshi Date: Sun, 26 Aug 2018 11:22:50 +0530 Subject: [PATCH] ffmpeg: block output == input for files Add option write_to_input_file to allow it. Fixes #4655 --- doc/ffmpeg.texi | 6 ++ fftools/ffmpeg.h | 1 + fftools/ffmpeg_opt.c | 20 +++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 3717f22d42..6fb359eabe 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -445,6 +445,12 @@ Overwrite output files without asking. Do not overwrite output files, and exit immediately if a specified output file already exists. +@item -write_to_input_file (@emph{global}) +Allow writing to an input file. Normally, this will destroy the input file and +the conversion will fail, as FFmpeg does not perform in-place editing. But some +protocols or storage services can accommodate this use-case. Verify before setting it. +This option does not override the generic output overwrite check. Disabled by default. + @item -stream_loop @var{number} (@emph{input}) Set number of times input stream shall be looped. Loop 0 means no loop, loop -1 means infinite loop. diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index eb1eaf6363..6c1f87c7ad 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -606,6 +606,7 @@ extern int frame_bits_per_raw_sample; extern AVIOContext *progress_avio; extern float max_error_rate; extern char *videotoolbox_pixfmt; +extern int write_to_input_file; extern int filter_nbthreads; extern int filter_complex_nbthreads; diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 58ec13e5a8..74e9b94bf5 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -121,6 +121,7 @@ static int input_stream_potentially_available = 0; static int ignore_unknown_streams = 0; static int copy_unknown_streams = 0; static int find_stream_info = 1; +extern int write_to_input_file = 0; static void uninit_options(OptionsContext *o) { @@ -900,13 +901,14 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic) static void assert_file_overwrite(const char *filename) { +const char *proto_name = avio_find_protocol_name(filename); + if (file_overwrite && no_file_overwrite) { fprintf(stderr, "Error, both -y and -n supplied. Exiting.\n"); exit_program(1); } if (!file_overwrite) { -const char *proto_name = avio_find_protocol_name(filename); if (proto_name && !strcmp(proto_name, "file") && avio_check(filename, 0) == 0) { if (stdin_interaction && !no_file_overwrite) { fprintf(stderr,"File '%s' already exists. Overwrite ? [y/N] ", filename); @@ -925,6 +927,20 @@ static void assert_file_overwrite(const char *filename) } } } + +if (!write_to_input_file && proto_name && !strcmp(proto_name, "file")) { +for (int i = 0; i < nb_input_files; i++) { + InputFile *file = input_files[i]; + if (file->ctx->iformat->flags & AVFMT_NOFILE) + continue; + if (!strcmp(filename, file->ctx->url)) { + av_log(NULL, AV_LOG_FATAL, "Output same as Input #%d - exiting\n", i); + av_log(NULL, AV_LOG_WARNING, "FFmpeg cannot edit existing files in-place.\n" +"Add -write_to_input_file if this is a safe operation and intended.\n"); + exit_program(1); + } +} +} } static void dump_attachment(AVStream *st, const char *filename) @@ -3315,6 +3331,8 @@ const OptionDef opti
Re: [FFmpeg-devel] [PATCH] ffmpeg: correct units for raw pts in -progress report
On 28-08-2018 01:29 AM, Michael Niedermayer wrote: LGTM thanks PS: these fields seem not documented anywhere, neither the new nor the old or iam looking at the wrong places Will add documentation. This patch pushed as 26dc76324564fc572689509c2efb7f1cb8f41a45 Thanks, Gyan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] ffmpeg: block output == input for files
On Tue, 28 Aug 2018, Gyan Doshi wrote: With some regularity, we have users trying to update input files using ffmpeg, usually for the purposes of tagging, but occasionally for changing the encoding or something else. Other apps like mp4box or taggers edit the files in-place i.e. destination file is same as the source. FFmpeg cannot do this. But since these users don't realize that, they will answer Yes to the overwrite prompt and then discover their source has been destroyed. Attached patch checks the URL for file protocol outputs against inputs and aborts upon a match. An option is provided for the user to force the operation. The check isn't robust. In particular, it looks for exact url string matches, so a command like ffmpeg -i file:somefile -some_op somefile will still pass through. But I consider such invocations rare. Most times I've seen users trying this (on Stackexchange or other support forums), the command is typically of the form, for i; do ffmpeg -i $i -some_op -y $i Such a scenario was filed as a bug in #4655 but it was marked as wontfix since some protocols/services can manage bidir ops to the same endpoint. For that reason, everything other than file protocol sources/sinks are exempt i.e. http, pipes, devices..etc. This patch doesn't affect the semantics of '-y' and adds the check after it. Instead of this, maybe we should add support to write lock the files when opening them for reading. Then ffmpeg can request this. That would be an useful option, and not just for unexperienced users. Regards, Marton ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] ffmpeg.c: add an option "detail_stats" to allow ffmpeg to output stats for each stream
From: Wang Cao Add an option "detail_stats" to ffmpeg to output stats for each video/audio streams and each ouptut file ffmpeg output log in print_report. The format of stats is unchanged. Signed-off-by: Wang Cao --- Run after "make fate" and all tests passed. doc/ffmpeg.texi | 4 fftools/ffmpeg.c | 56 +++- fftools/ffmpeg.h | 1 + fftools/ffmpeg_opt.c | 4 +++- 4 files changed, 48 insertions(+), 17 deletions(-) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 3717f22d42..53a5be9791 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -1623,6 +1623,10 @@ rtp stream. (Requires at least one of the output formats to be rtp). Allows discarding specific streams or frames of streams at the demuxer. Not all demuxers support this. +@item -detail_stats (@emph{global}) +Allows printing stats for each output stream and output file at the end of +processing. + @table @option @item none Discard no frame. diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 2459374f08..c268be20d4 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1530,17 +1530,31 @@ static int reap_filters(int flush) return 0; } -static void print_final_stats(int64_t total_size) +static void print_final_stats() { uint64_t video_size = 0, audio_size = 0, extra_size = 0, other_size = 0; uint64_t subtitle_size = 0; uint64_t data_size = 0; +int64_t total_size; float percent = -1.0; int i, j; int pass1_used = 1; - -for (i = 0; i < nb_output_streams; i++) { +int nb_display_streams = 0; +AVFormatContext *oc; + +if (nb_output_streams > 0) { +nb_display_streams = enable_detail_stats ? nb_output_streams : 1; +} +for (i = 0; i < nb_display_streams; i++) { OutputStream *ost = output_streams[i]; +if (i > 0 && ost->file_index != output_streams[i-1]->file_index) { +video_size = 0; +audio_size = 0; +extra_size = 0; +other_size = 0; +subtitle_size = 0; +data_size = 0; +} switch (ost->enc_ctx->codec_type) { case AVMEDIA_TYPE_VIDEO: video_size += ost->data_size; break; case AVMEDIA_TYPE_AUDIO: audio_size += ost->data_size; break; @@ -1552,7 +1566,13 @@ static void print_final_stats(int64_t total_size) if ( (ost->enc_ctx->flags & (AV_CODEC_FLAG_PASS1 | AV_CODEC_FLAG_PASS2)) != AV_CODEC_FLAG_PASS1) pass1_used = 0; -} + +// Print stats for each output file. +if (i == nb_output_streams-1 || ost->file_index != output_streams[i+1]->file_index) { +oc = output_files[ost->file_index]->ctx; +total_size = avio_size(oc->pb); +if (total_size <= 0) // FIXME improve avio_size() so it works with non seekable output too +total_size = avio_tell(oc->pb); if (data_size && total_size>0 && total_size >= data_size) percent = 100.0 * (total_size - data_size) / data_size; @@ -1568,6 +1588,8 @@ static void print_final_stats(int64_t total_size) else av_log(NULL, AV_LOG_INFO, "unknown"); av_log(NULL, AV_LOG_INFO, "\n"); +} +} /* print verbose per-stream stats */ for (i = 0; i < nb_input_files; i++) { @@ -1680,13 +1702,6 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti t = (cur_time-timer_start) / 100.0; - -oc = output_files[0]->ctx; - -total_size = avio_size(oc->pb); -if (total_size <= 0) // FIXME improve avio_size() so it works with non seekable output too -total_size = avio_tell(oc->pb); - vid = 0; av_bprint_init(&buf, 0, AV_BPRINT_SIZE_AUTOMATIC); av_bprint_init(&buf_script, 0, AV_BPRINT_SIZE_AUTOMATIC); @@ -1697,12 +1712,14 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti if (!ost->stream_copy) q = ost->quality / (float) FF_QP2LAMBDA; -if (vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) { +if (is_last_report && vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) { av_bprintf(&buf, "q=%2.1f ", q); av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n", ost->file_index, ost->index, q); } -if (!vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) { +// Only print the stats for the first stream during processing +if ((is_last_report && (enable_detail_stats && vid || !vid)) || !is_last_report && !vid) { +if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { float fps; frame_number = ost->frame_number; @@ -1761,7 +1778,9 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti ost->st->time_base, AV_TIME_BASE_Q)); if (is_last_report) nb_frames_drop += ost->last_dropped; -} +total_s