Re: [FFmpeg-devel] [PATCH] area changed:in cfhd height initialization was buggy for chroma plane
Thanks, sure will take care next time :) On Fri, 16 Mar 2018, 20:26 Carl Eugen Hoyos, wrote: > 2018-03-16 11:27 GMT+01:00, Gagandeep Singh : > > From: Gagandeep Singh > > Thank you for the important patch! > > The first line of the commit message should not start with "area changed" > but something similar to "lavc/cfhd: " which means you can also remove > "cfhd" from the rest of the first line. > > > description:when the chroma_y_shift was not present, the FFALIGN used to > > round the height was unnecessary for 0 chroma shift in y direction. > > The word description is unnecessary. > Please mention ticket #6675, without it is impossible to ever do a > regression test. > > > --- > > libavcodec/cfhd.c | 6 +++--- > > > libavcodec/tests/codec_desc | Bin 0 -> 189776 bytes > > You should not add the file codec_desc to your commit... > > Thank you, Carl Eugen > ___ > 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
[FFmpeg-devel] [PATCH] lavfi: Add OpenCL avgblur filter
From: drfer3 Behaves like the existing avgblur filter, except working on OpenCL hardware frames. Takes exactly the same options. --- configure | 1 + libavfilter/Makefile| 2 + libavfilter/allfilters.c| 1 + libavfilter/opencl/avgblur.cl | 60 libavfilter/opencl_source.h | 1 + libavfilter/vf_avgblur_opencl.c | 318 6 files changed, 383 insertions(+) create mode 100644 libavfilter/opencl/avgblur.cl create mode 100644 libavfilter/vf_avgblur_opencl.c diff --git a/configure b/configure index 0c5ed07a07..481d338caf 100755 --- a/configure +++ b/configure @@ -3202,6 +3202,7 @@ aresample_filter_deps="swresample" ass_filter_deps="libass" atempo_filter_deps="avcodec" atempo_filter_select="rdft" +avgblur_opencl_filter_deps="opencl" azmq_filter_deps="libzmq" blackframe_filter_deps="gpl" boxblur_filter_deps="gpl" diff --git a/libavfilter/Makefile b/libavfilter/Makefile index fc16512e2c..1043b41d80 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -139,6 +139,8 @@ OBJS-$(CONFIG_ALPHAMERGE_FILTER) += vf_alphamerge.o OBJS-$(CONFIG_ASS_FILTER)+= vf_subtitles.o OBJS-$(CONFIG_ATADENOISE_FILTER) += vf_atadenoise.o OBJS-$(CONFIG_AVGBLUR_FILTER)+= vf_avgblur.o +OBJS-$(CONFIG_AVGBLUR_OPENCL_FILTER) += vf_avgblur_opencl.o opencl.o \ +opencl/avgblur.o OBJS-$(CONFIG_BBOX_FILTER) += bbox.o vf_bbox.o OBJS-$(CONFIG_BENCH_FILTER) += f_bench.o OBJS-$(CONFIG_BITPLANENOISE_FILTER) += vf_bitplanenoise.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index cc423af738..3f67e321bf 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -149,6 +149,7 @@ static void register_all(void) REGISTER_FILTER(ASS,ass,vf); REGISTER_FILTER(ATADENOISE, atadenoise, vf); REGISTER_FILTER(AVGBLUR,avgblur,vf); +REGISTER_FILTER(AVGBLUR_OPENCL, avgblur_opencl, vf); REGISTER_FILTER(BBOX, bbox, vf); REGISTER_FILTER(BENCH, bench, vf); REGISTER_FILTER(BITPLANENOISE, bitplanenoise, vf); diff --git a/libavfilter/opencl/avgblur.cl b/libavfilter/opencl/avgblur.cl new file mode 100644 index 00..4dc9f0ab3f --- /dev/null +++ b/libavfilter/opencl/avgblur.cl @@ -0,0 +1,60 @@ +/* + * Author: Dylan Fernando + * + * 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 + */ + + +__kernel void avgblur_horiz(__write_only image2d_t dst, +__read_only image2d_t src, +int rad) +{ +const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE | + CLK_FILTER_NEAREST); +int2 loc = (int2)(get_global_id(0), get_global_id(1)); +int2 size = (int2)(get_global_size(0), get_global_size(1)); + +int count = 0; +float4 acc = (float4)(0,0,0,0); + +for (int xx = max(0,loc.x-rad); xx < min(loc.x+rad+1,size.x); xx++) { +count++; +acc += read_imagef(src, sampler, (int2)(xx, loc.y)); +} + +write_imagef(dst, loc, acc / count); +} + +__kernel void avgblur_vert(__write_only image2d_t dst, + __read_only image2d_t src, + int radv) +{ +const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE | + CLK_FILTER_NEAREST); +int2 loc = (int2)(get_global_id(0), get_global_id(1)); +int2 size = (int2)(get_global_size(0), get_global_size(1)); + +int count = 0; +float4 acc = (float4)(0,0,0,0); + +for (int yy = max(0,loc.y-radv); yy < min(loc.y+radv+1,size.y); yy++) { +count++; +acc += read_imagef(src, sampler, (int2)(loc.x, yy)); +} + +write_imagef(dst, loc, acc / count); +} diff --git a/libavfilter/opencl_source.h b/libavfilter/opencl_source.h index 23cdfc6ac9..02bc1723b0 100644 --- a/libavfilter/opencl_source.h +++ b/libavfilter/opencl_source.h @@ -19,6 +19,7 @@ #ifndef AVFILTER_OPENCL_SOURCE_H #define AVFILTER_OPENCL_SOURCE_H +extern const char *ff_opencl_source_avgblur; extern const char *ff_opencl_source
[FFmpeg-devel] [PATCH] fate: add a dca_core bitstream filter test
Signed-off-by: James Almer --- tests/fate/dca.mak | 5 + 1 file changed, 5 insertions(+) diff --git a/tests/fate/dca.mak b/tests/fate/dca.mak index b1681c6b59..fad3a7529e 100644 --- a/tests/fate/dca.mak +++ b/tests/fate/dca.mak @@ -75,5 +75,10 @@ fate-dts_es: CMD = pcm -i $(TARGET_SAMPLES)/dts/dts_es.dts fate-dts_es: CMP = oneoff fate-dts_es: REF = $(SAMPLES)/dts/dts_es_2.pcm +FATE_DCA-$(call ALLYES, DTS_DEMUXER DTS_MUXER DCA_CORE_BSF) += fate-dca-core-bsf +fate-dca-core-bsf: CMD = md5pipe -i $(TARGET_SAMPLES)/dts/master_audio_7.1_24bit.dts -c:a copy -bsf:a dca_core -fflags +bitexact -f dts +fate-dca-core-bsf: CMP = oneline +fate-dca-core-bsf: REF = ca22b00d8c641cd168e2f7ca8d2f340e + FATE_SAMPLES_AUDIO += $(FATE_DCA-yes) fate-dca: $(FATE_DCA-yes) -- 2.16.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] MOV: center channel 'chan' metadata
Hi - I'm working with a post-production workflow to mux 5.1 wav audio into a mov file (each channel specified as a separate track), with correct channel assignments written as metadata. I'm able to get everything except for the Center channel to appear correctly when viewed in Quicktime, however the Center channel shows up as 'mono'. I'm using a command like this (other channels omitted for the sake of brevity): ffmpeg -i input.mov \ -i audio.wav \ -filter_complex "[1:0]pan=FC|c0=c0[FC]" \ -map 0:v \ -map "[FC]" \ -c:v copy \ -c:a pcm_s24le \ output.mov This ends up writing a 'chan' tag that indicates Mono content (MOV_CH_LAYOUT_MONO). If I use a different channel, such as "FL", it writes a value that Quicktime understands (layout=MOV_CH_LAYOUT_USE_BITMAP bitmap=0). After some tracing, it appears that this configuration comes from the layout defined in mov_ch_layout_map_1ch for a single center channel. This seems like intended functionality and not a bug, but unfortunately doesn't solve my issue. I previously noticed that ffmpeg doesn't currently support writing channel labels -- I've just submitted a patch to add this fallback when a layout isn't found (for a semi-related situation, DownmixLeft/DownmixRight => LeftTotal/RightTotal tracks). One potential solution I've found for this is adding a flag which exclusively writes using channel labels instead of layouts. I can cleanup and submit this patch if desired, which adds a -movflags use_channel_labels (Link #1 below). I don't know enough to be sure that this is the right approach; however, it does work and shows up correctly in Quicktime Pro. I'm looking for some advice here on the best path forward -- I'm more than happy to implement whatever is needed. Thanks, -Courtland [#1]: https://github.com/Frugality/FFmpeg/commit/5ed6413fc9b17fd1bdd25672e959e934799f7b53 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] mov: add channel label support
Adds the ability to support writing channel labels to mov files if the layout_tag fails, instead of printing a warning and skipping the tag. This fixes channels such as DL/DR, which will now write to LeftTotal/RightTotal instead of omitting the channel tag. --- Changelog | 1 + libavformat/mov_chan.c | 20 libavformat/mov_chan.h | 8 libavformat/movenc.c | 38 +++--- 4 files changed, 60 insertions(+), 7 deletions(-) diff --git a/Changelog b/Changelog index 32a93d916a..d9b46b6d78 100644 --- a/Changelog +++ b/Changelog @@ -48,6 +48,7 @@ version : - drmeter audio filter - hapqa_extract bitstream filter - movenc option to write track title metadata +- mov: write channel labels if channel layout is not found version 3.4: - deflicker video filter diff --git a/libavformat/mov_chan.c b/libavformat/mov_chan.c index 324dd5f913..4eb434a97b 100644 --- a/libavformat/mov_chan.c +++ b/libavformat/mov_chan.c @@ -478,6 +478,26 @@ uint64_t ff_mov_get_channel_layout(uint32_t tag, uint32_t bitmap) return layout_map[i].layout; } +uint32_t ff_mov_get_channel_label_tag(uint64_t channel) +{ +int i; + +if(channel == 0) +return 0; + +for(i=0; i<=17; ++i) +if((1U << i) & channel) +return i+1; + +if(channel == AV_CH_STEREO_LEFT) +return 38; // LeftTotal + +if(channel == AV_CH_STEREO_RIGHT) +return 39; // RightTotal + +return 0; +} + static uint32_t mov_get_channel_label(uint32_t label) { if (label == 0) diff --git a/libavformat/mov_chan.h b/libavformat/mov_chan.h index ca28345aef..81acb73655 100644 --- a/libavformat/mov_chan.h +++ b/libavformat/mov_chan.h @@ -53,6 +53,14 @@ uint32_t ff_mov_get_channel_layout_tag(enum AVCodecID codec_id, uint64_t channel_layout, uint32_t *bitmap); +/** + * Get the channel label tag for the specified channel. + * + * @param[in] channel channel identifier + * @return channel label tag + */ +uint32_t ff_mov_get_channel_label_tag(uint64_t channel); + /** * Read 'chan' tag from the input stream. * diff --git a/libavformat/movenc.c b/libavformat/movenc.c index ea48c3293e..2c79462e9f 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -742,30 +742,54 @@ static int mov_write_dops_tag(AVIOContext *pb, MOVTrack *track) return update_size(pb, pos); } +static void mov_write_channel_layout_label_tags(AVFormatContext *s, AVIOContext *pb, uint64_t channel_layout) +{ +int i, channels; + +channels = av_get_channel_layout_nb_channels(channel_layout); + +for(i=0; ipar->codec_id, track->par->channel_layout, &bitmap); -if (!layout_tag) { -av_log(s, AV_LOG_WARNING, "not writing 'chan' tag due to " - "lack of channel information\n"); -return 0; -} if (track->multichannel_as_mono) return 0; +num_channel_desc = layout_tag == 0 ? av_get_channel_layout_nb_channels(track->par->channel_layout) : 0; + avio_wb32(pb, 0); // Size ffio_wfourcc(pb, "chan"); // Type avio_w8(pb, 0); // Version avio_wb24(pb, 0); // Flags avio_wb32(pb, layout_tag); // mChannelLayoutTag avio_wb32(pb, bitmap); // mChannelBitmap -avio_wb32(pb, 0); // mNumberChannelDescriptions +avio_wb32(pb, num_channel_desc); // mNumberChannelDescriptions + +if(!layout_tag) { +mov_write_channel_layout_label_tags(s, pb, track->par->channel_layout); +} return update_size(pb, pos); } -- 2.14.3 (Apple Git-98) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] add to changelog
--- Changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Changelog b/Changelog index 7969b414c4..32a93d916a 100644 --- a/Changelog +++ b/Changelog @@ -47,7 +47,7 @@ version : - native SBC encoder and decoder - drmeter audio filter - hapqa_extract bitstream filter - +- movenc option to write track title metadata version 3.4: - deflicker video filter -- 2.14.3 (Apple Git-98) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] Add option -movflags write_track_title which will write track title metadata. This is useful in conjunction with the metadata flag to specify track title, especially for wor
Example: ffmpeg -i in.mov -movflags write_track_title -metadata:s:a:0 title="Eng-FullMix" --- libavformat/movenc.c | 3 ++- libavformat/movenc.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 5b1e66c897..3b1a734a0a 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -79,6 +79,7 @@ static const AVOption options[] = { { "use_metadata_tags", "Use mdta atom for metadata.", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_USE_MDTA}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, { "skip_trailer", "Skip writing the mfra/tfra/mfro trailer for fragmented files", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_SKIP_TRAILER}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, { "negative_cts_offsets", "Use negative CTS offsets (reducing the need for edit lists)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_NEGATIVE_CTS_OFFSETS}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, +{ "write_track_title", "Include track title metadata, even for MOV containers", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_TRACK_TITLE}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" }, FF_RTP_FLAG_OPTS(MOVMuxContext, rtp_flags), { "skip_iods", "Skip writing iods atom.", offsetof(MOVMuxContext, iods_skip), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM}, { "iods_audio_profile", "iods audio profile atom.", offsetof(MOVMuxContext, iods_audio_profile), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 255, AV_OPT_FLAG_ENCODING_PARAM}, @@ -3027,7 +3028,7 @@ static int mov_write_track_udta_tag(AVIOContext *pb, MOVMuxContext *mov, if (ret < 0) return ret; -if (mov->mode & MODE_MP4) +if (mov->mode & MODE_MP4 || mov->flags & FF_MOV_FLAG_TRACK_TITLE) mov_write_track_metadata(pb_buf, st, "name", "title"); if ((size = avio_close_dyn_buf(pb_buf, &buf)) > 0) { diff --git a/libavformat/movenc.h b/libavformat/movenc.h index ca2a9c9722..72dd7a958b 100644 --- a/libavformat/movenc.h +++ b/libavformat/movenc.h @@ -246,6 +246,7 @@ typedef struct MOVMuxContext { #define FF_MOV_FLAG_SKIP_TRAILER (1 << 18) #define FF_MOV_FLAG_NEGATIVE_CTS_OFFSETS (1 << 19) #define FF_MOV_FLAG_FRAG_EVERY_FRAME (1 << 20) +#define FF_MOV_FLAG_TRACK_TITLE (1 << 21) int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt); -- 2.14.3 (Apple Git-98) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] avcodec/aac_adtstoasc: move the reference in the bsf internal buffer
There's no need to allocate a new packet for it. Signed-off-by: James Almer --- libavcodec/aac_adtstoasc_bsf.c | 33 ++--- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/libavcodec/aac_adtstoasc_bsf.c b/libavcodec/aac_adtstoasc_bsf.c index 49f1f095e6..6541b1189c 100644 --- a/libavcodec/aac_adtstoasc_bsf.c +++ b/libavcodec/aac_adtstoasc_bsf.c @@ -36,27 +36,26 @@ typedef struct AACBSFContext { * This filter creates an MPEG-4 AudioSpecificConfig from an MPEG-2/4 * ADTS header and removes the ADTS header. */ -static int aac_adtstoasc_filter(AVBSFContext *bsfc, AVPacket *out) +static int aac_adtstoasc_filter(AVBSFContext *bsfc, AVPacket *pkt) { AACBSFContext *ctx = bsfc->priv_data; GetBitContext gb; PutBitContext pb; AACADTSHeaderInfo hdr; -AVPacket *in; int ret; -ret = ff_bsf_get_packet(bsfc, &in); +ret = ff_bsf_get_packet_ref(bsfc, pkt); if (ret < 0) return ret; -if (bsfc->par_in->extradata && in->size >= 2 && (AV_RB16(in->data) >> 4) != 0xfff) -goto finish; +if (bsfc->par_in->extradata && pkt->size >= 2 && (AV_RB16(pkt->data) >> 4) != 0xfff) +return 0; -if (in->size < AV_AAC_ADTS_HEADER_SIZE) +if (pkt->size < AV_AAC_ADTS_HEADER_SIZE) goto packet_too_small; -init_get_bits(&gb, in->data, AV_AAC_ADTS_HEADER_SIZE * 8); +init_get_bits(&gb, pkt->data, AV_AAC_ADTS_HEADER_SIZE * 8); if (ff_adts_header_parse(&gb, &hdr) < 0) { av_log(bsfc, AV_LOG_ERROR, "Error parsing ADTS frame header!\n"); @@ -71,10 +70,10 @@ static int aac_adtstoasc_filter(AVBSFContext *bsfc, AVPacket *out) goto fail; } -in->size -= AV_AAC_ADTS_HEADER_SIZE + 2 * !hdr.crc_absent; -if (in->size <= 0) +pkt->size -= AV_AAC_ADTS_HEADER_SIZE + 2 * !hdr.crc_absent; +if (pkt->size <= 0) goto packet_too_small; -in->data += AV_AAC_ADTS_HEADER_SIZE + 2 * !hdr.crc_absent; +pkt->data += AV_AAC_ADTS_HEADER_SIZE + 2 * !hdr.crc_absent; if (!ctx->first_frame_done) { intpce_size = 0; @@ -82,7 +81,7 @@ static int aac_adtstoasc_filter(AVBSFContext *bsfc, AVPacket *out) uint8_t *extradata; if (!hdr.chan_config) { -init_get_bits(&gb, in->data, in->size * 8); +init_get_bits(&gb, pkt->data, pkt->size * 8); if (get_bits(&gb, 3) != 5) { avpriv_report_missing_feature(bsfc, "PCE-based channel configuration " @@ -94,11 +93,11 @@ static int aac_adtstoasc_filter(AVBSFContext *bsfc, AVPacket *out) init_put_bits(&pb, pce_data, MAX_PCE_SIZE); pce_size = ff_copy_pce_data(&pb, &gb) / 8; flush_put_bits(&pb); -in->size -= get_bits_count(&gb)/8; -in->data += get_bits_count(&gb)/8; +pkt->size -= get_bits_count(&gb)/8; +pkt->data += get_bits_count(&gb)/8; } -extradata = av_packet_new_side_data(in, AV_PKT_DATA_NEW_EXTRADATA, +extradata = av_packet_new_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, 2 + pce_size); if (!extradata) { ret = AVERROR(ENOMEM); @@ -120,17 +119,13 @@ static int aac_adtstoasc_filter(AVBSFContext *bsfc, AVPacket *out) ctx->first_frame_done = 1; } -finish: -av_packet_move_ref(out, in); -av_packet_free(&in); - return 0; packet_too_small: av_log(bsfc, AV_LOG_ERROR, "Input packet too small\n"); ret = AVERROR_INVALIDDATA; fail: -av_packet_free(&in); +av_packet_unref(pkt); return ret; } -- 2.16.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] avcodec/noise_bsf: move the reference in the bsf internal buffer
There's no need to allocate a new packet for it. Signed-off-by: James Almer --- libavcodec/noise_bsf.c | 30 -- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/libavcodec/noise_bsf.c b/libavcodec/noise_bsf.c index 84b94032ad..b433cadccd 100644 --- a/libavcodec/noise_bsf.c +++ b/libavcodec/noise_bsf.c @@ -35,46 +35,32 @@ typedef struct NoiseContext { unsigned int state; } NoiseContext; -static int noise(AVBSFContext *ctx, AVPacket *out) +static int noise(AVBSFContext *ctx, AVPacket *pkt) { NoiseContext *s = ctx->priv_data; -AVPacket *in; int amount = s->amount > 0 ? s->amount : (s->state % 10001 + 1); int i, ret = 0; if (amount <= 0) return AVERROR(EINVAL); -ret = ff_bsf_get_packet(ctx, &in); +ret = ff_bsf_get_packet_ref(ctx, pkt); if (ret < 0) return ret; if (s->dropamount > 0 && s->state % s->dropamount == 0) { s->state++; -av_packet_free(&in); +av_packet_unref(pkt); return AVERROR(EAGAIN); } -ret = av_new_packet(out, in->size); -if (ret < 0) -goto fail; - -ret = av_packet_copy_props(out, in); -if (ret < 0) -goto fail; - -memcpy(out->data, in->data, in->size); - -for (i = 0; i < out->size; i++) { -s->state += out->data[i] + 1; +for (i = 0; i < pkt->size; i++) { +s->state += pkt->data[i] + 1; if (s->state % amount == 0) -out->data[i] = s->state; +pkt->data[i] = s->state; } -fail: -if (ret < 0) -av_packet_unref(out); -av_packet_free(&in); -return ret; + +return 0; } #define OFFSET(x) offsetof(NoiseContext, x) -- 2.16.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avcodec/vp9_superframe_split: move the reference in the bsf internal buffer
There's no need to allocate a new packet for it. Signed-off-by: James Almer --- libavcodec/vp9_superframe_split_bsf.c | 21 ++--- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/libavcodec/vp9_superframe_split_bsf.c b/libavcodec/vp9_superframe_split_bsf.c index 0d2523ebf7..7b6fa38554 100644 --- a/libavcodec/vp9_superframe_split_bsf.c +++ b/libavcodec/vp9_superframe_split_bsf.c @@ -30,7 +30,7 @@ #include "get_bits.h" typedef struct VP9SFSplitContext { -AVPacket *buffer_pkt; +AVPacket buffer_pkt; int nb_frames; int next_frame; @@ -43,13 +43,13 @@ static int vp9_superframe_split_filter(AVBSFContext *ctx, AVPacket *out) VP9SFSplitContext *s = ctx->priv_data; AVPacket *in; int i, j, ret, marker; -int is_superframe = !!s->buffer_pkt; +int is_superframe = !!s->buffer_pkt.data; -if (!s->buffer_pkt) { -ret = ff_bsf_get_packet(ctx, &s->buffer_pkt); +if (!s->buffer_pkt.data) { +ret = ff_bsf_get_packet_ref(ctx, &s->buffer_pkt); if (ret < 0) return ret; -in = s->buffer_pkt; +in = &s->buffer_pkt; marker = in->data[in->size - 1]; if ((marker & 0xe0) == 0xc0) { @@ -90,7 +90,7 @@ static int vp9_superframe_split_filter(AVBSFContext *ctx, AVPacket *out) GetBitContext gb; int profile, invisible = 0; -ret = av_packet_ref(out, s->buffer_pkt); +ret = av_packet_ref(out, &s->buffer_pkt); if (ret < 0) goto fail; @@ -101,7 +101,7 @@ static int vp9_superframe_split_filter(AVBSFContext *ctx, AVPacket *out) s->next_frame++; if (s->next_frame >= s->nb_frames) -av_packet_free(&s->buffer_pkt); +av_packet_unref(&s->buffer_pkt); ret = init_get_bits8(&gb, out->data, out->size); if (ret < 0) @@ -121,20 +121,19 @@ static int vp9_superframe_split_filter(AVBSFContext *ctx, AVPacket *out) out->pts = AV_NOPTS_VALUE; } else { -av_packet_move_ref(out, s->buffer_pkt); -av_packet_free(&s->buffer_pkt); +av_packet_move_ref(out, &s->buffer_pkt); } return 0; fail: -av_packet_free(&s->buffer_pkt); +av_packet_unref(&s->buffer_pkt); return ret; } static void vp9_superframe_split_uninit(AVBSFContext *ctx) { VP9SFSplitContext *s = ctx->priv_data; -av_packet_free(&s->buffer_pkt); +av_packet_unref(&s->buffer_pkt); } const AVBitStreamFilter ff_vp9_superframe_split_bsf = { -- 2.16.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] FIX: HLS Discontinuity / Non-Monotonous DTS
I'm saying I don't think it needs it - MPEGTS does seem to handle the discontinuous input fine if I just concatenate it. MPEG TS packets themselves do have a discontinuity flag in the adaptation field, but again it looks like it might be working as-is without explicit notification of them. (and probably should) The question remains: what is missing to allow the HLS format to behave as MPEG-TS does right now? On Fri, Mar 16, 2018 at 3:36 PM, Bodecs Bela wrote: > > > 2018.03.16. 19:52 keltezéssel, wm4 írta: >> >> On Fri, 16 Mar 2018 09:58:17 -0400 >> Joe Koberg wrote: >> >>> Hello, >>> >>> This patch adds code to track and correct timestamp discontinuities, >>> fixing >>> "non-monotonous dts" errors and timing issues with HLS playlists. >>> >>> For some time, FFmpeg has not properly handled discontinuous timestamps >>> in >>> the MPEG-TS stream from Apple HLS playlists. Symptoms include inability >>> to >>> remux to containers like MP4 or stream to RTMP endpoints; choppy, broken, >>> or sped-up playback; and voluminous "Non-monotonous DTS", "went >>> backwards", >>> and "out of order" messages logged. This is particularly troublesome in >>> the context of HLS, as the format allows insertion of >>> independently-sourced >>> fragments for ad-insertion or to concatenate ongoing video to a stream. >>> >>> Over the years, many users have encountered and reported this issue in >>> different ways. >>> >>>* https://trac.ffmpeg.org/ticket/5419 "HLS EXT-X-DISCONTINUITY tag is >>> not >>> supported" >>>* https://trac.ffmpeg.org/ticket/6613 >>>* https://trac.ffmpeg.org/ticket/6810 >>>* https://trac.ffmpeg.org/ticket/6709 >>>* https://trac.ffmpeg.org/ticket/6365 >>>* https://trac.ffmpeg.org/ticket/5236 >>>* https://github.com/Bilibili/ijkplayer/issues/2565 >>>* >>> https://stackoverflow.com/questions/49289394/downloading-ts-stream-with- >>> ext-x-discontinuity-sequence-ffmpeg >>>* etc... >>> >>> >>> It appears that the -dts_delta_threshold checking code is quite similar >>> in >>> intent, and adjacent to this code, but the HLS demuxer lacks the >>> AVFMT_TS_DISCONT flag, effectively disabling that option. Even when >>> AVFMT_TS_DISCONT is set on the input format (e.g. MPEG-TS), >>> "-dts_delta_threshold 0" produces out-of-sync audio in our tests. That >>> code has been left as-is for now. The flag probably should be set on the >>> HLS format, though. >>> >>> In this fix, any backwards DTS jump is considered an error, as is any >>> forward jump of DTS or PTS by more than `dts_monotonicity_threshold` >>> microseconds (really, AV_TIME_BASE units, defaulting to 100 = 1 >>> second). The delta from the predicted value is updated and applied to all >>> subsequent packets, with the assumption that video was stitched together >>> from continuous runs. >>> >>> With this patch in place and the -force_dts_monotonicity flag set, we can >>> successfuly transcode arbitrary HLS playlists to MP4, FLV, or other >>> timestamped containers when we could not before. The playback >>> presentation >>> of the result is smooth, properly timed, and in-sync in Quicktime Player, >>> VLC, and ffplay with correctly reported and the file seekable. >>> >>> Interaction with flags such as -copyts, -copytb, and others has not been >>> fully analyzed. >>> >>> We have prepared a test HLS playlist that reveals the issue. >>> >>> How to reproduce: >>> >>>ffmpeg -i https://s3.amazonaws.com/playon-test-videos/discont_ >>> test_new/discont_test.m3u8 -c copy -y output.mp4 >>> >>> With patch: >>> >>>ffmpeg -force_dts_monotonicity -i https://s3.amazonaws.com/ >>> playon-test-videos/discont_test_new/discont_test.m3u8 -c copy -y >>> output.mp4 >>> >>> >>> Please let me know if I've missed anything! >> >> So I haven't looked too closely at this. It's possible that ffmpeg.c >> should handle discontinuities better, or has a regression with handling >> it. But besides that, shouldn't the HLS demuxer just be changed to >> parse the discontinuity markers, and add them as packet flags? Then >> these "clever" heuristics (which are just really hard to maintain) >> wouldn't be needed, and also applications using libavformat as library >> would benefit from it. >> >> Your patch may or may not have a benefit on top of it (for normal .ts >> files etc.), and the HLS demuxer may or may not have additional issues, >> but I think that's orthogonal. >> >> There isn't such a discontinuity packet flag - that would have to be >> added. > > maybe this discontinuity packet flag could be used in concat demuxer also? >> >> ___ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > bb > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org
[FFmpeg-devel] [PATCH] avfilter: add hrtfm filter
Signed-off-by: Paul B Mahol --- doc/filters.texi | 60 ++ libavfilter/Makefile | 1 + libavfilter/af_hrtfm.c | 486 +++ libavfilter/allfilters.c | 1 + 4 files changed, 548 insertions(+) create mode 100644 libavfilter/af_hrtfm.c diff --git a/doc/filters.texi b/doc/filters.texi index bd43a7ac6e..c298054325 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -3218,6 +3218,66 @@ Change highpass width. Syntax for the command is : "@var{width}" @end table +@section hrtfm + +Apply simple Head Related Transfer Function Model to audio stream. + +hrtfm filter creates virtual loudspeakers around the user for binaural +listening via headphones (audio formats up to 9 channels supported). + +This is very simple implementation which does not use any HRIRs. + +It accepts the following parameters: + +@table @option +@item hradius +Set head radius of listener. In meters. Default value is @code{0.0891}. + +@item sspeed +Set sound speed in meters per second. Default value is @code{334}. +Allowed range is from @code{300} to @code{400}. + +@item amin +Set minimum alfa. Default value is @code{0.05}. +Allowed range is from @code{0.01} to @code{1}. + +@item gain +Set output gain in dB. Default value is @code{0}. +Allowed range is from @code{-20} to @code{40}. + +@item rotation +Set rotation of virtual loudspeakers in deg. Default is @code{0}. +Allowed range is from @code{-360} to @code{360}. + +@item elevation +Set elevation of virtual speakers in deg. Default is @code{0}. +Allowed range is from @code{-90} to @code{90}. + +@item speakers +Set custom positions of virtual loudspeakers. Syntax for this option is: + [| |...]. +Each virtual loudspeaker is described with short channel name following with +azimuth and elevation in degrees. +Each virtual loudspeaker description is separated by '|'. +For example to override front left and front right channel positions use: +'speakers=FL 45 15|FR 345 15'. +Descriptions with unrecognised channel names are ignored. + +@item lfegain +Set LFE gain in dB. Default value is @code{0}. +Allowed range is from @code{-11} to @code{11}. +@end table + +@subsection Examples + +@itemize +@item +Apply filter with custom head radius, speed of sound and minimum alpha: +@example +hrtfm=hradius=0.09:sspeed=334:amin=0.01 +@end example +@end itemize + @section join Join multiple input streams into one multi-channel stream. diff --git a/libavfilter/Makefile b/libavfilter/Makefile index fc16512e2c..65783a8443 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -99,6 +99,7 @@ OBJS-$(CONFIG_HAAS_FILTER) += af_haas.o OBJS-$(CONFIG_HDCD_FILTER) += af_hdcd.o OBJS-$(CONFIG_HEADPHONE_FILTER) += af_headphone.o OBJS-$(CONFIG_HIGHPASS_FILTER) += af_biquads.o +OBJS-$(CONFIG_HRTFM_FILTER) += af_hrtfm.o OBJS-$(CONFIG_JOIN_FILTER) += af_join.o OBJS-$(CONFIG_LADSPA_FILTER) += af_ladspa.o OBJS-$(CONFIG_LOUDNORM_FILTER) += af_loudnorm.o ebur128.o diff --git a/libavfilter/af_hrtfm.c b/libavfilter/af_hrtfm.c new file mode 100644 index 00..a9ac95f9a5 --- /dev/null +++ b/libavfilter/af_hrtfm.c @@ -0,0 +1,486 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/avstring.h" +#include "libavutil/ffmath.h" +#include "libavutil/opt.h" + +#include "audio.h" +#include "avfilter.h" +#include "internal.h" + +typedef struct ChParams { +float azim; /* azimuth of the virtual loudspeakers */ +float elev; /* elevation of the virtual loudspeakers */ +int lfe; + +float Al[2], Bl[2], al[2], bl[2]; +float Ar[2], Br[2], ar[2], br[2]; + +float gain[2]; +int M[2]; + +float *delayed_samples[2]; +int delayed_index[2]; + +float cache1_in[2]; +float cache1_out[2]; + +float cache2_in[2]; +float cache2_out[2]; +} ChParams; + +typedef struct VirtualSpeaker { +uint8_t set; +float azim; +float elev; +} VirtualSpeaker; + +typedef struct HRTFMContext { +const AVClass *class; + +float sspeed; +float hradius; +float alfa_min; +float gain; /* filter gain (in dB) */ +float lfe_gain; +float gain_lfe
Re: [FFmpeg-devel] FIX: HLS Discontinuity / Non-Monotonous DTS
2018.03.16. 19:52 keltezéssel, wm4 írta: On Fri, 16 Mar 2018 09:58:17 -0400 Joe Koberg wrote: Hello, This patch adds code to track and correct timestamp discontinuities, fixing "non-monotonous dts" errors and timing issues with HLS playlists. For some time, FFmpeg has not properly handled discontinuous timestamps in the MPEG-TS stream from Apple HLS playlists. Symptoms include inability to remux to containers like MP4 or stream to RTMP endpoints; choppy, broken, or sped-up playback; and voluminous "Non-monotonous DTS", "went backwards", and "out of order" messages logged. This is particularly troublesome in the context of HLS, as the format allows insertion of independently-sourced fragments for ad-insertion or to concatenate ongoing video to a stream. Over the years, many users have encountered and reported this issue in different ways. * https://trac.ffmpeg.org/ticket/5419 "HLS EXT-X-DISCONTINUITY tag is not supported" * https://trac.ffmpeg.org/ticket/6613 * https://trac.ffmpeg.org/ticket/6810 * https://trac.ffmpeg.org/ticket/6709 * https://trac.ffmpeg.org/ticket/6365 * https://trac.ffmpeg.org/ticket/5236 * https://github.com/Bilibili/ijkplayer/issues/2565 * https://stackoverflow.com/questions/49289394/downloading-ts-stream-with- ext-x-discontinuity-sequence-ffmpeg * etc... It appears that the -dts_delta_threshold checking code is quite similar in intent, and adjacent to this code, but the HLS demuxer lacks the AVFMT_TS_DISCONT flag, effectively disabling that option. Even when AVFMT_TS_DISCONT is set on the input format (e.g. MPEG-TS), "-dts_delta_threshold 0" produces out-of-sync audio in our tests. That code has been left as-is for now. The flag probably should be set on the HLS format, though. In this fix, any backwards DTS jump is considered an error, as is any forward jump of DTS or PTS by more than `dts_monotonicity_threshold` microseconds (really, AV_TIME_BASE units, defaulting to 100 = 1 second). The delta from the predicted value is updated and applied to all subsequent packets, with the assumption that video was stitched together from continuous runs. With this patch in place and the -force_dts_monotonicity flag set, we can successfuly transcode arbitrary HLS playlists to MP4, FLV, or other timestamped containers when we could not before. The playback presentation of the result is smooth, properly timed, and in-sync in Quicktime Player, VLC, and ffplay with correctly reported and the file seekable. Interaction with flags such as -copyts, -copytb, and others has not been fully analyzed. We have prepared a test HLS playlist that reveals the issue. How to reproduce: ffmpeg -i https://s3.amazonaws.com/playon-test-videos/discont_ test_new/discont_test.m3u8 -c copy -y output.mp4 With patch: ffmpeg -force_dts_monotonicity -i https://s3.amazonaws.com/ playon-test-videos/discont_test_new/discont_test.m3u8 -c copy -y output.mp4 Please let me know if I've missed anything! So I haven't looked too closely at this. It's possible that ffmpeg.c should handle discontinuities better, or has a regression with handling it. But besides that, shouldn't the HLS demuxer just be changed to parse the discontinuity markers, and add them as packet flags? Then these "clever" heuristics (which are just really hard to maintain) wouldn't be needed, and also applications using libavformat as library would benefit from it. Your patch may or may not have a benefit on top of it (for normal .ts files etc.), and the HLS demuxer may or may not have additional issues, but I think that's orthogonal. There isn't such a discontinuity packet flag - that would have to be added. maybe this discontinuity packet flag could be used in concat demuxer also? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel bb ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/3] http: fix potentially dangerous whitespace skipping code
On 3/8/18, wm4 wrote: > If the string consists entirely of whitespace, this could in theory > continue to write '\0' before the start of the memory allocation. In > practice, it didn't really happen: the generic HTTP header parsing code > already skips leading whitespaces, so the string is either empty, or > consists a non-whitespace. (The generic code and the cookie code > actually have different ideas about what bytes are whitespace: the > former uses av_isspace(), the latter uses WHITESPACES. Fortunately, > av_isspace() is a super set of the http.c specific WHITESPACES, so > there's probably no case where the above assumption could have been > broken.) > --- > libavformat/http.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/libavformat/http.c b/libavformat/http.c > index 59f90ac603..983034f083 100644 > --- a/libavformat/http.c > +++ b/libavformat/http.c > @@ -760,6 +760,8 @@ static int parse_set_cookie(const char *set_cookie, > AVDictionary **dict) > back = &cstr[strlen(cstr)-1]; > while (strchr(WHITESPACES, *back)) { > *back='\0'; > +if (back == cstr) > +break; > back--; > } > > -- > 2.16.1 > LGTM ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] FIX: HLS Discontinuity / Non-Monotonous DTS
While HLS has the discontinuity flag, I'm not sure it would add anything that wouldn't be needed anyway without knowledge of it. I think it's valid for MPEG-TS streams to have discontinuous timestamps. It turns out the MPEGTS demuxer deals with the underlying MPEGTS stream just fine in this case, indicating that this patch wouldn't be needed if that logic would trigger for HLS. We would really like to not have to manually reconstruct the input from HLS playlists to make FFMPEG work with HLS. Joe On Fri, Mar 16, 2018 at 2:52 PM, wm4 wrote: > On Fri, 16 Mar 2018 09:58:17 -0400 > Joe Koberg wrote: > >> Hello, >> >> This patch adds code to track and correct timestamp discontinuities, fixing >> "non-monotonous dts" errors and timing issues with HLS playlists. >> >> For some time, FFmpeg has not properly handled discontinuous timestamps in >> the MPEG-TS stream from Apple HLS playlists. Symptoms include inability to >> remux to containers like MP4 or stream to RTMP endpoints; choppy, broken, >> or sped-up playback; and voluminous "Non-monotonous DTS", "went backwards", >> and "out of order" messages logged. This is particularly troublesome in >> the context of HLS, as the format allows insertion of independently-sourced >> fragments for ad-insertion or to concatenate ongoing video to a stream. >> >> Over the years, many users have encountered and reported this issue in >> different ways. >> >> * https://trac.ffmpeg.org/ticket/5419 "HLS EXT-X-DISCONTINUITY tag is not >> supported" >> * https://trac.ffmpeg.org/ticket/6613 >> * https://trac.ffmpeg.org/ticket/6810 >> * https://trac.ffmpeg.org/ticket/6709 >> * https://trac.ffmpeg.org/ticket/6365 >> * https://trac.ffmpeg.org/ticket/5236 >> * https://github.com/Bilibili/ijkplayer/issues/2565 >> * https://stackoverflow.com/questions/49289394/downloading-ts-stream-with- >> ext-x-discontinuity-sequence-ffmpeg >> * etc... >> >> >> It appears that the -dts_delta_threshold checking code is quite similar in >> intent, and adjacent to this code, but the HLS demuxer lacks the >> AVFMT_TS_DISCONT flag, effectively disabling that option. Even when >> AVFMT_TS_DISCONT is set on the input format (e.g. MPEG-TS), >> "-dts_delta_threshold 0" produces out-of-sync audio in our tests. That >> code has been left as-is for now. The flag probably should be set on the >> HLS format, though. >> >> In this fix, any backwards DTS jump is considered an error, as is any >> forward jump of DTS or PTS by more than `dts_monotonicity_threshold` >> microseconds (really, AV_TIME_BASE units, defaulting to 100 = 1 >> second). The delta from the predicted value is updated and applied to all >> subsequent packets, with the assumption that video was stitched together >> from continuous runs. >> >> With this patch in place and the -force_dts_monotonicity flag set, we can >> successfuly transcode arbitrary HLS playlists to MP4, FLV, or other >> timestamped containers when we could not before. The playback presentation >> of the result is smooth, properly timed, and in-sync in Quicktime Player, >> VLC, and ffplay with correctly reported and the file seekable. >> >> Interaction with flags such as -copyts, -copytb, and others has not been >> fully analyzed. >> >> We have prepared a test HLS playlist that reveals the issue. >> >> How to reproduce: >> >> ffmpeg -i https://s3.amazonaws.com/playon-test-videos/discont_ >> test_new/discont_test.m3u8 -c copy -y output.mp4 >> >> With patch: >> >> ffmpeg -force_dts_monotonicity -i https://s3.amazonaws.com/ >> playon-test-videos/discont_test_new/discont_test.m3u8 -c copy -y output.mp4 >> >> >> Please let me know if I've missed anything! > > So I haven't looked too closely at this. It's possible that ffmpeg.c > should handle discontinuities better, or has a regression with handling > it. But besides that, shouldn't the HLS demuxer just be changed to > parse the discontinuity markers, and add them as packet flags? Then > these "clever" heuristics (which are just really hard to maintain) > wouldn't be needed, and also applications using libavformat as library > would benefit from it. > > Your patch may or may not have a benefit on top of it (for normal .ts > files etc.), and the HLS demuxer may or may not have additional issues, > but I think that's orthogonal. > > There isn't such a discontinuity packet flag - that would have to be > added. > ___ > 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]lavfi/deshake: Check alignment before calling asm init function
On 3/16/2018 3:55 PM, Carl Eugen Hoyos wrote: > 2018-03-14 23:50 GMT+01:00, Michael Niedermayer : >> On Sat, Mar 10, 2018 at 08:50:08PM +0100, Carl Eugen Hoyos wrote: >>> Hi! >>> >>> Attached patch fixes ticket #7078 for me. >>> >>> Please comment, Carl Eugen >>> vf_deshake.c |8 >>> 1 file changed, 4 insertions(+), 4 deletions(-) >>> 9f4517eae88416277aeb5bd5b677159914e9c451 >>> 0001-lavfi-deshake-Check-alignment-before-calling-asm-ini.patch >>> From 75ead282c3aa3c214d37e766690e2edd037307c0 Mon Sep 17 00:00:00 2001 >>> From: Carl Eugen Hoyos >>> Date: Sat, 10 Mar 2018 20:46:21 +0100 >>> Subject: [PATCH] lavfi/deshake: Check alignment before calling asm init >>> function. >>> >>> Do this for every frame to make sure dynamic filters do not >>> cause crashes. >>> >>> Fixes ticket #7078. >>> --- >>> libavfilter/vf_deshake.c | 8 >>> 1 file changed, 4 insertions(+), 4 deletions(-) >>> >>> diff --git a/libavfilter/vf_deshake.c b/libavfilter/vf_deshake.c >>> index fb4eb35..75e9990 100644 >>> --- a/libavfilter/vf_deshake.c >>> +++ b/libavfilter/vf_deshake.c >>> @@ -342,10 +342,6 @@ static av_cold int init(AVFilterContext *ctx) >>> { >>> DeshakeContext *deshake = ctx->priv; >>> >>> -deshake->sad = av_pixelutils_get_sad_fn(4, 4, 1, deshake); // 16x16, >>> 2nd source unaligned >>> -if (!deshake->sad) >>> -return AVERROR(EINVAL); >>> - >>> deshake->refcount = 20; // XXX: add to options? >>> deshake->blocksize /= 2; >>> deshake->blocksize = av_clip(deshake->blocksize, 4, 128); >>> @@ -432,6 +428,10 @@ static int filter_frame(AVFilterLink *link, AVFrame >>> *in) >>> } >>> av_frame_copy_props(out, in); >>> >>> +deshake->sad = av_pixelutils_get_sad_fn(4, 4, !((unsigned >>> long)in->data[0] & 15), deshake); // 16x16, 2nd source unaligned >>> +if (!deshake->sad) >>> +return AVERROR(EINVAL); >> does this need to check linesize too ? > I think so, new patch attached. > > Will push if there are no comments, Carl Eugen > > > 0001-lavfi-deshake-Check-alignment-before-calling-asm-ini.patch > > > From 768a2cbcb0536f79fd7590186885c60de039afd5 Mon Sep 17 00:00:00 2001 > From: Carl Eugen Hoyos > Date: Fri, 16 Mar 2018 19:54:03 +0100 > Subject: [PATCH] lavfi/deshake: Check alignment before calling asm init > function. > > Do this for every frame to make sure dynamic filters do not > cause crashes. > > Fixes ticket #7078. > --- > libavfilter/vf_deshake.c | 10 ++ > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/libavfilter/vf_deshake.c b/libavfilter/vf_deshake.c > index fb4eb35..aa92cef 100644 > --- a/libavfilter/vf_deshake.c > +++ b/libavfilter/vf_deshake.c > @@ -342,10 +342,6 @@ static av_cold int init(AVFilterContext *ctx) > { > DeshakeContext *deshake = ctx->priv; > > -deshake->sad = av_pixelutils_get_sad_fn(4, 4, 1, deshake); // 16x16, 2nd > source unaligned > -if (!deshake->sad) > -return AVERROR(EINVAL); > - > deshake->refcount = 20; // XXX: add to options? > deshake->blocksize /= 2; > deshake->blocksize = av_clip(deshake->blocksize, 4, 128); > @@ -424,6 +420,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) > const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format); > const int chroma_width = AV_CEIL_RSHIFT(link->w, desc->log2_chroma_w); > const int chroma_height = AV_CEIL_RSHIFT(link->h, desc->log2_chroma_h); > +int aligned; > > out = ff_get_video_buffer(outlink, outlink->w, outlink->h); > if (!out) { > @@ -432,6 +429,11 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) > } > av_frame_copy_props(out, in); > > +aligned = !((unsigned long)in->data[0] & 15 | in->linesize[0] & 15); Should be intptr_t, not unsigned long. > +deshake->sad = av_pixelutils_get_sad_fn(4, 4, aligned, deshake); // > 16x16, 2nd source unaligned > +if (!deshake->sad) > +return AVERROR(EINVAL); > + > if (deshake->cx < 0 || deshake->cy < 0 || deshake->cw < 0 || deshake->ch > < 0) { > // Find the most likely global motion for the current frame > find_motion(deshake, (deshake->ref == NULL) ? in->data[0] : > deshake->ref->data[0], in->data[0], link->w, link->h, in->linesize[0], &t); > -- 1.7.10.4 > > > > ___ > 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] FIX: HLS Discontinuity / Non-Monotonous DTS
On Fri, 16 Mar 2018 09:58:17 -0400 Joe Koberg wrote: > Hello, > > This patch adds code to track and correct timestamp discontinuities, fixing > "non-monotonous dts" errors and timing issues with HLS playlists. > > For some time, FFmpeg has not properly handled discontinuous timestamps in > the MPEG-TS stream from Apple HLS playlists. Symptoms include inability to > remux to containers like MP4 or stream to RTMP endpoints; choppy, broken, > or sped-up playback; and voluminous "Non-monotonous DTS", "went backwards", > and "out of order" messages logged. This is particularly troublesome in > the context of HLS, as the format allows insertion of independently-sourced > fragments for ad-insertion or to concatenate ongoing video to a stream. > > Over the years, many users have encountered and reported this issue in > different ways. > > * https://trac.ffmpeg.org/ticket/5419 "HLS EXT-X-DISCONTINUITY tag is not > supported" > * https://trac.ffmpeg.org/ticket/6613 > * https://trac.ffmpeg.org/ticket/6810 > * https://trac.ffmpeg.org/ticket/6709 > * https://trac.ffmpeg.org/ticket/6365 > * https://trac.ffmpeg.org/ticket/5236 > * https://github.com/Bilibili/ijkplayer/issues/2565 > * https://stackoverflow.com/questions/49289394/downloading-ts-stream-with- > ext-x-discontinuity-sequence-ffmpeg > * etc... > > > It appears that the -dts_delta_threshold checking code is quite similar in > intent, and adjacent to this code, but the HLS demuxer lacks the > AVFMT_TS_DISCONT flag, effectively disabling that option. Even when > AVFMT_TS_DISCONT is set on the input format (e.g. MPEG-TS), > "-dts_delta_threshold 0" produces out-of-sync audio in our tests. That > code has been left as-is for now. The flag probably should be set on the > HLS format, though. > > In this fix, any backwards DTS jump is considered an error, as is any > forward jump of DTS or PTS by more than `dts_monotonicity_threshold` > microseconds (really, AV_TIME_BASE units, defaulting to 100 = 1 > second). The delta from the predicted value is updated and applied to all > subsequent packets, with the assumption that video was stitched together > from continuous runs. > > With this patch in place and the -force_dts_monotonicity flag set, we can > successfuly transcode arbitrary HLS playlists to MP4, FLV, or other > timestamped containers when we could not before. The playback presentation > of the result is smooth, properly timed, and in-sync in Quicktime Player, > VLC, and ffplay with correctly reported and the file seekable. > > Interaction with flags such as -copyts, -copytb, and others has not been > fully analyzed. > > We have prepared a test HLS playlist that reveals the issue. > > How to reproduce: > > ffmpeg -i https://s3.amazonaws.com/playon-test-videos/discont_ > test_new/discont_test.m3u8 -c copy -y output.mp4 > > With patch: > > ffmpeg -force_dts_monotonicity -i https://s3.amazonaws.com/ > playon-test-videos/discont_test_new/discont_test.m3u8 -c copy -y output.mp4 > > > Please let me know if I've missed anything! So I haven't looked too closely at this. It's possible that ffmpeg.c should handle discontinuities better, or has a regression with handling it. But besides that, shouldn't the HLS demuxer just be changed to parse the discontinuity markers, and add them as packet flags? Then these "clever" heuristics (which are just really hard to maintain) wouldn't be needed, and also applications using libavformat as library would benefit from it. Your patch may or may not have a benefit on top of it (for normal .ts files etc.), and the HLS demuxer may or may not have additional issues, but I think that's orthogonal. There isn't such a discontinuity packet flag - that would have to be added. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]lavfi/deshake: Check alignment before calling asm init function
2018-03-14 23:50 GMT+01:00, Michael Niedermayer : > On Sat, Mar 10, 2018 at 08:50:08PM +0100, Carl Eugen Hoyos wrote: >> Hi! >> >> Attached patch fixes ticket #7078 for me. >> >> Please comment, Carl Eugen > >> vf_deshake.c |8 >> 1 file changed, 4 insertions(+), 4 deletions(-) >> 9f4517eae88416277aeb5bd5b677159914e9c451 >> 0001-lavfi-deshake-Check-alignment-before-calling-asm-ini.patch >> From 75ead282c3aa3c214d37e766690e2edd037307c0 Mon Sep 17 00:00:00 2001 >> From: Carl Eugen Hoyos >> Date: Sat, 10 Mar 2018 20:46:21 +0100 >> Subject: [PATCH] lavfi/deshake: Check alignment before calling asm init >> function. >> >> Do this for every frame to make sure dynamic filters do not >> cause crashes. >> >> Fixes ticket #7078. >> --- >> libavfilter/vf_deshake.c | 8 >> 1 file changed, 4 insertions(+), 4 deletions(-) >> >> diff --git a/libavfilter/vf_deshake.c b/libavfilter/vf_deshake.c >> index fb4eb35..75e9990 100644 >> --- a/libavfilter/vf_deshake.c >> +++ b/libavfilter/vf_deshake.c >> @@ -342,10 +342,6 @@ static av_cold int init(AVFilterContext *ctx) >> { >> DeshakeContext *deshake = ctx->priv; >> >> -deshake->sad = av_pixelutils_get_sad_fn(4, 4, 1, deshake); // 16x16, >> 2nd source unaligned >> -if (!deshake->sad) >> -return AVERROR(EINVAL); >> - >> deshake->refcount = 20; // XXX: add to options? >> deshake->blocksize /= 2; >> deshake->blocksize = av_clip(deshake->blocksize, 4, 128); >> @@ -432,6 +428,10 @@ static int filter_frame(AVFilterLink *link, AVFrame >> *in) >> } >> av_frame_copy_props(out, in); >> >> +deshake->sad = av_pixelutils_get_sad_fn(4, 4, !((unsigned >> long)in->data[0] & 15), deshake); // 16x16, 2nd source unaligned >> +if (!deshake->sad) >> +return AVERROR(EINVAL); > > does this need to check linesize too ? I think so, new patch attached. Will push if there are no comments, Carl Eugen From 768a2cbcb0536f79fd7590186885c60de039afd5 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Fri, 16 Mar 2018 19:54:03 +0100 Subject: [PATCH] lavfi/deshake: Check alignment before calling asm init function. Do this for every frame to make sure dynamic filters do not cause crashes. Fixes ticket #7078. --- libavfilter/vf_deshake.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libavfilter/vf_deshake.c b/libavfilter/vf_deshake.c index fb4eb35..aa92cef 100644 --- a/libavfilter/vf_deshake.c +++ b/libavfilter/vf_deshake.c @@ -342,10 +342,6 @@ static av_cold int init(AVFilterContext *ctx) { DeshakeContext *deshake = ctx->priv; -deshake->sad = av_pixelutils_get_sad_fn(4, 4, 1, deshake); // 16x16, 2nd source unaligned -if (!deshake->sad) -return AVERROR(EINVAL); - deshake->refcount = 20; // XXX: add to options? deshake->blocksize /= 2; deshake->blocksize = av_clip(deshake->blocksize, 4, 128); @@ -424,6 +420,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format); const int chroma_width = AV_CEIL_RSHIFT(link->w, desc->log2_chroma_w); const int chroma_height = AV_CEIL_RSHIFT(link->h, desc->log2_chroma_h); +int aligned; out = ff_get_video_buffer(outlink, outlink->w, outlink->h); if (!out) { @@ -432,6 +429,11 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) } av_frame_copy_props(out, in); +aligned = !((unsigned long)in->data[0] & 15 | in->linesize[0] & 15); +deshake->sad = av_pixelutils_get_sad_fn(4, 4, aligned, deshake); // 16x16, 2nd source unaligned +if (!deshake->sad) +return AVERROR(EINVAL); + if (deshake->cx < 0 || deshake->cy < 0 || deshake->cw < 0 || deshake->ch < 0) { // Find the most likely global motion for the current frame find_motion(deshake, (deshake->ref == NULL) ? in->data[0] : deshake->ref->data[0], in->data[0], link->w, link->h, in->linesize[0], &t); -- 1.7.10.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] [RFC][WIP] avutil/buffer: add add a dynamnic size buffer pool API
Signed-off-by: James Almer --- This is a proof of concept for a dynamic size buffer pool API. For the purpose of easy testing and reviewing I replaced the current linked list used to keep a pool of fixed size buffers with the tree based pool that will be used to keep a pool of varying size buffers, instead of adding a new set of functions exclusively for the new API. The final committed work doesn't necessarely have to do the above, as there's no real benefit using a tree when you only need a fixed size buffer pool, other than simplying things. I'm open to suggestions about how to introduce this. Completely separate set of functions and struct names? Sharing the struct and init/uninit functions and only adding a new get() one like in this patch? Any preferences with function/struct naming, for that matter? libavutil/buffer.c | 98 - libavutil/buffer.h | 2 + libavutil/buffer_internal.h | 6 ++- 3 files changed, 85 insertions(+), 21 deletions(-) diff --git a/libavutil/buffer.c b/libavutil/buffer.c index 8d1aa5fa84..9fe5aa9825 100644 --- a/libavutil/buffer.c +++ b/libavutil/buffer.c @@ -251,19 +251,27 @@ AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size)) return pool; } +/* Callback function to free every pooled buffer during uninit, + * to be used with av_tree_enumerate(). */ +static int free_node(void *opaque, void *elem) +{ +BufferPoolEntry *buf = elem; + +buf->free(buf->opaque, buf->data); +av_free(buf); + +return 0; +} + /* * This function gets called when the pool has been uninited and * all the buffers returned to it. */ static void buffer_pool_free(AVBufferPool *pool) { -while (pool->pool) { -BufferPoolEntry *buf = pool->pool; -pool->pool = buf->next; +av_tree_enumerate(pool->root, NULL, NULL, free_node); +av_tree_destroy(pool->root); -buf->free(buf->opaque, buf->data); -av_freep(&buf); -} ff_mutex_destroy(&pool->mutex); if (pool->pool_free) @@ -285,17 +293,29 @@ void av_buffer_pool_uninit(AVBufferPool **ppool) buffer_pool_free(pool); } +/* Callback function to compare two nodes, order them based + * on size, and retrieve them, to be used with av_tree_insert(). */ +static int cmp_insert(const void *key, const void *node) +{ +int ret = FFDIFFSIGN(((const BufferPoolEntry *) key)->size, ((const BufferPoolEntry *) node)->size); + +if (!ret) +ret = FFDIFFSIGN(((const BufferPoolEntry *) key)->data, ((const BufferPoolEntry *) node)->data); +return ret; +} + static void pool_release_buffer(void *opaque, uint8_t *data) { BufferPoolEntry *buf = opaque; AVBufferPool *pool = buf->pool; if(CONFIG_MEMORY_POISONING) -memset(buf->data, FF_MEMORY_POISON, pool->size); +memset(buf->data, FF_MEMORY_POISON, buf->size); ff_mutex_lock(&pool->mutex); -buf->next = pool->pool; -pool->pool = buf; +/* Add the buffer into the pool, using the preallocated + * AVTreeNode stored in buf->node */ +av_tree_insert(&pool->root, buf, cmp_insert, &buf->node); ff_mutex_unlock(&pool->mutex); if (atomic_fetch_add_explicit(&pool->refcount, -1, memory_order_acq_rel) == 1) @@ -304,13 +324,13 @@ static void pool_release_buffer(void *opaque, uint8_t *data) /* allocate a new buffer and override its free() callback so that * it is returned to the pool on free */ -static AVBufferRef *pool_alloc_buffer(AVBufferPool *pool) +static AVBufferRef *pool_alloc_buffer(AVBufferPool *pool, int size) { BufferPoolEntry *buf; AVBufferRef *ret; -ret = pool->alloc2 ? pool->alloc2(pool->opaque, pool->size) : - pool->alloc(pool->size); +ret = pool->alloc2 ? pool->alloc2(pool->opaque, size) : + pool->alloc(size); if (!ret) return NULL; @@ -320,9 +340,17 @@ static AVBufferRef *pool_alloc_buffer(AVBufferPool *pool) return NULL; } +buf->node = av_tree_node_alloc(); +if (!buf->node) { +av_free(buf); +av_buffer_unref(&ret); +return NULL; +} + buf->data = ret->buffer->data; buf->opaque = ret->buffer->opaque; buf->free = ret->buffer->free; +buf->size = size; buf->pool = pool; ret->buffer->opaque = buf; @@ -331,22 +359,49 @@ static AVBufferRef *pool_alloc_buffer(AVBufferPool *pool) return ret; } -AVBufferRef *av_buffer_pool_get(AVBufferPool *pool) +/* Callback function to compare the requested size with the + * size of existing buffers in the pool, to be used with + * av_tree_find(). */ +static int cmp_int(const void *key, const void *node) +{ +return FFDIFFSIGN(*(const int *)key, ((const BufferPoolEntry *) node)->size); +} + +AVBufferRef *av_buffer_pool_get_dyn(AVBufferPool *pool, int size) { AVBufferRef *ret; -BufferPoolEntry *buf; +BufferPoolEntry *buf, *next[2] = { NUL
Re: [FFmpeg-devel] [PATCH] avfilter: add hrtfm filter
On Thu, 15 Mar 2018 18:54:00 +0100 Paul B Mahol wrote: [...] > diff --git a/libavfilter/af_hrtfm.c b/libavfilter/af_hrtfm.c > new file mode 100644 > index 00..48536edd4b > --- /dev/null > +++ b/libavfilter/af_hrtfm.c [...] > +static const AVOption hrtfm_options[] = { > +{ "hradius", "set head radius", OFFSET(hradius), AV_OPT_TYPE_FLOAT, > {.dbl=0.0891},0.01,0.2, .flags = FLAGS }, I'd like to see more descriptive option names with the shorter name left as an alias if desired. { "head_radius", "set head radius", OFFSET(head_radius), AV_OPT_TYPE_FLOAT, {.dbl=0.0891},0.01,0.2, .flags = FLAGS }, { "hradius", "set head radius", OFFSET(head_radius), AV_OPT_TYPE_FLOAT, {.dbl=0.0891},0.01,0.2, .flags = FLAGS }, > +{ "sspeed","set sound speed", OFFSET(sspeed),AV_OPT_TYPE_FLOAT, > {.dbl=334}, 300, 400, .flags = FLAGS }, Same here. sound_speed Missing docs, and also please provide an example in the docs. Many of our filters are missing examples. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter: add hrtfm filter
On 3/16/18, Derek Buitenhuis wrote: > On 3/15/2018 5:54 PM, Paul B Mahol wrote: >> Signed-off-by: Paul B Mahol >> --- >> libavfilter/Makefile | 1 + >> libavfilter/af_hrtfm.c | 477 >> +++ >> libavfilter/allfilters.c | 1 + >> 3 files changed, 479 insertions(+) >> create mode 100644 libavfilter/af_hrtfm.c > > Because we all know what HRTFM means immediately, so we don't need > any doc. Google is always your friend. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] doc/outdevs: Add declink signal generator example
2018-03-15 15:39 GMT+01:00, Marton Balint : > > On Thu, 15 Mar 2018, Carl Eugen Hoyos wrote: > >> 2018-03-09 21:58 GMT+01:00, Marton Balint : >>> >>> On Fri, 9 Mar 2018, Devin Heitmueller wrote: >> Also, isn’t -format_code a capture parameter? Is it even valid to provide that on output? >>> >>> Yes, it is capture only indeed. Wonder why does ffmpeg >>> accept it in the first place? >> >> Output options are not (cannot?) be validated, this is also discussed >> in several tickets. > > Can you point me to the tickets? I only found #4184, I believe there was another ticket... Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] FIX: HLS Discontinuity / Non-Monotonous DTS
On Fri, Mar 16, 2018 at 11:14 AM, Carl Eugen Hoyos wrote: > 2018-03-16 16:07 GMT+01:00, Joe Koberg : >> On Fri, Mar 16, 2018 at 10:48 AM, Carl Eugen Hoyos >> wrote: >>> >>> 2018-03-16 14:58 GMT+01:00, Joe Koberg : >>> >>> > How to reproduce: >>> > >>> > ffmpeg -i https://s3.amazonaws.com/playon-test-videos/discont_ >>> > test_new/discont_test.m3u8 -c copy -y output.mp4 >>> >>> Is the issue only reproducible if you use hls input or is it also >>> reproducible if you first concatenate the ts files and use the >>> complete file as input? >> >> Very interesting, this case seems to work perfectly with ffmpeg 3.4.2. > > Only current FFmpeg is relevant. > >> In previous versions, I don't think it did. >> >> Any hints on getting that to apply to the HLS demuxer? >> >> test concat file: > > I meant: > What happens if you concat all these files (with "cat") before > feeding the resulting large file to ffmpeg? > That also seems to work fine! But the duration of the output file differs a bit (it's correct, 112.112s) from the concat demuxer, which I didn't expect ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] FIX: HLS Discontinuity / Non-Monotonous DTS
2018-03-16 16:07 GMT+01:00, Joe Koberg : > On Fri, Mar 16, 2018 at 10:48 AM, Carl Eugen Hoyos > wrote: >> >> 2018-03-16 14:58 GMT+01:00, Joe Koberg : >> >> > How to reproduce: >> > >> > ffmpeg -i https://s3.amazonaws.com/playon-test-videos/discont_ >> > test_new/discont_test.m3u8 -c copy -y output.mp4 >> >> Is the issue only reproducible if you use hls input or is it also >> reproducible if you first concatenate the ts files and use the >> complete file as input? > > Very interesting, this case seems to work perfectly with ffmpeg 3.4.2. Only current FFmpeg is relevant. > In previous versions, I don't think it did. > > Any hints on getting that to apply to the HLS demuxer? > > test concat file: I meant: What happens if you concat all these files (with "cat") before feeding the resulting large file to ffmpeg? Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] FIX: HLS Discontinuity / Non-Monotonous DTS
On Fri, Mar 16, 2018 at 10:48 AM, Carl Eugen Hoyos wrote: > > 2018-03-16 14:58 GMT+01:00, Joe Koberg : > > > How to reproduce: > > > > ffmpeg -i https://s3.amazonaws.com/playon-test-videos/discont_ > > test_new/discont_test.m3u8 -c copy -y output.mp4 > > Is the issue only reproducible if you use hls input or is it also > reproducible if you first concatenate the ts files and use the > complete file as input? > Very interesting, this case seems to work perfectly with ffmpeg 3.4.2. In previous versions, I don't think it did. Any hints on getting that to apply to the HLS demuxer? test concat file: file 'b1dc7f03bcce8b554f5f840cf5018b0e_20171009T151157Z_00.ts' file 'b1dc7f03bcce8b554f5f840cf5018b0e_20171009T151157Z_00.ts' file 'b1dc7f03bcce8b554f5f840cf5018b0e_20171009T151157Z_00.ts' file 'b1dc7f03bcce8b554f5f840cf5018b0e_20171009T151157Z_00.ts' file '2befd3aa94_20180313T082811_16.ts' file '2befd3aa94_20180313T082811_17.ts' file '2befd3aa94_20180313T082811_18.ts' file '2befd3aa94_20180313T082811_19.ts' file '2befd3aa94_20180313T082811_20.ts' file '2befd3aa94_20180313T082811_21.ts' file 'b1dc7f03bcce8b554f5f840cf5018b0e_20171009T151157Z_00.ts' file 'b1dc7f03bcce8b554f5f840cf5018b0e_20171009T151157Z_00.ts' file 'b1dc7f03bcce8b554f5f840cf5018b0e_20171009T151157Z_00.ts' file '2befd3aa94_20180313T082811_22.ts' file '2befd3aa94_20180313T082811_23.ts' file '2befd3aa94_20180313T082811_24.ts' file '2befd3aa94_20180313T082811_25.ts' file 'b1dc7f03bcce8b554f5f840cf5018b0e_20171009T151157Z_00.ts' file 'b1dc7f03bcce8b554f5f840cf5018b0e_20171009T151157Z_00.ts' with command: $ ffmpeg -f concat -i test.concat -c copy -y outputconcat.mp4 Joe Koberg jkob...@gmail.com ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavfi: Add OpenCL avgblur filter
2018-03-16 8:33 GMT+01:00, dylanf...@gmail.com : > From: drfer3 > --- /dev/null > +++ b/libavfilter/opencl/avgblur.cl > @@ -0,0 +1,60 @@ > +/* > + * This file is part of FFmpeg. Please add your name. > +for (int xx = max(0,loc.x-rad); xx < min(loc.x+rad+1,size.x); xx++) > +{ > +count++; > +acc += read_imagef(src, sampler, (int2)(xx, loc.y)); > +} Usual style is: for ( ; ; ) { ... } which is also what you use for if(). Thank you, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] area changed:in cfhd height initialization was buggy for chroma plane
2018-03-16 11:27 GMT+01:00, Gagandeep Singh : > From: Gagandeep Singh Thank you for the important patch! The first line of the commit message should not start with "area changed" but something similar to "lavc/cfhd: " which means you can also remove "cfhd" from the rest of the first line. > description:when the chroma_y_shift was not present, the FFALIGN used to > round the height was unnecessary for 0 chroma shift in y direction. The word description is unnecessary. Please mention ticket #6675, without it is impossible to ever do a regression test. > --- > libavcodec/cfhd.c | 6 +++--- > libavcodec/tests/codec_desc | Bin 0 -> 189776 bytes You should not add the file codec_desc to your commit... Thank you, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] FIX: HLS Discontinuity / Non-Monotonous DTS
2018-03-16 14:58 GMT+01:00, Joe Koberg : > How to reproduce: > > ffmpeg -i https://s3.amazonaws.com/playon-test-videos/discont_ > test_new/discont_test.m3u8 -c copy -y output.mp4 Is the issue only reproducible if you use hls input or is it also reproducible if you first concatenate the ts files and use the complete file as input? Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] FIX: HLS Discontinuity / Non-Monotonous DTS
2018-03-16 14:58 GMT+01:00, Joe Koberg : > Hello, > > This patch adds code to track and correct timestamp discontinuities, fixing > "non-monotonous dts" errors and timing issues with HLS playlists. > > For some time, FFmpeg has not properly handled discontinuous timestamps in > the MPEG-TS stream from Apple HLS playlists. Symptoms include inability to > remux to containers like MP4 or stream to RTMP endpoints; choppy, broken, > or sped-up playback; and voluminous "Non-monotonous DTS", "went backwards", > and "out of order" messages logged. This is particularly troublesome in > the context of HLS, as the format allows insertion of independently-sourced > fragments for ad-insertion or to concatenate ongoing video to a stream. > > Over the years, many users have encountered and reported this issue in > different ways. > > * https://trac.ffmpeg.org/ticket/5419 "HLS EXT-X-DISCONTINUITY tag is not > supported" > * https://trac.ffmpeg.org/ticket/6613 > * https://trac.ffmpeg.org/ticket/6810 > * https://trac.ffmpeg.org/ticket/6709 > * https://trac.ffmpeg.org/ticket/6365 > * https://trac.ffmpeg.org/ticket/5236 > * https://github.com/Bilibili/ijkplayer/issues/2565 > * > https://stackoverflow.com/questions/49289394/downloading-ts-stream-with- > ext-x-discontinuity-sequence-ffmpeg > * etc... > > > It appears that the -dts_delta_threshold checking code is quite similar in > intent, and adjacent to this code, but the HLS demuxer lacks the > AVFMT_TS_DISCONT flag, effectively disabling that option. Even when > AVFMT_TS_DISCONT is set on the input format (e.g. MPEG-TS), > "-dts_delta_threshold 0" produces out-of-sync audio in our tests. That > code has been left as-is for now. The flag probably should be set on the > HLS format, though. > > In this fix, any backwards DTS jump is considered an error, as is any > forward jump of DTS or PTS by more than `dts_monotonicity_threshold` > microseconds (really, AV_TIME_BASE units, defaulting to 100 = 1 > second). The delta from the predicted value is updated and applied to all > subsequent packets, with the assumption that video was stitched together > from continuous runs. > > With this patch in place and the -force_dts_monotonicity flag set, we can > successfuly transcode arbitrary HLS playlists to MP4, FLV, or other > timestamped containers when we could not before. The playback presentation > of the result is smooth, properly timed, and in-sync in Quicktime Player, > VLC, and ffplay with correctly reported and the file seekable. > > Interaction with flags such as -copyts, -copytb, and others has not been > fully analyzed. > > We have prepared a test HLS playlist that reveals the issue. > > How to reproduce: > > ffmpeg -i https://s3.amazonaws.com/playon-test-videos/discont_ > test_new/discont_test.m3u8 -c copy -y output.mp4 > > With patch: > > ffmpeg -force_dts_monotonicity -i https://s3.amazonaws.com/ > playon-test-videos/discont_test_new/discont_test.m3u8 -c copy -y output.mp4 > > > Please let me know if I've missed anything! > > > > Joe Koberg > jkob...@gmail.com > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter: add hrtfm filter
On 3/15/2018 5:54 PM, Paul B Mahol wrote: > Signed-off-by: Paul B Mahol > --- > libavfilter/Makefile | 1 + > libavfilter/af_hrtfm.c | 477 > +++ > libavfilter/allfilters.c | 1 + > 3 files changed, 479 insertions(+) > create mode 100644 libavfilter/af_hrtfm.c Because we all know what HRTFM means immediately, so we don't need any doc. - Derek ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/openh264enc.c: generate IDR frame in response to I frame pict_type
On Wed, Mar 14, 2018 at 2:12 PM, Moritz Barsnick wrote: > > On Mon, Mar 12, 2018 at 14:38:21 -0800, Lou Logan wrote: > > > But you don't necessarily need to make a new patch to address the > > minor whitespace issue. You can wait for other comments and include > > it with any other requested changes. > > Another whitespace nit: > > > if (frame->pict_type==AV_PICTURE_TYPE_I) { > > Please use single spaces around operators, i.e. > if (frame->pict_type == AV_PICTURE_TYPE_I) { > > Moritz Attached is an updated patch incorporating all feedback - only formatting for now. Friendly ping to maintainers to review and pull the patch. Valery From 8334dfcea924ac687783d2ad7685ad143a2f1a26 Mon Sep 17 00:00:00 2001 From: vkot Date: Fri, 16 Mar 2018 14:50:34 +0100 Subject: [PATCH v2] avcodec/openh264enc.c: generate IDR frame in response to I frame pict_type Signed-off-by: vkot --- libavcodec/libopenh264enc.c | 4 1 file changed, 4 insertions(+) diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c index fdadb101f5..83c3f0ce20 100644 --- a/libavcodec/libopenh264enc.c +++ b/libavcodec/libopenh264enc.c @@ -246,6 +246,10 @@ static int svc_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, sp.iPicWidth = avctx->width; sp.iPicHeight = avctx->height; +if (frame->pict_type == AV_PICTURE_TYPE_I) { +(*s->encoder)->ForceIntraFrame(s->encoder, true); +} + encoded = (*s->encoder)->EncodeFrame(s->encoder, &sp, &fbi); if (encoded != cmResultSuccess) { av_log(avctx, AV_LOG_ERROR, "EncodeFrame failed\n"); -- 2.15.1.windows.2 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] FIX: HLS Discontinuity / Non-Monotonous DTS
Hello, This patch adds code to track and correct timestamp discontinuities, fixing "non-monotonous dts" errors and timing issues with HLS playlists. For some time, FFmpeg has not properly handled discontinuous timestamps in the MPEG-TS stream from Apple HLS playlists. Symptoms include inability to remux to containers like MP4 or stream to RTMP endpoints; choppy, broken, or sped-up playback; and voluminous "Non-monotonous DTS", "went backwards", and "out of order" messages logged. This is particularly troublesome in the context of HLS, as the format allows insertion of independently-sourced fragments for ad-insertion or to concatenate ongoing video to a stream. Over the years, many users have encountered and reported this issue in different ways. * https://trac.ffmpeg.org/ticket/5419 "HLS EXT-X-DISCONTINUITY tag is not supported" * https://trac.ffmpeg.org/ticket/6613 * https://trac.ffmpeg.org/ticket/6810 * https://trac.ffmpeg.org/ticket/6709 * https://trac.ffmpeg.org/ticket/6365 * https://trac.ffmpeg.org/ticket/5236 * https://github.com/Bilibili/ijkplayer/issues/2565 * https://stackoverflow.com/questions/49289394/downloading-ts-stream-with- ext-x-discontinuity-sequence-ffmpeg * etc... It appears that the -dts_delta_threshold checking code is quite similar in intent, and adjacent to this code, but the HLS demuxer lacks the AVFMT_TS_DISCONT flag, effectively disabling that option. Even when AVFMT_TS_DISCONT is set on the input format (e.g. MPEG-TS), "-dts_delta_threshold 0" produces out-of-sync audio in our tests. That code has been left as-is for now. The flag probably should be set on the HLS format, though. In this fix, any backwards DTS jump is considered an error, as is any forward jump of DTS or PTS by more than `dts_monotonicity_threshold` microseconds (really, AV_TIME_BASE units, defaulting to 100 = 1 second). The delta from the predicted value is updated and applied to all subsequent packets, with the assumption that video was stitched together from continuous runs. With this patch in place and the -force_dts_monotonicity flag set, we can successfuly transcode arbitrary HLS playlists to MP4, FLV, or other timestamped containers when we could not before. The playback presentation of the result is smooth, properly timed, and in-sync in Quicktime Player, VLC, and ffplay with correctly reported and the file seekable. Interaction with flags such as -copyts, -copytb, and others has not been fully analyzed. We have prepared a test HLS playlist that reveals the issue. How to reproduce: ffmpeg -i https://s3.amazonaws.com/playon-test-videos/discont_ test_new/discont_test.m3u8 -c copy -y output.mp4 With patch: ffmpeg -force_dts_monotonicity -i https://s3.amazonaws.com/ playon-test-videos/discont_test_new/discont_test.m3u8 -c copy -y output.mp4 Please let me know if I've missed anything! Joe Koberg jkob...@gmail.com 0001-Introduce-force_dts_monotonicity-to-fix-timestamp-no.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] area changed:in cfhd height initialization was buggy for chroma plane
From: Gagandeep Singh description:when the chroma_y_shift was not present, the FFALIGN used to round the height was unnecessary for 0 chroma shift in y direction. --- libavcodec/cfhd.c | 6 +++--- libavcodec/tests/codec_desc | Bin 0 -> 189776 bytes 2 files changed, 3 insertions(+), 3 deletions(-) create mode 100755 libavcodec/tests/codec_desc diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index fd834b..a064cd1599 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -195,14 +195,14 @@ static int alloc_buffers(AVCodecContext *avctx) int w8, h8, w4, h4, w2, h2; int width = i ? avctx->width >> chroma_x_shift : avctx->width; int height = i ? avctx->height >> chroma_y_shift : avctx->height; -ptrdiff_t stride = FFALIGN(width / 8, 8) * 8; -height = FFALIGN(height / 8, 2) * 8; +ptrdiff_t stride = FFALIGN(width / 8, 8) * 8; +if (chroma_y_shift) height = FFALIGN(height / 8, 2) * 8; s->plane[i].width = width; s->plane[i].height = height; s->plane[i].stride = stride; w8 = FFALIGN(s->plane[i].width / 8, 8); -h8 = FFALIGN(s->plane[i].height / 8, 2); +h8 = height / 8; w4 = w8 * 2; h4 = h8 * 2; w2 = w4 * 2; diff --git a/libavcodec/tests/codec_desc b/libavcodec/tests/codec_desc new file mode 100755 index ..9ab8ff99476f136327817d3b270f6fe072be1ed6 GIT binary patch literal 189776 zcmc${3s_v$x&OaOh#@vQSQCr4c56w6HY7ku1Y4B}1KH@1OadWzD@=v~#xTreE@Wc8 z;2~6|h^42tO;0^7ww{)@o;JOu)MG6qnxLnxcrD)1svV3M>J@L{|9#hf_b~G&sqO!H z&hwj=S$lofyVvDiYrX3_@w!T9)x3-h&HBvOF3`v~eWgjtIUxJVdHkel2;a-J zT00km_UJvWhI3GJmMLJloPUj7t9(>8`m19uU56QqX1OFwAJ+?! zW_o`33FSS)eVMaixz>9d@t(@3`PxT*XS2j6PVZQH$!5J+E+?<8Z1-(lQ?jzXxuD(G z5sekZO4k&uDOnK?tSDCHrua#A-TKWcC8}>rRg~u?_#;N)XT9+7nSY5+fAZnKEm(2J zO?w_Yr)Srf=w0g%kN@=NFeE>I6zRo?>}Y(;G5D>=i0345{V4JO_89Va9fS8CgP(qk z{5*RM`FoDRe{>99d5rikI0lb{>xfH!{swR~eO`JD{^~LKw~xWkK1P0ib`1H4j=^^x zgBO77_>-TNNcU_B;r}E4j#l1v$KVSP54DveKIk{WNL$G3Zl=yss5MsC)igGHL*7W788zCS5kEmLLAzw$Ng(A~hg3(A=y&v3(pw4hdN?@xu;_c|fizqO?m==h*C{4;) z$P?VDVry*l#N3T7z7FL2Dletz@dqJ7<)RXVB8`5xuS07IdA-^?XZ6~O#^M#lD^@3; zi%OD@b5E;Qlpu~)f1rcoXhb#5gFTw3Y!rQGs%LsK*#e9L6mI>I{5&wrre(ldp~^L~ zdpiE2r}-Aq$ZMY0Ip?sZ~odhVXhZwZ3ri}#OFJKMvO4~Bd5~)^R;W(Z^kz- z8J{(7S>w(0HcCa)X5P@1YwIg51s`O-NATO3j|je(`MBVt%qIlDpZT=lPcYZs(v|+K zdU=6)w%~6v*9EuqQz-c2Kd5LmL-6beP2MK>QsyziKgGOP@Ot}&%9UgA2Q!9xb}#d z&mqC@X8B>kb(S9!{2`W~5PXVxLhuYO?~LFE$Dj3%t}HAo%Z?w+VhX^O)d&WH-9Krw2@#G2q7IQ=JtN%k&AD7@aFpmj- zGxILNzsG#H;N@(Oh6KNz<@X5w3+5Ao|Cafr;5j@`$oe2%KXNG1DCvd=c{*!9T%V`!HQUXE4tb zypVaJ;O8=L5d1>sO@dc4j|r~x_}wdbEz1uGemV1D!CRP*2;RW$At88><);PjW%-=L z>H4{f<#oY_S>6zQ7t6Z@k28-6{ypYhg5Sn`NbozD?-4xl2eUm)2tLB{lY$>$o;90Z z-Updy3!Xh<#$PJp{gMxRl{BFUYW%)tDr0HSo6lkET1R1&b(0YVa~rH_#n?G8U$a)@iYm(oO!R{=P@4;`~v2~f>$vg z5xj|1WzsP(@@cG|0^|nWF z8}kXlKh1nn@a4?27NnQ=eCFAL8(d$dg0E%ya>0Wv-zNAvmJbTPo8@;4Uc>T(f)BI& znBXV<7q@@GH*q{Og1eb($DO5Kw8n*2=6QneU|uNr)yx|Nk27x){3hnTg8T0>^FJW? z1ebSEaBF{USn&Vg_(uf)F7t%ocQT(Ae1v(VofN`9i_1^D{&6UvfMy!4sU% zCc*c-sjGa%1mDH!b_w3gd`R$HneP$&N6g0rALRYk3Bljkqq3t-3jPa@C+ozs()9Kx z=GlTjz`RuOCzzKD{tWXr!Czq>6#QN0y9Iyp4m1CQf-nBQ$;Sl$B=d2>v-g|wGlHMZ z@|x|eG(D8Fe4gM-eqqK_DEK)XPlMn^%$o!+VcskFkk!8guVnc_!L4)RVZpCp`4Pdr z%oBoN#e7=uAnPF~J6%85v%D_&0LvSK_p-c8@SB*&1izVim*BgZ4+;K#=6eLco%w{| zzhyot`0tr#os?eQ{miokKghgP@MoBp3;tK;ZGwNuJSh0_KQPe$Cwuiehu>m!TXsv3I28Fy@LN2^8vws%6wSxdzg<1 zelPQc;Eyt&7Tk(I=j3!fJi+q1;CuF)^<@bD49mL&|10yD;M#3wJY9k>U_K=HY0UQs z{%PhDf|oI$6x_i)Ye{-}>zQW@ei`#p!RxH`j^JUIZxj40%!7j8%zU@t-(x-~_yp^J zOzFRd*<5GbUlnR&lCI+=7oYk#=JrBXPGw%o?zZ9_zd#_!9Qd^EcjyH z4;c|$yW4D63BgZc`DwxPSU%^JbUmEK^19%kVQvUs&fFz<74w+jmoo1X+{1iG@F?>= zf?v&iLhx@gpA`Jt%(Fg`Ufy3a&lY?y^HRYNGA|eW0p@Ljzrs8yc#!qKTkyA8eo*kk z%*O;@_(QYa#|1x$`HbLs%(a|!Jrpp{6Wq?cP;i5JgWwyOHwj+HyjSoJ<^zIw5y8L4JR$fGnNJJ;6Xx2f>H6v7baMp%1Iz1z-^<(({5j?>!T-iQCiol7 zy9A$MJ|y^Ybio>*J%TT0J|Xxr=97YdmU-4`>3UelJX>%l^HRY*%*zEI;P&4pcpJ+H z1#f5GD|i#{&+Ha_2g?r%{w3yPg5S)1T=4HQpAr1W%(c_g_4D7%^90|)^Z!D@hgrT{ z@F2Ih2El*N@=bytWZob4I$} zPT+ZkF8Ha;4Z%Oh+$DH|%M}xRHOqGiUdDV#@O8}h2!1j13BhZbPYT|^JnPK#@`jmb z3w{;zQo(zfmkXYAkJ;bb1n+10px_3}?-u;uS$YAu;4E;9})Zw<_W>IADi_uE%+ek zC+Ab?dRV~ny5Pq%Hw4dP?h?F!c}#GFd6(eUI%r7n8kXN9_$KBPg8P|I3O>f=&C=7$ z8)Erv!LMOnD)@JpmkU0~yiM>smEzDhlN0`S1|99qHf`5zokl;UKzDMxiGM^Cq0P{(~ zA7GyK>GbkG&pcc31oKkCKVV)ixb{;X7X&|uP`O@e=$c~Ec{x7%L9OMYYOb3pK)aXiC<-^YAJ z@Q0Zv1b>?OwBUbbp0g}nKN+{1`OyVGj=3TDS~KI=2-dT3?&Y{9oPFBSYI=H-HSar|w9?`HX+;6p6GTk!9* z{Gi}JW1^+b5 z4+vhsd|2>{n2!ja;P?}Q*RlMx;MoVw{O9DQ>*0$muM1wt@`m7TEbkIL#5^YWSDAMS z?&A1|1phY6?-4x4@)LspfaNCz-_7z_`RV2TIm>4YKFqvS@KNUFf{$?gZGu0@@$Q1C96ZxDPQ{g4}< zCc%eTzE|)QSbjk8NtPcLd@0M12!1;Agy5fHJ}r0&^PJD6>%qxf7d-1;vs{MYSFpTG z@Isc43Esi-U4l2T{E*<+vHTvvyI6ig@Hop)3jTHGS1%HA0px|#X9}_%-??sObZeuH^Mv4kU_LGQ81tMJ>3aAJb6xOfnHz$?$=oIQ zhsD3xZv+FpAr0czNeuTrt2Yxd7j{(vF>#UUd+5f z@Qax@3BHASui!!E1A<@8d|2>rFdq>-`##e?Cj|cy%TEhl$nrTw>3aAb%j<$4U~ULL z$=oHli{p<8{yNKd39kLp%>R(!OPTKxTxUKZ_;Tixf}h7ct2n*9HO#XGZ(v?3xSx5s z;5(SN3I28
Re: [FFmpeg-devel] [PATCH 2/2] lavc/qsvenc: add the Access Unit Delimiter NAL Unit support
> From: Steven Liu [mailto:l...@chinaffmpeg.org] > Sent: Friday, March 16, 2018 4:34 PM > To: FFmpeg development discussions and patches > > Cc: Steven Liu ; Li, Zhong > Subject: Re: [FFmpeg-devel] [PATCH 2/2] lavc/qsvenc: add the Access Unit > Delimiter NAL Unit support > What about add the option document into doc/encoders.texi ? Good idea. The problem is currently qsv encoding options hasn't been added into doc/encoders.texi (except some rate control options.) So I thinks firstly we need a patch to add the legacy qsv encoding options, then add this options. > > + > > { "a53cc" , "Use A53 Closed Captions (if available)", > OFFSET(qsv.a53_cc), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, VE}, > > { NULL }, > > }; > > -- > > 1.8.3.1 > > > Thanks > Steven ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Fix iterating of input and output devices
Will push tomorrow unless someone sees a problem with this. smime.p7s Description: S/MIME Cryptographic Signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/opensrt: add Haivision Open SRT protocol
> -Ursprüngliche Nachricht- > Von: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] Im Auftrag > von Sven Dueking > Gesendet: Mittwoch, 14. März 2018 08:39 > An: 'FFmpeg development discussions and patches' > Betreff: [FFmpeg-devel] [PATCH] avformat/opensrt: add Haivision Open > SRT protocol > > Updated patch according to latest feedback : > > - spelling errors and capitalization > - renamed option "timeout" -> "rw_timeout" > - changed max values for duration parameters to INT64_MAX Ping !?!? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] lavc/qsvenc: add the Access Unit Delimiter NAL Unit support
> On 16 Mar 2018, at 13:53, Zhong Li wrote: > > Signed-off-by: Zhong Li > --- > libavcodec/qsvenc.c | 1 + > libavcodec/qsvenc.h | 2 ++ > libavcodec/qsvenc_h264.c | 2 ++ > 3 files changed, 5 insertions(+) > > diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c > index 0d2e223..afb953e 100644 > --- a/libavcodec/qsvenc.c > +++ b/libavcodec/qsvenc.c > @@ -595,6 +595,7 @@ FF_ENABLE_DEPRECATION_WARNINGS > if (q->recovery_point_sei >= 0) > q->extco.RecoveryPointSEI = q->recovery_point_sei ? > MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF; > q->extco.MaxDecFrameBuffering = q->max_dec_frame_buffering; > +q->extco.AUDelimiter = q->aud ? MFX_CODINGOPTION_ON : > MFX_CODINGOPTION_OFF; > } > > q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer > *)&q->extco; > diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h > index fb5fd68..080f6f0 100644 > --- a/libavcodec/qsvenc.h > +++ b/libavcodec/qsvenc.h > @@ -138,6 +138,8 @@ typedef struct QSVEncContext { > int max_frame_size; > int max_slice_size; > > +int aud; > + > int single_sei_nal_unit; > int max_dec_frame_buffering; > int trellis; > diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c > index e01a2a3..3f090ce 100644 > --- a/libavcodec/qsvenc_h264.c > +++ b/libavcodec/qsvenc_h264.c > @@ -141,6 +141,8 @@ static const AVOption options[] = { > { "main", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_PROFILE_AVC_MAIN > }, INT_MIN, INT_MAX, VE, "profile" }, > { "high", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MFX_PROFILE_AVC_HIGH > }, INT_MIN, INT_MAX, VE, "profile" }, > > +{ "aud", "Insert the Access Unit Delimiter NAL", OFFSET(qsv.aud), > AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE}, What about add the option document into doc/encoders.texi ? > + > { "a53cc" , "Use A53 Closed Captions (if available)", OFFSET(qsv.a53_cc), > AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, VE}, > { NULL }, > }; > -- > 1.8.3.1 > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel Thanks Steven ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] avutil/log: print level prefix also when no AVClass context is available
On 16.03.2018 00:03, Michael Niedermayer wrote: On Wed, Mar 14, 2018 at 09:55:23AM +0100, Tobias Rapp wrote: Adds the level prefix to all log messages, except those with level <= AV_LOG_QUIET as they seem to be used for flushing the log buffer. Signed-off-by: Tobias Rapp --- libavutil/log.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) LGTM thx Pushed, thanks for review. Regards, Tobias ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavfi: Add OpenCL avgblur filter
From: drfer3 Behaves like the existing avgblur filter, except working on OpenCL hardware frames. Takes exactly the same options. --- configure | 1 + libavfilter/Makefile| 2 + libavfilter/allfilters.c| 1 + libavfilter/opencl/avgblur.cl | 60 libavfilter/opencl_source.h | 1 + libavfilter/vf_avgblur_opencl.c | 316 6 files changed, 381 insertions(+) create mode 100644 libavfilter/opencl/avgblur.cl create mode 100644 libavfilter/vf_avgblur_opencl.c diff --git a/configure b/configure index 0c5ed07a07..481d338caf 100755 --- a/configure +++ b/configure @@ -3202,6 +3202,7 @@ aresample_filter_deps="swresample" ass_filter_deps="libass" atempo_filter_deps="avcodec" atempo_filter_select="rdft" +avgblur_opencl_filter_deps="opencl" azmq_filter_deps="libzmq" blackframe_filter_deps="gpl" boxblur_filter_deps="gpl" diff --git a/libavfilter/Makefile b/libavfilter/Makefile index fc16512e2c..1043b41d80 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -139,6 +139,8 @@ OBJS-$(CONFIG_ALPHAMERGE_FILTER) += vf_alphamerge.o OBJS-$(CONFIG_ASS_FILTER)+= vf_subtitles.o OBJS-$(CONFIG_ATADENOISE_FILTER) += vf_atadenoise.o OBJS-$(CONFIG_AVGBLUR_FILTER)+= vf_avgblur.o +OBJS-$(CONFIG_AVGBLUR_OPENCL_FILTER) += vf_avgblur_opencl.o opencl.o \ +opencl/avgblur.o OBJS-$(CONFIG_BBOX_FILTER) += bbox.o vf_bbox.o OBJS-$(CONFIG_BENCH_FILTER) += f_bench.o OBJS-$(CONFIG_BITPLANENOISE_FILTER) += vf_bitplanenoise.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index cc423af738..3f67e321bf 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -149,6 +149,7 @@ static void register_all(void) REGISTER_FILTER(ASS,ass,vf); REGISTER_FILTER(ATADENOISE, atadenoise, vf); REGISTER_FILTER(AVGBLUR,avgblur,vf); +REGISTER_FILTER(AVGBLUR_OPENCL, avgblur_opencl, vf); REGISTER_FILTER(BBOX, bbox, vf); REGISTER_FILTER(BENCH, bench, vf); REGISTER_FILTER(BITPLANENOISE, bitplanenoise, vf); diff --git a/libavfilter/opencl/avgblur.cl b/libavfilter/opencl/avgblur.cl new file mode 100644 index 00..fff655529b --- /dev/null +++ b/libavfilter/opencl/avgblur.cl @@ -0,0 +1,60 @@ +/* + * 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 + */ + + +__kernel void avgblur_horiz(__write_only image2d_t dst, +__read_only image2d_t src, +int rad) +{ +const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE | + CLK_FILTER_NEAREST); +int2 loc = (int2)(get_global_id(0), get_global_id(1)); +int2 size = (int2)(get_global_size(0), get_global_size(1)); + +int count = 0; +float4 acc = (float4)(0,0,0,0); + +for (int xx = max(0,loc.x-rad); xx < min(loc.x+rad+1,size.x); xx++) +{ +count++; +acc += read_imagef(src, sampler, (int2)(xx, loc.y)); +} + +write_imagef(dst, loc, acc / count); +} + +__kernel void avgblur_vert(__write_only image2d_t dst, + __read_only image2d_t src, + int radv) +{ +const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE | + CLK_FILTER_NEAREST); +int2 loc = (int2)(get_global_id(0), get_global_id(1)); +int2 size = (int2)(get_global_size(0), get_global_size(1)); + +int count = 0; +float4 acc = (float4)(0,0,0,0); + +for (int yy = max(0,loc.y-radv); yy < min(loc.y+radv+1,size.y); yy++) +{ +count++; +acc += read_imagef(src, sampler, (int2)(loc.x, yy)); +} + +write_imagef(dst, loc, acc / count); +} diff --git a/libavfilter/opencl_source.h b/libavfilter/opencl_source.h index 23cdfc6ac9..02bc1723b0 100644 --- a/libavfilter/opencl_source.h +++ b/libavfilter/opencl_source.h @@ -19,6 +19,7 @@ #ifndef AVFILTER_OPENCL_SOURCE_H #define AVFILTER_OPENCL_SOURCE_H +extern const char *ff_opencl_source_avgblur; extern const char *ff_opencl_source_overlay; extern cons