[FFmpeg-devel] [PATCH] avformat/aa: initialize "header_seed" and "header_key"
From 8e28e0721c61cface6496fe4657ff5d3c3d2e6b8 Mon Sep 17 00:00:00 2001 From: Vesselin Bontchev Date: Thu, 10 Sep 2015 08:59:56 +0200 Subject: [PATCH] avformat/aa: initialize "header_seed" and "header_key" Fixes CID 1322364, CID 1322363 Signed-off-by: Vesselin Bontchev --- libavformat/aadec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/aadec.c b/libavformat/aadec.c index ba700d5..266a8e8 100644 --- a/libavformat/aadec.c +++ b/libavformat/aadec.c @@ -65,7 +65,7 @@ static int get_second_size(char *codec_name) static int aa_read_header(AVFormatContext *s) { int i, j, idx, largest_idx = -1; -uint32_t nkey, nval, toc_size, npairs, header_seed, start; +uint32_t nkey, nval, toc_size, npairs, header_seed = 0, start; char key[128], val[128], codec_name[64] = {0}; uint8_t output[24], dst[8], src[8]; int64_t largest_size = -1, current_size = -1; @@ -74,7 +74,7 @@ static int aa_read_header(AVFormatContext *s) uint32_t size; } TOC[MAX_TOC_ENTRIES]; uint32_t header_key_part[4]; -uint8_t header_key[16]; +uint8_t header_key[16] = {0}; AADemuxContext *c = s->priv_data; AVIOContext *pb = s->pb; AVStream *st; -- 2.5.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] Optimize nvenc parameters, add 3 more presets: fast, medium, slow
--- libavcodec/nvenc.c | 59 +- 1 file changed, 54 insertions(+), 5 deletions(-) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 5490652..7c683ea 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -610,8 +610,17 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx) if (ctx->preset) { if (!strcmp(ctx->preset, "hp")) { encoder_preset = NV_ENC_PRESET_HP_GUID; +}else if (!strcmp(ctx->preset, "fast")) { +ctx->twopass = 0; +encoder_preset = NV_ENC_PRESET_HQ_GUID; } else if (!strcmp(ctx->preset, "hq")) { encoder_preset = NV_ENC_PRESET_HQ_GUID; +} else if (!strcmp(ctx->preset, "medium")) { +ctx->twopass = 0; +encoder_preset = NV_ENC_PRESET_HQ_GUID; +} else if (!strcmp(ctx->preset, "slow")) { +ctx->twopass = 1; +encoder_preset = NV_ENC_PRESET_HQ_GUID; } else if (!strcmp(ctx->preset, "bd")) { encoder_preset = NV_ENC_PRESET_BD_GUID; } else if (!strcmp(ctx->preset, "ll")) { @@ -632,7 +641,7 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx) } else if (!strcmp(ctx->preset, "default")) { encoder_preset = NV_ENC_PRESET_DEFAULT_GUID; } else { -av_log(avctx, AV_LOG_FATAL, "Preset \"%s\" is unknown! Supported presets: hp, hq, bd, ll, llhp, llhq, lossless, losslesshp, default\n", ctx->preset); +av_log(avctx, AV_LOG_FATAL, "Preset \"%s\" is unknown! Supported presets: slow, medium, fast, hp, hq, bd, ll, llhp, llhq, lossless, losslesshp, default\n", ctx->preset); res = AVERROR(EINVAL); goto error; } @@ -710,6 +719,7 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx) switch (avctx->codec->id) { case AV_CODEC_ID_H264: ctx->encode_config.encodeCodecConfig.h264Config.maxNumRefFrames = avctx->refs; + ctx->encode_config.encodeCodecConfig.h264Config.hierarchicalPFrames = 1; break; case AV_CODEC_ID_H265: ctx->encode_config.encodeCodecConfig.hevcConfig.maxNumRefFramesInDPB = avctx->refs; @@ -770,7 +780,7 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx) avctx->qmin = -1; avctx->qmax = -1; } else if (ctx->cbr) { -if (!ctx->twopass) { +if (!ctx->twopass < 1) { ctx->encode_config.rcParams.rateControlMode = NV_ENC_PARAMS_RC_CBR; } else if (ctx->twopass == 1 || isLL) { ctx->encode_config.rcParams.rateControlMode = NV_ENC_PARAMS_RC_2_PASS_QUALITY; @@ -799,7 +809,7 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx) ctx->encode_config.encodeCodecConfig.h264Config.fmoMode = NV_ENC_H264_FMO_DISABLE; } } else { -ctx->encode_config.rcParams.rateControlMode = NV_ENC_PARAMS_RC_VBR; +ctx->encode_config.rcParams.rateControlMode = NV_ENC_PARAMS_RC_VBR_MINQP; } ctx->encode_config.rcParams.enableMinQP = 1; @@ -812,6 +822,45 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx) ctx->encode_config.rcParams.maxQP.qpInterB = avctx->qmax; ctx->encode_config.rcParams.maxQP.qpInterP = avctx->qmax; ctx->encode_config.rcParams.maxQP.qpIntra = avctx->qmax; + +{ +uint32_t qpInterP = (avctx->qmax + 3*avctx->qmin)/4; // biased towards Qmin +ctx->encode_config.rcParams.initialRCQP.qpInterP = qpInterP; +if(avctx->i_quant_factor != 0.0 && avctx->b_quant_factor != 0.0) { +ctx->encode_config.rcParams.initialRCQP.qpIntra = qpInterP * fabs(avctx->i_quant_factor); +ctx->encode_config.rcParams.initialRCQP.qpIntra += qpInterP * (avctx->i_quant_offset); +ctx->encode_config.rcParams.initialRCQP.qpInterB = qpInterP * fabs(avctx->b_quant_factor); +ctx->encode_config.rcParams.initialRCQP.qpInterB += qpInterP * (avctx->b_quant_offset); +} else { +ctx->encode_config.rcParams.initialRCQP.qpIntra = qpInterP; +ctx->encode_config.rcParams.initialRCQP.qpInterB = qpInterP; +} +} +ctx->encode_config.rcParams.enableInitialRCQP = 1; +} else { +if (ctx->twopass < 1) { +ctx->encode_config.rcParams.rateControlMode = NV_ENC_PARAMS_RC_VBR; +} else { +ctx->encode_config.rcParams.rateControlMode = NV_ENC_PARAMS_RC_2_PASS_VBR; +} + +{ +uint32_t qpInterP = 26; // default to 26 +ctx->encode_config.rcParams.initialRCQP.qpInterP = qpInterP; + +if(avctx->i_quant_factor != 0.0 && avctx->b_quant_factor != 0.0) { + +ctx->encode_config.rcParams.initialRCQP.qpIntra = qpInterP * fabs(avctx->i_quant_factor); +ctx->encode_config.rcParams.initialRCQP.qpIntra += qpInterP * (avctx->i_quant_offset); + +
Re: [FFmpeg-devel] [PATCH] Optimize nvenc parameters, add 3 more presets: fast, medium, slow
--- libavcodec/nvenc.c | 59 +- 1 file changed, 54 insertions(+), 5 deletions(-) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 5490652..7c683ea 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -610,8 +610,17 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx) if (ctx->preset) { if (!strcmp(ctx->preset, "hp")) { encoder_preset = NV_ENC_PRESET_HP_GUID; +}else if (!strcmp(ctx->preset, "fast")) { It's missing a space here. +ctx->twopass = 0; +encoder_preset = NV_ENC_PRESET_HQ_GUID; } else if (!strcmp(ctx->preset, "hq")) { encoder_preset = NV_ENC_PRESET_HQ_GUID; +} else if (!strcmp(ctx->preset, "medium")) { +ctx->twopass = 0; +encoder_preset = NV_ENC_PRESET_HQ_GUID; +} else if (!strcmp(ctx->preset, "slow")) { +ctx->twopass = 1; +encoder_preset = NV_ENC_PRESET_HQ_GUID; } else if (!strcmp(ctx->preset, "bd")) { encoder_preset = NV_ENC_PRESET_BD_GUID; } else if (!strcmp(ctx->preset, "ll")) { @@ -632,7 +641,7 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx) } else if (!strcmp(ctx->preset, "default")) { encoder_preset = NV_ENC_PRESET_DEFAULT_GUID; } else { -av_log(avctx, AV_LOG_FATAL, "Preset \"%s\" is unknown! Supported presets: hp, hq, bd, ll, llhp, llhq, lossless, losslesshp, default\n", ctx->preset); +av_log(avctx, AV_LOG_FATAL, "Preset \"%s\" is unknown! Supported presets: slow, medium, fast, hp, hq, bd, ll, llhp, llhq, lossless, losslesshp, default\n", ctx->preset); res = AVERROR(EINVAL); goto error; } @@ -710,6 +719,7 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx) switch (avctx->codec->id) { case AV_CODEC_ID_H264: ctx->encode_config.encodeCodecConfig.h264Config.maxNumRefFrames = avctx->refs; + ctx->encode_config.encodeCodecConfig.h264Config.hierarchicalPFrames = 1; break; case AV_CODEC_ID_H265: ctx->encode_config.encodeCodecConfig.hevcConfig.maxNumRefFramesInDPB = avctx->refs; @@ -770,7 +780,7 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx) avctx->qmin = -1; avctx->qmax = -1; } else if (ctx->cbr) { -if (!ctx->twopass) { +if (!ctx->twopass < 1) { This doesn't seem right at all, what is it supposed to do? Keep in mind that twopass is a tristate, with the default beeing -1, which means autoselect. ctx->encode_config.rcParams.rateControlMode = NV_ENC_PARAMS_RC_CBR; } else if (ctx->twopass == 1 || isLL) { ctx->encode_config.rcParams.rateControlMode = NV_ENC_PARAMS_RC_2_PASS_QUALITY; @@ -799,7 +809,7 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx) ctx->encode_config.encodeCodecConfig.h264Config.fmoMode = NV_ENC_H264_FMO_DISABLE; } } else { -ctx->encode_config.rcParams.rateControlMode = NV_ENC_PARAMS_RC_VBR; +ctx->encode_config.rcParams.rateControlMode = NV_ENC_PARAMS_RC_VBR_MINQP; } ctx->encode_config.rcParams.enableMinQP = 1; @@ -812,6 +822,45 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx) ctx->encode_config.rcParams.maxQP.qpInterB = avctx->qmax; ctx->encode_config.rcParams.maxQP.qpInterP = avctx->qmax; ctx->encode_config.rcParams.maxQP.qpIntra = avctx->qmax; + +{ I'm not sure if this conforms with the ffmpeg code style guidelines. +uint32_t qpInterP = (avctx->qmax + 3*avctx->qmin)/4; // biased towards Qmin +ctx->encode_config.rcParams.initialRCQP.qpInterP = qpInterP; +if(avctx->i_quant_factor != 0.0 && avctx->b_quant_factor != 0.0) { +ctx->encode_config.rcParams.initialRCQP.qpIntra = qpInterP * fabs(avctx->i_quant_factor); +ctx->encode_config.rcParams.initialRCQP.qpIntra += qpInterP * (avctx->i_quant_offset); +ctx->encode_config.rcParams.initialRCQP.qpInterB = qpInterP * fabs(avctx->b_quant_factor); +ctx->encode_config.rcParams.initialRCQP.qpInterB += qpInterP * (avctx->b_quant_offset); +} else { +ctx->encode_config.rcParams.initialRCQP.qpIntra = qpInterP; +ctx->encode_config.rcParams.initialRCQP.qpInterB = qpInterP; +} +} +ctx->encode_config.rcParams.enableInitialRCQP = 1; +} else { +if (ctx->twopass < 1) { This also seems a bit strange. +ctx->encode_config.rcParams.rateControlMode = NV_ENC_PARAMS_RC_VBR; +} else { +ctx->encode_config.rcParams.rateControlMode = NV_ENC_PARAMS_RC_2_PASS_VBR; +} + +{ +uint32_t qpInterP = 26; // default to 26 +ctx->encode_config.rcParams.initial
Re: [FFmpeg-devel] [PATCH] avformat/aa: initialize "header_seed" and "header_key"
On Thu, Sep 10, 2015 at 09:10:17AM +0200, Vesselin Bontchev wrote: > From 8e28e0721c61cface6496fe4657ff5d3c3d2e6b8 Mon Sep 17 00:00:00 2001 > From: Vesselin Bontchev > Date: Thu, 10 Sep 2015 08:59:56 +0200 > Subject: [PATCH] avformat/aa: initialize "header_seed" and "header_key" > > Fixes CID 1322364, CID 1322363 > > Signed-off-by: Vesselin Bontchev > --- > libavformat/aadec.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) LGTM thanks -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB During times of universal deceit, telling the truth becomes a revolutionary act. -- George Orwell signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] MP3 streaming/seeking broken in new Chrome release using newer ffmpeg
Hello, A recent Chrome update today has caused seeking in audio files streamed on the web (eg, via SoundCloud and others) to no longer work. Instead, the file is slowly buffered until the required position in the data stream is reached. I added some notes about this problem at the Chrome bug report list at https://code.google.com/p/chromium/issues/detail?id=530043 I'm not sure how to directly test this in the ffmpeg toolset, perhaps it has been corrected in a recent commit? Please see below for my analysis. *ANALYSIS* ffmpeg has been updated in the new Chrome release. Various mp3 seeking commits were included that made large changes, breaking this feature. Other commits have since been added that have not been merged in, I do not know if these fix the issue - potentially. I noticed a new seek "mode" was added to ffmpeg for mp3's that causes seeking to either by disabled or use the "slow but accurate" mode of reading data until the byte position is available, instead of causing a seek like before. This commit, which was not part of the merge, is also of interest https://github.com/FFmpeg/FFmpeg/commit/c43bd08f8b043df7e18110e5344283c37b8380c1 *DETAILS* I noticed that ffmpeg was updated, and ffmpeg had a lot of changes regarding mp3 seeking, and more changes after the commit that Chrome merged. 1. Chrome stable release diff: https://chromium.googlesource.com/chromium/src/+log/44.0.2403.157..45.0.2454.85?pretty=fuller&n=1 2.These are the ffmpeg DEPS submodule versions 44x ffmpeg deps: ffmpeg cc2ec2825b0cc25cf27c5843847e7028c1cdb075 45x ffmpeg deps: ffmpeg 833732528c1873f37b490b289eeaded2ae86349c 3. Diff of ffmpeg from the previous stable release to this one: https://chromium.googlesource.com/chromium/third_party/ffmpeg.git/+log/cc2ec2825b0cc25cf27c5843847e7028c1cdb075..833732528c1873f37b490b289eeaded2ae86349c 4. Commits affecting mp3 seeking in this diff: avformat/mp3: large id3 tags break concatenated file detection https://chromium.googlesource.com/chromium/third_party/ffmpeg.git/+/537ab680534e53bd298ba3f62d4aabb56afcd403 avformat/mp3dec: fix gapless audio when seeking in CBR mode https://chromium.googlesource.com/chromium/third_party/ffmpeg.git/+/92eef26e67ea8d2265854594344f8db17b9ce299 avformat/mp3dec: Allow forcing the use of the xing TOC for CBR files https://chromium.googlesource.com/chromium/third_party/ffmpeg.git/+/a742a0536dbb8b5a280b21ffd76c8b4acdbd20a6 avformat/mp3dec: offset seek index to end of id3v2 tag https://chromium.googlesource.com/chromium/third_party/ffmpeg.git/+/8b76c0eb561b0313e2a27950fe9d2bc5e4780dd8 avformat/mp3: skip junk at the beginning of mp3 files https://chromium.googlesource.com/chromium/third_party/ffmpeg.git/+/2b3e9bbfb529e6bde238aeb511b55ebe461664c8 avformat/mp3dec: allow enabling generic seek mode https://chromium.googlesource.com/chromium/third_party/ffmpeg.git/+/c3a73666ad1eee93e49f25efae30fda5556c228e 5. I notice that further commits, that were not merged, have been made to ffmpeg seeking at https://github.com/FFmpeg/FFmpeg/commit/c43bd08f8b043df7e18110e5344283c37b8380c1 Regards, Andrew ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Use av_log() to log messages from the libopenh264 encoder.
On Wed, Sep 09, 2015 at 03:32:42PM -0400, Gregory J. Wolfe wrote: > File libopenh264enc.c has been modified so that the encoder uses av_log() > to log messages (error, warning, info, etc.) instead of logging them > directly to stderr. At the time the encoder is created, the current > libav log level is mapped to an equivalent libopenh264 log level. This > log level, and a message logging function that invokes av_log() to > actually log messages, are then set on the encoder. > > Signed-off-by: Gregory J. Wolfe > --- > libavcodec/libopenh264enc.c | 90 > + > 1 file changed, 90 insertions(+) applied with some minor changes thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Awnsering whenever a program halts or runs forever is On a turing machine, in general impossible (turings halting problem). On any real computer, always possible as a real computer has a finite number of states N, and will either halt in less than N cycles or never halt. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avformat/avienc: add muxer option "write_channel_mask"
Attached patch adds support for writing an empty channel-mask into AVI files. My use-case is handling recorded AVI files which have an unknown/empty/unsupported channel layout. Instead of writing the guessed channel layout into the output file, using "-write_channel_mask off" allows to write an empty channel mask instead. Regards, Tobias >From 0c1ca2caef76063cff932e146954d04ae65cd019 Mon Sep 17 00:00:00 2001 From: Tobias Rapp Date: Thu, 10 Sep 2015 14:04:18 +0200 Subject: [PATCH] avformat/avienc: add muxer option "write_channel_mask" Allow writing an empty channel mask into the wave format header. Useful if the input file contains an unknown channel layout. --- libavformat/avienc.c | 22 -- libavformat/riff.h| 5 + libavformat/riffenc.c | 5 +++-- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/libavformat/avienc.c b/libavformat/avienc.c index a79f156..a743262 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -34,6 +34,7 @@ #include "libavutil/dict.h" #include "libavutil/avassert.h" #include "libavutil/timestamp.h" +#include "libavutil/opt.h" #include "libavutil/pixdesc.h" #include "libavcodec/raw.h" @@ -61,6 +62,7 @@ typedef struct AVIContext { int64_t riff_start, movi_list, odml_list; int64_t frames_hdr_all; int riff_id; +int write_channel_mask; } AVIContext; typedef struct AVIStream { @@ -339,7 +341,7 @@ static int avi_write_header(AVFormatContext *s) ff_end_tag(pb, strh); if (enc->codec_type != AVMEDIA_TYPE_DATA) { -int ret; +int ret, flags; enum AVPixelFormat pix_fmt; strf = ff_start_tag(pb, "strf"); @@ -367,7 +369,8 @@ static int avi_write_header(AVFormatContext *s) av_get_pix_fmt_name(enc->pix_fmt)); break; case AVMEDIA_TYPE_AUDIO: -if ((ret = ff_put_wav_header(pb, enc, 0)) < 0) +flags = (avi->write_channel_mask == 0) ? FF_PUT_WAV_HEADER_SKIP_CHANNELMASK : 0; +if ((ret = ff_put_wav_header(pb, enc, flags)) < 0) return ret; break; default: @@ -782,6 +785,20 @@ static int avi_write_trailer(AVFormatContext *s) return res; } +#define OFFSET(x) offsetof(AVIContext, x) +#define ENC AV_OPT_FLAG_ENCODING_PARAM +static const AVOption options[] = { +{ "write_channel_mask", "write channel mask into wave format header", OFFSET(write_channel_mask), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, ENC }, +{ NULL }, +}; + +static const AVClass avi_muxer_class = { +.class_name = "AVI muxer", +.item_name = av_default_item_name, +.option = options, +.version= LIBAVUTIL_VERSION_INT, +}; + AVOutputFormat ff_avi_muxer = { .name = "avi", .long_name = NULL_IF_CONFIG_SMALL("AVI (Audio Video Interleaved)"), @@ -796,4 +813,5 @@ AVOutputFormat ff_avi_muxer = { .codec_tag = (const AVCodecTag * const []) { ff_codec_bmp_tags, ff_codec_wav_tags, 0 }, +.priv_class= &avi_muxer_class, }; diff --git a/libavformat/riff.h b/libavformat/riff.h index 399c527..d6d91ef 100644 --- a/libavformat/riff.h +++ b/libavformat/riff.h @@ -53,6 +53,11 @@ void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc, const AVCodecTag *t #define FF_PUT_WAV_HEADER_FORCE_WAVEFORMATEX0x0001 /** + * Tell ff_put_wav_header() to write an empty channel mask. + */ +#define FF_PUT_WAV_HEADER_SKIP_CHANNELMASK 0x0002 + +/** * Write WAVEFORMAT header structure. * * @param flags a combination of FF_PUT_WAV_HEADER_* constants diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c index 85c953f..ceb27f2 100644 --- a/libavformat/riffenc.c +++ b/libavformat/riffenc.c @@ -168,8 +168,9 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc, int flags) } /* write WAVEFORMATEXTENSIBLE extensions */ if (waveformatextensible) { -int write_channel_mask = enc->strict_std_compliance < FF_COMPLIANCE_NORMAL || - enc->channel_layout < 0x4; +int write_channel_mask = !(flags & FF_PUT_WAV_HEADER_SKIP_CHANNELMASK) && + (enc->strict_std_compliance < FF_COMPLIANCE_NORMAL || + enc->channel_layout < 0x4); /* 22 is WAVEFORMATEXTENSIBLE size */ avio_wl16(pb, riff_extradata - riff_extradata_start + 22); /* ValidBitsPerSample || SamplesPerBlock || Reserved */ -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] MP3 streaming/seeking broken in new Chrome release using newer ffmpeg
On Thu, Sep 10, 2015 at 08:35:21PM +1000, Andrew Armstrong wrote: > Hello, > > A recent Chrome update today has caused seeking in audio files streamed on > the web (eg, via SoundCloud and others) to no longer work. Instead, the > file is slowly buffered until the required position in the data stream is > reached. > > I added some notes about this problem at the Chrome bug report list at > https://code.google.com/p/chromium/issues/detail?id=530043 > > I'm not sure how to directly test this in the ffmpeg toolset, perhaps it > has been corrected in a recent commit? Please see below for my analysis. > > > *ANALYSIS* > ffmpeg has been updated in the new Chrome release. Various mp3 seeking > commits were included that made large changes, breaking this feature. Other > commits have since been added that have not been merged in, I do not know > if these fix the issue - potentially. > > I noticed a new seek "mode" was added to ffmpeg for mp3's that causes > seeking to either by disabled or use the "slow but accurate" mode of > reading data until the byte position is available, instead of causing a > seek like before. > > This commit, which was not part of the merge, is also of interest > https://github.com/FFmpeg/FFmpeg/commit/c43bd08f8b043df7e18110e5344283c37b8380c1 > > *DETAILS* > I noticed that ffmpeg was updated, and ffmpeg had a lot of changes > regarding mp3 seeking, and more changes after the commit that Chrome merged. > > 1. Chrome stable release diff: > https://chromium.googlesource.com/chromium/src/+log/44.0.2403.157..45.0.2454.85?pretty=fuller&n=1 > > 2.These are the ffmpeg DEPS submodule versions > 44x ffmpeg deps: ffmpeg cc2ec2825b0cc25cf27c5843847e7028c1cdb075 > 45x ffmpeg deps: ffmpeg 833732528c1873f37b490b289eeaded2ae86349c > > 3. Diff of ffmpeg from the previous stable release to this one: > https://chromium.googlesource.com/chromium/third_party/ffmpeg.git/+log/cc2ec2825b0cc25cf27c5843847e7028c1cdb075..833732528c1873f37b490b289eeaded2ae86349c > > 4. Commits affecting mp3 seeking in this diff: > avformat/mp3: large id3 tags break concatenated file detection > https://chromium.googlesource.com/chromium/third_party/ffmpeg.git/+/537ab680534e53bd298ba3f62d4aabb56afcd403 > > avformat/mp3dec: fix gapless audio when seeking in CBR mode > https://chromium.googlesource.com/chromium/third_party/ffmpeg.git/+/92eef26e67ea8d2265854594344f8db17b9ce299 > > avformat/mp3dec: Allow forcing the use of the xing TOC for CBR files > https://chromium.googlesource.com/chromium/third_party/ffmpeg.git/+/a742a0536dbb8b5a280b21ffd76c8b4acdbd20a6 > > avformat/mp3dec: offset seek index to end of id3v2 tag > https://chromium.googlesource.com/chromium/third_party/ffmpeg.git/+/8b76c0eb561b0313e2a27950fe9d2bc5e4780dd8 > > avformat/mp3: skip junk at the beginning of mp3 files > https://chromium.googlesource.com/chromium/third_party/ffmpeg.git/+/2b3e9bbfb529e6bde238aeb511b55ebe461664c8 > > avformat/mp3dec: allow enabling generic seek mode > https://chromium.googlesource.com/chromium/third_party/ffmpeg.git/+/c3a73666ad1eee93e49f25efae30fda5556c228e > > 5. I notice that further commits, that were not merged, have been made to > ffmpeg seeking at > https://github.com/FFmpeg/FFmpeg/commit/c43bd08f8b043df7e18110e5344283c37b8380c1 > So which commit is responsible of the regression? -- Clément B. pgpVnH2tRN7i3.pgp Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/avienc: add muxer option "write_channel_mask"
On 9/10/2015 1:25 PM, Tobias Rapp wrote: > My use-case is handling recorded AVI files which have an > unknown/empty/unsupported channel layout. Instead of writing the guessed > channel layout into the output file, using "-write_channel_mask off" > allows to write an empty channel mask instead. Are such files even valid? - Derek ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] MP3 streaming/seeking broken in new Chrome release using newer ffmpeg
Hi Andrew, On Thu, Sep 10, 2015 at 8:37 AM, Clément Bœsch wrote: > On Thu, Sep 10, 2015 at 08:35:21PM +1000, Andrew Armstrong wrote: > > Hello, > > > > A recent Chrome update today has caused seeking in audio files streamed > on > > the web (eg, via SoundCloud and others) to no longer work. Instead, the > > file is slowly buffered until the required position in the data stream is > > reached. > > > > I added some notes about this problem at the Chrome bug report list at > > https://code.google.com/p/chromium/issues/detail?id=530043 > > > > I'm not sure how to directly test this in the ffmpeg toolset, perhaps it > > has been corrected in a recent commit? Please see below for my analysis. > > > > > > *ANALYSIS* > > ffmpeg has been updated in the new Chrome release. Various mp3 seeking > > commits were included that made large changes, breaking this feature. > Other > > commits have since been added that have not been merged in, I do not know > > if these fix the issue - potentially. > > > > I noticed a new seek "mode" was added to ffmpeg for mp3's that causes > > seeking to either by disabled or use the "slow but accurate" mode of > > reading data until the byte position is available, instead of causing a > > seek like before. > > > > This commit, which was not part of the merge, is also of interest > > > https://github.com/FFmpeg/FFmpeg/commit/c43bd08f8b043df7e18110e5344283c37b8380c1 > > > > *DETAILS* > > I noticed that ffmpeg was updated, and ffmpeg had a lot of changes > > regarding mp3 seeking, and more changes after the commit that Chrome > merged. > > > > 1. Chrome stable release diff: > > > https://chromium.googlesource.com/chromium/src/+log/44.0.2403.157..45.0.2454.85?pretty=fuller&n=1 > > > > 2.These are the ffmpeg DEPS submodule versions > > 44x ffmpeg deps: ffmpeg cc2ec2825b0cc25cf27c5843847e7028c1cdb075 > > 45x ffmpeg deps: ffmpeg 833732528c1873f37b490b289eeaded2ae86349c > > > > 3. Diff of ffmpeg from the previous stable release to this one: > > > https://chromium.googlesource.com/chromium/third_party/ffmpeg.git/+log/cc2ec2825b0cc25cf27c5843847e7028c1cdb075..833732528c1873f37b490b289eeaded2ae86349c > > > > 4. Commits affecting mp3 seeking in this diff: > > avformat/mp3: large id3 tags break concatenated file detection > > > https://chromium.googlesource.com/chromium/third_party/ffmpeg.git/+/537ab680534e53bd298ba3f62d4aabb56afcd403 > > > > avformat/mp3dec: fix gapless audio when seeking in CBR mode > > > https://chromium.googlesource.com/chromium/third_party/ffmpeg.git/+/92eef26e67ea8d2265854594344f8db17b9ce299 > > > > avformat/mp3dec: Allow forcing the use of the xing TOC for CBR files > > > https://chromium.googlesource.com/chromium/third_party/ffmpeg.git/+/a742a0536dbb8b5a280b21ffd76c8b4acdbd20a6 > > > > avformat/mp3dec: offset seek index to end of id3v2 tag > > > https://chromium.googlesource.com/chromium/third_party/ffmpeg.git/+/8b76c0eb561b0313e2a27950fe9d2bc5e4780dd8 > > > > avformat/mp3: skip junk at the beginning of mp3 files > > > https://chromium.googlesource.com/chromium/third_party/ffmpeg.git/+/2b3e9bbfb529e6bde238aeb511b55ebe461664c8 > > > > avformat/mp3dec: allow enabling generic seek mode > > > https://chromium.googlesource.com/chromium/third_party/ffmpeg.git/+/c3a73666ad1eee93e49f25efae30fda5556c228e > > > > 5. I notice that further commits, that were not merged, have been made to > > ffmpeg seeking at > > > https://github.com/FFmpeg/FFmpeg/commit/c43bd08f8b043df7e18110e5344283c37b8380c1 > > > > So which commit is responsible of the regression? Also, what code does Chrome invoke to seek? I assume it calls av_seek_frame() - with which arguments? Ronald ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] MP3 streaming/seeking broken in new Chrome release using newer ffmpeg
On Thu, 10 Sep 2015 20:35:21 +1000 Andrew Armstrong wrote: > Hello, > > A recent Chrome update today has caused seeking in audio files streamed on > the web (eg, via SoundCloud and others) to no longer work. Instead, the > file is slowly buffered until the required position in the data stream is > reached. > > I added some notes about this problem at the Chrome bug report list at > https://code.google.com/p/chromium/issues/detail?id=530043 This was already fixed by an (apparent) chrome developer. The issue is that seeking precision was increased, which forces reading the whole file up until the seek position. Blame mp3 for being a terrible format. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] IRC meeting on Saturday 2015-09-12, UTC 15:00
On Mon, Sep 07, 2015 at 11:37:47AM +0200, Stefano Sabatini wrote: > Hi, > > I propose to have an official IRC meeting on the next Saturday, and I > propose the tentative time of 15:00 UTC, but feel free to propose a > different time if this can't suit you. > Being in CEST, it kind of blocks the afternoon to beginning of evening, I'm actually not sure I'll be able to stay for very long. One or two hours earlier would be great. > The IRC meeting channel will be public and the log will be published > at the end of the meeting. > > This meeting is also meant as a preparation for the real-life meeting > that will be held in Paris at the next VDD > (http://www.videolan.org/videolan/events/vdd15/) for the FFmpeg > developers who will attend it. > > I propose these topics of the day (suggested by ubitux on IRC): > 1. ABI compatibility policy This needs to be discussed ASAP since it's blocking some patches. Any person willing to have a word on this needs to attend the meeting since we will likely come up with a decision. > 2. general policy decision process > 3. VDD15 > 4. Any other business > > Feel free to suggest other topics. -- Clément B. pgpbN2gh7k2DY.pgp Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/avienc: add muxer option "write_channel_mask"
On 10.09.2015 14:57, Derek Buitenhuis wrote: On 9/10/2015 1:25 PM, Tobias Rapp wrote: My use-case is handling recorded AVI files which have an unknown/empty/unsupported channel layout. Instead of writing the guessed channel layout into the output file, using "-write_channel_mask off" allows to write an empty channel mask instead. Are such files even valid? I guess so as the docs at [1] say in chapter "Details about dwChannelMask": "If, for example in a multi-channel audio authoring application, no speaker location is desired on any of the mono streams, the dwChannelMask should explicitly be set to 0." BTW: I just noticed that FATE is failing after applying the patch so I'll need to take a closer look and update the patch before it can be applied. /Tobias Link [1]: https://msdn.microsoft.com/en-us/library/windows/hardware/dn653308.aspx ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] Triple GET request while encoding remote JPEG image
Hi One question: Why does FFmpeg need to perform 3 GET requests to encode one remote JPEG image: $ ./ffmpeg -y -loglevel trace -i http://i.wp.pl/a/i/dppadmin/sport/wid_15524107.jpg -f mjpeg /dev/null ffmpeg version N-75159-g319898b Copyright (c) 2000-2015 the FFmpeg developers built with gcc 4.8.3 (GCC) 20140911 (Red Hat 4.8.3-9) configuration: --prefix=/home/pszemus/ffmpeg-2.8/build --enable-pic --enable-pthreads --enable-libmp3lame --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfaac --enable-gpl --enable-nonfree --enable-libvpx --enable-libvorbis --enable-libx264 --pkg-config-flags=--static --enable-protocol=https --enable-openssl --extra-cflags=-I/opt/WP/common.libs/inc --extra-ldflags='-L/opt/WP/common.libs/lib -ldl' libavutil 55. 1.100 / 55. 1.100 libavcodec 57. 1.100 / 57. 1.100 libavformat57. 0.100 / 57. 0.100 libavdevice57. 0.100 / 57. 0.100 libavfilter 6. 1.100 / 6. 1.100 libswscale 4. 0.100 / 4. 0.100 libswresample 2. 0.100 / 2. 0.100 libpostproc54. 0.100 / 54. 0.100 [cut] Parsing a group of options: input file http://i.wp.pl/a/i/dppadmin/sport/wid_15524107.jpg. Successfully parsed a group of options. Opening an input file: http://i.wp.pl/a/i/dppadmin/sport/wid_15524107.jpg. [http @ 0x2f24c80] request: GET /a/i/dppadmin/sport/wid_15524107.jpg HTTP/1.1 User-Agent: Lavf/57.0.100 Accept: */* Range: bytes=0- Connection: close Host: i.wp.pl Icy-MetaData: 1 [http @ 0x2f24c80] header='HTTP/1.1 206 Partial Content' [http @ 0x2f24c80] http_code=206 [http @ 0x2f24c80] header='Server: nginx' [http @ 0x2f24c80] header='Date: Thu, 10 Sep 2015 13:55:47 GMT' [http @ 0x2f24c80] header='Content-Type: image/jpeg' [http @ 0x2f24c80] header='Content-Length: 290686' [http @ 0x2f24c80] header='Connection: close' [http @ 0x2f24c80] header='Last-Modified: Thu, 25 Apr 2013 09:24:03 GMT' [http @ 0x2f24c80] header='Vary: Accept-Encoding' [http @ 0x2f24c80] header='ETag: "5178f633-46f7e"' [http @ 0x2f24c80] header='Expires: Thu, 17 Sep 2015 13:55:16 GMT' [http @ 0x2f24c80] header='Cache-Control: max-age=604800' [http @ 0x2f24c80] header='Access-Control-Allow-Origin: *' [http @ 0x2f24c80] header='Cache-Control: public' [http @ 0x2f24c80] header='Content-Range: bytes 0-290685/290686' [http @ 0x2f24c80] header='' Probing image2 score:50 size:2048 Probing jpeg_pipe score:6 size:2048 [image2 @ 0x2f24380] Format image2 probed with size=2048 and score=50 [http @ 0x2f28840] request: GET /a/i/dppadmin/sport/wid_15524107.jpg HTTP/1.1 User-Agent: Lavf/57.0.100 Accept: */* Range: bytes=0- Connection: close Host: i.wp.pl Icy-MetaData: 1 [http @ 0x2f28840] header='HTTP/1.1 206 Partial Content' [http @ 0x2f28840] http_code=206 [http @ 0x2f28840] header='Server: nginx' [http @ 0x2f28840] header='Date: Thu, 10 Sep 2015 13:55:47 GMT' [http @ 0x2f28840] header='Content-Type: image/jpeg' [http @ 0x2f28840] header='Content-Length: 290686' [http @ 0x2f28840] header='Connection: close' [http @ 0x2f28840] header='Last-Modified: Thu, 25 Apr 2013 09:24:03 GMT' [http @ 0x2f28840] header='Vary: Accept-Encoding' [http @ 0x2f28840] header='ETag: "5178f633-46f7e"' [http @ 0x2f28840] header='Expires: Thu, 17 Sep 2015 13:55:16 GMT' [http @ 0x2f28840] header='Cache-Control: max-age=604800' [http @ 0x2f28840] header='Access-Control-Allow-Origin: *' [http @ 0x2f28840] header='Cache-Control: public' [http @ 0x2f28840] header='Content-Range: bytes 0-290685/290686' [http @ 0x2f28840] header='' [image2 @ 0x2f24380] Before avformat_find_stream_info() pos: 0 bytes read:2486 seeks:0 [http @ 0x2f28860] request: GET /a/i/dppadmin/sport/wid_15524107.jpg HTTP/1.1 User-Agent: Lavf/57.0.100 Accept: */* Range: bytes=0- Connection: close Host: i.wp.pl Icy-MetaData: 1 [http @ 0x2f28860] header='HTTP/1.1 206 Partial Content' [http @ 0x2f28860] http_code=206 [http @ 0x2f28860] header='Server: nginx' [http @ 0x2f28860] header='Date: Thu, 10 Sep 2015 13:55:47 GMT' [http @ 0x2f28860] header='Content-Type: image/jpeg' [http @ 0x2f28860] header='Content-Length: 290686' [http @ 0x2f28860] header='Connection: close' [http @ 0x2f28860] header='Last-Modified: Thu, 25 Apr 2013 09:24:03 GMT' [http @ 0x2f28860] header='Vary: Accept-Encoding' [http @ 0x2f28860] header='ETag: "5178f633-46f7e"' [http @ 0x2f28860] header='Expires: Thu, 17 Sep 2015 13:33:14 GMT' [http @ 0x2f28860] header='Cache-Control: max-age=604800' [http @ 0x2f28860] header='Access-Control-Allow-Origin: *' [http @ 0x2f28860] header='Cache-Control: public' [http @ 0x2f28860] header='Content-Range: bytes 0-290685/290686' [http @ 0x2f28860] header='' [AVIOContext @ 0x2f28920] Statistics: 290686 bytes read, 0 seeks [cut] [image2 @ 0x2f24380] 0: start_time: 0.000 duration: 0.000 [image2 @ 0x2f24
Re: [FFmpeg-devel] [PATCH v2] avformat/avienc: add muxer option "write_channel_mask"
On 10.09.2015 15:28, Tobias Rapp wrote: On 10.09.2015 14:57, Derek Buitenhuis wrote: On 9/10/2015 1:25 PM, Tobias Rapp wrote: My use-case is handling recorded AVI files which have an unknown/empty/unsupported channel layout. Instead of writing the guessed channel layout into the output file, using "-write_channel_mask off" allows to write an empty channel mask instead. Are such files even valid? I guess so as the docs at [1] say in chapter "Details about dwChannelMask": "If, for example in a multi-channel audio authoring application, no speaker location is desired on any of the mono streams, the dwChannelMask should explicitly be set to 0." BTW: I just noticed that FATE is failing after applying the patch so I'll need to take a closer look and update the patch before it can be applied. Forgot to add a reference to AVClass in AVIContext. Attached an updated version of the patch. /Tobias >From 6b2c3feb43870398005ea307d6d9ee4736dd2d11 Mon Sep 17 00:00:00 2001 From: Tobias Rapp Date: Thu, 10 Sep 2015 14:04:18 +0200 Subject: [PATCH] avformat/avienc: add muxer option "write_channel_mask" Allow writing an empty channel mask into the wave format header. Useful if the input file contains an unknown channel layout. --- libavformat/avienc.c | 23 +-- libavformat/riff.h| 5 + libavformat/riffenc.c | 5 +++-- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/libavformat/avienc.c b/libavformat/avienc.c index a79f156..649961d 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -34,6 +34,7 @@ #include "libavutil/dict.h" #include "libavutil/avassert.h" #include "libavutil/timestamp.h" +#include "libavutil/opt.h" #include "libavutil/pixdesc.h" #include "libavcodec/raw.h" @@ -58,9 +59,11 @@ typedef struct AVIIndex { } AVIIndex; typedef struct AVIContext { +const AVClass *class; int64_t riff_start, movi_list, odml_list; int64_t frames_hdr_all; int riff_id; +int write_channel_mask; } AVIContext; typedef struct AVIStream { @@ -339,7 +342,7 @@ static int avi_write_header(AVFormatContext *s) ff_end_tag(pb, strh); if (enc->codec_type != AVMEDIA_TYPE_DATA) { -int ret; +int ret, flags; enum AVPixelFormat pix_fmt; strf = ff_start_tag(pb, "strf"); @@ -367,7 +370,8 @@ static int avi_write_header(AVFormatContext *s) av_get_pix_fmt_name(enc->pix_fmt)); break; case AVMEDIA_TYPE_AUDIO: -if ((ret = ff_put_wav_header(pb, enc, 0)) < 0) +flags = (avi->write_channel_mask == 0) ? FF_PUT_WAV_HEADER_SKIP_CHANNELMASK : 0; +if ((ret = ff_put_wav_header(pb, enc, flags)) < 0) return ret; break; default: @@ -782,6 +786,20 @@ static int avi_write_trailer(AVFormatContext *s) return res; } +#define OFFSET(x) offsetof(AVIContext, x) +#define ENC AV_OPT_FLAG_ENCODING_PARAM +static const AVOption options[] = { +{ "write_channel_mask", "write channel mask into wave format header", OFFSET(write_channel_mask), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, ENC }, +{ NULL }, +}; + +static const AVClass avi_muxer_class = { +.class_name = "AVI muxer", +.item_name = av_default_item_name, +.option = options, +.version= LIBAVUTIL_VERSION_INT, +}; + AVOutputFormat ff_avi_muxer = { .name = "avi", .long_name = NULL_IF_CONFIG_SMALL("AVI (Audio Video Interleaved)"), @@ -796,4 +814,5 @@ AVOutputFormat ff_avi_muxer = { .codec_tag = (const AVCodecTag * const []) { ff_codec_bmp_tags, ff_codec_wav_tags, 0 }, +.priv_class = &avi_muxer_class, }; diff --git a/libavformat/riff.h b/libavformat/riff.h index 399c527..d6d91ef 100644 --- a/libavformat/riff.h +++ b/libavformat/riff.h @@ -53,6 +53,11 @@ void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc, const AVCodecTag *t #define FF_PUT_WAV_HEADER_FORCE_WAVEFORMATEX0x0001 /** + * Tell ff_put_wav_header() to write an empty channel mask. + */ +#define FF_PUT_WAV_HEADER_SKIP_CHANNELMASK 0x0002 + +/** * Write WAVEFORMAT header structure. * * @param flags a combination of FF_PUT_WAV_HEADER_* constants diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c index 85c953f..ceb27f2 100644 --- a/libavformat/riffenc.c +++ b/libavformat/riffenc.c @@ -168,8 +168,9 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc, int flags) } /* write WAVEFORMATEXTENSIBLE extensions */ if (waveformatextensible) { -int write_channel_mask = enc->strict_std_compliance < FF_COMPLIANCE_NORMAL || - enc->channel_layout < 0x4; +int write_channel_mask = !(flags & FF_PUT_WAV_HEADER_SKIP_CHANNELMASK) && + (enc->strict_std_compliance < FF_COMPLIANCE_NORMAL || + enc->chann
Re: [FFmpeg-devel] [PATCH 3/3] avfilter/vf_stereo3d: add HDMI output format
Hi Paul, On Sat, Sep 5, 2015 at 9:29 PM, Paul B Mahol wrote > +HDMI, // HDMI frame pack (left eye first, right eye > second) > I'm wondering, how this output filter can be actually used? Packaging stereo pair into HDMI format at software level (e.g. without support by driver) makes no sense as far as I know... Does this filter is expected to be used internally by hardware player? Regards, Kirill ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/6] lavc/ass_split: Fix parser bugs
Specifically: - Skip writing drawings as text - Parse \h correctly - Handle comments and unknown tags correctly --- libavcodec/ass_split.c | 29 + 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/libavcodec/ass_split.c b/libavcodec/ass_split.c index 9bc7b9d..e9b100d 100644 --- a/libavcodec/ass_split.c +++ b/libavcodec/ass_split.c @@ -428,30 +428,37 @@ int ff_ass_split_override_codes(const ASSCodesCallbacks *callbacks, void *priv, const char *text = NULL; char new_line[2]; int text_len = 0; +int drawing = 0; while (buf && *buf) { if (text && callbacks->text && -(sscanf(buf, "\\%1[nN]", new_line) == 1 || - !strncmp(buf, "{\\", 2))) { -callbacks->text(priv, text, text_len); +(sscanf(buf, "\\%1[nNh]", new_line) == 1 || + *buf == '{')) { +if (!drawing) +callbacks->text(priv, text, text_len); text = NULL; } -if (sscanf(buf, "\\%1[nN]", new_line) == 1) { +if (sscanf(buf, "\\%1h", new_line) == 1) { +callbacks->text(priv, "\u00A0", 2); +buf += 2; +} else if (sscanf(buf, "\\%1[nN]", new_line) == 1) { if (callbacks->new_line) callbacks->new_line(priv, new_line[0] == 'N'); buf += 2; -} else if (!strncmp(buf, "{\\", 2)) { -buf++; +} else if (*buf == '{' && strchr(buf, '}')) { +buf += strcspn(buf, "\\}"); // skip comments while (*buf == '\\') { char style[2], c[2], sep[2], c_num[2] = "0", tmp[128] = {0}; unsigned int color = 0x; -int len, size = -1, an = -1, alpha = -1; +int len = 2, size = -1, an = -1, alpha = -1; int x1, y1, x2, y2, t1 = -1, t2 = -1; if (sscanf(buf, "\\%1[bisu]%1[01\\}]%n", style, c, &len) > 1) { int close = c[0] == '0' ? 1 : c[0] == '1' ? 0 : -1; len += close != -1; if (callbacks->style) callbacks->style(priv, style[0], close); +} else if (sscanf(buf, "\\p%u%1[\\}]%n", &size, sep, &len) > 1) { +drawing = (size > 0); } else if (sscanf(buf, "\\c%1[\\}]%n", sep, &len) > 0 || sscanf(buf, "\\c&H%X&%1[\\}]%n", &color, sep, &len) > 1 || sscanf(buf, "\\%1[1234]c%1[\\}]%n", c_num, sep, &len) > 1 || @@ -494,13 +501,11 @@ int ff_ass_split_override_codes(const ASSCodesCallbacks *callbacks, void *priv, } else if (sscanf(buf, "\\org(%d,%d)%1[\\}]%n", &x1, &y1, sep, &len) > 2) { if (callbacks->origin) callbacks->origin(priv, x1, y1); -} else { -len = strcspn(buf+1, "\\}") + 2; /* skip unknown code */ } buf += len - 1; +buf += strcspn(buf, "\\}"); // skip comments } -if (*buf++ != '}') -return AVERROR_INVALIDDATA; +buf++; // skip } } else { if (!text) { text = buf; @@ -510,7 +515,7 @@ int ff_ass_split_override_codes(const ASSCodesCallbacks *callbacks, void *priv, buf++; } } -if (text && callbacks->text) +if (text && callbacks->text && !drawing) callbacks->text(priv, text, text_len); if (callbacks->end) callbacks->end(priv); -- 2.5.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/6] lavu/avstring: switch AV_ESCAPE_FLAGs to shift-based formatting
--- libavutil/avstring.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavutil/avstring.h b/libavutil/avstring.h index 466edaf..234c030 100644 --- a/libavutil/avstring.h +++ b/libavutil/avstring.h @@ -300,14 +300,14 @@ enum AVEscapeMode { * characters lists, except it is guaranteed to use the exact same list * of whitespace characters as the rest of libavutil. */ -#define AV_ESCAPE_FLAG_WHITESPACE 0x01 +#define AV_ESCAPE_FLAG_WHITESPACE (1 << 0) /** * Escape only specified special characters. * Without this flag, escape also any characters that may be considered * special by av_get_token(), such as the single quote. */ -#define AV_ESCAPE_FLAG_STRICT 0x02 +#define AV_ESCAPE_FLAG_STRICT (1 << 1) /** * Escape string in src, and put the escaped string in an allocated -- 2.5.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 4/6] ffprobe: switch xml_escape_str to use av_bprint_escape; cleanup a bit
--- ffprobe.c | 25 ++--- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/ffprobe.c b/ffprobe.c index 4328b61..3c097bb 100644 --- a/ffprobe.c +++ b/ffprobe.c @@ -1543,21 +1543,10 @@ static av_cold int xml_init(WriterContext *wctx) return 0; } -static const char *xml_escape_str(AVBPrint *dst, const char *src, void *log_ctx) +static const char *xml_escape_str(AVBPrint *dst, const char *src) { -const char *p; - -for (p = src; *p; p++) { -switch (*p) { -case '&' : av_bprintf(dst, "%s", "&"); break; -case '<' : av_bprintf(dst, "%s", "<"); break; -case '>' : av_bprintf(dst, "%s", ">"); break; -case '"' : av_bprintf(dst, "%s", """); break; -case '\'': av_bprintf(dst, "%s", "'"); break; -default: av_bprint_chars(dst, *p, 1); -} -} - +av_bprint_clear(dst); +av_bprint_escape(dst, src, NULL, AV_ESCAPE_MODE_XML, AV_ESCAPE_FLAG_ESCAPE_DOUBLE_QUOTE); return dst->str; } @@ -1632,14 +1621,12 @@ static void xml_print_str(WriterContext *wctx, const char *key, const char *valu if (section->flags & SECTION_FLAG_HAS_VARIABLE_FIELDS) { XML_INDENT(); -printf("<%s key=\"%s\"", - section->element_name, xml_escape_str(&buf, key, wctx)); -av_bprint_clear(&buf); -printf(" value=\"%s\"/>\n", xml_escape_str(&buf, value, wctx)); +printf("<%s key=\"%s\"", section->element_name, xml_escape_str(&buf, key)); +printf(" value=\"%s\"/>\n", xml_escape_str(&buf, value)); } else { if (wctx->nb_item[wctx->level]) printf(" "); -printf("%s=\"%s\"", key, xml_escape_str(&buf, value, wctx)); +printf("%s=\"%s\"", key, xml_escape_str(&buf, value)); } av_bprint_finalize(&buf, NULL); -- 2.5.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/6] lavu/bprint: add XML escaping
--- libavutil/avstring.h | 28 libavutil/bprint.c | 43 +++ 2 files changed, 71 insertions(+) diff --git a/libavutil/avstring.h b/libavutil/avstring.h index 234c030..71a3179 100644 --- a/libavutil/avstring.h +++ b/libavutil/avstring.h @@ -290,6 +290,7 @@ enum AVEscapeMode { AV_ESCAPE_MODE_AUTO, ///< Use auto-selected escaping mode. AV_ESCAPE_MODE_BACKSLASH, ///< Use backslash escaping. AV_ESCAPE_MODE_QUOTE, ///< Use single-quote escaping. +AV_ESCAPE_MODE_XML, ///< Use XML ampersand-escaping; requires UTF-8 input. }; /** @@ -310,6 +311,33 @@ enum AVEscapeMode { #define AV_ESCAPE_FLAG_STRICT (1 << 1) /** + * In addition to the provided list, escape all characters outside the range of + * U+0020 to U+007E. + * This only applies to XML-escaping. + */ +#define AV_ESCAPE_FLAG_NON_ASCII (1 << 2) + +/** + * In addition to the provided list, escape single or double quotes. + * This only applies to XML-escaping. + */ +#define AV_ESCAPE_FLAG_ESCAPE_SINGLE_QUOTE (1 << 3) +#define AV_ESCAPE_FLAG_ESCAPE_DOUBLE_QUOTE (1 << 4) + +/** + * Replace invalid UTF-8 characters with a U+FFFD REPLACEMENT CHARACTER, escaped + * if AV_ESCAPE_FLAG_NON_ASCII is set. + * This only applies to XML-escaping. + */ +#define AV_ESCAPE_FLAG_REPLACE_INVALID_SEQUENCES (1 << 5) + +/** + * Replace invalid UTF-8 characters with a '?', overriding the previous flag. + * This only applies to XML-escaping. + */ +#define AV_ESCAPE_FLAG_REPLACE_INVALID_ASCII (1 << 6) + +/** * Escape string in src, and put the escaped string in an allocated * string in *dst, which must be freed with av_free(). * diff --git a/libavutil/bprint.c b/libavutil/bprint.c index 0a0d078..d8e6f99 100644 --- a/libavutil/bprint.c +++ b/libavutil/bprint.c @@ -271,6 +271,49 @@ void av_bprint_escape(AVBPrint *dstbuf, const char *src, const char *special_cha mode = AV_ESCAPE_MODE_BACKSLASH; /* TODO: implement a heuristic */ switch (mode) { +case AV_ESCAPE_MODE_XML: +/* &;-escape characters */ +while (*src) { +uint8_t tmp; +uint32_t cp; +const char *src1 = src; +GET_UTF8(cp, (uint8_t)*src++, goto err;); + +if ((cp < 0xFF && + ((special_chars && strchr(special_chars, cp)) || + (flags & AV_ESCAPE_FLAG_WHITESPACE) && strchr(WHITESPACES, cp))) || +(!(flags & AV_ESCAPE_FLAG_STRICT) && + (cp == '&' || cp == '<' || cp == '>')) || +((flags & AV_ESCAPE_FLAG_ESCAPE_SINGLE_QUOTE) && cp == '\'') || +((flags & AV_ESCAPE_FLAG_ESCAPE_DOUBLE_QUOTE) && cp == '"') || +((flags & AV_ESCAPE_FLAG_NON_ASCII) && (cp < 0x20 || cp > 0x7e))) { +switch (cp) { +case '&' : av_bprintf(dstbuf, "&"); break; +case '<' : av_bprintf(dstbuf, "<"); break; +case '>' : av_bprintf(dstbuf, ">"); break; +case '"' : av_bprintf(dstbuf, """); break; +case '\'': av_bprintf(dstbuf, "'"); break; +default: av_bprintf(dstbuf, "%"PRIx32";", cp); break; +} +} else { +PUT_UTF8(cp, tmp, av_bprint_chars(dstbuf, tmp, 1);) +} +continue; +err: +if (flags & AV_ESCAPE_FLAG_REPLACE_INVALID_ASCII) { +av_bprint_chars(dstbuf, '?', 1); +} else if (flags & AV_ESCAPE_FLAG_REPLACE_INVALID_SEQUENCES) { +if (flags & AV_ESCAPE_FLAG_NON_ASCII) +av_bprintf(dstbuf, "\xEF\xBF\xBD"); +else +av_bprintf(dstbuf, "�"); +} else { +while (src1 < src) +av_bprint_chars(dstbuf, *src1++, 1); +} +} +break; + case AV_ESCAPE_MODE_QUOTE: /* enclose the string between '' */ av_bprint_chars(dstbuf, '\'', 1); -- 2.5.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 5/6] lavc/webvttenc: XML-escape text output
--- libavcodec/webvttenc.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavcodec/webvttenc.c b/libavcodec/webvttenc.c index 9f67a2e..555e7c7 100644 --- a/libavcodec/webvttenc.c +++ b/libavcodec/webvttenc.c @@ -112,7 +112,12 @@ static void webvtt_style_apply(WebVTTContext *s, const char *style) static void webvtt_text_cb(void *priv, const char *text, int len) { WebVTTContext *s = priv; -av_bprint_append_data(&s->buffer, text, len); +char *buf = av_strndup(text, len); +if (!buf) +return; + +av_bprint_escape(&s->buffer, buf, NULL, AV_ESCAPE_MODE_XML, 0); +av_free(buf); } static void webvtt_new_line_cb(void *priv, int forced) -- 2.5.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 6/6] FATE: fix tests modified by ass_split and XML escaping changes
--- tests/ref/fate/ffprobe_xml | 2 +- tests/ref/fate/sub-webvttenc | 22 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/ref/fate/ffprobe_xml b/tests/ref/fate/ffprobe_xml index 2fdd81b..443cc12 100644 --- a/tests/ref/fate/ffprobe_xml +++ b/tests/ref/fate/ffprobe_xml @@ -51,7 +51,7 @@ - + diff --git a/tests/ref/fate/sub-webvttenc b/tests/ref/fate/sub-webvttenc index dbeadb0..8945a74 100644 --- a/tests/ref/fate/sub-webvttenc +++ b/tests/ref/fate/sub-webvttenc @@ -36,18 +36,18 @@ This line should be strikethrough should be underline 00:14.501 --> 00:17.501 -> +> It would be a good thing to hide invalid html tags that are closed and show the text in them -but show un-closed invalid html tags -Show not opened tags -< +but show un-closed invalid html tags +Show not opened tags +< 00:17.501 --> 00:20.501 and also hide invalid html tags with parameters that are closed and show the text in them -but show un-closed invalid html tags -This text should be showed underlined without problems also: 2<3,5>1,4<6 + but show un-closed invalid html tags +This text should be showed underlined without problems also: 2<3,5>1,4<6 This shouldn't be underlined 00:20.501 --> 00:21.501 @@ -125,7 +125,7 @@ text 2 00:52.501 --> 00:54.501 Hide these tags: also hide these tags: -but show this: {normal text} +but show this: 00:54.501 --> 01:00.501 @@ -164,14 +164,14 @@ should be hidden. 01:02.501 --> 01:04.501 It shouldn't be strikethrough, -not opened tag showed as text. -Not opened tag showed as text. +not opened tag showed as text. +Not opened tag showed as text. 01:04.501 --> 01:06.501 Three lines should be strikethrough, yes. -Not closed tags showed as text +<>Not closed tags showed as text 01:06.501 --> 01:08.501 Both line should be strikethrough but -the wrong closing tag should be showed +the wrong closing tag should be showed -- 2.5.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavf/mov: add support for sidx fragment indexes
The logic in mov_seek_fragment for matching track_ids to AVStream ids is almost certainly wrong, and should be corrected (by someone who knows more about the relevant structures) before this is merged. Fixes trac #3842 --- libavformat/isom.h | 1 + libavformat/mov.c | 182 - 2 files changed, 169 insertions(+), 14 deletions(-) diff --git a/libavformat/isom.h b/libavformat/isom.h index aee9d6e..8f22ea5 100644 --- a/libavformat/isom.h +++ b/libavformat/isom.h @@ -103,6 +103,7 @@ typedef struct MOVSbgp { typedef struct MOVFragmentIndexItem { int64_t moof_offset; int64_t time; +int headers_read; } MOVFragmentIndexItem; typedef struct MOVFragmentIndex { diff --git a/libavformat/mov.c b/libavformat/mov.c index 471b6ca..313dd0c 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -3541,7 +3541,96 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) return AVERROR_EOF; frag->implicit_offset = offset; -st->duration = sc->track_end = dts + sc->time_offset; + +sc->track_end = dts + sc->time_offset; +if (st->duration < sc->track_end) +st->duration = sc->track_end; + +return 0; +} + +static int mov_read_sidx(MOVContext *c, AVIOContext *pb, MOVAtom atom) +{ +int64_t offset = avio_tell(pb) + atom.size, pts; +uint8_t version; +int i, track_id; +AVStream *st = NULL; +MOVStreamContext *sc; +MOVFragmentIndex *index; +MOVFragmentIndex **tmp; +AVRational timescale; + +version = avio_r8(pb); +if (version > 1) +return AVERROR_PATCHWELCOME; + +avio_rb24(pb); // flags + +track_id = avio_rb32(pb); // Reference ID +for (i = 0; i < c->fc->nb_streams; i++) { +if (c->fc->streams[i]->id == track_id) { +st = c->fc->streams[i]; +break; +} +} +if (!st) { +av_log(c->fc, AV_LOG_ERROR, "could not find corresponding track id %d\n", track_id); +return AVERROR_INVALIDDATA; +} + +sc = st->priv_data; + +timescale = av_make_q(1, avio_rb32(pb)); + +if (version == 0) { +pts = avio_rb32(pb); +offset += avio_rb32(pb); +} else { +pts = avio_rb64(pb); +offset += avio_rb64(pb); +} + +avio_rb16(pb); // reserved + +index = av_mallocz(sizeof(MOVFragmentIndex)); +if (!index) { +return AVERROR(ENOMEM); +} + +index->track_id = track_id; + +index->item_count = avio_rb16(pb); +index->items = av_mallocz_array( +index->item_count, sizeof(MOVFragmentIndexItem)); + +if (!index->items) { +av_freep(&index); +return AVERROR(ENOMEM); +} + +tmp = av_realloc_array(c->fragment_index_data, + c->fragment_index_count + 1, + sizeof(MOVFragmentIndex*)); +if (!tmp) { +av_freep(&index->items); +av_freep(&index); +return AVERROR(ENOMEM); +} +c->fragment_index_data = tmp; +c->fragment_index_data[c->fragment_index_count++] = index; + +for (i = 0; i < index->item_count; i++) { +int32_t size = avio_rb32(pb); +int32_t duration = avio_rb32(pb); +avio_rb32(pb); // sap_flags +index->items[i].moof_offset = offset; +index->items[i].time = av_rescale_q(pts, st->time_base, timescale); +offset += size; +pts += duration; +} + +st->duration = sc->track_end = pts; + return 0; } @@ -3799,6 +3888,7 @@ static const MOVParseTableEntry mov_default_parse_table[] = { { MKTAG('a','l','a','c'), mov_read_alac }, /* alac specific atom */ { MKTAG('a','v','c','C'), mov_read_glbl }, { MKTAG('p','a','s','p'), mov_read_pasp }, +{ MKTAG('s','i','d','x'), mov_read_sidx }, { MKTAG('s','t','b','l'), mov_read_default }, { MKTAG('s','t','c','o'), mov_read_stco }, { MKTAG('s','t','p','s'), mov_read_stps }, @@ -3922,9 +4012,9 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) return err; } if (c->found_moov && c->found_mdat && -((!pb->seekable || c->fc->flags & AVFMT_FLAG_IGNIDX) || +((!pb->seekable || c->fc->flags & AVFMT_FLAG_IGNIDX || c->fragment_index_data) || start_pos + a.size == avio_size(pb))) { -if (!pb->seekable || c->fc->flags & AVFMT_FLAG_IGNIDX) +if (!pb->seekable || c->fc->flags & AVFMT_FLAG_IGNIDX || c->fragment_index_data) c->next_root_atom = start_pos + a.size; c->atom_depth --; return 0; @@ -4529,6 +4619,39 @@ static int should_retry(AVIOContext *pb, int error_code) { return 1; } +static int mov_switch_root(AVFormatContext *s, int64_t target) +{ +MOVContext *mov = s->priv_data; +int i, j; + +if (avio_seek(s->pb, target, SEEK_SET) != target) { +av_log(mov->fc, AV_LOG_ERROR, "root atom offset 0x%"PRIx64": pa
Re: [FFmpeg-devel] [PATCH 3/3] avfilter/vf_stereo3d: add HDMI output format
On 9/10/15, Kirill Gavrilov wrote: > Hi Paul, > > On Sat, Sep 5, 2015 at 9:29 PM, Paul B Mahol wrote > >> +HDMI, // HDMI frame pack (left eye first, right eye >> second) >> > I'm wondering, how this output filter can be actually used? > > Packaging stereo pair into HDMI format at software level (e.g. without > support by driver) makes no sense as far as I know... > Does this filter is expected to be used internally by hardware player? > See https://github.com/mpv-player/mpv/issues/1945 > Regards, > Kirill > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/3] avfilter/vf_stereo3d: add HDMI output format
OK, On Thu, Sep 10, 2015 at 7:23 PM, Paul B Mahol wrote: > > See https://github.com/mpv-player/mpv/issues/1945 > thank you for the link to actual conversation! Although I believe that adding manually mode into /etc/X11/xorg.conf like that: > Modeline "1920x2205@24" 148.32 1920 2558 2602 2750 2205 2209 2214 2250 +hsync > +vsync > > is a horrible hack... But at least now I understand that it is really possible. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] Proposed patches to mpjpeg demux
Please look at the attached patches. They accomplish the following: 1) change to format.c: allows the demux to be matched by Content-Type, even if the incoming Content-Type header contains parameters, such as 'multipart/x-mixed-replace;boundary=ffserver’. Currently the comparison seems to occur verbatim, thus preventing the selection of mpjpegdec demux, even when running against MJPEG served by ffserver. P.S. I’m not sure if parameters are ever needed to be included for this comparison, but considering we’re dealing with probing, seems unlikely 2) changes to mpjpegdec.c: - allow the empty line after multipart MIME headers to be parsed without generating an error - if get_line encounters EOF, don’t fail right away (exit the loop and check if the relevant headers had been processed instead) - trim whitespace from both name and value extracted from a header, allowing for more flexibility for the incoming data -- Alex Agranovsky Sighthound, Inc www.sighthound.com ffmpeg3.patch Description: Binary data ffmpeg4.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] IRC meeting on Saturday 2015-09-12, UTC 15:00
On Mon, Sep 07, 2015 at 11:37:47AM +0200, Stefano Sabatini wrote: > Hi, > > I propose to have an official IRC meeting on the next Saturday, and I > propose the tentative time of 15:00 UTC, but feel free to propose a > different time if this can't suit you. > > The IRC meeting channel will be public and the log will be published > at the end of the meeting. > > This meeting is also meant as a preparation for the real-life meeting > that will be held in Paris at the next VDD > (http://www.videolan.org/videolan/events/vdd15/) for the FFmpeg > developers who will attend it. > > I propose these topics of the day (suggested by ubitux on IRC): > 1. ABI compatibility policy > 2. general policy decision process heres a suggestion, maybe useful as input for discussions on Saturday ... FFmpeg used and uses "unanimous consent" in patch reviews any person could make a suggestion to improve a patch and it has to be taken care of one way or another before the patch is ok. This system worked quite well almost all the time. So i would suggest to use the same / a similar system for policy decisions * Everyone should be able to comment and propose options/choices * There should be enough time to understand, discuss and amend proposals * People should try to understand the other people and avoid strawman arguments and other non constructive discussion tactics, people/the commuity should step in if discussions become non constructive and hostile and try to get people back toward constructive discussion. * People should be able to declare reservations to a proposal without blocking the proposal and as a seperate choice veto it in a blocking fashion. A veto should be public with full name of the developer, reason why it is bad for the community/project and ideally a alternative proposal. Also developers vetoing a proposal must be willing and able to work on finding an better solution. * The authors of proposals should try to amend proposals based on raised issues & reservations and restart the process if changes where made. There could be a maximum number of such restarts after which only vetos would block If this doesnt work due to too many vetos then it could be adjusted to require 2 or more vetos to reject a proposal, but IMHO i dont think this would be needed. Simply having ones full name in public with a veto should result in people using the veto right wisely. A "unanimous consent" system also should push toward cooperation and discussions intended to find compromises and understanding the others. Because simply trying to be loud and push and troll are unlikely effective means to find an agreement. also such a system, if it works, would ensure noones oppinion or suggestion is just pushed aside [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB There will always be a question for which you do not know the correct answer. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] avfoundation AVMediaTypeMuxed device support
On Tue, Jul 28, 2015 at 01:32:16PM +0200, Thilo Borgmann wrote: > Hi, > > Am 27.07.15 um 18:08 schrieb Gianluigi Tiesi: > > Hi, with the attached patch, ffmpeg avfoundation device input > > is able to find my canopus dv firewire adapter. > > I only have 1 format 'muxed' and it's not possible to set resolution or > > framerate > > via 'setValue'. > > > > I've looked at the code in the AVRecorder sample: > > https://developer.apple.com/library/mac/samplecode/AVRecorder/Introduction/Intro.html > > > > it's able to correctly record (audio and video) from dv adapter > > using almost same api calls of ffmpeg. > > > > with my patch ffmpeg is able to record too (video only) but looks like > > there is a problem with video resolution. > > > > http://oss.netfarm.it/mplayer/upload/with-avrecorder.png > > http://oss.netfarm.it/mplayer/upload/with-ffmpeg.png > > > > and videos: > > > > http://oss.netfarm.it/mplayer/upload/with-avrecorder.mov > > http://oss.netfarm.it/mplayer/upload/with-ffmpeg.mp4 > > > > I known the patch can be improved, but I should at least solve > > the resolution problem. whats the status of this patch does it wait for a review? does it need changes ? it still applies cleanly > > I'm not available to look further in this until next week. > For the time being, you might want to try to allow AVMediaTypeMuxed for audio > and video devices and see if the device is then listed properly and what comes > out then if recording from these. > > I think I don't have any devices detected to be a muxed type available, so > this > might need close collaboration to fix the issue. Please consider opening a > ticket on trac for that. > > -Thilo > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Everything should be made as simple as possible, but not simpler. -- Albert Einstein signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] IRC meeting on Saturday 2015-09-12, UTC 15:00
Hi, On Thu, Sep 10, 2015 at 1:46 PM, Michael Niedermayer wrote: > On Mon, Sep 07, 2015 at 11:37:47AM +0200, Stefano Sabatini wrote: > > Hi, > > > > I propose to have an official IRC meeting on the next Saturday, and I > > propose the tentative time of 15:00 UTC, but feel free to propose a > > different time if this can't suit you. > > > > The IRC meeting channel will be public and the log will be published > > at the end of the meeting. > > > > This meeting is also meant as a preparation for the real-life meeting > > that will be held in Paris at the next VDD > > (http://www.videolan.org/videolan/events/vdd15/) for the FFmpeg > > developers who will attend it. > > > > I propose these topics of the day (suggested by ubitux on IRC): > > 1. ABI compatibility policy > > > 2. general policy decision process > > heres a suggestion, maybe useful as input for discussions on > Saturday ... > > FFmpeg used and uses "unanimous consent" in patch reviews > any person could make a suggestion > to improve a patch and it has to be taken care of one way or another > before the patch is ok. This system worked quite well almost all the > time. So i would suggest to use the same / a similar system for > policy decisions > > * Everyone should be able to comment and propose options/choices > * There should be enough time to understand, discuss and amend > proposals > * People should try to understand the other people and avoid strawman > arguments and other non constructive discussion tactics, people/the > commuity should step in if discussions become non constructive and > hostile and try to get people back toward constructive discussion. > * People should be able to declare reservations to a proposal without > blocking the proposal and as a seperate choice veto it in a blocking > fashion. A veto should be public with full name of the developer, > reason why it is bad for the community/project and ideally a > alternative proposal. Also developers vetoing a proposal must be > willing and able to work on finding an better solution. I have serious reservations about giving each developer veto rights; imho, we need a much higher bar than that. As evidence, I would like to offer the example of the united nations security council having only 5 members with veto power, and that's working out really well, right? So in light of that, if we decide to go this route, I would humbly suggest to make sure our number of developers with veto power is significantly smaller than five. "Use it wisely" won't work, power corrupts. Let's fix it by design. Ronald ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter/avf_showcqt: draw text optionally
On Tue, Sep 01, 2015 at 12:33:51PM +, Paul B Mahol wrote: > Signed-off-by: Paul B Mahol > --- > libavfilter/avf_showcqt.c | 16 ++-- > 1 file changed, 14 insertions(+), 2 deletions(-) LGTM thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB No human being will ever know the Truth, for even if they happen to say it by chance, they would not even known they had done so. -- Xenophanes signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avutil: Add additional primaries and transfer characteristic enumerations from ITU-T Rec H.265
On Tue, Sep 01, 2015 at 12:45:03PM +0100, Kevin Wheatley wrote: > I noticed that the output from actually tagging buffers with the new > states needs patching as well, is there any other place I need to > update? yes, the docs, see doc/encoders.texi patches applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB It is what and why we do it that matters, not just one of them. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter/f_perms: use the name 's' for the pointer to the private context
On 9/9/15, Ganesh Ajjanagadde wrote: > Signed-off-by: Ganesh Ajjanagadde > --- > libavfilter/f_perms.c | 18 +- > 1 file changed, 9 insertions(+), 9 deletions(-) > applied ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter/vf_transpose: use the name 's' for the pointer to the private context
On 9/3/15, Ganesh Ajjanagadde wrote: > Signed-off-by: Ganesh Ajjanagadde > --- > libavfilter/vf_transpose.c | 46 > +++--- > 1 file changed, 23 insertions(+), 23 deletions(-) > applied ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/exr/c Add support for applying a transfer characteristic curve to OpenEXR inputs.
On Tue, Sep 01, 2015 at 12:46:21PM +0100, Kevin Wheatley wrote: > This actually marks up the buffers as having the state given by the applied > trc, > > Kevin > > On Tue, Sep 1, 2015 at 12:04 PM, Kevin Wheatley > wrote: > > This adds the actual usage and allows for command lines similar to this: > > > > ffmpeg -apply_trc bt709 -i linear.exr bt709.png > > ffmpeg -apply_trc smpte2084 -i linear.exr smpte2084.png > > ffmpeg -apply_trc iec61966_2_1 -i linear.exr sRGB.png > > > > > > Which assuming the correct primaries in the linear OpenEXR file will > > generate the appropriate file. > > > > Kevin > exr.c |3 +++ > 1 file changed, 3 insertions(+) > 366da9c44d8bcbe2f00090588fefd868ced6f441 > 0007-Mark-up-the-decoded-buffer-as-the-appropriate-transf.patch > From 0e6bd2437146dafef0e6a89c9db378ba534211bd Mon Sep 17 00:00:00 2001 > From: Kevin Wheatley > Date: Tue, 1 Sep 2015 12:35:55 +0100 > Subject: [PATCH 7/7] Mark up the decoded buffer as the appropriate transfer > characteristic when applying one equivalent patches from github applied (i assume they match these) thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Complexity theory is the science of finding the exact solution to an approximation. Benchmarking OTOH is finding an approximation of the exact signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avutil: Add basic transfer functions for each AVColorTransferCharacteristic
On Tue, Sep 01, 2015 at 05:02:10PM +0100, Kevin Wheatley wrote: > Rather than rewrite history or anything like that people could either > apply this on top of my previous patches, or for a view of the whole > kit and kaboodle: > > https://github.com/FFmpeg/FFmpeg/compare/master...KevinJW:image_exr_transfer_characteristics > > Happy to take further feedback, equivalent patch from github applied (as it doesnt have the reserved _) thanks -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Complexity theory is the science of finding the exact solution to an approximation. Benchmarking OTOH is finding an approximation of the exact signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] change flag of cuCtxCreate to avoid CPU spins
--- libavcodec/nvenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 7c683ea..a20356f 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -580,7 +580,7 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx) } ctx->cu_context = NULL; -cu_res = dl_fn->cu_ctx_create(&ctx->cu_context, 0, dl_fn->nvenc_devices[ctx->gpu]); +cu_res = dl_fn->cu_ctx_create(&ctx->cu_context, 4, dl_fn->nvenc_devices[ctx->gpu]); // CU_CTX_SCHED_BLOCKING_SYNC=4, avoid CPU spins if (cu_res != CUDA_SUCCESS) { av_log(avctx, AV_LOG_FATAL, "Failed creating CUDA context for NVENC: 0x%x\n", (int)cu_res); -- 1.9.5.github.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Optimize nvenc parameters, add 3 more presets: fast, medium, slow
在 2015/9/10 17:48, Timo Rothenpieler 写道: * PGP Signed by an unknown key --- libavcodec/nvenc.c | 59 +- 1 file changed, 54 insertions(+), 5 deletions(-) diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 5490652..7c683ea 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -610,8 +610,17 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx) if (ctx->preset) { if (!strcmp(ctx->preset, "hp")) { encoder_preset = NV_ENC_PRESET_HP_GUID; +}else if (!strcmp(ctx->preset, "fast")) { It's missing a space here. +ctx->twopass = 0; +encoder_preset = NV_ENC_PRESET_HQ_GUID; } else if (!strcmp(ctx->preset, "hq")) { encoder_preset = NV_ENC_PRESET_HQ_GUID; +} else if (!strcmp(ctx->preset, "medium")) { +ctx->twopass = 0; +encoder_preset = NV_ENC_PRESET_HQ_GUID; +} else if (!strcmp(ctx->preset, "slow")) { +ctx->twopass = 1; +encoder_preset = NV_ENC_PRESET_HQ_GUID; } else if (!strcmp(ctx->preset, "bd")) { encoder_preset = NV_ENC_PRESET_BD_GUID; } else if (!strcmp(ctx->preset, "ll")) { @@ -632,7 +641,7 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx) } else if (!strcmp(ctx->preset, "default")) { encoder_preset = NV_ENC_PRESET_DEFAULT_GUID; } else { -av_log(avctx, AV_LOG_FATAL, "Preset \"%s\" is unknown! Supported presets: hp, hq, bd, ll, llhp, llhq, lossless, losslesshp, default\n", ctx->preset); +av_log(avctx, AV_LOG_FATAL, "Preset \"%s\" is unknown! Supported presets: slow, medium, fast, hp, hq, bd, ll, llhp, llhq, lossless, losslesshp, default\n", ctx->preset); res = AVERROR(EINVAL); goto error; } @@ -710,6 +719,7 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx) switch (avctx->codec->id) { case AV_CODEC_ID_H264: ctx->encode_config.encodeCodecConfig.h264Config.maxNumRefFrames = avctx->refs; + ctx->encode_config.encodeCodecConfig.h264Config.hierarchicalPFrames = 1; break; case AV_CODEC_ID_H265: ctx->encode_config.encodeCodecConfig.hevcConfig.maxNumRefFramesInDPB = avctx->refs; @@ -770,7 +780,7 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx) avctx->qmin = -1; avctx->qmax = -1; } else if (ctx->cbr) { -if (!ctx->twopass) { +if (!ctx->twopass < 1) { This doesn't seem right at all, what is it supposed to do? Keep in mind that twopass is a tristate, with the default beeing -1, which means autoselect. ctx->encode_config.rcParams.rateControlMode = NV_ENC_PARAMS_RC_CBR; } else if (ctx->twopass == 1 || isLL) { ctx->encode_config.rcParams.rateControlMode = NV_ENC_PARAMS_RC_2_PASS_QUALITY; @@ -799,7 +809,7 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx) ctx->encode_config.encodeCodecConfig.h264Config.fmoMode = NV_ENC_H264_FMO_DISABLE; } } else { -ctx->encode_config.rcParams.rateControlMode = NV_ENC_PARAMS_RC_VBR; +ctx->encode_config.rcParams.rateControlMode = NV_ENC_PARAMS_RC_VBR_MINQP; } ctx->encode_config.rcParams.enableMinQP = 1; @@ -812,6 +822,45 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx) ctx->encode_config.rcParams.maxQP.qpInterB = avctx->qmax; ctx->encode_config.rcParams.maxQP.qpInterP = avctx->qmax; ctx->encode_config.rcParams.maxQP.qpIntra = avctx->qmax; + +{ I'm not sure if this conforms with the ffmpeg code style guidelines. +uint32_t qpInterP = (avctx->qmax + 3*avctx->qmin)/4; // biased towards Qmin +ctx->encode_config.rcParams.initialRCQP.qpInterP = qpInterP; +if(avctx->i_quant_factor != 0.0 && avctx->b_quant_factor != 0.0) { +ctx->encode_config.rcParams.initialRCQP.qpIntra = qpInterP * fabs(avctx->i_quant_factor); +ctx->encode_config.rcParams.initialRCQP.qpIntra += qpInterP * (avctx->i_quant_offset); +ctx->encode_config.rcParams.initialRCQP.qpInterB = qpInterP * fabs(avctx->b_quant_factor); +ctx->encode_config.rcParams.initialRCQP.qpInterB += qpInterP * (avctx->b_quant_offset); +} else { +ctx->encode_config.rcParams.initialRCQP.qpIntra = qpInterP; +ctx->encode_config.rcParams.initialRCQP.qpInterB = qpInterP; +} +} +ctx->encode_config.rcParams.enableInitialRCQP = 1; +} else { +if (ctx->twopass < 1) { This also seems a bit strange. +ctx->encode_config.rcParams.rateControlMode = NV_ENC_PARAMS_RC_VBR; +} else { +ctx->encode_config.rcParams.rateControlMode = NV_ENC_PARAMS_RC_2_PASS_VBR; +} + +{ +uint32_t qpInter
Re: [FFmpeg-devel] [PATCHv2 2/2] all: do standards compliant absdiff computation
On Sun, Aug 23, 2015 at 6:11 PM, Ganesh Ajjanagadde wrote: > This resolves undefined behavior, and also silences -Wabsolute-value in clang > 3.5+. > > Signed-off-by: Ganesh Ajjanagadde > --- > libavcodec/flashsv2enc.c | 6 +++--- > libavfilter/vf_hqx.c | 6 +++--- > libavfilter/vf_xbr.c | 6 +++--- > 3 files changed, 9 insertions(+), 9 deletions(-) > > diff --git a/libavcodec/flashsv2enc.c b/libavcodec/flashsv2enc.c > index c2c00f4..75b9a32 100644 > --- a/libavcodec/flashsv2enc.c > +++ b/libavcodec/flashsv2enc.c > @@ -415,9 +415,9 @@ static inline unsigned int chroma_diff(unsigned int c1, > unsigned int c2) > unsigned int t1 = (c1 & 0x00ff) + ((c1 & 0xff00) >> 8) + ((c1 & > 0x00ff) >> 16); > unsigned int t2 = (c2 & 0x00ff) + ((c2 & 0xff00) >> 8) + ((c2 & > 0x00ff) >> 16); > > -return abs(t1 - t2) + abs((c1 & 0x00ff) - (c2 & 0x00ff)) + > -abs(((c1 & 0xff00) >> 8) - ((c2 & 0xff00) >> 8)) + > -abs(((c1 & 0x00ff) >> 16) - ((c2 & 0x00ff) >> 16)); > +return FFABSDIFF(t1, t2) + FFABSDIFF(c1 & 0x00ff, c2 & 0x00ff) + > +FFABSDIFF((c1 & 0xff00) >> 8 , (c2 & 0xff00) >> 8) + > +FFABSDIFF((c1 & 0x00ff) >> 16, (c2 & 0x00ff) >> 16); > } > > static inline int pixel_color7_fast(Palette * palette, unsigned c15) > diff --git a/libavfilter/vf_hqx.c b/libavfilter/vf_hqx.c > index fa15d9c..407b9b5 100644 > --- a/libavfilter/vf_hqx.c > +++ b/libavfilter/vf_hqx.c > @@ -65,9 +65,9 @@ static av_always_inline int yuv_diff(uint32_t yuv1, > uint32_t yuv2) > #define YMASK 0xff > #define UMASK 0x00ff00 > #define VMASK 0xff > -return abs((yuv1 & YMASK) - (yuv2 & YMASK)) > (48 << 16) || > - abs((yuv1 & UMASK) - (yuv2 & UMASK)) > ( 7 << 8) || > - abs((yuv1 & VMASK) - (yuv2 & VMASK)) > ( 6 << 0); > +return FFABSDIFF(yuv1 & YMASK, yuv2 & YMASK) > (48 << 16) || > + FFABSDIFF(yuv1 & UMASK, yuv2 & UMASK) > ( 7 << 8) || > + FFABSDIFF(yuv1 & VMASK, yuv2 & VMASK) > ( 6 << 0); > } > > /* (c1*w1 + c2*w2) >> s */ > diff --git a/libavfilter/vf_xbr.c b/libavfilter/vf_xbr.c > index 38c3b70..1c6a8ea 100644 > --- a/libavfilter/vf_xbr.c > +++ b/libavfilter/vf_xbr.c > @@ -69,9 +69,9 @@ static uint32_t pixel_diff(uint32_t x, uint32_t y, const > uint32_t *r2y) > uint32_t yuv1 = r2y[x & 0xff]; > uint32_t yuv2 = r2y[y & 0xff]; > > -return (abs((yuv1 & YMASK) - (yuv2 & YMASK)) >> 16) + > - (abs((yuv1 & UMASK) - (yuv2 & UMASK)) >> 8) + > - abs((yuv1 & VMASK) - (yuv2 & VMASK)); > +return (FFABSDIFF(yuv1 & YMASK, yuv2 & YMASK) >> 16) + > + (FFABSDIFF(yuv1 & UMASK, yuv2 & UMASK) >> 8) + > +FFABSDIFF(yuv1 & VMASK, yuv2 & VMASK); > } > > #define ALPHA_BLEND_128_W(a, b) a) & LB_MASK) >> 1) + (((b) & LB_MASK) > >> 1)) > -- > 2.5.0 > I do not recall any objections to this patchv2 (v1 had efficiency issues that are fixed with this). IIRC, the only comment that applies to this v2 patch is one from Michael: https://ffmpeg.org/pipermail/ffmpeg-devel/2015-August/177796.html. I believe this patchv2 series should be applied. True, FFmpeg did work correctly before this patch, but it was relying on implementation defined behavior. This patch series not only silences the warnings on clang, but also does so at no efficiency loss (compare the generated asm; v1 had this issue while v2 does not), and has the added benefit of not relying on implementation defined behavior. IMHO, when one looks at the things the codebase already does to silence warnings (see e.g https://ffmpeg.org/pipermail/ffmpeg-devel/2015-August/177184.html, a workaround useful for GCC < 4.6), this should be ok. Note that the commit message should be changed from "undefined" to "implementation defined". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] IRC meeting on Saturday 2015-09-12, UTC 15:00
On Mon, Sep 7, 2015 at 5:37 AM, Stefano Sabatini wrote: > Hi, > > I propose to have an official IRC meeting on the next Saturday, and I > propose the tentative time of 15:00 UTC, but feel free to propose a > different time if this can't suit you. > > The IRC meeting channel will be public and the log will be published > at the end of the meeting. > > This meeting is also meant as a preparation for the real-life meeting > that will be held in Paris at the next VDD > (http://www.videolan.org/videolan/events/vdd15/) for the FFmpeg > developers who will attend it. > > I propose these topics of the day (suggested by ubitux on IRC): > 1. ABI compatibility policy > 2. general policy decision process > 3. VDD15 > 4. Any other business > > Feel free to suggest other topics. A less important issue; but I think a clear stance on use of Github/Gitorious and their pull request development model would be useful. I think it is clear that in general many people here do not like it, and repeated comments on the FFmpeg Github page discourage it. However, a user checking out README.md (which is the document people see on Github) does not have an explicit note on this; and instead only a hyperlink to the documentation which again lacks full clarity on this point. My own proposed solution is an added line to README.md clearly stating that FFmpeg does not do pull requests from Github, and instead that we use the mailing list. This will hopefully reduce the number of pull requests on Github; thus avoiding fragmentation of development discussion. > -- > FFmpeg = Fascinating & Fiendish Murdering Powerful Earthshaking Gymnast > ___ > 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] Optimize nvenc parameters, add 3 more presets: fast, medium, slow
在 2015/9/10 17:48, Timo Rothenpieler 写道: @@ -770,7 +780,7 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx) avctx->qmin = -1; avctx->qmax = -1; } else if (ctx->cbr) { -if (!ctx->twopass) { +if (!ctx->twopass < 1) { This doesn't seem right at all, what is it supposed to do? Keep in mind that twopass is a tristate, with the default beeing -1, which means autoselect. Sorry I made a mistake +if (!ctx->twopass < 1) { It should be +if (ctx->twopass < 1) { No wonder it doesn't seem right at all... Agatha Hu ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] Proposed patches to mpjpeg demux
Quick update: format.c patch needs to be amended, to include a NULL check. -- Alex Agranovsky Sighthound, Inc www.sighthound.com On September 10, 2015 at 12:04:55 PM, Alex Agranovsky (a...@sighthound.com) wrote: Please look at the attached patches. They accomplish the following: 1) change to format.c: allows the demux to be matched by Content-Type, even if the incoming Content-Type header contains parameters, such as 'multipart/x-mixed-replace;boundary=ffserver’. Currently the comparison seems to occur verbatim, thus preventing the selection of mpjpegdec demux, even when running against MJPEG served by ffserver. P.S. I’m not sure if parameters are ever needed to be included for this comparison, but considering we’re dealing with probing, seems unlikely 2) changes to mpjpegdec.c: - allow the empty line after multipart MIME headers to be parsed without generating an error - if get_line encounters EOF, don’t fail right away (exit the loop and check if the relevant headers had been processed instead) - trim whitespace from both name and value extracted from a header, allowing for more flexibility for the incoming data -- Alex Agranovsky Sighthound, Inc www.sighthound.com ffmpeg4.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] TCP socket descriptor leak on listen and interrupt
Hi all! We are found another descriptors leak :-) If we try to listen on TCP port and ff_listen() fails on interrupt callback, socket (bind) descriptor overwrites at the tcp_open() and does not closed at all. As a result, we can't rebind to the same port. Minimal sample for issue (sorry for C++ in some places :-), also sample code assumes that librtmp does not used - it does not allow to listen): ``` #include #include extern "C" { #ifndef __STDC_CONSTANT_MACROS #define __STDC_CONSTANT_MACROS #endif #include #include #include #include #include #include #include } int openInputInterruptCallBack(void *ctx) { // I know, stupid code :-) in real code more complex logic here return 1; } int main(int argc, char **argv) { std::cout << "Hello, world!" << std::endl; avdevice_register_all(); avcodec_register_all(); avfilter_register_all(); av_register_all(); avformat_network_init(); AVFormatContext *mpFormatCtx = avformat_alloc_context(); mpFormatCtx->interrupt_callback.callback = &openInputInterruptCallBack; mpFormatCtx->interrupt_callback.opaque = mpFormatCtx; AVDictionary * dict = nullptr; av_dict_set_int(&dict, "rtmp_listen", 1, 0); av_dict_set_int(&dict, "timeout", -1, 0); av_dict_set(&dict, "rtmp_live", "live", 0); char* inputFileName = "rtmp://0.0.0.0:1936/live/mystream"; AVInputFormat *pInAvFormat = av_find_input_format(inputFileName); int err = avformat_open_input(&mpFormatCtx, inputFileName, pInAvFormat, &dict); // avformat_open_input() fails here but bind socket descriptor still open. // we can check it via `ls -l /proc/PID/fd` if(err != 0) { char errMsg[100]; av_strerror(err, errMsg, 100); std::cout << "Couldn't open input source: " << inputFileName <<", err : " << errMsg << std::endl; avformat_network_deinit(); for (;;) sleep(1); return -1; } else { avformat_close_input(&mpFormatCtx); avformat_network_deinit(); } return 0; } ``` Fix is attached to the letter. -- WBR, Alexander Drozdov http://htrd.su 0001-TCP-Protocol-fix-descriptor-leak-on-listen-and-inter.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel