Re: [FFmpeg-devel] [PATCH] movenc: calculate track_duration without packet duration
On 18-06-2019 02:00 PM, Alfred E. Heggestad wrote: On 17/06/2019 10:23, Gyan wrote: On 17-06-2019 01:37 PM, Alfred E. Heggestad wrote: From c69b63a7af5531257753754e64ac33b7ef530e75 Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" Date: Mon, 17 Jun 2019 10:04:08 +0200 Subject: [PATCH] movenc: calculate track_duration without packet duration --- libavformat/movenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 46d314ff17..fa5833962b 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -5486,7 +5486,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) "this case.\n", pkt->stream_index, pkt->dts); } - trk->track_duration = pkt->dts - trk->start_dts + pkt->duration; + trk->track_duration = pkt->dts - trk->start_dts; Why? trk->last_sample_is_subtitle_end = 0; if (pkt->pts == AV_NOPTS_VALUE) { the background for this change is the check done in check_pkt(): if (trk->entry) { ref = trk->cluster[trk->entry - 1].dts; } else if ( trk->start_dts != AV_NOPTS_VALUE && !trk->frag_discont) { ref = trk->start_dts + trk->track_duration; } else ref = pkt->dts; // Skip tests for the first packet if (trk->dts_shift != AV_NOPTS_VALUE) { /* With negative CTS offsets we have set an offset to the DTS, * reverse this for the check. */ ref -= trk->dts_shift; } duration = pkt->dts - ref; if (pkt->dts < ref || duration >= INT_MAX) { av_log(s, AV_LOG_ERROR, "Application provided duration: %"PRId64" / timestamp: %"PRId64" is out of range for mov/mp4 format\n", duration, pkt->dts ); pkt->dts = ref + 1; pkt->pts = AV_NOPTS_VALUE; } it requires that the DTS of the packet is larger than "ref" which in some cases is equal to track_duration. line 5015: track->track_duration = pkt.dts - track->start_dts; line 5489: trk->track_duration = pkt->dts - trk->start_dts + pkt->duration; line 5615: trk->track_duration = pkt->dts - trk->start_dts; setting track_duration is inconsistent; some times it includes duration and some times not. It may be best to check the commits for these assignments to see if the inconsistency is deliberate. The track duration is written into the media header box for the track. I also see it being used elsewhere to adjust dts. Do those roles remain intact? Does FATE pass? Gyan here is an example with a stream of AVPacket's that increment the DTS by approx. 10 (and duration is set to 0): pkt: dts: 1 0 2 10 3 20 4 30 5 40 6 50 after packet 6 has arrived, the "ref" value in check_pkt will now be calculated to 50 + 10 = 60. the code assumes a duration of 10. when packet 7 arrives it has a DTS of 59 (which is valid). but this packet will fail in check_pkt and print a warning, because 59 < 60. ___ 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] dash: change default MP4 extension to .m4s
> > the background for this is the extension for DASH media files > > used to be *.m4s and it is now *.mp4 I don't know about the official standard, but at least one implimentation (vimeo.com) has a bunch of moov atoms in a .mp4 file at the start of the stream, followed by .m4s segments ___ 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] dash: change default MP4 extension to .m4s
On 6/18/19 1:48 PM, Alfred E. Heggestad wrote: > On 18/06/2019 04:02, Steven Liu wrote: >> Alfred E. Heggestad 于2019年6月17日周一 下午4:02写道: >>> >>> From 923da82598bddd1ed05750427dbc71e607d296a2 Mon Sep 17 00:00:00 2001 >>> From: "Alfred E. Heggestad" >>> Date: Mon, 17 Jun 2019 09:59:04 +0200 >>> Subject: [PATCH] dash: change default MP4 extension to .m4s >>> >>> this was changed in commit 281a21ed50849e3c8c0d03005230e9fd07c24370 >>> --- >>>libavformat/dashenc.c | 2 +- >>>1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c >>> index 3fd7e78166..a51a1da0ca 100644 >>> --- a/libavformat/dashenc.c >>> +++ b/libavformat/dashenc.c >>> @@ -166,7 +166,7 @@ static struct format_string { >>>const char *str; >>>} formats[] = { >>>{ SEGMENT_TYPE_AUTO, "auto" }, >>> -{ SEGMENT_TYPE_MP4, "mp4" }, >>> +{ SEGMENT_TYPE_MP4, "m4s" }, >>>{ SEGMENT_TYPE_WEBM, "webm" }, >>>{ 0, NULL } >>>}; >>> -- >>> 2.20.1 (Apple Git-117) >>> >>> ___ >>> 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". >> >> >> >> LGTM >> > > the background for this is the extension for DASH media files > used to be *.m4s and it is now *.mp4 > > > the patch is a suggestion and should be checked by the DASH experts > > what is correct according to the standard ? > > the media-file is not really an .mp4 file, it cannot be > played with e.g. ffplay: > > $ ffplay chunk-stream1-1.m4s Thanks for submitting the patch. I agree that m4s should be extension for media segments. mp4 should be used only for complete files. With respect to the patch, dashenc generates either multiple segments or a single file(with byte range as segments) based on "single_file" option. The default of mp4 is correct when "single_file" is enabled. But it is wrong when "single_file" is disabled. The proposed patch just reverses this situation. I would suggest the patch should handle both cases correctly. > > > > > /alfred > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] libavcodec: Reduce the size of some arrays
This commit uses smaller types for some static const arrays to reduce their size in case the entries can be represented in the smaller type. The biggest savings came from inv_map_table in vp9.c. Signed-off-by: Andreas Rheinhardt --- libavcodec/a64multienc.c | 6 +++--- libavcodec/ac3enc.c | 2 +- libavcodec/adpcm.c| 8 libavcodec/aic.c | 4 ++-- libavcodec/atrac3plus.c | 12 ++-- libavcodec/atrac3plusdsp.c| 4 ++-- libavcodec/atrac9dec.c| 2 +- libavcodec/cbs_h264_syntax_template.c | 2 +- libavcodec/cbs_vp9_syntax_template.c | 4 ++-- libavcodec/vp9.c | 2 +- 10 files changed, 23 insertions(+), 23 deletions(-) diff --git a/libavcodec/a64multienc.c b/libavcodec/a64multienc.c index 91aac0933f..38f25020f5 100644 --- a/libavcodec/a64multienc.c +++ b/libavcodec/a64multienc.c @@ -60,11 +60,11 @@ typedef struct A64Context { } A64Context; /* gray gradient */ -static const int mc_colors[5]={0x0,0xb,0xc,0xf,0x1}; +static const uint8_t mc_colors[5]={0x0,0xb,0xc,0xf,0x1}; /* other possible gradients - to be tested */ -//static const int mc_colors[5]={0x0,0x8,0xa,0xf,0x7}; -//static const int mc_colors[5]={0x0,0x9,0x8,0xa,0x3}; +//static const uint8_t mc_colors[5]={0x0,0x8,0xa,0xf,0x7}; +//static const uint8_t mc_colors[5]={0x0,0x9,0x8,0xa,0x3}; static void to_meta_with_crop(AVCodecContext *avctx, const AVFrame *p, int *dest) diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index e7e18af92d..f1c95ce877 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -652,7 +652,7 @@ void ff_ac3_process_exponents(AC3EncodeContext *s) */ static void count_frame_bits_fixed(AC3EncodeContext *s) { -static const int frame_bits_inc[8] = { 0, 0, 2, 2, 2, 4, 2, 4 }; +static const uint8_t frame_bits_inc[8] = { 0, 0, 2, 2, 2, 4, 2, 4 }; int blk; int frame_bits; diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index ede0130bf1..e194764374 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -57,7 +57,7 @@ */ /* These are for CD-ROM XA ADPCM */ -static const int xa_adpcm_table[5][2] = { +static const int8_t xa_adpcm_table[5][2] = { { 0, 0 }, { 60, 0 }, { 115, -52 }, @@ -65,7 +65,7 @@ static const int xa_adpcm_table[5][2] = { { 122, -60 } }; -static const int ea_adpcm_table[] = { +static const int16_t ea_adpcm_table[] = { 0, 240, 460, 392, 0,0, -208, -220, 0,1,3,4, @@ -74,7 +74,7 @@ static const int ea_adpcm_table[] = { }; // padded to zero where table size is less then 16 -static const int swf_index_tables[4][16] = { +static const int8_t swf_index_tables[4][16] = { /*2*/ { -1, 2 }, /*3*/ { -1, -1, 2, 4 }, /*4*/ { -1, -1, -1, -1, 2, 4, 6, 8 }, @@ -484,7 +484,7 @@ static void adpcm_swf_decode(AVCodecContext *avctx, const uint8_t *buf, int buf_ { ADPCMDecodeContext *c = avctx->priv_data; GetBitContext gb; -const int *table; +const int8_t *table; int k0, signmask, nb_bits, count; int size = buf_size*8; int i; diff --git a/libavcodec/aic.c b/libavcodec/aic.c index dc28c83661..956d71fcff 100644 --- a/libavcodec/aic.c +++ b/libavcodec/aic.c @@ -42,9 +42,9 @@ enum AICBands { NUM_BANDS }; -static const int aic_num_band_coeffs[NUM_BANDS] = { 64, 32, 192, 96 }; +static const uint8_t aic_num_band_coeffs[NUM_BANDS] = { 64, 32, 192, 96 }; -static const int aic_band_off[NUM_BANDS] = { 0, 64, 96, 288 }; +static const uint16_t aic_band_off[NUM_BANDS] = { 0, 64, 96, 288 }; static const uint8_t aic_quant_matrix[64] = { 8, 16, 19, 22, 22, 26, 26, 27, diff --git a/libavcodec/atrac3plus.c b/libavcodec/atrac3plus.c index 3e3bba801b..9f964efb4d 100644 --- a/libavcodec/atrac3plus.c +++ b/libavcodec/atrac3plus.c @@ -81,8 +81,8 @@ av_cold void ff_atrac3p_init_vlcs(void) { int i, wl_vlc_offs, ct_vlc_offs, sf_vlc_offs, tab_offset; -static const int wl_nb_bits[4] = { 2, 3, 5, 5 }; -static const int wl_nb_codes[4] = { 3, 5, 8, 8 }; +static const uint8_t wl_nb_bits[4] = { 2, 3, 5, 5 }; +static const uint8_t wl_nb_codes[4] = { 3, 5, 8, 8 }; static const uint8_t * const wl_bits[4] = { atrac3p_wl_huff_bits1, atrac3p_wl_huff_bits2, atrac3p_wl_huff_bits3, atrac3p_wl_huff_bits4 @@ -95,8 +95,8 @@ av_cold void ff_atrac3p_init_vlcs(void) atrac3p_wl_huff_xlat1, atrac3p_wl_huff_xlat2, NULL, NULL }; -static const int ct_nb_bits[4] = { 3, 4, 4, 4 }; -static const int ct_nb_codes[4] = { 4, 8, 8, 8 }; +static const uint8_t ct_nb_bits[4] = { 3, 4, 4, 4 }; +static const uint8_t ct_nb_codes[4] = { 4, 8, 8, 8 }; static const uint8_t * const ct_bits[4] = { atrac3p_ct_huff_bits1, atrac3p_ct_huff_bits2, atrac3p_ct_huff_bits2, atrac3p_ct_huff_bits3 @@ -109,8 +109,8 @@ av_cold void ff_atrac3p_init_vlc
Re: [FFmpeg-devel] [PATCH v2] avfilter/vaapi: add overlay_vaapi filter
? On Tue, Jun 11, 2019 at 10:52 AM Zachary Zhou wrote: > > --- > configure | 1 + > libavfilter/Makefile | 1 + > libavfilter/allfilters.c | 1 + > libavfilter/vaapi_vpp.c| 95 + > libavfilter/vaapi_vpp.h| 5 + > libavfilter/vf_overlay_vaapi.c | 357 + > 6 files changed, 460 insertions(+) > create mode 100644 libavfilter/vf_overlay_vaapi.c > > diff --git a/configure b/configure > index 32fc26356c..f469e6a3b1 100755 > --- a/configure > +++ b/configure > @@ -3478,6 +3478,7 @@ openclsrc_filter_deps="opencl" > overlay_opencl_filter_deps="opencl" > overlay_qsv_filter_deps="libmfx" > overlay_qsv_filter_select="qsvvpp" > +overlay_vaapi_filter_deps="vaapi" > owdenoise_filter_deps="gpl" > pan_filter_deps="swresample" > perspective_filter_deps="gpl" > diff --git a/libavfilter/Makefile b/libavfilter/Makefile > index 07ea8d7edc..5cbf1a7e41 100644 > --- a/libavfilter/Makefile > +++ b/libavfilter/Makefile > @@ -311,6 +311,7 @@ OBJS-$(CONFIG_OVERLAY_FILTER)+= > vf_overlay.o framesync.o > OBJS-$(CONFIG_OVERLAY_OPENCL_FILTER) += vf_overlay_opencl.o opencl.o > \ > opencl/overlay.o framesync.o > OBJS-$(CONFIG_OVERLAY_QSV_FILTER)+= vf_overlay_qsv.o framesync.o > +OBJS-$(CONFIG_OVERLAY_VAAPI_FILTER) += vf_overlay_vaapi.o > framesync.o > OBJS-$(CONFIG_OWDENOISE_FILTER) += vf_owdenoise.o > OBJS-$(CONFIG_PAD_FILTER)+= vf_pad.o > OBJS-$(CONFIG_PALETTEGEN_FILTER) += vf_palettegen.o > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c > index 9c846b1ddd..27ee1df78b 100644 > --- a/libavfilter/allfilters.c > +++ b/libavfilter/allfilters.c > @@ -295,6 +295,7 @@ extern AVFilter ff_vf_oscilloscope; > extern AVFilter ff_vf_overlay; > extern AVFilter ff_vf_overlay_opencl; > extern AVFilter ff_vf_overlay_qsv; > +extern AVFilter ff_vf_overlay_vaapi; > extern AVFilter ff_vf_owdenoise; > extern AVFilter ff_vf_pad; > extern AVFilter ff_vf_palettegen; > diff --git a/libavfilter/vaapi_vpp.c b/libavfilter/vaapi_vpp.c > index b5b245c8af..a8caa5b532 100644 > --- a/libavfilter/vaapi_vpp.c > +++ b/libavfilter/vaapi_vpp.c > @@ -663,6 +663,101 @@ fail: > return err; > } > > +int ff_vaapi_vpp_render_overlay(AVFilterContext *avctx, > +VAProcPipelineParameterBuffer *params, > +VAProcPipelineParameterBuffer *subpic_params, > +VASurfaceID output_surface) > +{ > +VABufferID params_id; > +VABufferID subpic_params_id; > +VAStatus vas; > +int err = 0; > +VAAPIVPPContext *ctx = avctx->priv; > + > +vas = vaBeginPicture(ctx->hwctx->display, > + ctx->va_context, output_surface); > +if (vas != VA_STATUS_SUCCESS) { > +av_log(avctx, AV_LOG_ERROR, "Failed to attach new picture: " > + "%d (%s).\n", vas, vaErrorStr(vas)); > +err = AVERROR(EIO); > +goto fail; > +} > + > +vas = vaCreateBuffer(ctx->hwctx->display, ctx->va_context, > + VAProcPipelineParameterBufferType, > + sizeof(*params), 1, params, ¶ms_id); > +if (vas != VA_STATUS_SUCCESS) { > +av_log(avctx, AV_LOG_ERROR, "Failed to create parameter buffer: " > + "%d (%s).\n", vas, vaErrorStr(vas)); > +err = AVERROR(EIO); > +goto fail_after_begin; > +} > +av_log(avctx, AV_LOG_DEBUG, "Pipeline parameter buffer is %#x.\n", > + params_id); > + > + > +vas = vaCreateBuffer(ctx->hwctx->display, ctx->va_context, > + VAProcPipelineParameterBufferType, > + sizeof(*subpic_params), 1, subpic_params, > &subpic_params_id); > +if (vas != VA_STATUS_SUCCESS) { > +av_log(avctx, AV_LOG_ERROR, "Failed to create parameter buffer: " > + "%d (%s).\n", vas, vaErrorStr(vas)); > +err = AVERROR(EIO); > +goto fail_after_begin; > +} > +av_log(avctx, AV_LOG_DEBUG, "Pipeline subpic parameter buffer is %#x.\n", > + subpic_params_id); > + > +vas = vaRenderPicture(ctx->hwctx->display, ctx->va_context, > + ¶ms_id, 1); > +if (vas != VA_STATUS_SUCCESS) { > +av_log(avctx, AV_LOG_ERROR, "Failed to render parameter buffer: " > + "%d (%s).\n", vas, vaErrorStr(vas)); > +err = AVERROR(EIO); > +goto fail_after_begin; > +} > + > +vas = vaRenderPicture(ctx->hwctx->display, ctx->va_context, > + &subpic_params_id, 1); > +if (vas != VA_STATUS_SUCCESS) { > +av_log(avctx, AV_LOG_ERROR, "Failed to render subpic parameter > buffer: " > + "%d (%s).\n", vas, vaErrorStr(vas)); > +err = AVERROR(EIO); > +goto fail_after_begin; > +} > + > +
Re: [FFmpeg-devel] [PATCH v2] avfilter/vaapi: add overlay_vaapi filter
> -Original Message- > From: Zhou, Zachary > Sent: Tuesday, June 11, 2019 10:52 AM > To: ffmpeg-devel@ffmpeg.org > Cc: Zhou, Zachary > Subject: [PATCH v2] avfilter/vaapi: add overlay_vaapi filter > > --- > configure | 1 + > libavfilter/Makefile | 1 + > libavfilter/allfilters.c | 1 + > libavfilter/vaapi_vpp.c| 95 + > libavfilter/vaapi_vpp.h| 5 + > libavfilter/vf_overlay_vaapi.c | 357 + > 6 files changed, 460 insertions(+) > create mode 100644 libavfilter/vf_overlay_vaapi.c > Hi Mark, Can you help to review this patch ? Thanks Zachary ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/3] avcodec/iff: Check bpp for validity
Fixes: shift exponent -100663046 is negative Fixes: out of array access Fixes: 15270/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IFF_ILBM_fuzzer-5727829913763840 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/iff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/iff.c b/libavcodec/iff.c index 33cf2e3a94..48a0340604 100644 --- a/libavcodec/iff.c +++ b/libavcodec/iff.c @@ -382,7 +382,7 @@ static av_cold int decode_init(AVCodecContext *avctx) IffContext *s = avctx->priv_data; int err; -if (avctx->bits_per_coded_sample <= 8) { +if (avctx->bits_per_coded_sample <= 8U) { int palette_size; if (avctx->extradata_size >= 2) @@ -391,7 +391,7 @@ static av_cold int decode_init(AVCodecContext *avctx) palette_size = 0; avctx->pix_fmt = (avctx->bits_per_coded_sample < 8) || (avctx->extradata_size >= 2 && palette_size) ? AV_PIX_FMT_PAL8 : AV_PIX_FMT_GRAY8; -} else if (avctx->bits_per_coded_sample <= 32) { +} else if (avctx->bits_per_coded_sample <= 32U) { if (avctx->codec_tag == MKTAG('R', 'G', 'B', '8')) { avctx->pix_fmt = AV_PIX_FMT_RGB32; } else if (avctx->codec_tag == MKTAG('R', 'G', 'B', 'N')) { -- 2.21.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 3/3] avcodec/alac: Check lpc_quant
lpc_quant of 0 produces undefined behavior, thus disallow this. If valid samples use this then such a sample would be quite usefull to confirm the correct&lossles handling of this. Fixes: libavcodec/alac.c:218:25: runtime error: shift exponent -1 is negative Fixes: 15273/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-5656388535058432 Fixes: 15276/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-5761238417539072 Fixes: 15315/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALAC_fuzzer-5767260766994432 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/alac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/alac.c b/libavcodec/alac.c index 2f44340661..c234d7153b 100644 --- a/libavcodec/alac.c +++ b/libavcodec/alac.c @@ -306,7 +306,7 @@ static int decode_element(AVCodecContext *avctx, AVFrame *frame, int ch_index, rice_history_mult[ch] = get_bits(&alac->gb, 3); lpc_order[ch] = get_bits(&alac->gb, 5); -if (lpc_order[ch] >= alac->max_samples_per_frame) +if (lpc_order[ch] >= alac->max_samples_per_frame || !lpc_quant[ch]) return AVERROR_INVALIDDATA; /* read the predictor table */ -- 2.21.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/3] avformat/vqf: Check header_size
Fixes: 15271/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5735262606327808 Fixes: signed integer overflow: -2147483648 - 8 cannot be represented in type 'int' Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavformat/vqf.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavformat/vqf.c b/libavformat/vqf.c index a58992318a..755849bac7 100644 --- a/libavformat/vqf.c +++ b/libavformat/vqf.c @@ -107,6 +107,9 @@ static int vqf_read_header(AVFormatContext *s) header_size = avio_rb32(s->pb); +if (header_size < 0) +return AVERROR_INVALIDDATA; + st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->codec_id = AV_CODEC_ID_TWINVQ; st->start_time = 0; @@ -120,7 +123,7 @@ static int vqf_read_header(AVFormatContext *s) len = avio_rb32(s->pb); -if ((unsigned) len > INT_MAX/2) { +if ((unsigned) len > INT_MAX/2 || header_size < 8) { av_log(s, AV_LOG_ERROR, "Malformed header\n"); return -1; } -- 2.21.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: enhanced %v handling with variant names
this patch assumes/requires my previous patch to be applied 2019 jun 17 [PATCH] av_format/hlsenc: fix %v handling by format_name function best, Bela ___ 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] avformat/hlsenc: enhanced %v handling with variant names
Dear All, When multiple variant streams are specified by var_stream_map option, %v placeholder in various names ensures that each variant has its unique names. Currently %v is substituted by its variant index value (0, 1, 2 etc.). In some use cases it would be handy to specify names for variants instead of numerical indexes. This patch makes it possible to use names instead of default indexes. In var_stream_map option each or some of the variant streams may use an optional name attributum (e.g. -var_stream_map "v:0,a:0,name:sd v:1,a:1,name:720p") If a name is specified for a variant, then this name value will be used as substitution value of %v instead of the default index value. example: ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \ -map 0:v:0 -map 0:a:0 -map 0:v:1 -map 0:a:1 -f hls -var_stream_map "v:0,a:0,name:my_hd v:1,a:1,name:mysd" \ http://example.com/live/out_%v.m3u8 This example creates two hls variant streams, the two output media playlist with file names out_my_hd.m3u8 and out_mysd.m3u8 will be created. Please review this patch. best regards, Bela >From 690670d8c66fce71662292b44b9927a7f46917b5 Mon Sep 17 00:00:00 2001 From: Bela Bodecs Date: Tue, 18 Jun 2019 22:44:49 +0200 Subject: [PATCH] avformat/hlsenc: enhanced %v handling with variant names When multiple variant streams are specified by var_stream_map option, %v placeholder in various names ensures that each variant has its unique names. Currently %v is substituted by its variant index value (0, 1, 2 etc.). In some use cases it would be handy to specify names for variants instead of numerical indexes. This patch makes it possible to use names instead of default indexes. In var_stream_map option each or some of the variant streams may use an optional name attributum (e.g. -var_stream_map "v:0,a:0,name:sd v:1,a:1,name:720p") If a name is specified for a variant, then this name value will be used as substitution value of %v instead of the default index value. Signed-off-by: Bela Bodecs --- doc/muxers.texi | 16 +++- libavformat/hlsenc.c | 95 +--- 2 files changed, 95 insertions(+), 16 deletions(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index 50147c4d20..8370b6dc2e 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -943,7 +943,21 @@ This example creates two hls variant streams. The first variant stream will contain video stream of bitrate 1000k and audio stream of bitrate 64k and the second variant stream will contain video stream of bitrate 256k and audio stream of bitrate 32k. Here, two media playlist with file names out_0.m3u8 and -out_1.m3u8 will be created. +out_1.m3u8 will be created. If you want something meaningful text instead of indexes +in result names, you may specify names for each or some of the variants +as in the following example. + + +@example +ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \ + -map 0:v -map 0:a -map 0:v -map 0:a -f hls -var_stream_map "v:0,a:0,name:my_hd v:1,a:1,name:mysd" \ + http://example.com/live/out_%v.m3u8 +@end example + +This example creates two hls variant streams as in the previous one. +But here, the two media playlist with file names out_my_hd.m3u8 and +out_mysd.m3u8 will be created. + @example ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k \ -map 0:v -map 0:a -map 0:v -f hls -var_stream_map "v:0 a:0 v:1" \ diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 6d00a70041..f88b8a9618 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -164,6 +164,7 @@ typedef struct VariantStream { char *agroup; /* audio group name */ char *ccgroup; /* closed caption group name */ char *baseurl; +char *varname; // variant name } VariantStream; typedef struct ClosedCaptionsStream { @@ -340,6 +341,47 @@ fail: return; } +static int replace_str_data_in_filename(char **s, const char *filename, char placeholder, const char *datastring) +{ +const char *p; +char *new_filename; +char c; +int addchar_count; +int found_count = 0; +AVBPrint buf; + +av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED); + +p = filename; +for (;;) { +c = *p; +if (c == '\0') +break; +if (c == '%' && *(p+1) == '%') // %% +addchar_count = 2; +else if (c == '%' && *(p+1) == placeholder) { +av_bprintf(&buf, "%s", datastring); +p += 2; +addchar_count = 0; +found_count ++; +} else +addchar_count = 1; + +if (addchar_count > 0) { +av_bprint_append_data(&buf, p, addchar_count); +p += addchar_count; +} +} +if (!av_bprint_is_complete(&buf)) { +av_bprint_finalize(&buf, NULL); +return -1; +} +if (av_bprint_finalize(&buf, &new_filename) < 0 || !new_filename) +return -1; +*s = new_filename; +return found_count; +} + static
[FFmpeg-devel] [PATCH] avcodec/videodsp_template: Fix overflow of addition
Fixes: addition of unsigned offset to 0x7f56fc26a9b6 overflowed to 0x7f56fc26a8be* Fixes: clusterfuzz-testcase-minimized-mediasource_MP4_AVC1_pipeline_integration_fuzzer-4917949056679936 Reported-by: Matt Wolenetz Reviewed-by: Matt Wolenetz Signed-off-by: Michael Niedermayer --- libavcodec/videodsp_template.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/videodsp_template.c b/libavcodec/videodsp_template.c index 94c1b7188d..eae2f1d51b 100644 --- a/libavcodec/videodsp_template.c +++ b/libavcodec/videodsp_template.c @@ -44,7 +44,7 @@ void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src, src_y = 1 - block_h; } if (src_x >= w) { -src += (w - 1 - src_x) * sizeof(pixel); +src -= (1 + src_x - w) * sizeof(pixel); src_x = w - 1; } else if (src_x <= -block_w) { src += (1 - block_w - src_x) * sizeof(pixel); -- 2.21.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avformat/segment: fix muxing tmcd tracks in MOV
Fixes crash when muxing tmcd tracks. Gyan From d056439a43989c4f2f2e2fdf23ed1e780b56f7f4 Mon Sep 17 00:00:00 2001 From: Gyan Doshi Date: Tue, 18 Jun 2019 19:22:16 +0530 Subject: [PATCH] avformat/segment: fix muxing tmcd tracks in MOV avformat/movenc still relies on AVCodecContext time_base to mux tmcd tracks and segment muxer did not copy that field to inner streams leading to SIGFPE in the child muxer instance. --- libavformat/segment.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/libavformat/segment.c b/libavformat/segment.c index 99f048aa39..e3082063d8 100644 --- a/libavformat/segment.c +++ b/libavformat/segment.c @@ -181,6 +181,12 @@ static int segment_mux_init(AVFormatContext *s) st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio; st->time_base = s->streams[i]->time_base; st->avg_frame_rate = s->streams[i]->avg_frame_rate; +#if FF_API_LAVF_AVCTX +FF_DISABLE_DEPRECATION_WARNINGS +if (s->streams[i]->codecpar->codec_tag == MKTAG('t','m','c','d')) +st->codec->time_base = s->streams[i]->codec->time_base; +FF_ENABLE_DEPRECATION_WARNINGS +#endif av_dict_copy(&st->metadata, s->streams[i]->metadata, 0); } -- 2.22.0___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avformat/segment: fix increment_tc
On 17-06-2019 01:32 PM, Gyan wrote: On 15-06-2019 04:57 PM, Gyan wrote: On 14-06-2019 10:45 PM, Gyan wrote: Fixes an issue brought to my attention at Super User. v2 fixes inadvertent stream TC creation when non existed. Plan to push tomorrow. Pushed as 2fdbeb0b8cc3b80cf45674522c4867eeb985f274 Gyan ___ 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] Frame duplication support in FFMPEG for progressive frames' pulldown in HEVC
Hi all, Is there a support to handle pulldown feature of progressive HEVC streams in FFMPEG? FFMPEG already handles it for H.264 streams. Command line used to verify this in x264: x264.exe CIF_5frames_1fps.y4m --bframes 0 --fps 1 -o single.264 x264.exe CIF_5frames_1fps.y4m --bframes 0 --pulldown double -o double.264 "ffmpeg -i single.264" shows: Stream #0:0: Video: h264 (High), yuv420p(progressive), 352x288, 1 fps, 1 tbr, 1200k tbn, 2 tbc "ffmpeg -i double.264 shows: Stream #0:0: Video: h264 (High), yuv420p(progressive), 352x288, 1.67 fps, 2 tbr, 1200k tbn, 4 tbc Decoding using ffmpeg: ffmpeg -i single.264 -c:v rawvideo single.264.yuv (Gives 5 frames) ffmpeg -i double.264 -c:v rawvideo double.264.yuv (Gives 8 frames) The same doesn't work with x265 when I make param->pictureStructure=7 for HEVC frame doubling. Kindly let us know if there is a plan to implement handling of HEVC pulldown feature in FFMPEG? Thanks & Regards, Praveen Karadugattu ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 1/2] avcodec/bink: Fix integer overflow in unquantize_dct_coeffs()
Fixes: signed integer overflow: -3447 * 2883584 cannot be represented in type 'int' Fixes: 15265/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BINK_fuzzer-5088311799971840 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/bink.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/bink.c b/libavcodec/bink.c index 8392bbeeb0..d18c0ceae4 100644 --- a/libavcodec/bink.c +++ b/libavcodec/bink.c @@ -702,15 +702,15 @@ static int read_dct_coeffs(BinkContext *c, GetBitContext *gb, int32_t block[64], return quant_idx; } -static void unquantize_dct_coeffs(int32_t block[64], const int32_t quant[64], +static void unquantize_dct_coeffs(int32_t block[64], const uint32_t quant[64], int coef_count, int coef_idx[64], const uint8_t *scan) { int i; -block[0] = (block[0] * quant[0]) >> 11; +block[0] = (int)(block[0] * quant[0]) >> 11; for (i = 0; i < coef_count; i++) { int idx = coef_idx[i]; -block[scan[idx]] = (block[scan[idx]] * quant[idx]) >> 11; +block[scan[idx]] = (int)(block[scan[idx]] * quant[idx]) >> 11; } } -- 2.21.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH 2/2] avcodec/binkdsp: Fix integer overflows in idct
Fixes: signed integer overflow: 3784 * 682038 cannot be represented in type 'int' Fixes: 15265/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BINK_fuzzer-5088311799971840 Fixes: 15268/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BINK_fuzzer-5666502344179712 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/binkdsp.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libavcodec/binkdsp.c b/libavcodec/binkdsp.c index 9d70e2326f..a357d31672 100644 --- a/libavcodec/binkdsp.c +++ b/libavcodec/binkdsp.c @@ -33,20 +33,22 @@ #define A3 3784 #define A4 -5352 +#define MUL(X,Y) ((int)((unsigned)(X) * (Y)) >> 11) + #define IDCT_TRANSFORM(dest,s0,s1,s2,s3,s4,s5,s6,s7,d0,d1,d2,d3,d4,d5,d6,d7,munge,src) {\ const int a0 = (src)[s0] + (src)[s4]; \ const int a1 = (src)[s0] - (src)[s4]; \ const int a2 = (src)[s2] + (src)[s6]; \ -const int a3 = (A1*((src)[s2] - (src)[s6])) >> 11; \ +const int a3 = MUL(A1, (src)[s2] - (src)[s6]); \ const int a4 = (src)[s5] + (src)[s3]; \ const int a5 = (src)[s5] - (src)[s3]; \ const int a6 = (src)[s1] + (src)[s7]; \ const int a7 = (src)[s1] - (src)[s7]; \ const int b0 = a4 + a6; \ -const int b1 = (A3*(a5 + a7)) >> 11; \ -const int b2 = ((A4*a5) >> 11) - b0 + b1; \ -const int b3 = (A1*(a6 - a4) >> 11) - b2; \ -const int b4 = ((A2*a7) >> 11) + b3 - b1; \ +const int b1 = MUL(A3, a5 + a7); \ +const int b2 = MUL(A4, a5) - b0 + b1; \ +const int b3 = MUL(A1, a6 - a4) - b2; \ +const int b4 = MUL(A2, a7) + b3 - b1; \ (dest)[d0] = munge(a0+a2 +b0); \ (dest)[d1] = munge(a1+a3-a2+b2); \ (dest)[d2] = munge(a1-a3+a2+b3); \ -- 2.21.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] set AVFrame decode_error_flags to FF_DECODE_ERROR_CONCEALMENT_ACTIVE in case of concealed errors
Thanks Michael, The reason I set the flag before the log line in ff_er_frame_end is because the code might never get there even though the return value is set to zero. Should we use two different values ? Thanks Amir On Sun, Jun 16, 2019 at 10:53 AM Michael Niedermayer wrote: > On Fri, Jun 14, 2019 at 07:43:46AM -0700, Amir Pauker wrote: > > set AVFrame decode_error_flags to FF_DECODE_ERROR_CONCEALMENT_ACTIVE in > case > > h->slice_ctx->er.error_occurred is set after the call to > ff_h264_execute_decode_slices. > > This allows the user to detect concealed decoding errors in the call to > avcodec_receive_frame > > > > Signed-off-by: Amir Pauker > > --- > > libavcodec/h264dec.c | 5 + > > 1 file changed, 5 insertions(+) > > > > diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c > > index 837c3b7..98b7d79 100644 > > --- a/libavcodec/h264dec.c > > +++ b/libavcodec/h264dec.c > > @@ -761,6 +761,11 @@ static int decode_nal_units(H264Context *h, const > uint8_t *buf, int buf_size) > > if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE)) > > goto end; > > > > +// set decode_error_flags to allow users to detect concealed > decoding errors > > +if ((ret < 0 || h->slice_ctx->er.error_occurred) && h->cur_pic_ptr) > { > > +h->cur_pic_ptr->f->decode_error_flags |= > FF_DECODE_ERROR_CONCEALMENT_ACTIVE; > > +} > > + > > it would be more robust to set the flag around where the > "concealing %d DC, %d AC, %d MV errors in %c frame\" message is printed > > That is when concealing actually happens > > thanks > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > Avoid a single point of failure, be that a person or equipment. > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v1 1/2] libavformat/avio: Fix for the unexpected file close which will cause fd 0 is closed
From: Limin Wang Signed-off-by: Limin Wang --- libavformat/avio.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavformat/avio.c b/libavformat/avio.c index 663789ec02..c1d10ee8c3 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -568,7 +568,6 @@ int avio_open_dir(AVIODirContext **s, const char *url, AVDictionary **options) fail: av_free(ctx); *s = NULL; -ffurl_close(h); return ret; } @@ -594,7 +593,6 @@ int avio_close_dir(AVIODirContext **s) return AVERROR(EINVAL); h = (*s)->url_context; h->prot->url_close_dir(h); -ffurl_close(h); av_freep(s); *s = NULL; return 0; -- 2.21.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v1 2/2] libavformat/file: initilize the fd to -1 instead of 0(valid fd) in case unexpected file close
From: Limin Wang Signed-off-by: Limin Wang --- libavformat/file.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/file.c b/libavformat/file.c index 08c7f8e6dd..40ae9ad2a8 100644 --- a/libavformat/file.c +++ b/libavformat/file.c @@ -274,6 +274,7 @@ static int file_open_dir(URLContext *h) #if HAVE_LSTAT FileContext *c = h->priv_data; +c->fd = -1; c->dir = opendir(h->filename); if (!c->dir) return AVERROR(errno); -- 2.21.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] movenc: calculate track_duration without packet duration
On 17/06/2019 10:23, Gyan wrote: On 17-06-2019 01:37 PM, Alfred E. Heggestad wrote: From c69b63a7af5531257753754e64ac33b7ef530e75 Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" Date: Mon, 17 Jun 2019 10:04:08 +0200 Subject: [PATCH] movenc: calculate track_duration without packet duration --- libavformat/movenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 46d314ff17..fa5833962b 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -5486,7 +5486,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) "this case.\n", pkt->stream_index, pkt->dts); } - trk->track_duration = pkt->dts - trk->start_dts + pkt->duration; + trk->track_duration = pkt->dts - trk->start_dts; Why? trk->last_sample_is_subtitle_end = 0; if (pkt->pts == AV_NOPTS_VALUE) { the background for this change is the check done in check_pkt(): if (trk->entry) { ref = trk->cluster[trk->entry - 1].dts; } else if ( trk->start_dts != AV_NOPTS_VALUE && !trk->frag_discont) { ref = trk->start_dts + trk->track_duration; } else ref = pkt->dts; // Skip tests for the first packet if (trk->dts_shift != AV_NOPTS_VALUE) { /* With negative CTS offsets we have set an offset to the DTS, * reverse this for the check. */ ref -= trk->dts_shift; } duration = pkt->dts - ref; if (pkt->dts < ref || duration >= INT_MAX) { av_log(s, AV_LOG_ERROR, "Application provided duration: %"PRId64" / timestamp: %"PRId64" is out of range for mov/mp4 format\n", duration, pkt->dts ); pkt->dts = ref + 1; pkt->pts = AV_NOPTS_VALUE; } it requires that the DTS of the packet is larger than "ref" which in some cases is equal to track_duration. line 5015: track->track_duration = pkt.dts - track->start_dts; line 5489: trk->track_duration = pkt->dts - trk->start_dts + pkt->duration; line 5615: trk->track_duration = pkt->dts - trk->start_dts; setting track_duration is inconsistent; some times it includes duration and some times not. here is an example with a stream of AVPacket's that increment the DTS by approx. 10 (and duration is set to 0): pkt: dts: 1 0 210 320 430 540 650 after packet 6 has arrived, the "ref" value in check_pkt will now be calculated to 50 + 10 = 60. the code assumes a duration of 10. when packet 7 arrives it has a DTS of 59 (which is valid). but this packet will fail in check_pkt and print a warning, because 59 < 60. /alfred ___ 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] dash: change default MP4 extension to .m4s
On 18/06/2019 04:02, Steven Liu wrote: Alfred E. Heggestad 于2019年6月17日周一 下午4:02写道: From 923da82598bddd1ed05750427dbc71e607d296a2 Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" Date: Mon, 17 Jun 2019 09:59:04 +0200 Subject: [PATCH] dash: change default MP4 extension to .m4s this was changed in commit 281a21ed50849e3c8c0d03005230e9fd07c24370 --- libavformat/dashenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 3fd7e78166..a51a1da0ca 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -166,7 +166,7 @@ static struct format_string { const char *str; } formats[] = { { SEGMENT_TYPE_AUTO, "auto" }, -{ SEGMENT_TYPE_MP4, "mp4" }, +{ SEGMENT_TYPE_MP4, "m4s" }, { SEGMENT_TYPE_WEBM, "webm" }, { 0, NULL } }; -- 2.20.1 (Apple Git-117) ___ 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". LGTM the background for this is the extension for DASH media files used to be *.m4s and it is now *.mp4 the patch is a suggestion and should be checked by the DASH experts what is correct according to the standard ? the media-file is not really an .mp4 file, it cannot be played with e.g. ffplay: $ ffplay chunk-stream1-1.m4s /alfred ___ 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, v4 1/2] lavf/qsvvpp:allocate continuous memory
From: Max Dmitrichenko [mailto:maxim@gmail.com] Sent: Tuesday, June 18, 2019 15:06 To: FFmpeg development discussions and patches Cc: Fu, Linjie Subject: Re: [FFmpeg-devel] [PATCH, v4 1/2] lavf/qsvvpp:allocate continuous memory On Tue, Jun 18, 2019 at 9:52 AM Linjie Fu mailto:linjie...@intel.com>> wrote: Mediasdk calls CMRT to copy from video to system memory and requires memory to be continuously allocated across Y and UV. Add a new path to allocate continuous memory when using system out. Use get_continuous_buffer to arrange data according to pixfmt. it would be good to keep such continuous allocations consistent with encoder's implementation, see https://github.com/FFmpeg/FFmpeg/blob/8f6e65183354d1d402ae80c71cba2759fe152018/libavcodec/qsvenc.c#L1218 if needed, needs to be checked before re-allocation. Thanks for the advice and I agree consistency is important. And I’ve thought about the behavior in qsvenc.c as well to make sure the memory is continuous. However, I got some concerns: 1. av_frame_get_buffer() will introduce plane_padding, and it will lead to un-continuous data[0]/data[1]; And the paddings will lead to wrong offset of U/V, and will cause garbage on chroma filed of image. (when using mirror methods) So I choose to use get_continuous_buffer() which is similar but introduced no paddings. 2. Since here is the first the position to allocate memory for output frame, directly allocate a continuous memory seems to be good IMHO. Thanks, Linjie ___ 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] lavf/qsv_scale: add scaling modes support
low_power mode will use a fixed HW engine (SFC), thus can offload EU usage. high quality mode will take EU usage (AVS sampler). Performance and EU usage (Render usage) comparsion on Intel(R) Xeon(R) CPU E3-1225 v5 @ 3.30GHz: High quality mode : ffmpeg -hwaccel qsv -c:v h264_qsv -i bbb_sunflower_1080p_30fps_normal_2000frames.h264 \ -vf scale_qsv=w=1280:h=736:mode=hq -f null - fps=389 RENDER usage: 28.10 (provided by MSDK metrics_monitor) Low Power mode: ffmpeg -hwaccel qsv -c:v h264_qsv -i ~/bbb_sunflower_1080p_30fps_normal_2000frames.h264 \ -vf scale_qsv=w=1280:h=736:mode=low_power -f null - fps=343 RENDER usage: 0.00 Low power mode (SFC) may be disabled if not supported by MSDK/Driver/HW, and replaced by AVS mode interanlly. Signed-off-by: Zhong Li --- libavfilter/vf_scale_qsv.c | 40 +++- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/libavfilter/vf_scale_qsv.c b/libavfilter/vf_scale_qsv.c index db7715f..499534e 100644 --- a/libavfilter/vf_scale_qsv.c +++ b/libavfilter/vf_scale_qsv.c @@ -69,6 +69,8 @@ enum var_name { VARS_NB }; +#define QSV_HAVE_SCALING_CONFIG QSV_VERSION_ATLEAST(1, 19) + typedef struct QSVScaleContext { const AVClass *class; @@ -88,7 +90,14 @@ typedef struct QSVScaleContext { int nb_surface_ptrs_out; mfxExtOpaqueSurfaceAlloc opaque_alloc; -mfxExtBuffer*ext_buffers[1]; + +#if QSV_HAVE_SCALING_CONFIG +mfxExtVPPScaling scale_conf; +#endif +int mode; + +mfxExtBuffer *ext_buffers[1 + QSV_HAVE_SCALING_CONFIG]; +int num_ext_buf; int shift_width, shift_height; @@ -285,6 +294,8 @@ static int init_out_session(AVFilterContext *ctx) mfxStatus err; int i; +s->num_ext_buf = 0; + /* extract the properties of the "master" session given to us */ err = MFXQueryIMPL(device_hwctx->session, &impl); if (err == MFX_ERR_NONE) @@ -357,10 +368,7 @@ static int init_out_session(AVFilterContext *ctx) s->opaque_alloc.Header.BufferId = MFX_EXTBUFF_OPAQUE_SURFACE_ALLOCATION; s->opaque_alloc.Header.BufferSz = sizeof(s->opaque_alloc); -s->ext_buffers[0] = (mfxExtBuffer*)&s->opaque_alloc; - -par.ExtParam= s->ext_buffers; -par.NumExtParam = FF_ARRAY_ELEMS(s->ext_buffers); +s->ext_buffers[s->num_ext_buf++] = (mfxExtBuffer*)&s->opaque_alloc; par.IOPattern = MFX_IOPATTERN_IN_OPAQUE_MEMORY | MFX_IOPATTERN_OUT_OPAQUE_MEMORY; } else { @@ -396,6 +404,18 @@ static int init_out_session(AVFilterContext *ctx) par.IOPattern = MFX_IOPATTERN_IN_VIDEO_MEMORY | MFX_IOPATTERN_OUT_VIDEO_MEMORY; } +#if QSV_HAVE_SCALING_CONFIG +memset(&s->scale_conf, 0, sizeof(mfxExtVPPScaling)); +s->scale_conf.Header.BufferId = MFX_EXTBUFF_VPP_SCALING; +s->scale_conf.Header.BufferSz = sizeof(mfxExtVPPScaling); +s->scale_conf.ScalingMode = s->mode; +s->ext_buffers[s->num_ext_buf++] = (mfxExtBuffer*)&s->scale_conf; +av_log(ctx, AV_LOG_VERBOSE, "Scaling mode: %"PRIu16"\n", s->mode); +#endif + +par.ExtParam= s->ext_buffers; +par.NumExtParam = s->num_ext_buf; + par.AsyncDepth = 1;// TODO async par.vpp.In = in_frames_hwctx->surfaces[0].Info; @@ -595,6 +615,16 @@ static const AVOption options[] = { { "h", "Output video height", OFFSET(h_expr), AV_OPT_TYPE_STRING, { .str = "ih" }, .flags = FLAGS }, { "format", "Output pixel format", OFFSET(format_str), AV_OPT_TYPE_STRING, { .str = "same" }, .flags = FLAGS }, +#if QSV_HAVE_SCALING_CONFIG +{ "mode", "set scaling mode",OFFSET(mode),AV_OPT_TYPE_INT, { .i64 = MFX_SCALING_MODE_DEFAULT}, MFX_SCALING_MODE_DEFAULT, MFX_SCALING_MODE_QUALITY, FLAGS, "mode"}, +{ "low_power", "low power mode",0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_LOWPOWER}, INT_MIN, INT_MAX, FLAGS, "mode"}, +{ "hq","high quality mode", 0, AV_OPT_TYPE_CONST, { .i64 = MFX_SCALING_MODE_QUALITY}, INT_MIN, INT_MAX, FLAGS, "mode"}, +#else +{ "mode", "(not supported)", OFFSET(mode),AV_OPT_TYPE_INT, { .i64 = 0}, 0, INT_MAX, FLAGS, "mode"}, +{ "low_power", "", 0, AV_OPT_TYPE_CONST, { .i64 = 1}, 0, 0, FLAGS, "mode"}, +{ "hq","", 0, AV_OPT_TYPE_CONST, { .i64 = 2}, 0, 0, FLAGS, "mode"}, +#endif + { NULL }, }; -- 2.7.4 ___ 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] libavformat/segment: add an option to split the rest of stream after the segment_times is set
Hi all: Add an option to split the rest of stream after the segment_times is set. It's very useful to set the first some segments to a little small, and then split with a clear duration. The code is simple, but i'm not good at writing the document. From cd90b0b552223c78741eecb6cbdd13a4ae8f3e57 Mon Sep 17 00:00:00 2001 From: hectorqin Date: Tue, 18 Jun 2019 15:03:21 +0800 Subject: [PATCH] Add libavformat segment_rest_duration option, ignore VSCode editor files --- .gitignore| 1 + doc/muxers.texi | 5 + libavformat/segment.c | 21 +++-- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 0e57cb0b4c..33f8693522 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,4 @@ /lcov/ /src /mapfile +/.vscode \ No newline at end of file diff --git a/doc/muxers.texi b/doc/muxers.texi index 50147c4d20..38f773c055 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -1912,6 +1912,11 @@ Specify a list of split points. @var{times} contains a list of comma separated duration specifications, in increasing order. See also the @option{segment_time} option. +@item segment_rest_duration @var{rest_duration} +Set the rest segment duration to @var{rest_duration} when the @var{segment_times} is set, the value must be a duration +specification. Default value is "0", which means don't split the rest part. See also the +@option{segment_time} option. + @item segment_frames @var{frames} Specify a list of split video frame numbers. @var{frames} contains a list of comma separated integer numbers, in increasing order. diff --git a/libavformat/segment.c b/libavformat/segment.c index 6e37707f9f..0d22549296 100644 --- a/libavformat/segment.c +++ b/libavformat/segment.c @@ -100,6 +100,9 @@ typedef struct SegmentContext { int64_t *times;///< list of segment interval specification int nb_times; ///< number of elments in the times array +char *rest_duration_str; ///< rest segment duration specification string +int64_t rest_duration; ///< rest segment duration + char *frames_str; ///< segment frame numbers specification string int *frames; ///< list of frame number specification int nb_frames; ///< number of elments in the frames array @@ -675,6 +678,14 @@ static int seg_init(AVFormatContext *s) if (seg->times_str) { if ((ret = parse_times(s, &seg->times, &seg->nb_times, seg->times_str)) < 0) return ret; +if (seg->rest_duration_str) { +if ((ret = av_parse_time(&seg->rest_duration, seg->rest_duration_str, 1)) < 0) { +av_log(s, AV_LOG_ERROR, +"Invalid time duration specification '%s' for segment_rest_duration option\n", +seg->rest_duration_str); +return ret; +} +} } else if (seg->frames_str) { if ((ret = parse_frames(s, &seg->frames, &seg->nb_frames, seg->frames_str)) < 0) return ret; @@ -875,8 +886,13 @@ static int seg_write_packet(AVFormatContext *s, AVPacket *pkt) calc_times: if (seg->times) { -end_pts = seg->segment_count < seg->nb_times ? -seg->times[seg->segment_count] : INT64_MAX; +if (seg->segment_count < seg->nb_times) { +end_pts = seg->times[seg->segment_count]; +} else if (seg->rest_duration > 0) { +end_pts = seg->times[seg->nb_times - 1] + seg->rest_duration * (seg->segment_count + 1 - seg->nb_times); +} else { +end_pts = INT64_MAX; +} } else if (seg->frames) { start_frame = seg->segment_count < seg->nb_frames ? seg->frames[seg->segment_count] : INT_MAX; @@ -1061,6 +1077,7 @@ static const AVOption options[] = { { "segment_time", "set segment duration", OFFSET(time_str),AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E }, { "segment_time_delta","set approximation value used for the segment times", OFFSET(time_delta), AV_OPT_TYPE_DURATION, {.i64 = 0}, 0, INT64_MAX, E }, { "segment_times", "set segment split time points", OFFSET(times_str),AV_OPT_TYPE_STRING,{.str = NULL}, 0, 0, E }, +{ "segment_rest_duration", "set rest segment duration after out of the segment_times", OFFSET(rest_duration_str), AV_OPT_TYPE_STRING,{.str = NULL}, 0, 0, E }, { "segment_frames","set segment split frame numbers", OFFSET(frames_str),AV_OPT_TYPE_STRING,{.str = NULL}, 0, 0, E }, { "segment_wrap", "set number after which the index wraps", OFFSET(segment_idx_wrap), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, E }, { "segment_list_entry_prefix", "set base url prefix for segments", OFFSET(entry_prefix), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E }, -- 2.17.2 (Apple Git-113) ___ ffmpeg-devel mailing list ffmpeg-d
Re: [FFmpeg-devel] [PATCH, v4 1/2] lavf/qsvvpp:allocate continuous memory
On Tue, Jun 18, 2019 at 9:52 AM Linjie Fu wrote: > Mediasdk calls CMRT to copy from video to system memory and requires > memory to be continuously allocated across Y and UV. > > Add a new path to allocate continuous memory when using system out. > Use get_continuous_buffer to arrange data according to pixfmt. > > it would be good to keep such continuous allocations consistent with encoder's implementation, see https://github.com/FFmpeg/FFmpeg/blob/8f6e65183354d1d402ae80c71cba2759fe152018/libavcodec/qsvenc.c#L1218 if needed, needs to be checked before re-allocation. > Signed-off-by: Linjie Fu > --- > libavfilter/qsvvpp.c | 67 > 1 file changed, 62 insertions(+), 5 deletions(-) > > diff --git a/libavfilter/qsvvpp.c b/libavfilter/qsvvpp.c > index 8d5ff2eb65..07fe53573d 100644 > --- a/libavfilter/qsvvpp.c > +++ b/libavfilter/qsvvpp.c > @@ -27,6 +27,7 @@ > #include "libavutil/hwcontext_qsv.h" > #include "libavutil/time.h" > #include "libavutil/pixdesc.h" > +#include "libavutil/imgutils.h" > > #include "internal.h" > #include "qsvvpp.h" > @@ -346,6 +347,57 @@ static QSVFrame *submit_frame(QSVVPPContext *s, > AVFilterLink *inlink, AVFrame *p > return qsv_frame; > } > > +static int get_continuous_buffer(AVFrame *frame, int align) > +{ > +const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format); > +int ret, i, padded_height; > + > +if (!desc) > +return AVERROR(EINVAL); > + > +if ((ret = av_image_check_size(frame->width, frame->height, 0, NULL)) > < 0) > +return ret; > + > +if (!frame->linesize[0]) { > +if (align <= 0) > +align = 32; /* STRIDE_ALIGN. Should be av_cpu_max_align() */ > + > +for (i=1; i<=align; i+=i) { > +ret = av_image_fill_linesizes(frame->linesize, frame->format, > + FFALIGN(frame->width, i)); > +if (ret < 0) > +return ret; > +if (!(frame->linesize[0] & (align-1))) > +break; > +} > + > +for (i = 0; i < 4 && frame->linesize[i]; i++) > +frame->linesize[i] = FFALIGN(frame->linesize[i], align); > +} > + > +padded_height = FFALIGN(frame->height, 64); > +if ((ret = av_image_fill_pointers(frame->data, frame->format, > padded_height, > + NULL, frame->linesize)) < 0) > +return ret; > + > +frame->buf[0] = av_buffer_alloc(ret); > +if (!frame->buf[0]) { > +ret = AVERROR(ENOMEM); > +goto fail; > +} > + > +if ((ret = av_image_fill_pointers(frame->data, frame->format, > padded_height, > + frame->buf[0]->data, > frame->linesize)) < 0) > +goto fail; > + > +frame->extended_data = frame->data; > + > +return 0; > +fail: > +av_frame_unref(frame); > +return ret; > +} > + > /* get the output surface */ > static QSVFrame *query_frame(QSVVPPContext *s, AVFilterLink *outlink) > { > @@ -375,15 +427,20 @@ static QSVFrame *query_frame(QSVVPPContext *s, > AVFilterLink *outlink) > out_frame->surface = (mfxFrameSurface1 > *)out_frame->frame->data[3]; > } else { > /* Get a frame with aligned dimensions. > - * Libmfx need system memory being 128x64 aligned */ > -out_frame->frame = ff_get_video_buffer(outlink, > - FFALIGN(outlink->w, 128), > - FFALIGN(outlink->h, 64)); > -if (!out_frame->frame) > + * Libmfx need system memory being 128x64 aligned > + * and continuously allocated across Y and UV */ > +out_frame->frame = av_frame_alloc(); > +if (!out_frame->frame) { > return NULL; > +} > > out_frame->frame->width = outlink->w; > out_frame->frame->height = outlink->h; > +out_frame->frame->format = outlink->format; > + > +ret = get_continuous_buffer(out_frame->frame, 128); > +if (ret < 0) > +return NULL; > > ret = map_frame_to_surface(out_frame->frame, >&out_frame->surface_internal); > -- > 2.17.1 > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". regards Max ___ 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".