[FFmpeg-devel] [PATCH 0/5] mpeg: add experimental support for PSMF audio.
From: Misty De Meo I checked in with IRC and got some suggestions on the best way to handle both of these. I've updated the patchset with the changes you requested. The media files referenced by the tests are here: https://public.drac.at/6.MPS http://samples.ffmpeg.org/PSMF/EV01_01_0500D.PMF Maxim Poliakovski (1): mpeg: add experimental support for PSMF audio. Misty De Meo (4): oma: move some constants into libavcodec Fix detecting ATRAC3 audio from MPS files mpeg: fix use of deprecated struct psmf: add FATE tests Changelog | 1 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c| 1 + libavcodec/atrac3plus_parser.c| 150 ++ libavformat/oma.c => libavcodec/oma.h | 27 +++--- libavcodec/version.h | 2 +- libavformat/Makefile | 4 +- libavformat/mpeg.c| 15 libavformat/mpeg.h| 1 + libavformat/oma.h | 21 ++--- libavformat/omadec.c | 13 +-- libavformat/omaenc.c | 7 +- libavformat/version.h | 2 +- tests/Makefile| 1 + tests/fate/psmf.mak | 23 ++ 15 files changed, 230 insertions(+), 39 deletions(-) create mode 100644 libavcodec/atrac3plus_parser.c rename libavformat/oma.c => libavcodec/oma.h (65%) create mode 100644 tests/fate/psmf.mak -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/5] mpeg: add experimental support for PSMF audio.
From: Maxim Poliakovski Changes by Misty De Meo : atrac3plus_parser: remove return statements for invalid data atrac3plus_parser: use libavcodec's oma Signed-off-by: Misty De Meo --- libavcodec/Makefile| 1 + libavcodec/allcodecs.c | 1 + libavcodec/atrac3plus_parser.c | 150 + libavformat/mpeg.c | 27 +++- 4 files changed, 178 insertions(+), 1 deletion(-) create mode 100644 libavcodec/atrac3plus_parser.c diff --git a/libavcodec/Makefile b/libavcodec/Makefile index ca72138c02..e0e3f1ebac 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -977,6 +977,7 @@ OBJS-$(CONFIG_AAC_PARSER) += aac_parser.o aac_ac3_parser.o \ mpeg4audio.o OBJS-$(CONFIG_AC3_PARSER) += ac3tab.o aac_ac3_parser.o OBJS-$(CONFIG_ADX_PARSER) += adx_parser.o adx.o +OBJS-$(CONFIG_ATRAC3P_PARSER) += atrac3plus_parser.o OBJS-$(CONFIG_BMP_PARSER) += bmp_parser.o OBJS-$(CONFIG_CAVSVIDEO_PARSER)+= cavs_parser.o OBJS-$(CONFIG_COOK_PARSER) += cook_parser.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index ed1e7ab06e..81d5d2814a 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -623,6 +623,7 @@ static void register_all(void) REGISTER_PARSER(AAC_LATM, aac_latm); REGISTER_PARSER(AC3,ac3); REGISTER_PARSER(ADX,adx); +REGISTER_PARSER(ATRAC3P,atrac3p); REGISTER_PARSER(BMP,bmp); REGISTER_PARSER(CAVSVIDEO, cavsvideo); REGISTER_PARSER(COOK, cook); diff --git a/libavcodec/atrac3plus_parser.c b/libavcodec/atrac3plus_parser.c new file mode 100644 index 00..9f54efddd2 --- /dev/null +++ b/libavcodec/atrac3plus_parser.c @@ -0,0 +1,150 @@ +/* + * Copyright (C) 2014 Maxim Poliakovski + * + * 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 "parser.h" +#include "get_bits.h" +#include "oma.h" + +typedef struct Atrac3PlusParseContext { +ParseContext pc; +uint8_t hdr[8]; +int hdr_bytes_needed, got_bytes; +int sample_rate, channel_id, frame_size; +} Atrac3PlusParseContext; + +static int parse_sound_frame_header(Atrac3PlusParseContext *c, +const uint8_t *buf) +{ +uint16_t atrac_config; + +if (AV_RB16(buf) != 0x0FD0) +return AVERROR_INVALIDDATA; + +atrac_config = AV_RB16(&buf[2]); +c->sample_rate = oma_srate_tab[(atrac_config >> 13) & 7] * 100; +c->channel_id = (atrac_config >> 10) & 7; +c->frame_size = ((atrac_config & 0x3FF) * 8) + 8; + +if (!c->channel_id || !c->sample_rate || !c->frame_size) +return AVERROR_INVALIDDATA; + +return 0; +} + +static int ff_atrac3p_parse(AVCodecParserContext *s, + AVCodecContext *avctx, + const uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size) +{ +Atrac3PlusParseContext *ctx = s->priv_data; +const uint8_t *hdr_buf = buf; +size_t bytes_remain; +int frame_size, hdr_bytes = 8; +int next = 0; + +if (s->flags & PARSER_FLAG_COMPLETE_FRAMES || !buf_size) { +next = buf_size; +} else { +if (buf_size >= 2) { +bytes_remain = AV_RB16(buf); + +if (bytes_remain != 0xFD0) { +next += 2; +buf += 2; +buf_size -= 2; +hdr_buf = buf; + +if (bytes_remain && !ctx->pc.index && !ctx->hdr_bytes_needed) { +av_log(avctx, AV_LOG_ERROR, + "2nd frame portion found but the 1st one is missing!\n"); +} + +if (ctx->hdr_bytes_needed) { +if (buf_size >= ctx->hdr_bytes_needed) { +memcpy(&ctx->hdr[8 - ctx->hdr_bytes_needed], + buf, ctx->hdr_bytes_needed); +hdr_bytes = ctx->hdr_bytes_needed; +ctx->hdr_bytes_needed = 0; +hdr_buf = ctx->hdr; +} +} else if (bytes_remain) { +if (
[FFmpeg-devel] [PATCH 1/5] oma: move some constants into libavcodec
From: Misty De Meo Most of the constants in libavcodec/oma aren't specific to libavformat; moving them into libavcodec makes them available to libavcodec as well as keeping them compatible with libavformat. ff_oma_codec_tags uses a libavformat-specific type, so it has been left in libavformat. --- libavformat/oma.c => libavcodec/oma.h | 27 +-- libavcodec/version.h | 2 +- libavformat/Makefile | 4 ++-- libavformat/oma.h | 21 + libavformat/omadec.c | 13 +++-- libavformat/omaenc.c | 7 --- libavformat/version.h | 2 +- 7 files changed, 37 insertions(+), 39 deletions(-) rename libavformat/oma.c => libavcodec/oma.h (65%) diff --git a/libavformat/oma.c b/libavcodec/oma.h similarity index 65% rename from libavformat/oma.c rename to libavcodec/oma.h index f7ae3c9948..f091ef24ca 100644 --- a/libavformat/oma.c +++ b/libavcodec/oma.h @@ -18,25 +18,22 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#ifndef AVCODEC_OMA_H +#define AVCODEC_OMA_H + +#include + #include "internal.h" -#include "oma.h" -#include "libavcodec/avcodec.h" #include "libavutil/channel_layout.h" -const uint16_t ff_oma_srate_tab[8] = { 320, 441, 480, 882, 960, 0 }; +#define EA3_HEADER_SIZE 96 +#define ID3v2_EA3_MAGIC "ea3" +#define OMA_ENC_HEADER_SIZE 16 -const AVCodecTag ff_oma_codec_tags[] = { -{ AV_CODEC_ID_ATRAC3, OMA_CODECID_ATRAC3}, -{ AV_CODEC_ID_ATRAC3P, OMA_CODECID_ATRAC3P }, -{ AV_CODEC_ID_MP3, OMA_CODECID_MP3 }, -{ AV_CODEC_ID_PCM_S16BE, OMA_CODECID_LPCM }, -{ AV_CODEC_ID_ATRAC3PAL, OMA_CODECID_ATRAC3PAL }, -{ AV_CODEC_ID_ATRAC3AL,OMA_CODECID_ATRAC3AL }, -{ 0 }, -}; +static const uint16_t oma_srate_tab[8] = { 320, 441, 480, 882, 960, 0 }; /** map ATRAC-X channel id to internal channel layout */ -const uint64_t ff_oma_chid_to_native_layout[7] = { +static const uint64_t oma_chid_to_native_layout[7] = { AV_CH_LAYOUT_MONO, AV_CH_LAYOUT_STEREO, AV_CH_LAYOUT_SURROUND, @@ -47,4 +44,6 @@ const uint64_t ff_oma_chid_to_native_layout[7] = { }; /** map ATRAC-X channel id to total number of channels */ -const int ff_oma_chid_to_num_channels[7] = {1, 2, 3, 4, 6, 7, 8}; +static const int oma_chid_to_num_channels[7] = {1, 2, 3, 4, 6, 7, 8}; + +#endif /* AVCODEC_OMA_H */ diff --git a/libavcodec/version.h b/libavcodec/version.h index d55de89797..d48857578d 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #define LIBAVCODEC_VERSION_MAJOR 58 #define LIBAVCODEC_VERSION_MINOR 8 -#define LIBAVCODEC_VERSION_MICRO 100 +#define LIBAVCODEC_VERSION_MICRO 101 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ diff --git a/libavformat/Makefile b/libavformat/Makefile index cb70eac920..ef0365e6e2 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -358,8 +358,8 @@ OBJS-$(CONFIG_OGG_MUXER) += oggenc.o \ vorbiscomment.o OBJS-$(CONFIG_OGV_MUXER) += oggenc.o \ vorbiscomment.o -OBJS-$(CONFIG_OMA_DEMUXER) += omadec.o pcm.o oma.o -OBJS-$(CONFIG_OMA_MUXER) += omaenc.o rawenc.o oma.o id3v2enc.o +OBJS-$(CONFIG_OMA_DEMUXER) += omadec.o pcm.o +OBJS-$(CONFIG_OMA_MUXER) += omaenc.o rawenc.o id3v2enc.o OBJS-$(CONFIG_OPUS_MUXER)+= oggenc.o \ vorbiscomment.o OBJS-$(CONFIG_PAF_DEMUXER) += paf.o diff --git a/libavformat/oma.h b/libavformat/oma.h index 36fd0125e4..41972830ec 100644 --- a/libavformat/oma.h +++ b/libavformat/oma.h @@ -21,14 +21,8 @@ #ifndef AVFORMAT_OMA_H #define AVFORMAT_OMA_H -#include - #include "internal.h" -#define EA3_HEADER_SIZE 96 -#define ID3v2_EA3_MAGIC "ea3" -#define OMA_ENC_HEADER_SIZE 16 - enum { OMA_CODECID_ATRAC3 = 0, OMA_CODECID_ATRAC3P = 1, @@ -39,11 +33,14 @@ enum { OMA_CODECID_ATRAC3AL = 34, }; -extern const uint16_t ff_oma_srate_tab[8]; - -extern const AVCodecTag ff_oma_codec_tags[]; - -extern const uint64_t ff_oma_chid_to_native_layout[7]; -extern const int ff_oma_chid_to_num_channels[7]; +static const AVCodecTag oma_codec_tags[] = { +{ AV_CODEC_ID_ATRAC3, OMA_CODECID_ATRAC3}, +{ AV_CODEC_ID_ATRAC3P, OMA_CODECID_ATRAC3P }, +{ AV_CODEC_ID_MP3, OMA_CODECID_MP3 }, +{ AV_CODEC_ID_PCM_S16BE, OMA_CODECID_LPCM }, +{ AV_CODEC_ID_ATRAC3PAL, OMA_CODECID_ATRAC3PAL }, +{ AV_CODEC_ID_ATRAC3AL,OMA_CODECID_ATRAC3AL }, +{ 0 }, +}; #endif /* AVFORMAT_OMA_H */ diff --git a/libavformat/omadec.c b/libavformat/omadec.c index 423d52b3aa..24afaa417b 100644 ---
[FFmpeg-devel] [PATCH 4/5] mpeg: fix use of deprecated struct
From: Misty De Meo --- libavformat/mpeg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index a366ece0ed..210424faf3 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -547,8 +547,8 @@ redo: len--; for (i = 0; i < s->nb_streams; i++) { st = s->streams[i]; -if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && -st->codec->codec_id == AV_CODEC_ID_ATRAC3P && +if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && +st->codecpar->codec_id == AV_CODEC_ID_ATRAC3P && st->id - 0x1BD0 == (startcode & 0xF)) goto found; } -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/5] Fix detecting ATRAC3 audio from MPS files
From: Misty De Meo MPS files are MPEG files used on PSP Video discs. They lack the PSMF header used by .pms files, and so the special casing in the original patch fails to support their audio. This patch fixes this by unconditionally reading a new byte for the startcode for PRIVATE_STREAM_1 sections, and doing the comparison on that to find ATRAC-3 streams. In my testing, it works fine for both MPS and PSMF files. --- Changelog | 1 + libavformat/mpeg.c | 38 ++ libavformat/mpeg.h | 1 + 3 files changed, 16 insertions(+), 24 deletions(-) diff --git a/Changelog b/Changelog index ee48876128..67f28ea839 100644 --- a/Changelog +++ b/Changelog @@ -27,6 +27,7 @@ version : - video setrange filter - nsp demuxer - support LibreSSL (via libtls) +- ATRAC-3 support for Sony PSP MPEG files version 3.4: diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index 895c6fb231..a366ece0ed 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -128,7 +128,6 @@ typedef struct MpegDemuxContext { int sofdec; int dvd; int imkh_cctv; -int sony_psmf; // true if Play Station Movie file signature is present #if CONFIG_VOBSUB_DEMUXER AVFormatContext *sub_ctx; FFDemuxSubtitlesQueue q[32]; @@ -148,8 +147,6 @@ static int mpegps_read_header(AVFormatContext *s) avio_get_str(s->pb, 6, buffer, sizeof(buffer)); if (!memcmp("IMKH", buffer, 4)) { m->imkh_cctv = 1; -} else if (!memcmp("PSMF00", buffer, 6)) { -m->sony_psmf = 1; } else if (!memcmp("Sofdec", buffer, 6)) { m->sofdec = 1; } else @@ -444,7 +441,7 @@ redo: goto redo; } -if (startcode == PRIVATE_STREAM_1 && !m->sony_psmf) { +if (startcode == PRIVATE_STREAM_1) { startcode = avio_r8(s->pb); len--; } @@ -544,28 +541,21 @@ redo: else request_probe= 1; type = AVMEDIA_TYPE_VIDEO; -} else if (startcode == PRIVATE_STREAM_1 && m->sony_psmf) { -uint8_t stream_id; - -if (len < 2) -goto skip; -stream_id = avio_r8(s->pb); +// Sony PSP video with ATRAC-3 audio +} else if (!(startcode & STREAM_TYPE_AUDIO_ATRAC3)) { avio_r8(s->pb); // skip padding -len -= 2; -if (!(stream_id & 0xF0)) { // seems like we got an ATRAC stream -/* check if an appropriate stream already exists */ -for (i = 0; i < s->nb_streams; i++) { -st = s->streams[i]; -if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && -st->codec->codec_id == AV_CODEC_ID_ATRAC3P && -st->id - 0x1BD0 == (stream_id & 0xF)) -goto found; -} - -startcode = 0x1BD0 + (stream_id & 0xF); -type = AVMEDIA_TYPE_AUDIO; -codec_id = AV_CODEC_ID_ATRAC3P; +len--; +for (i = 0; i < s->nb_streams; i++) { +st = s->streams[i]; +if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && +st->codec->codec_id == AV_CODEC_ID_ATRAC3P && +st->id - 0x1BD0 == (startcode & 0xF)) +goto found; } + +startcode = 0x1BD0 + (startcode & 0xF); +type = AVMEDIA_TYPE_AUDIO; +codec_id = AV_CODEC_ID_ATRAC3P; } else if (startcode == PRIVATE_STREAM_2) { type = AVMEDIA_TYPE_DATA; codec_id = AV_CODEC_ID_DVD_NAV; diff --git a/libavformat/mpeg.h b/libavformat/mpeg.h index 617e36cba8..efbadec8ba 100644 --- a/libavformat/mpeg.h +++ b/libavformat/mpeg.h @@ -58,6 +58,7 @@ #define STREAM_TYPE_VIDEO_CAVS 0x42 #define STREAM_TYPE_AUDIO_AC3 0x81 +#define STREAM_TYPE_AUDIO_ATRAC30xF0 static const int lpcm_freq_tab[4] = { 48000, 96000, 44100, 32000 }; -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 5/5] psmf: add FATE tests
From: Misty De Meo --- tests/Makefile | 1 + tests/fate/psmf.mak | 23 +++ 2 files changed, 24 insertions(+) create mode 100644 tests/fate/psmf.mak diff --git a/tests/Makefile b/tests/Makefile index fd3713fe81..c569091fcb 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -165,6 +165,7 @@ include $(SRC_PATH)/tests/fate/pcm.mak include $(SRC_PATH)/tests/fate/pixlet.mak include $(SRC_PATH)/tests/fate/probe.mak include $(SRC_PATH)/tests/fate/prores.mak +include $(SRC_PATH)/tests/fate/psmf.mak include $(SRC_PATH)/tests/fate/qt.mak include $(SRC_PATH)/tests/fate/qtrle.mak include $(SRC_PATH)/tests/fate/real.mak diff --git a/tests/fate/psmf.mak b/tests/fate/psmf.mak new file mode 100644 index 00..0d83daad49 --- /dev/null +++ b/tests/fate/psmf.mak @@ -0,0 +1,23 @@ +# +# Test detecting ATRAC-3 audio in Sony MPEG files +# + +PROBE_CODEC_NAME_COMMAND = \ + ffprobe$(PROGSSUF)$(EXESUF) -show_entries stream=codec_name \ + -select_streams a -print_format default=noprint_wrappers=1 -bitexact -v 0 + +FATE_PSMF_FFPROBE = fate-psmf-probe-6 \ + fate-psmf-probe-EV01_01_0500D + +fate-psmf-probe-6: SRC = $(TARGET_SAMPLES)/psmf/6.MPS +fate-psmf-probe-6: CMD = run $(PROBE_CODEC_NAME_COMMAND) -i "$(SRC)" +fate-psmf-probe-6: CMP = oneline +fate-psmf-probe-6: REF = codec_name=atrac3p +fate-psmf-probe-EV01_01_0500D: SRC = $(TARGET_SAMPLES)/psmf/EV01_01_0500D.PMF +fate-psmf-probe-EV01_01_0500D: CMD = run $(PROBE_CODEC_NAME_COMMAND) -i "$(SRC)" +fate-psmf-probe-EV01_01_0500D: CMP = oneline +fate-psmf-probe-EV01_01_0500D: REF = codec_name=atrac3p + +FATE_SAMPLES_FFPROBE += $(FATE_PSMF_FFPROBE) + +fate-psmf: $(FATE_PSMF_FFPROBE) -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2 1/3] avformat/hlsenc: revamped master playlist url creation logic
From: Vishwanath Dixit --- libavformat/hlsenc.c | 34 ++ 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 74f66ce..bd43336 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -1697,28 +1697,30 @@ static int update_variant_stream_info(AVFormatContext *s) { static int update_master_pl_info(AVFormatContext *s) { HLSContext *hls = s->priv_data; -int m3u8_name_size, ret; -char *p; +const char *dir; +char *fn; +int ret = 0; -m3u8_name_size = strlen(s->filename) + strlen(hls->master_pl_name) + 1; -hls->master_m3u8_url = av_malloc(m3u8_name_size); -if (!hls->master_m3u8_url) { +fn = av_strdup(s->filename); +if (!fn) { ret = AVERROR(ENOMEM); -return ret; +goto fail; } -av_strlcpy(hls->master_m3u8_url, s->filename, m3u8_name_size); -p = strrchr(hls->master_m3u8_url, '/') ? -strrchr(hls->master_m3u8_url, '/') : -strrchr(hls->master_m3u8_url, '\\'); -if (p) { -*(p + 1) = '\0'; -av_strlcat(hls->master_m3u8_url, hls->master_pl_name, m3u8_name_size); -} else { -av_strlcpy(hls->master_m3u8_url, hls->master_pl_name, m3u8_name_size); +dir = av_dirname(fn); +if (dir && strcmp(dir, ".")) +hls->master_m3u8_url = av_append_path_component(dir, hls->master_pl_name); +else +hls->master_m3u8_url = av_strdup(hls->master_pl_name); + +if (!hls->master_m3u8_url) { +ret = AVERROR(ENOMEM); +goto fail; } -return 0; +fail: +av_freep(&fn); +return ret; } static int hls_write_header(AVFormatContext *s) -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v2 3/3] avformat/hlsenc: creation of variant streams in subdirectories
From: Vishwanath Dixit --- doc/muxers.texi | 33 - libavformat/hlsenc.c | 68 +--- 2 files changed, 92 insertions(+), 9 deletions(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index 6af970d..2951262 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -587,6 +587,20 @@ This example will produce the playlists segment file sets: @file{file_0_000.ts}, @file{file_0_001.ts}, @file{file_0_002.ts}, etc. and @file{file_1_000.ts}, @file{file_1_001.ts}, @file{file_1_002.ts}, etc. +The string "%v" may be present in the filename or in the last directory name +containing the file. If the string is present in the directory name, then +sub-directories are created after expanding the directory name pattern. This +enables creation of segments corresponding to different variant streams in +subdirectories. +@example +ffmpeg -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \ + -map 0:v -map 0:a -map 0:v -map 0:a -f hls -var_stream_map "v:0,a:0 v:1,a:1" \ + -hls_segment_filename 'vs%v/file_%03d.ts' vs%v/out.m3u8 +@end example +This example will produce the playlists segment file sets: +@file{vs0/file_000.ts}, @file{vs0/file_001.ts}, @file{vs0/file_002.ts}, etc. and +@file{vs1/file_000.ts}, @file{vs1/file_001.ts}, @file{vs1/file_002.ts}, etc. + @item use_localtime Use strftime() on @var{filename} to expand the segment filename with localtime. The segment number is also available in this mode, but to use it, you need to specify second_level_segment_index @@ -715,6 +729,11 @@ set filename to the fragment files header file, default filename is @file{init.m When @code{var_stream_map} is set with two or more variant streams, the @var{filename} pattern must contain the string "%v", this string specifies the position of variant stream index in the generated init file names. +The string "%v" may be present in the filename or in the last directory name +containing the file. If the string is present in the directory name, then +sub-directories are created after expanding the directory name pattern. This +enables creation of init files corresponding to different variant streams in +subdirectories. @item hls_flags @var{flags} Possible values: @@ -831,7 +850,11 @@ Allowed values are 0 to 9 (limited just based on practical usage). When there are two or more variant streams, the output filename pattern must contain the string "%v", this string specifies the position of variant stream -index in the output media playlist filenames. +index in the output media playlist filenames. The string "%v" may be present in +the filename or in the last directory name containing the file. If the string is +present in the directory name, then sub-directories are created after expanding +the directory name pattern. This enables creation of variant streams in +subdirectories. @example ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \ @@ -854,6 +877,14 @@ be an audio only stream with bitrate 64k and the third variant stream will be a video only stream with bitrate 256k. Here, three media playlist with file names out_0.m3u8, out_1.m3u8 and out_2.m3u8 will be created. @example +ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \ + -map 0:v -map 0:a -map 0:v -map 0:a -f hls -var_stream_map "v:0,a:0 v:1,a:1" \ + http://example.com/live/vs_%v/out.m3u8 +@end example +This example creates the variant streams in subdirectories. Here, the first +media playlist is created at @file{http://example.com/live/vs_0/out.m3u8} and +the second one at @file{http://example.com/live/vs_1/out.m3u8}. +@example ffmpeg -re -i in.ts -b:a:0 32k -b:a:1 64k -b:v:0 1000k -b:v:1 3000k \ -map 0:a -map 0:a -map 0:v -map 0:v -f hls \ -var_stream_map "a:0,agroup:aud_low a:1,agroup:aud_high v:0,agroup:aud_low v:1,agroup:aud_high" \ diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 76a4110..9e1a267 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -1557,7 +1557,8 @@ static int append_postfix(char *name, int name_buf_len, int i) static int validate_name(int nb_vs, const char *fn) { -const char *filename; +const char *filename, *subdir_name; +char *fn_dup = NULL; int ret = 0; if (!fn) { @@ -1565,22 +1566,38 @@ static int validate_name(int nb_vs, const char *fn) goto fail; } +fn_dup = av_strdup(fn); +if (!fn_dup) { +ret = AVERROR(ENOMEM); +goto fail; +} + filename = av_basename(fn); +subdir_name = av_dirname(fn_dup); -if (nb_vs > 1 && !av_stristr(filename, "%v")) { +if (nb_vs > 1 && !av_stristr(filename, "%v") && !av_stristr(subdir_name, "%v")) { av_log(NULL, AV_LOG_ERROR, "More than 1 variant streams are present, %%v is expected in the filename %s\n", fn); ret = AVERROR(EINVAL); goto fail; } +if (av_stristr(filename, "%v") && av_stristr(subdir_name, "%v"))
[FFmpeg-devel] [PATCH v2 2/3] avformat/hlsenc: configurable variant stream index position in filenames
From: Vishwanath Dixit --- doc/muxers.texi | 31 +-- libavformat/hlsenc.c | 153 ++- 2 files changed, 127 insertions(+), 57 deletions(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index 93db549..6af970d 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -575,6 +575,17 @@ Should a relative path be specified, the path of the created segment files will be relative to the current working directory. When use_localtime_mkdir is set, the whole expanded value of @var{filename} will be written into the m3u8 segment list. +When @code{var_stream_map} is set with two or more variant streams, the +@var{filename} pattern must contain the string "%v", this string specifies +the position of variant stream index in the generated segment file names. +@example +ffmpeg -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \ + -map 0:v -map 0:a -map 0:v -map 0:a -f hls -var_stream_map "v:0,a:0 v:1,a:1" \ + -hls_segment_filename 'file_%v_%03d.ts' out_%v.m3u8 +@end example +This example will produce the playlists segment file sets: +@file{file_0_000.ts}, @file{file_0_001.ts}, @file{file_0_002.ts}, etc. and +@file{file_1_000.ts}, @file{file_1_001.ts}, @file{file_1_002.ts}, etc. @item use_localtime Use strftime() on @var{filename} to expand the segment filename with localtime. @@ -701,6 +712,10 @@ the fmp4 files is used in hls after version 7. @item hls_fmp4_init_filename @var{filename} set filename to the fragment files header file, default filename is @file{init.mp4}. +When @code{var_stream_map} is set with two or more variant streams, the +@var{filename} pattern must contain the string "%v", this string specifies +the position of variant stream index in the generated init file names. + @item hls_flags @var{flags} Possible values: @@ -814,32 +829,36 @@ Expected string format is like this "a:0,v:0 a:1,v:1 ". Here a:, v:, s: are the keys to specify audio, video and subtitle streams respectively. Allowed values are 0 to 9 (limited just based on practical usage). +When there are two or more variant streams, the output filename pattern must +contain the string "%v", this string specifies the position of variant stream +index in the output media playlist filenames. + @example ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \ -map 0:v -map 0:a -map 0:v -map 0:a -f hls -var_stream_map "v:0,a:0 v:1,a:1" \ - http://example.com/live/out.m3u8 + http://example.com/live/out_%v.m3u8 @end example This example creates two hls variant streams. The first variant stream will contain video stream of bitrate 1000k and audio stream of bitrate 64k and the second variant stream will contain video stream of bitrate 256k and audio -stream of bitrate 32k. Here, two media playlist with file names out_1.m3u8 and -out_2.m3u8 will be created. +stream of bitrate 32k. Here, two media playlist with file names out_0.m3u8 and +out_1.m3u8 will be created. @example ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k \ -map 0:v -map 0:a -map 0:v -f hls -var_stream_map "v:0 a:0 v:1" \ - http://example.com/live/out.m3u8 + http://example.com/live/out_%v.m3u8 @end example This example creates three hls variant streams. The first variant stream will be a video only stream with video bitrate 1000k, the second variant stream will be an audio only stream with bitrate 64k and the third variant stream will be a video only stream with bitrate 256k. Here, three media playlist with file names -out_1.m3u8, out_2.m3u8 and out_3.m3u8 will be created. +out_0.m3u8, out_1.m3u8 and out_2.m3u8 will be created. @example ffmpeg -re -i in.ts -b:a:0 32k -b:a:1 64k -b:v:0 1000k -b:v:1 3000k \ -map 0:a -map 0:a -map 0:v -map 0:v -f hls \ -var_stream_map "a:0,agroup:aud_low a:1,agroup:aud_high v:0,agroup:aud_low v:1,agroup:aud_high" \ -master_pl_name master.m3u8 \ - http://example.com/live/out.m3u8 + http://example.com/live/out_%v.m3u8 @end example This example creates two audio only and two video only variant streams. In addition to the #EXT-X-STREAM-INF tag for each variant stream in the master diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index bd43336..76a4110 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -1536,7 +1536,7 @@ static const char * get_default_pattern_localtime_fmt(AVFormatContext *s) return (HAVE_LIBC_MSVCRT || !strftime(b, sizeof(b), "%s", p) || !strcmp(b, "%s")) ? "-%Y%m%d%H%M%S.ts" : "-%s.ts"; } -static int format_name(char *name, int name_buf_len, int i) +static int append_postfix(char *name, int name_buf_len, int i) { char *p; char extension[10] = {'\0'}; @@ -1555,6 +1555,53 @@ static int format_name(char *name, int name_buf_len, int i) return 0; } +static int validate_name(int nb_vs, const char *fn) +{ +const char *filename; +int ret = 0; + +if (!fn) { +ret = AVERROR(EINVAL); +goto fail; +} + +filename = av_base
Re: [FFmpeg-devel] [PATCH v2 2/3] avformat/hlsenc: configurable variant stream index position in filenames
> On 26 Dec 2017, at 17:53, vdi...@akamai.com wrote: > > From: Vishwanath Dixit > > --- > doc/muxers.texi | 31 +-- > libavformat/hlsenc.c | 153 ++- > 2 files changed, 127 insertions(+), 57 deletions(-) > > diff --git a/doc/muxers.texi b/doc/muxers.texi > index 93db549..6af970d 100644 > --- a/doc/muxers.texi > +++ b/doc/muxers.texi > @@ -575,6 +575,17 @@ Should a relative path be specified, the path of the > created segment > files will be relative to the current working directory. > When use_localtime_mkdir is set, the whole expanded value of @var{filename} > will be written into the m3u8 segment list. > > +When @code{var_stream_map} is set with two or more variant streams, the > +@var{filename} pattern must contain the string "%v", this string specifies > +the position of variant stream index in the generated segment file names. > +@example > +ffmpeg -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \ > + -map 0:v -map 0:a -map 0:v -map 0:a -f hls -var_stream_map "v:0,a:0 > v:1,a:1" \ > + -hls_segment_filename 'file_%v_%03d.ts' out_%v.m3u8 > +@end example > +This example will produce the playlists segment file sets: > +@file{file_0_000.ts}, @file{file_0_001.ts}, @file{file_0_002.ts}, etc. and > +@file{file_1_000.ts}, @file{file_1_001.ts}, @file{file_1_002.ts}, etc. > > @item use_localtime > Use strftime() on @var{filename} to expand the segment filename with > localtime. > @@ -701,6 +712,10 @@ the fmp4 files is used in hls after version 7. > @item hls_fmp4_init_filename @var{filename} > set filename to the fragment files header file, default filename is > @file{init.mp4}. > > +When @code{var_stream_map} is set with two or more variant streams, the > +@var{filename} pattern must contain the string "%v", this string specifies > +the position of variant stream index in the generated init file names. > + > @item hls_flags @var{flags} > Possible values: > > @@ -814,32 +829,36 @@ Expected string format is like this "a:0,v:0 a:1,v:1 > ". Here a:, v:, s: are > the keys to specify audio, video and subtitle streams respectively. > Allowed values are 0 to 9 (limited just based on practical usage). > > +When there are two or more variant streams, the output filename pattern must > +contain the string "%v", this string specifies the position of variant stream > +index in the output media playlist filenames. > + > @example > ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \ > -map 0:v -map 0:a -map 0:v -map 0:a -f hls -var_stream_map "v:0,a:0 > v:1,a:1" \ > - http://example.com/live/out.m3u8 > + http://example.com/live/out_%v.m3u8 > @end example > This example creates two hls variant streams. The first variant stream will > contain video stream of bitrate 1000k and audio stream of bitrate 64k and the > second variant stream will contain video stream of bitrate 256k and audio > -stream of bitrate 32k. Here, two media playlist with file names out_1.m3u8 > and > -out_2.m3u8 will be created. > +stream of bitrate 32k. Here, two media playlist with file names out_0.m3u8 > and > +out_1.m3u8 will be created. > @example > ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k \ > -map 0:v -map 0:a -map 0:v -f hls -var_stream_map "v:0 a:0 v:1" \ > - http://example.com/live/out.m3u8 > + http://example.com/live/out_%v.m3u8 > @end example > This example creates three hls variant streams. The first variant stream will > be a video only stream with video bitrate 1000k, the second variant stream > will > be an audio only stream with bitrate 64k and the third variant stream will be > a > video only stream with bitrate 256k. Here, three media playlist with file > names > -out_1.m3u8, out_2.m3u8 and out_3.m3u8 will be created. > +out_0.m3u8, out_1.m3u8 and out_2.m3u8 will be created. > @example > ffmpeg -re -i in.ts -b:a:0 32k -b:a:1 64k -b:v:0 1000k -b:v:1 3000k \ > -map 0:a -map 0:a -map 0:v -map 0:v -f hls \ > -var_stream_map "a:0,agroup:aud_low a:1,agroup:aud_high v:0,agroup:aud_low > v:1,agroup:aud_high" \ > -master_pl_name master.m3u8 \ > - http://example.com/live/out.m3u8 > + http://example.com/live/out_%v.m3u8 > @end example > This example creates two audio only and two video only variant streams. In > addition to the #EXT-X-STREAM-INF tag for each variant stream in the master > diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c > index bd43336..76a4110 100644 > --- a/libavformat/hlsenc.c > +++ b/libavformat/hlsenc.c > @@ -1536,7 +1536,7 @@ static const char * > get_default_pattern_localtime_fmt(AVFormatContext *s) > return (HAVE_LIBC_MSVCRT || !strftime(b, sizeof(b), "%s", p) || > !strcmp(b, "%s")) ? "-%Y%m%d%H%M%S.ts" : "-%s.ts"; > } > > -static int format_name(char *name, int name_buf_len, int i) > +static int append_postfix(char *name, int name_buf_len, int i) > { > char *p; > char extension[10] = {'\0'}; > @@ -1555,6 +1555,53 @@ static int format_name(char *name, int name_
Re: [FFmpeg-devel] [PATCH v2 2/3] avformat/hlsenc: configurable variant stream index position in filenames
On 12/26/17 3:37 PM, 刘歧 wrote: On 26 Dec 2017, at 17:53, vdi...@akamai.com wrote: From: Vishwanath Dixit --- doc/muxers.texi | 31 +-- libavformat/hlsenc.c | 153 ++- 2 files changed, 127 insertions(+), 57 deletions(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index 93db549..6af970d 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -575,6 +575,17 @@ Should a relative path be specified, the path of the created segment files will be relative to the current working directory. When use_localtime_mkdir is set, the whole expanded value of @var{filename} will be written into the m3u8 segment list. +When @code{var_stream_map} is set with two or more variant streams, the +@var{filename} pattern must contain the string "%v", this string specifies +the position of variant stream index in the generated segment file names. +@example +ffmpeg -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \ + -map 0:v -map 0:a -map 0:v -map 0:a -f hls -var_stream_map "v:0,a:0 v:1,a:1" \ + -hls_segment_filename 'file_%v_%03d.ts' out_%v.m3u8 +@end example +This example will produce the playlists segment file sets: +@file{file_0_000.ts}, @file{file_0_001.ts}, @file{file_0_002.ts}, etc. and +@file{file_1_000.ts}, @file{file_1_001.ts}, @file{file_1_002.ts}, etc. @item use_localtime Use strftime() on @var{filename} to expand the segment filename with localtime. @@ -701,6 +712,10 @@ the fmp4 files is used in hls after version 7. @item hls_fmp4_init_filename @var{filename} set filename to the fragment files header file, default filename is @file{init.mp4}. +When @code{var_stream_map} is set with two or more variant streams, the +@var{filename} pattern must contain the string "%v", this string specifies +the position of variant stream index in the generated init file names. + @item hls_flags @var{flags} Possible values: @@ -814,32 +829,36 @@ Expected string format is like this "a:0,v:0 a:1,v:1 ". Here a:, v:, s: are the keys to specify audio, video and subtitle streams respectively. Allowed values are 0 to 9 (limited just based on practical usage). +When there are two or more variant streams, the output filename pattern must +contain the string "%v", this string specifies the position of variant stream +index in the output media playlist filenames. + @example ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \ -map 0:v -map 0:a -map 0:v -map 0:a -f hls -var_stream_map "v:0,a:0 v:1,a:1" \ - http://example.com/live/out.m3u8 + http://example.com/live/out_%v.m3u8 @end example This example creates two hls variant streams. The first variant stream will contain video stream of bitrate 1000k and audio stream of bitrate 64k and the second variant stream will contain video stream of bitrate 256k and audio -stream of bitrate 32k. Here, two media playlist with file names out_1.m3u8 and -out_2.m3u8 will be created. +stream of bitrate 32k. Here, two media playlist with file names out_0.m3u8 and +out_1.m3u8 will be created. @example ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k \ -map 0:v -map 0:a -map 0:v -f hls -var_stream_map "v:0 a:0 v:1" \ - http://example.com/live/out.m3u8 + http://example.com/live/out_%v.m3u8 @end example This example creates three hls variant streams. The first variant stream will be a video only stream with video bitrate 1000k, the second variant stream will be an audio only stream with bitrate 64k and the third variant stream will be a video only stream with bitrate 256k. Here, three media playlist with file names -out_1.m3u8, out_2.m3u8 and out_3.m3u8 will be created. +out_0.m3u8, out_1.m3u8 and out_2.m3u8 will be created. @example ffmpeg -re -i in.ts -b:a:0 32k -b:a:1 64k -b:v:0 1000k -b:v:1 3000k \ -map 0:a -map 0:a -map 0:v -map 0:v -f hls \ -var_stream_map "a:0,agroup:aud_low a:1,agroup:aud_high v:0,agroup:aud_low v:1,agroup:aud_high" \ -master_pl_name master.m3u8 \ - http://example.com/live/out.m3u8 + http://example.com/live/out_%v.m3u8 @end example This example creates two audio only and two video only variant streams. In addition to the #EXT-X-STREAM-INF tag for each variant stream in the master diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index bd43336..76a4110 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -1536,7 +1536,7 @@ static const char * get_default_pattern_localtime_fmt(AVFormatContext *s) return (HAVE_LIBC_MSVCRT || !strftime(b, sizeof(b), "%s", p) || !strcmp(b, "%s")) ? "-%Y%m%d%H%M%S.ts" : "-%s.ts"; } -static int format_name(char *name, int name_buf_len, int i) +static int append_postfix(char *name, int name_buf_len, int i) { char *p; char extension[10] = {'\0'}; @@ -1555,6 +1555,53 @@ static int format_name(char *name, int name_buf_len, int i) return 0; } +static int validate_name(int nb_vs, const char *fn) +{ +const char *filename; +int ret = 0; + +if (!fn) { +ret = AVERROR(EINVAL); +
Re: [FFmpeg-devel] [PATCH v2 2/3] avformat/hlsenc: configurable variant stream index position in filenames
> On 26 Dec 2017, at 18:38, Vishwanath Dixit wrote: > > > > On 12/26/17 3:37 PM, 刘歧 wrote: >>> On 26 Dec 2017, at 17:53, vdi...@akamai.com wrote: >>> >>> From: Vishwanath Dixit >>> >>> --- >>> doc/muxers.texi | 31 +-- >>> libavformat/hlsenc.c | 153 >>> ++- >>> 2 files changed, 127 insertions(+), 57 deletions(-) >>> >>> diff --git a/doc/muxers.texi b/doc/muxers.texi >>> index 93db549..6af970d 100644 >>> --- a/doc/muxers.texi >>> +++ b/doc/muxers.texi >>> @@ -575,6 +575,17 @@ Should a relative path be specified, the path of the >>> created segment >>> files will be relative to the current working directory. >>> When use_localtime_mkdir is set, the whole expanded value of @var{filename} >>> will be written into the m3u8 segment list. >>> >>> +When @code{var_stream_map} is set with two or more variant streams, the >>> +@var{filename} pattern must contain the string "%v", this string specifies >>> +the position of variant stream index in the generated segment file names. >>> +@example >>> +ffmpeg -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \ >>> + -map 0:v -map 0:a -map 0:v -map 0:a -f hls -var_stream_map "v:0,a:0 >>> v:1,a:1" \ >>> + -hls_segment_filename 'file_%v_%03d.ts' out_%v.m3u8 >>> +@end example >>> +This example will produce the playlists segment file sets: >>> +@file{file_0_000.ts}, @file{file_0_001.ts}, @file{file_0_002.ts}, etc. and >>> +@file{file_1_000.ts}, @file{file_1_001.ts}, @file{file_1_002.ts}, etc. >>> >>> @item use_localtime >>> Use strftime() on @var{filename} to expand the segment filename with >>> localtime. >>> @@ -701,6 +712,10 @@ the fmp4 files is used in hls after version 7. >>> @item hls_fmp4_init_filename @var{filename} >>> set filename to the fragment files header file, default filename is >>> @file{init.mp4}. >>> >>> +When @code{var_stream_map} is set with two or more variant streams, the >>> +@var{filename} pattern must contain the string "%v", this string specifies >>> +the position of variant stream index in the generated init file names. >>> + >>> @item hls_flags @var{flags} >>> Possible values: >>> >>> @@ -814,32 +829,36 @@ Expected string format is like this "a:0,v:0 a:1,v:1 >>> ". Here a:, v:, s: are >>> the keys to specify audio, video and subtitle streams respectively. >>> Allowed values are 0 to 9 (limited just based on practical usage). >>> >>> +When there are two or more variant streams, the output filename pattern >>> must >>> +contain the string "%v", this string specifies the position of variant >>> stream >>> +index in the output media playlist filenames. >>> + >>> @example >>> ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \ >>> -map 0:v -map 0:a -map 0:v -map 0:a -f hls -var_stream_map "v:0,a:0 >>> v:1,a:1" \ >>> - http://example.com/live/out.m3u8 >>> + http://example.com/live/out_%v.m3u8 >>> @end example >>> This example creates two hls variant streams. The first variant stream will >>> contain video stream of bitrate 1000k and audio stream of bitrate 64k and >>> the >>> second variant stream will contain video stream of bitrate 256k and audio >>> -stream of bitrate 32k. Here, two media playlist with file names out_1.m3u8 >>> and >>> -out_2.m3u8 will be created. >>> +stream of bitrate 32k. Here, two media playlist with file names out_0.m3u8 >>> and >>> +out_1.m3u8 will be created. >>> @example >>> ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k \ >>> -map 0:v -map 0:a -map 0:v -f hls -var_stream_map "v:0 a:0 v:1" \ >>> - http://example.com/live/out.m3u8 >>> + http://example.com/live/out_%v.m3u8 >>> @end example >>> This example creates three hls variant streams. The first variant stream >>> will >>> be a video only stream with video bitrate 1000k, the second variant stream >>> will >>> be an audio only stream with bitrate 64k and the third variant stream will >>> be a >>> video only stream with bitrate 256k. Here, three media playlist with file >>> names >>> -out_1.m3u8, out_2.m3u8 and out_3.m3u8 will be created. >>> +out_0.m3u8, out_1.m3u8 and out_2.m3u8 will be created. >>> @example >>> ffmpeg -re -i in.ts -b:a:0 32k -b:a:1 64k -b:v:0 1000k -b:v:1 3000k \ >>> -map 0:a -map 0:a -map 0:v -map 0:v -f hls \ >>> -var_stream_map "a:0,agroup:aud_low a:1,agroup:aud_high >>> v:0,agroup:aud_low v:1,agroup:aud_high" \ >>> -master_pl_name master.m3u8 \ >>> - http://example.com/live/out.m3u8 >>> + http://example.com/live/out_%v.m3u8 >>> @end example >>> This example creates two audio only and two video only variant streams. In >>> addition to the #EXT-X-STREAM-INF tag for each variant stream in the master >>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c >>> index bd43336..76a4110 100644 >>> --- a/libavformat/hlsenc.c >>> +++ b/libavformat/hlsenc.c >>> @@ -1536,7 +1536,7 @@ static const char * >>> get_default_pattern_localtime_fmt(AVFormatContext *s) >>> return (HAVE_LIBC_MSVCRT || !strftime(b, sizeo
[FFmpeg-devel] [PATCH 2/3] avformat/hlsplaylist: Audio rendition's name and defaultness made configurable
From: Karthick Jeyapal --- libavformat/hlsenc.c | 2 +- libavformat/hlsplaylist.c | 5 +++-- libavformat/hlsplaylist.h | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index fe531fb..5cff3b4 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -1169,7 +1169,7 @@ static int create_master_playlist(AVFormatContext *s, goto fail; } -ff_hls_write_audio_rendition(hls->m3u8_out, vs->agroup, m3u8_rel_name); +ff_hls_write_audio_rendition(hls->m3u8_out, vs->agroup, m3u8_rel_name, 0, 1); av_freep(&m3u8_rel_name); } diff --git a/libavformat/hlsplaylist.c b/libavformat/hlsplaylist.c index a065eda..098dc89 100644 --- a/libavformat/hlsplaylist.c +++ b/libavformat/hlsplaylist.c @@ -36,12 +36,13 @@ void ff_hls_write_playlist_version(AVIOContext *out, int version) { } void ff_hls_write_audio_rendition(AVIOContext *out, char *agroup, - char *filename) { + char *filename, int name_id, int is_default) { if (!out || !agroup || !filename) return; avio_printf(out, "#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"group_%s\"", agroup); -avio_printf(out, ",NAME=\"audio_0\",DEFAULT=YES,URI=\"%s\"\n", filename); +avio_printf(out, ",NAME=\"audio_%d\",DEFAULT=%s,URI=\"%s\"\n", name_id, + is_default ? "YES" : "NO", filename); } void ff_hls_write_stream_info(AVStream *st, AVIOContext *out, diff --git a/libavformat/hlsplaylist.h b/libavformat/hlsplaylist.h index 518cfc2..9969315 100644 --- a/libavformat/hlsplaylist.h +++ b/libavformat/hlsplaylist.h @@ -37,7 +37,8 @@ typedef enum { } PlaylistType; void ff_hls_write_playlist_version(AVIOContext *out, int version); -void ff_hls_write_audio_rendition(AVIOContext *out, char *agroup, char *filename); +void ff_hls_write_audio_rendition(AVIOContext *out, char *agroup, + char *filename, int name_id, int is_default); void ff_hls_write_stream_info(AVStream *st, AVIOContext *out, int bandwidth, char *filename, char *agroup); void ff_hls_write_playlist_header(AVIOContext *out, int version, int allowcache, -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/3] avformat/hlsenc: Modularized audio rendition playlist write to allow reuse
From: Karthick Jeyapal --- libavformat/hlsenc.c | 6 ++ libavformat/hlsplaylist.c | 9 + libavformat/hlsplaylist.h | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 74f66ce..fe531fb 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -1169,10 +1169,8 @@ static int create_master_playlist(AVFormatContext *s, goto fail; } -avio_printf(hls->m3u8_out, "#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"group_%s\"", -vs->agroup); -avio_printf(hls->m3u8_out, ",NAME=\"audio_0\",DEFAULT=YES,URI=\"%s\"\n", -m3u8_rel_name); +ff_hls_write_audio_rendition(hls->m3u8_out, vs->agroup, m3u8_rel_name); + av_freep(&m3u8_rel_name); } diff --git a/libavformat/hlsplaylist.c b/libavformat/hlsplaylist.c index 42f059a..a065eda 100644 --- a/libavformat/hlsplaylist.c +++ b/libavformat/hlsplaylist.c @@ -35,6 +35,15 @@ void ff_hls_write_playlist_version(AVIOContext *out, int version) { avio_printf(out, "#EXT-X-VERSION:%d\n", version); } +void ff_hls_write_audio_rendition(AVIOContext *out, char *agroup, + char *filename) { +if (!out || !agroup || !filename) +return; + +avio_printf(out, "#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID=\"group_%s\"", agroup); +avio_printf(out, ",NAME=\"audio_0\",DEFAULT=YES,URI=\"%s\"\n", filename); +} + void ff_hls_write_stream_info(AVStream *st, AVIOContext *out, int bandwidth, char *filename, char *agroup) { if (!out || !filename) diff --git a/libavformat/hlsplaylist.h b/libavformat/hlsplaylist.h index ac03550..518cfc2 100644 --- a/libavformat/hlsplaylist.h +++ b/libavformat/hlsplaylist.h @@ -37,6 +37,7 @@ typedef enum { } PlaylistType; void ff_hls_write_playlist_version(AVIOContext *out, int version); +void ff_hls_write_audio_rendition(AVIOContext *out, char *agroup, char *filename); void ff_hls_write_stream_info(AVStream *st, AVIOContext *out, int bandwidth, char *filename, char *agroup); void ff_hls_write_playlist_header(AVIOContext *out, int version, int allowcache, -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/3] avformat/dashenc: Addition of #EXT-X-MEDIA tag and AUDIO attribute
From: Karthick Jeyapal This is required for AV playout from master.m3u8. Otherwise master.m3u8 lists only video-only and/or audio-only streams. --- libavformat/dashenc.c | 24 ++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 478a384..a3eb522 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -737,6 +737,9 @@ static int write_manifest(AVFormatContext *s, int final) if (c->hls_playlist && !c->master_playlist_created) { char filename_hls[1024]; +const char *audio_group = "A1"; +int is_default = 1; +int max_audio_bitrate = 0; if (*c->dirname) snprintf(filename_hls, sizeof(filename_hls), "%s/master.m3u8", c->dirname); @@ -758,9 +761,26 @@ static int write_manifest(AVFormatContext *s, int final) for (i = 0; i < s->nb_streams; i++) { char playlist_file[64]; AVStream *st = s->streams[i]; +if (st->codecpar->codec_type != AVMEDIA_TYPE_AUDIO) +continue; +get_hls_playlist_name(playlist_file, sizeof(playlist_file), NULL, i); +ff_hls_write_audio_rendition(out, (char *)audio_group, + playlist_file, i, is_default); +max_audio_bitrate = FFMAX(st->codecpar->bit_rate, max_audio_bitrate); +is_default = 0; +} + +for (i = 0; i < s->nb_streams; i++) { +char playlist_file[64]; +AVStream *st = s->streams[i]; +char *agroup = NULL; +int stream_bitrate = st->codecpar->bit_rate; +if ((st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) && max_audio_bitrate) { +agroup = (char *)audio_group; +stream_bitrate += max_audio_bitrate; +} get_hls_playlist_name(playlist_file, sizeof(playlist_file), NULL, i); -ff_hls_write_stream_info(st, out, st->codecpar->bit_rate, -playlist_file, NULL); +ff_hls_write_stream_info(st, out, stream_bitrate, playlist_file, agroup); } avio_close(out); if (use_rename) -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v3 1/3] avformat/hlsenc: revamped master playlist url creation logic
From: Vishwanath Dixit --- libavformat/hlsenc.c | 34 ++ 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 74f66ce..bd43336 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -1697,28 +1697,30 @@ static int update_variant_stream_info(AVFormatContext *s) { static int update_master_pl_info(AVFormatContext *s) { HLSContext *hls = s->priv_data; -int m3u8_name_size, ret; -char *p; +const char *dir; +char *fn; +int ret = 0; -m3u8_name_size = strlen(s->filename) + strlen(hls->master_pl_name) + 1; -hls->master_m3u8_url = av_malloc(m3u8_name_size); -if (!hls->master_m3u8_url) { +fn = av_strdup(s->filename); +if (!fn) { ret = AVERROR(ENOMEM); -return ret; +goto fail; } -av_strlcpy(hls->master_m3u8_url, s->filename, m3u8_name_size); -p = strrchr(hls->master_m3u8_url, '/') ? -strrchr(hls->master_m3u8_url, '/') : -strrchr(hls->master_m3u8_url, '\\'); -if (p) { -*(p + 1) = '\0'; -av_strlcat(hls->master_m3u8_url, hls->master_pl_name, m3u8_name_size); -} else { -av_strlcpy(hls->master_m3u8_url, hls->master_pl_name, m3u8_name_size); +dir = av_dirname(fn); +if (dir && strcmp(dir, ".")) +hls->master_m3u8_url = av_append_path_component(dir, hls->master_pl_name); +else +hls->master_m3u8_url = av_strdup(hls->master_pl_name); + +if (!hls->master_m3u8_url) { +ret = AVERROR(ENOMEM); +goto fail; } -return 0; +fail: +av_freep(&fn); +return ret; } static int hls_write_header(AVFormatContext *s) -- 1.9.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v3 3/3] avformat/hlsenc: creation of variant streams in subdirectories
From: Vishwanath Dixit --- doc/muxers.texi | 33 - libavformat/hlsenc.c | 68 +--- 2 files changed, 92 insertions(+), 9 deletions(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index 6af970d..2951262 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -587,6 +587,20 @@ This example will produce the playlists segment file sets: @file{file_0_000.ts}, @file{file_0_001.ts}, @file{file_0_002.ts}, etc. and @file{file_1_000.ts}, @file{file_1_001.ts}, @file{file_1_002.ts}, etc. +The string "%v" may be present in the filename or in the last directory name +containing the file. If the string is present in the directory name, then +sub-directories are created after expanding the directory name pattern. This +enables creation of segments corresponding to different variant streams in +subdirectories. +@example +ffmpeg -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \ + -map 0:v -map 0:a -map 0:v -map 0:a -f hls -var_stream_map "v:0,a:0 v:1,a:1" \ + -hls_segment_filename 'vs%v/file_%03d.ts' vs%v/out.m3u8 +@end example +This example will produce the playlists segment file sets: +@file{vs0/file_000.ts}, @file{vs0/file_001.ts}, @file{vs0/file_002.ts}, etc. and +@file{vs1/file_000.ts}, @file{vs1/file_001.ts}, @file{vs1/file_002.ts}, etc. + @item use_localtime Use strftime() on @var{filename} to expand the segment filename with localtime. The segment number is also available in this mode, but to use it, you need to specify second_level_segment_index @@ -715,6 +729,11 @@ set filename to the fragment files header file, default filename is @file{init.m When @code{var_stream_map} is set with two or more variant streams, the @var{filename} pattern must contain the string "%v", this string specifies the position of variant stream index in the generated init file names. +The string "%v" may be present in the filename or in the last directory name +containing the file. If the string is present in the directory name, then +sub-directories are created after expanding the directory name pattern. This +enables creation of init files corresponding to different variant streams in +subdirectories. @item hls_flags @var{flags} Possible values: @@ -831,7 +850,11 @@ Allowed values are 0 to 9 (limited just based on practical usage). When there are two or more variant streams, the output filename pattern must contain the string "%v", this string specifies the position of variant stream -index in the output media playlist filenames. +index in the output media playlist filenames. The string "%v" may be present in +the filename or in the last directory name containing the file. If the string is +present in the directory name, then sub-directories are created after expanding +the directory name pattern. This enables creation of variant streams in +subdirectories. @example ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \ @@ -854,6 +877,14 @@ be an audio only stream with bitrate 64k and the third variant stream will be a video only stream with bitrate 256k. Here, three media playlist with file names out_0.m3u8, out_1.m3u8 and out_2.m3u8 will be created. @example +ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \ + -map 0:v -map 0:a -map 0:v -map 0:a -f hls -var_stream_map "v:0,a:0 v:1,a:1" \ + http://example.com/live/vs_%v/out.m3u8 +@end example +This example creates the variant streams in subdirectories. Here, the first +media playlist is created at @file{http://example.com/live/vs_0/out.m3u8} and +the second one at @file{http://example.com/live/vs_1/out.m3u8}. +@example ffmpeg -re -i in.ts -b:a:0 32k -b:a:1 64k -b:v:0 1000k -b:v:1 3000k \ -map 0:a -map 0:a -map 0:v -map 0:v -f hls \ -var_stream_map "a:0,agroup:aud_low a:1,agroup:aud_high v:0,agroup:aud_low v:1,agroup:aud_high" \ diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 198c9d3..b25bfc9 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -1557,7 +1557,8 @@ static int append_postfix(char *name, int name_buf_len, int i) static int validate_name(int nb_vs, const char *fn) { -const char *filename; +const char *filename, *subdir_name; +char *fn_dup = NULL; int ret = 0; if (!fn) { @@ -1565,22 +1566,38 @@ static int validate_name(int nb_vs, const char *fn) goto fail; } +fn_dup = av_strdup(fn); +if (!fn_dup) { +ret = AVERROR(ENOMEM); +goto fail; +} + filename = av_basename(fn); +subdir_name = av_dirname(fn_dup); -if (nb_vs > 1 && !av_stristr(filename, "%v")) { +if (nb_vs > 1 && !av_stristr(filename, "%v") && !av_stristr(subdir_name, "%v")) { av_log(NULL, AV_LOG_ERROR, "More than 1 variant streams are present, %%v is expected in the filename %s\n", fn); ret = AVERROR(EINVAL); goto fail; } +if (av_stristr(filename, "%v") && av_stristr(subdir_name, "%v"))
[FFmpeg-devel] [PATCH v3 2/3] avformat/hlsenc: configurable variant stream index position in filenames
From: Vishwanath Dixit --- doc/muxers.texi | 31 +-- libavformat/hlsenc.c | 153 ++- 2 files changed, 126 insertions(+), 58 deletions(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index 93db549..6af970d 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -575,6 +575,17 @@ Should a relative path be specified, the path of the created segment files will be relative to the current working directory. When use_localtime_mkdir is set, the whole expanded value of @var{filename} will be written into the m3u8 segment list. +When @code{var_stream_map} is set with two or more variant streams, the +@var{filename} pattern must contain the string "%v", this string specifies +the position of variant stream index in the generated segment file names. +@example +ffmpeg -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \ + -map 0:v -map 0:a -map 0:v -map 0:a -f hls -var_stream_map "v:0,a:0 v:1,a:1" \ + -hls_segment_filename 'file_%v_%03d.ts' out_%v.m3u8 +@end example +This example will produce the playlists segment file sets: +@file{file_0_000.ts}, @file{file_0_001.ts}, @file{file_0_002.ts}, etc. and +@file{file_1_000.ts}, @file{file_1_001.ts}, @file{file_1_002.ts}, etc. @item use_localtime Use strftime() on @var{filename} to expand the segment filename with localtime. @@ -701,6 +712,10 @@ the fmp4 files is used in hls after version 7. @item hls_fmp4_init_filename @var{filename} set filename to the fragment files header file, default filename is @file{init.mp4}. +When @code{var_stream_map} is set with two or more variant streams, the +@var{filename} pattern must contain the string "%v", this string specifies +the position of variant stream index in the generated init file names. + @item hls_flags @var{flags} Possible values: @@ -814,32 +829,36 @@ Expected string format is like this "a:0,v:0 a:1,v:1 ". Here a:, v:, s: are the keys to specify audio, video and subtitle streams respectively. Allowed values are 0 to 9 (limited just based on practical usage). +When there are two or more variant streams, the output filename pattern must +contain the string "%v", this string specifies the position of variant stream +index in the output media playlist filenames. + @example ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \ -map 0:v -map 0:a -map 0:v -map 0:a -f hls -var_stream_map "v:0,a:0 v:1,a:1" \ - http://example.com/live/out.m3u8 + http://example.com/live/out_%v.m3u8 @end example This example creates two hls variant streams. The first variant stream will contain video stream of bitrate 1000k and audio stream of bitrate 64k and the second variant stream will contain video stream of bitrate 256k and audio -stream of bitrate 32k. Here, two media playlist with file names out_1.m3u8 and -out_2.m3u8 will be created. +stream of bitrate 32k. Here, two media playlist with file names out_0.m3u8 and +out_1.m3u8 will be created. @example ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k \ -map 0:v -map 0:a -map 0:v -f hls -var_stream_map "v:0 a:0 v:1" \ - http://example.com/live/out.m3u8 + http://example.com/live/out_%v.m3u8 @end example This example creates three hls variant streams. The first variant stream will be a video only stream with video bitrate 1000k, the second variant stream will be an audio only stream with bitrate 64k and the third variant stream will be a video only stream with bitrate 256k. Here, three media playlist with file names -out_1.m3u8, out_2.m3u8 and out_3.m3u8 will be created. +out_0.m3u8, out_1.m3u8 and out_2.m3u8 will be created. @example ffmpeg -re -i in.ts -b:a:0 32k -b:a:1 64k -b:v:0 1000k -b:v:1 3000k \ -map 0:a -map 0:a -map 0:v -map 0:v -f hls \ -var_stream_map "a:0,agroup:aud_low a:1,agroup:aud_high v:0,agroup:aud_low v:1,agroup:aud_high" \ -master_pl_name master.m3u8 \ - http://example.com/live/out.m3u8 + http://example.com/live/out_%v.m3u8 @end example This example creates two audio only and two video only variant streams. In addition to the #EXT-X-STREAM-INF tag for each variant stream in the master diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index bd43336..198c9d3 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -1536,7 +1536,7 @@ static const char * get_default_pattern_localtime_fmt(AVFormatContext *s) return (HAVE_LIBC_MSVCRT || !strftime(b, sizeof(b), "%s", p) || !strcmp(b, "%s")) ? "-%Y%m%d%H%M%S.ts" : "-%s.ts"; } -static int format_name(char *name, int name_buf_len, int i) +static int append_postfix(char *name, int name_buf_len, int i) { char *p; char extension[10] = {'\0'}; @@ -1555,6 +1555,53 @@ static int format_name(char *name, int name_buf_len, int i) return 0; } +static int validate_name(int nb_vs, const char *fn) +{ +const char *filename; +int ret = 0; + +if (!fn) { +ret = AVERROR(EINVAL); +goto fail; +} + +filename = av_base
Re: [FFmpeg-devel] [PATCH 6/6] psmf: add FATE tests
On Mon, Dec 25, 2017 at 11:32:50PM +, Rostislav Pehlivanov wrote: > On 25 December 2017 at 23:27, Michael Niedermayer > wrote: > > > On Mon, Dec 25, 2017 at 10:28:34AM +0800, mi...@brew.sh wrote: > > > From: Misty De Meo > > > > > > --- > > > tests/Makefile | 1 + > > > tests/fate/psmf.mak | 23 +++ > > > 2 files changed, 24 insertions(+) > > > create mode 100644 tests/fate/psmf.mak > > > > > > diff --git a/tests/Makefile b/tests/Makefile > > > index fd3713fe81..c569091fcb 100644 > > > --- a/tests/Makefile > > > +++ b/tests/Makefile > > > @@ -165,6 +165,7 @@ include $(SRC_PATH)/tests/fate/pcm.mak > > > include $(SRC_PATH)/tests/fate/pixlet.mak > > > include $(SRC_PATH)/tests/fate/probe.mak > > > include $(SRC_PATH)/tests/fate/prores.mak > > > +include $(SRC_PATH)/tests/fate/psmf.mak > > > include $(SRC_PATH)/tests/fate/qt.mak > > > include $(SRC_PATH)/tests/fate/qtrle.mak > > > include $(SRC_PATH)/tests/fate/real.mak > > > diff --git a/tests/fate/psmf.mak b/tests/fate/psmf.mak > > > new file mode 100644 > > > index 00..0d83daad49 > > > --- /dev/null > > > +++ b/tests/fate/psmf.mak > > > @@ -0,0 +1,23 @@ > > > +# > > > +# Test detecting ATRAC-3 audio in Sony MPEG files > > > +# > > > + > > > +PROBE_CODEC_NAME_COMMAND = \ > > > + ffprobe$(PROGSSUF)$(EXESUF) -show_entries stream=codec_name \ > > > + -select_streams a -print_format default=noprint_wrappers=1 > > -bitexact -v 0 > > > + > > > +FATE_PSMF_FFPROBE = fate-psmf-probe-6 \ > > > + fate-psmf-probe-EV01_01_0500D > > > + > > > +fate-psmf-probe-6: SRC = $(TARGET_SAMPLES)/psmf/6.MPS > > > +fate-psmf-probe-6: CMD = run $(PROBE_CODEC_NAME_COMMAND) -i "$(SRC)" > > > +fate-psmf-probe-6: CMP = oneline > > > +fate-psmf-probe-6: REF = codec_name=atrac3p > > > +fate-psmf-probe-EV01_01_0500D: SRC = $(TARGET_SAMPLES)/psmf/EV01_ > > 01_0500D.PMF > > > +fate-psmf-probe-EV01_01_0500D: CMD = run $(PROBE_CODEC_NAME_COMMAND) > > -i "$(SRC)" > > > +fate-psmf-probe-EV01_01_0500D: CMP = oneline > > > +fate-psmf-probe-EV01_01_0500D: REF = codec_name=atrac3p > > > > where are the sample files ? > > did i miss a upload request ? > > > > [...] > > -- > > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > > > I have never wished to cater to the crowd; for what I know they do not > > approve, and what they approve I do not know. -- Epicurus > > > > ___ > > ffmpeg-devel mailing list > > ffmpeg-devel@ffmpeg.org > > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > > > > They're in another email: > http://ffmpeg.org/pipermail/ffmpeg-devel/2017-December/222885.html Missed these one is 512k one 1.7m, these seem a bit large for just testing filetype probing is this intended ? [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If a bugfix only changes things apparently unrelated to the bug with no further explanation, that is a good sign that the bugfix is wrong. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] avcodec/libx264: fix compilation with x264 builds >= 153
On 26 December 2017 at 00:44, James Almer wrote: > x264 now supports multibitdepth builds, with a slightly changed API to > request bitdepth during initialization. > > Signed-off-by: James Almer > --- > libx264 can still be compiled with only 8 or 10 bit format support even > after the multibitdepth change, so take that into consideration. > > libavcodec/libx264.c | 30 +++--- > 1 file changed, 27 insertions(+), 3 deletions(-) > > diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c > index 2d36c5e566..20ed59fbc4 100644 > --- a/libavcodec/libx264.c > +++ b/libavcodec/libx264.c > @@ -454,6 +454,7 @@ static av_cold int X264_init(AVCodecContext *avctx) > { > X264Context *x4 = avctx->priv_data; > AVCPBProperties *cpb_props; > +const av_unused AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx-> > pix_fmt); > int sw,sh; > > if (avctx->global_quality > 0) > @@ -724,6 +725,9 @@ FF_ENABLE_DEPRECATION_WARNINGS > > x4->params.i_width = avctx->width; > x4->params.i_height = avctx->height; > +#if X264_BUILD >= 153 > +x4->params.i_bitdepth = desc->comp[0].depth; > +#endif > av_reduce(&sw, &sh, avctx->sample_aspect_ratio.num, > avctx->sample_aspect_ratio.den, 4096); > x4->params.vui.i_sar_width = sw; > x4->params.vui.i_sar_height = sh; > @@ -837,6 +841,24 @@ FF_ENABLE_DEPRECATION_WARNINGS > return 0; > } > > +static const enum AVPixelFormat pix_fmts[] = { > +AV_PIX_FMT_YUV420P, > +AV_PIX_FMT_YUVJ420P, > +AV_PIX_FMT_YUV422P, > +AV_PIX_FMT_YUVJ422P, > +AV_PIX_FMT_YUV444P, > +AV_PIX_FMT_YUVJ444P, > +AV_PIX_FMT_YUV420P10, > +AV_PIX_FMT_YUV422P10, > +AV_PIX_FMT_YUV444P10, > +AV_PIX_FMT_NV12, > +AV_PIX_FMT_NV16, > +AV_PIX_FMT_NV20, > +#ifdef X264_CSP_NV21 > +AV_PIX_FMT_NV21, > +#endif > +AV_PIX_FMT_NONE > +}; > static const enum AVPixelFormat pix_fmts_8bit[] = { > AV_PIX_FMT_YUV420P, > AV_PIX_FMT_YUVJ420P, > @@ -874,12 +896,14 @@ static const enum AVPixelFormat pix_fmts_8bit_rgb[] > = { > > static av_cold void X264_init_static(AVCodec *codec) > { > -if (x264_bit_depth == 8) > +if (X264_BIT_DEPTH == 8) > codec->pix_fmts = pix_fmts_8bit; > -else if (x264_bit_depth == 9) > +else if (X264_BIT_DEPTH == 9) > codec->pix_fmts = pix_fmts_9bit; > -else if (x264_bit_depth == 10) > +else if (X264_BIT_DEPTH == 10) > codec->pix_fmts = pix_fmts_10bit; > +else /* X264_BIT_DEPTH == 0 */ > +codec->pix_fmts = pix_fmts; > } > > #define OFFSET(x) offsetof(X264Context, x) > -- > 2.15.0 > > LGTM > ___ > 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] lavr: deprecate the entire library
On 25 December 2017 at 17:53, Rostislav Pehlivanov wrote: > Deprecate the entire library. Merged years ago to provide compatibility > with Libav, it remained unmaintained by the FFmpeg project and duplicated > functionality provided by libswresample. > > In order to improve consistency and reduce attack surface, as well as to > ease > burden on maintainers, it has been deprecated. Users of this library are > asked > to migrate to libswresample, which, as well as providing more > functionality, > is faster and has higher accuracy. > > Signed-off-by: Rostislav Pehlivanov > --- > configure | 4 ++-- > doc/APIchanges | 10 ++ > libavresample/avresample.h | 30 +- > 3 files changed, 37 insertions(+), 7 deletions(-) > > I'll push this tonight if there are no more objections. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2] frame: add an av_frame_new_side_data_from_buf function
On 17 October 2017 at 23:57, Rostislav Pehlivanov wrote: > Signed-off-by: Rostislav Pehlivanov > --- > libavutil/frame.c | 38 -- > libavutil/frame.h | 13 + > 2 files changed, 33 insertions(+), 18 deletions(-) > > I'll push this tonight if there are no more objections. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavr: deprecate the entire library
Rostislav Pehlivanov (2017-12-26): > I'll push this tonight if there are no more objections. Way too soon. For a patch that sensitive, leaving a week for people to voice their concerns and raise objections that you may not have thought of seems like a reasonable minimum. Plus we are on vacation period, people do not read their mail as often. I'd say wait until approximatively the fourth of January. By the way, the change seems quite good to me. Regards, -- Nicolas George signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavr: deprecate the entire library
On 26 December 2017 at 15:47, Nicolas George wrote: > Rostislav Pehlivanov (2017-12-26): > > I'll push this tonight if there are no more objections. > > Way too soon. For a patch that sensitive, leaving a week for people to > voice their concerns and raise objections that you may not have thought > of seems like a reasonable minimum. Plus we are on vacation period, > people do not read their mail as often. I'd say wait until > approximatively the fourth of January. > > By the way, the change seems quite good to me. > > Regards, > > -- > Nicolas George > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > This has been on the ML for over a month. No one disagreed then. No one was on vacation then. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] avcodec/dirac_dwt: Fix integer overflow in COMPOSE_DD97iH0() and COMPOSE_DD137iL0()
On Fri, Dec 22, 2017 at 03:52:41AM +0100, Michael Niedermayer wrote: > Fixes: runtime error: signed integer overflow: 2147483646 + 33554433 cannot > be represented in type 'int' > Fixes: 4563/clusterfuzz-testcase-minimized-5438979567517696 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/dirac_dwt.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions patchset applied [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB No great genius has ever existed without some touch of madness. -- Aristotle signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavr: deprecate the entire library
Rostislav Pehlivanov (2017-12-26): > This has been on the ML for over a month. No one disagreed then. No one was > on vacation then. I missed that. If the proposal was similar enough to what was sent yesterday, then my objection does not stand, of course, sorry. Regards, -- Nicolas George signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavr: deprecate the entire library
On 12/26/2017 3:54 PM, Rostislav Pehlivanov wrote: > This has been on the ML for over a month. No one disagreed then. No one was > on vacation then. I agree with Nicholas, sending a new, different version of a patch, *on Christmas Day*, and pushing on Boxing Day if nobody has objections, is not OK. It's sketchy as hell. - Derek ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavr: deprecate the entire library
On 12/26/2017 4:10 PM, Nicolas George wrote: > I missed that. If the proposal was similar enough to what was sent > yesterday, then my objection does not stand, of course, sorry. The version on the ML then was different, and it never reached consensus at all on wording. I object for the reasons stated in my other mail. - Derek ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavr: deprecate the entire library
On 26 December 2017 at 16:35, Derek Buitenhuis wrote: > On 12/26/2017 4:10 PM, Nicolas George wrote: > > I missed that. If the proposal was similar enough to what was sent > > yesterday, then my objection does not stand, of course, sorry. > > The version on the ML then was different, and it never reached consensus at > all on wording. I object for the reasons stated in my other mail. > > - Derek > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > You didn't even bother to read the patch? Your objections have been addressed. Since your new objection is invalid, I still intent to push it. Either give a valid objection or I'm pushing tomorrow night. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 6/9] sbc: add raw muxer for SBC
On Mon, Dec 25, 2017 at 12:43:18PM +, Rostislav Pehlivanov wrote: > On 23 December 2017 at 18:01, Aurelien Jacobs wrote: > > > --- > > doc/general.texi | 2 +- > > libavformat/Makefile | 2 ++ > > libavformat/allformats.c | 4 ++-- > > libavformat/rawenc.c | 28 > > 4 files changed, 33 insertions(+), 3 deletions(-) > > > > diff --git a/doc/general.texi b/doc/general.texi > > index e5669b0e93..560465a4b8 100644 > > --- a/doc/general.texi > > +++ b/doc/general.texi > > @@ -466,7 +466,7 @@ library: > > @item raw NULL @tab X @tab > > @item raw video @tab X @tab X > > @item raw id RoQ@tab X @tab > > -@item raw SBC @tab @tab X > > +@item raw SBC @tab X @tab X > > @item raw Shorten @tab @tab X > > @item raw TAK @tab @tab X > > @item raw TrueHD@tab X @tab X > > diff --git a/libavformat/Makefile b/libavformat/Makefile > > index 6270c28a8a..689fc6b23f 100644 > > --- a/libavformat/Makefile > > +++ b/libavformat/Makefile > > @@ -448,7 +448,9 @@ OBJS-$(CONFIG_SAMI_DEMUXER) += samidec.o > > subtitles.o > > OBJS-$(CONFIG_SAP_DEMUXER) += sapdec.o > > OBJS-$(CONFIG_SAP_MUXER) += sapenc.o > > OBJS-$(CONFIG_SBC_DEMUXER) += sbcdec.o rawdec.o > > +OBJS-$(CONFIG_SBC_MUXER) += rawenc.o > > OBJS-$(CONFIG_MSBC_DEMUXER) += sbcdec.o rawdec.o > > +OBJS-$(CONFIG_MSBC_MUXER)+= rawenc.o > > OBJS-$(CONFIG_SBG_DEMUXER) += sbgdec.o > > OBJS-$(CONFIG_SCC_DEMUXER) += sccdec.o subtitles.o > > OBJS-$(CONFIG_SCC_MUXER) += sccenc.o subtitles.o > > diff --git a/libavformat/allformats.c b/libavformat/allformats.c > > index a6b72715bd..eb1d17d38c 100644 > > --- a/libavformat/allformats.c > > +++ b/libavformat/allformats.c > > @@ -211,7 +211,7 @@ static void register_all(void) > > REGISTER_MUXDEMUX(MPJPEG, mpjpeg); > > REGISTER_DEMUXER (MPL2, mpl2); > > REGISTER_DEMUXER (MPSUB,mpsub); > > -REGISTER_DEMUXER (MSBC, msbc); > > +REGISTER_MUXDEMUX(MSBC, msbc); > > REGISTER_DEMUXER (MSF, msf); > > REGISTER_DEMUXER (MSNWC_TCP,msnwc_tcp); > > REGISTER_DEMUXER (MTAF, mtaf); > > @@ -278,7 +278,7 @@ static void register_all(void) > > REGISTER_DEMUXER (S337M,s337m); > > REGISTER_DEMUXER (SAMI, sami); > > REGISTER_MUXDEMUX(SAP, sap); > > -REGISTER_DEMUXER (SBC, sbc); > > +REGISTER_MUXDEMUX(SBC, sbc); > > REGISTER_DEMUXER (SBG, sbg); > > REGISTER_MUXDEMUX(SCC, scc); > > REGISTER_DEMUXER (SDP, sdp); > > diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c > > index aa3ef76fbf..e27b280014 100644 > > --- a/libavformat/rawenc.c > > +++ b/libavformat/rawenc.c > > @@ -426,6 +426,34 @@ AVOutputFormat ff_rawvideo_muxer = { > > }; > > #endif > > > > +#if CONFIG_SBC_MUXER > > +AVOutputFormat ff_sbc_muxer = { > > +.name = "sbc", > > +.long_name = NULL_IF_CONFIG_SMALL("raw SBC"), > > +.mime_type = "audio/x-sbc", > > +.extensions= "sbc", > > +.audio_codec = AV_CODEC_ID_SBC, > > +.video_codec = AV_CODEC_ID_NONE, > > +.write_header = force_one_stream, > > +.write_packet = ff_raw_write_packet, > > +.flags = AVFMT_NOTIMESTAMPS, > > +}; > > +#endif > > + > > +#if CONFIG_MSBC_MUXER > > +AVOutputFormat ff_msbc_muxer = { > > +.name = "msbc", > > +.long_name = NULL_IF_CONFIG_SMALL("raw mSBC"), > > +.mime_type = "audio/x-msbc", > > +.extensions= "msbc", > > +.audio_codec = AV_CODEC_ID_MSBC, > > +.video_codec = AV_CODEC_ID_NONE, > > +.write_header = force_one_stream, > > +.write_packet = ff_raw_write_packet, > > +.flags = AVFMT_NOTIMESTAMPS, > > +}; > > +#endif > > + > > #if CONFIG_TRUEHD_MUXER > > AVOutputFormat ff_truehd_muxer = { > > .name = "truehd", > > > > ___ > > ffmpeg-devel mailing list > > ffmpeg-devel@ffmpeg.org > > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > > > What happened with the profiles idea? Are the 2 variants different enough > to need 2 CODEC_IDs? Repeating what I wrote in the other thread: SBC support various samplerates while mSBC is limited to 16 kHz. I think the only way to declare this properly and to get automatic conversion to 16 kHz when encoding to mSBC is to have 2 separate codec ID. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavr: deprecate the entire library
On 12/26/2017 1:52 PM, Rostislav Pehlivanov wrote: > On 26 December 2017 at 16:35, Derek Buitenhuis > wrote: > >> On 12/26/2017 4:10 PM, Nicolas George wrote: >>> I missed that. If the proposal was similar enough to what was sent >>> yesterday, then my objection does not stand, of course, sorry. >> >> The version on the ML then was different, and it never reached consensus at >> all on wording. I object for the reasons stated in my other mail. >> >> - Derek >> ___ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >> > > You didn't even bother to read the patch? Your objections have been > addressed. > Since your new objection is invalid, I still intent to push it. > > Either give a valid objection or I'm pushing tomorrow night. Don't give ultimatums, please. There is no hurry to push this patch. It's not fixing any problem nor being the solution to something that's blocked because of it. You can wait a bit before pushing. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavr: deprecate the entire library
On 12/26/2017 4:52 PM, Rostislav Pehlivanov wrote: > You didn't even bother to read the patch? Your objections have been > addressed. > Since your new objection is invalid, I still intent to push it. I said wording, which others had issues with, and were *not* addressed until v2 of the patch yesterday. On Christmas day. I do not object to the patch, but I massively object to the way it's being forced through over Christmas, with very little time, when many are with their e.g. families. > Either give a valid objection or I'm pushing tomorrow night. Threat-style "give me an objection NOW or I'll push!!" over the holidays. Delightful. Very professional. It would be nice if this community moved away from the "aggressive asshole" style of development, as seen here, but after so many years, that just seems impossible. Normal people get pushed away by aggressive assholes. A very warm and welcoming community we have here. Happy Holidays! - Derek ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavr: deprecate the entire library
Derek Buitenhuis (2017-12-26): > It would be nice if this community moved away from the "aggressive asshole" > style of development, as seen here, but after so many years, that just > seems impossible. Normal people get pushed away by aggressive assholes. I agree on the idea. Maybe start by not calling people "aggressive assholes"? ;-) Regards, -- Nicolas George signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavr: deprecate the entire library
On 12/26/2017 5:03 PM, Nicolas George wrote: > Derek Buitenhuis (2017-12-26): >> It would be nice if this community moved away from the "aggressive asshole" >> style of development, as seen here, but after so many years, that just >> seems impossible. Normal people get pushed away by aggressive assholes. > > I agree on the idea. Maybe start by not calling people "aggressive > assholes"? ;-) Very good point; I wrote that in frustration. I apologize. - Derek ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] mpeg4videodec: Fix unused variable warning
On 23/12/17 23:57, Michael Niedermayer wrote: > On Thu, Dec 21, 2017 at 07:54:56PM +, Mark Thompson wrote: >> video_format is not used. >> --- >> Introduced by 4b2a186ef02c1fbe7f7cae30a2bdfff72bcc75f7: >> >> src/libavcodec/mpeg4videodec.c: In function ‘mpeg4_decode_visual_object’: >> src/libavcodec/mpeg4videodec.c:1771:17: warning: unused variable >> ‘video_format’ [-Wunused-variable] >> int video_format = get_bits(gb, 3); >> ^~~~ >> >> libavcodec/mpeg4videodec.c | 7 --- >> 1 file changed, 4 insertions(+), 3 deletions(-) > > LGTM Applied. Thanks, - Mark ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavr: deprecate the entire library
On 26 December 2017 at 16:57, Derek Buitenhuis wrote: > On 12/26/2017 4:52 PM, Rostislav Pehlivanov wrote: > > You didn't even bother to read the patch? Your objections have been > > addressed. > > Since your new objection is invalid, I still intent to push it. > > I said wording, which others had issues with, and were *not* addressed > until > v2 of the patch yesterday. On Christmas day. I do not object to the patch, > but I massively object to the way it's being forced through over Christmas, > with very little time, when many are with their e.g. families. > > > Either give a valid objection or I'm pushing tomorrow night. > > Threat-style "give me an objection NOW or I'll push!!" over the holidays. > Delightful. Very professional. > > It would be nice if this community moved away from the "aggressive asshole" > style of development, as seen here, but after so many years, that just > seems impossible. Normal people get pushed away by aggressive assholes. > > A very warm and welcoming community we have here. > > Happy Holidays! > > - Derek > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > Fine, I'll wait ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/6] mpeg: add experimental support for PSMF audio.
I originally left this patch alone since it was another person's commit; I can squash the fixes for that into this commit if you prefer, though. On Tue, Dec 26, 2017 at 8:39 AM, Michael Niedermayer wrote: > On Mon, Dec 25, 2017 at 10:28:30AM +0800, mi...@brew.sh wrote: >> From: Maxim Poliakovski >> >> --- >> libavcodec/Makefile| 1 + >> libavcodec/allcodecs.c | 1 + >> libavcodec/atrac3plus_parser.c | 153 >> + >> libavformat/mpeg.c | 27 +++- >> 4 files changed, 181 insertions(+), 1 deletion(-) >> create mode 100644 libavcodec/atrac3plus_parser.c > > This fails to build without the next patch > > libavcodec/atrac3plus_parser.c: In function ‘parse_sound_frame_header’: > libavcodec/atrac3plus_parser.c:41:22: error: ‘ff_oma_srate_tab’ undeclared > (first use in this function) > c->sample_rate = ff_oma_srate_tab[(atrac_config >> 13) & 7] * 100; > ^ > libavcodec/atrac3plus_parser.c:41:22: note: each undeclared identifier is > reported only once for each function it appears in > libavcodec/atrac3plus_parser.c: In function ‘ff_atrac3p_parse’: > libavcodec/atrac3plus_parser.c:92:32: warning: format ‘%d’ expects argument > of type ‘int’, but argument 4 has type ‘size_t’ [-Wformat=] > bytes_remain, buf_size); > ^ > libavcodec/atrac3plus_parser.c:123:27: error: ‘ff_oma_chid_to_num_channels’ > undeclared (first use in this function) > avctx->channels = ff_oma_chid_to_num_channels[ctx->channel_id > - 1]; >^ > libavcodec/atrac3plus_parser.c:124:33: error: ‘ff_oma_chid_to_native_layout’ > undeclared (first use in this function) > avctx->channel_layout = ff_oma_chid_to_native_layout[ctx->channel_id > - 1]; > ^ > make: *** [libavcodec/atrac3plus_parser.o] Error 1 > make: *** Waiting for unfinished jobs > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > During times of universal deceit, telling the truth becomes a > revolutionary act. -- George Orwell > > ___ > 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] avformat/hls: fix compiling error
On Mon, Dec 25, 2017 at 3:46 PM wm4 wrote: > On Mon, 25 Dec 2017 17:21:23 + > Aman Gupta wrote: > > > On Sun, Dec 24, 2017 at 7:48 PM Steven Liu wrote: > > > > > fix --disable-network compipling error > > > > > > Signed-off-by: Steven Liu > > > --- > > > libavformat/hls.c | 4 +++- > > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > > > diff --git a/libavformat/hls.c b/libavformat/hls.c > > > index f00e22dfef..51d83b7557 100644 > > > --- a/libavformat/hls.c > > > +++ b/libavformat/hls.c > > > @@ -611,14 +611,16 @@ static void update_options(char **dest, const > char > > > *name, void *src) > > > static int open_url_keepalive(AVFormatContext *s, AVIOContext **pb, > > >const char *url) > > > { > > > -int ret; > > > +int ret = 0; > > > > > > Returning 0 does not make sense since that means no error. > > > > > > > URLContext *uc = ffio_geturlcontext(*pb); > > > av_assert0(uc); > > > > > > This will trigger an assertion failure and crash. > > > > > > > (*pb)->eof_reached = 0; > > > +#if CONFIG_HTTP_PROTOCOL > > > ret = ff_http_do_new_request(uc, url); > > > if (ret < 0) { > > > ff_format_io_close(s, pb); > > > } > > > +#endif > > > > > > > return ret; > > > } > > > > > > I think it would be better to #if the entire function body, and return > some > > error code in the case where the feature is not available, like > > AVERROR_PROTOCOL_NOT_FOUND > > Or a callback, to make this part of native AVIO or URLContext (or > whatever it's using). That would avoid all ifdeffery and build > fragility. I'm struggling to understand what you mean. Currently we have an AVIOContext which wraps an URLContext, which wraps an HTTPContext. What callback are you proposing, and where would it go? Aman > ___ > 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] avfilter: add deconvolve filter
mån 2017-12-25 klockan 21:38 +0100 skrev Paul B Mahol: > > > -if (!(s->fft_hdata[i] = av_calloc(s->fft_len[i] + 1, s->fft_len[i] * > sizeof(FFTComplex > +if (!(s->fft_hdata[i] = av_calloc(s->fft_len[i], s->fft_len[i] * > sizeof(FFTComplex > return AVERROR(ENOMEM); > Is there a particular reason these were +1? Maybe something to do with padding? > @@ -166,7 +171,7 @@ static int fft_horizontal(AVFilterContext *ctx, void > *arg, int jobnr, int nb_job > FFTComplex *hdata = td->hdata; > const int plane = td->plane; > const int n = td->n; > -int start = (n * jobnr ) / nb_jobs; > +int start = (n * jobnr) / nb_jobs; Don't mix cosmetic and functional changes Rest of the patch looks OK enough to me /Tomas signature.asc Description: This is a digitally signed message part ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libavformat/dashdec: Fix for ticket 6658 (Dash demuxer segfault)
tis 2017-12-26 klockan 01:12 + skrev Colin NG: > +static int resolve_content_path(AVFormatContext *s, const char *url, > xmlNodePtr *baseurl_nodes, int n_baseurl_nodes) { > + > +char *tmp_str = av_mallocz(MAX_URL_SIZE); > +char *path = av_mallocz(MAX_URL_SIZE); > +char *mpdName = NULL; > +xmlNodePtr node = NULL; > +char *baseurl = NULL; > +char *root_url = NULL; > +char *text = NULL; > + > +int isRootHttp = 0; > +char token ='/'; > +int start = 0; > +int rootId = 0; > +int updated = 0; > +int size = 0; > +int i; > + > +if (!tmp_str || !path) { > +updated = AVERROR(ENOMEM); > +goto end; > +} > + > +av_strlcpy(tmp_str, url, strlen(url) + 1); MAX_URL_SIZE maybe? Is there some way url can be too long? > +mpdName = strtok (tmp_str, "/"); > +while (mpdName = strtok (NULL, "/")) { > +size = strlen(mpdName); > +} strtok() isn't thread safe. I forget if we guarantee thread safeness at this stage in lavf > + > +av_strlcpy (path, url, strlen(url) - size + 1); Similarly here. Plus strlen(url) being computed again > +for (rootId = n_baseurl_nodes - 1; rootId > 0; rootId --) { > +if (!(node = baseurl_nodes[rootId])) { > +continue; > +} > +if (ishttp(xmlNodeGetContent(node))) { > +break; > +} > +} > + > +node = baseurl_nodes[rootId]; > +baseurl = xmlNodeGetContent(node); > +root_url = (av_strcasecmp(baseurl, "")) ? baseurl : path; > +if (node) { > +xmlNodeSetContent(node, root_url); > +} > + > +size = strlen(root_url); > +isRootHttp = ishttp(root_url); > + > +if (root_url[size - 1] == token) { > +av_strlcat(root_url, "/", size + 2); > +size += 2; > +} > + > +for (i = 0; i < n_baseurl_nodes; ++i) { > +if (i == rootId) { > +continue; > +} > +text = xmlNodeGetContent(baseurl_nodes[i]); > +if (text) { > +memset(tmp_str, 0, strlen(tmp_str)); > +if (!ishttp(text) && isRootHttp) { > +av_strlcpy(tmp_str, root_url, size + 1); > +} > +start = (text[0] == token); > +av_strlcat(tmp_str, text + start, MAX_URL_SIZE); > +xmlNodeSetContent(baseurl_nodes[i], tmp_str); > +updated = 1; > +xmlFree(text); > +} > +} > + > +end: > +av_free(path); > +av_free(tmp_str); > +return updated; > + > +} I don't really like lavf doing URL parsing/manipulation like this when there's (supposedly) mature libraries to do it. Especially after this year's Blackhat revelations of exploits making use of how whitespace, unicode, slashes, percent encoding etc are handled differently in every library [1]. But I'm also not familiar with DASH so can't say what would be the typical thing to do /Tomas [1] https://www.blackhat.com/docs/us-17/thursday/us-17-Tsai-A-New-Era-O f-SSRF-Exploiting-URL-Parser-In-Trending-Programming-Languages.pdf signature.asc Description: This is a digitally signed message part ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/3] Don't complain about codec2's 700 bit/s modes in ffmpeg.c
mån 2017-12-25 klockan 20:07 +0100 skrev Michael Niedermayer: > On Sat, Dec 23, 2017 at 11:15:56PM +0100, Tomas Härdin wrote: > > > > ffmpeg.c |3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > 68440596af0b5c26d6123f5ee964414ce9e2f48f 0003-Don-t-complain- > > about-codec2-s-700-bit-s-modes-in-ffm.patch > > From 8bd1d9981484c9b4964f3fdfd542951a02f5a01d Mon Sep 17 00:00:00 > > 2001 > > From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= > > Date: Thu, 3 Aug 2017 17:33:04 +0200 > > Subject: [PATCH 3/3] Don't complain about codec2's 700 bit/s modes > > in ffmpeg.c > > In absence of a cleaner solution, LGTM There was a brief discussion last time I think, but a more general solution is just more complexity until someone provides another example of a codec that's intended to work at below 1 kbps to justify said complexity :) /Tomas signature.asc Description: This is a digitally signed message part ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [FFmpeg-cvslog] avcodec/libx264: fix compilation with x264 builds >= 153
On Tue, Dec 26, 2017 at 02:58:19PM +, James Almer wrote: > ffmpeg | branch: master | James Almer | Mon Dec 25 > 19:41:09 2017 -0300| [2a111c99a60fdf4fe5eea2b073901630190c6c93] | committer: > James Almer > > avcodec/libx264: fix compilation with x264 builds >= 153 > > x264 now supports multibitdepth builds, with a slightly changed API to > request bitdepth during initialization. > > Reviewed-by: Ricardo Constantino > Signed-off-by: James Almer > > > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2a111c99a60fdf4fe5eea2b073901630190c6c93 > --- > > libavcodec/libx264.c | 29 ++--- > 1 file changed, 26 insertions(+), 3 deletions(-) This breaks: LD_PRELOAD=/usr/local/x264-10/lib/libx264.so.146 ./ffmpeg -i ~/videos/mm-short.mpg -avcintra-class 100 -tune psnr -flags +ildct-global_header -t 0.5 -pix_fmt yuv422p10 -vf scale=1920:1080 -an x.mov previously it encoded with high bit depth after the patch it attempts to use 8bit and fails: [libx264 @ 0x3c36a80] This build of x264 requires high depth input. Rebuild to support 8-bit input. IIUC this patch changes from the value at runtime to the value at build time. That seems like a bad idea as they can differ and the value of the library linked to is the one mattering [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you fake or manipulate statistics in a paper in physics you will never get a job again. If you fake or manipulate statistics in a paper in medicin you will get a job for life at the pharma industry. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2 1/2] avformat/hlsenc, utils: Moved is_http_proto from hlsenc to utils for re-use
On Sat, Dec 16, 2017 at 11:03 AM Karthick J wrote: > From: Karthick Jeyapal > > --- > libavformat/hlsenc.c | 12 +++- > libavformat/internal.h | 8 > libavformat/utils.c| 5 + > 3 files changed, 16 insertions(+), 9 deletions(-) > > diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c > index e3442c3..03d54c7 100644 > --- a/libavformat/hlsenc.c > +++ b/libavformat/hlsenc.c > @@ -240,15 +240,10 @@ static int mkdir_p(const char *path) { > return ret; > } > > -static int is_http_proto(char *filename) { > -const char *proto = avio_find_protocol_name(filename); > -return proto ? (!av_strcasecmp(proto, "http") || > !av_strcasecmp(proto, "https")) : 0; > -} > - > static int hlsenc_io_open(AVFormatContext *s, AVIOContext **pb, char > *filename, >AVDictionary **options) { > HLSContext *hls = s->priv_data; > -int http_base_proto = filename ? is_http_proto(filename) : 0; > +int http_base_proto = filename ? ff_is_http_proto(filename) : 0; > int err = AVERROR_MUXER_NOT_FOUND; > if (!*pb || !http_base_proto || !hls->http_persistent) { > err = s->io_open(s, pb, filename, AVIO_FLAG_WRITE, options); > @@ -264,8 +259,7 @@ static int hlsenc_io_open(AVFormatContext *s, > AVIOContext **pb, char *filename, > > static void hlsenc_io_close(AVFormatContext *s, AVIOContext **pb, char > *filename) { > HLSContext *hls = s->priv_data; > -int http_base_proto = filename ? is_http_proto(filename) : 0; > - > +int http_base_proto = filename ? ff_is_http_proto(filename) : 0; > if (!http_base_proto || !hls->http_persistent || hls->key_info_file > || hls->encrypt) { > ff_format_io_close(s, pb); > } else { > @@ -275,7 +269,7 @@ static void hlsenc_io_close(AVFormatContext *s, > AVIOContext **pb, char *filename > > static void set_http_options(AVFormatContext *s, AVDictionary **options, > HLSContext *c) > { > -int http_base_proto = is_http_proto(s->filename); > +int http_base_proto = ff_is_http_proto(s->filename); > > if (c->method) { > av_dict_set(options, "method", c->method, 0); > diff --git a/libavformat/internal.h b/libavformat/internal.h > index 36a5721..8f168c9 100644 > --- a/libavformat/internal.h > +++ b/libavformat/internal.h > @@ -619,6 +619,14 @@ int ff_format_output_open(AVFormatContext *s, const > char *url, AVDictionary **op > void ff_format_io_close(AVFormatContext *s, AVIOContext **pb); > > /** > + * Utility function to check if the file uses http or https protocol > + * > + * @param s AVFormatContext > + * @param filename URL or file name to open for writing > + */ > +int ff_is_http_proto(char *filename); +1 from me. This would be useful for some of the changes I'm making to the hls demuxer as well. Any objections? Aman > + > +/** > * Parse creation_time in AVFormatContext metadata if exists and warn if > the > * parsing fails. > * > diff --git a/libavformat/utils.c b/libavformat/utils.c > index 84e4920..f18a7c8 100644 > --- a/libavformat/utils.c > +++ b/libavformat/utils.c > @@ -5459,6 +5459,11 @@ void ff_format_io_close(AVFormatContext *s, > AVIOContext **pb) > *pb = NULL; > } > > +int ff_is_http_proto(char *filename) { > +const char *proto = avio_find_protocol_name(filename); > +return proto ? (!av_strcasecmp(proto, "http") || > !av_strcasecmp(proto, "https")) : 0; > +} > + > int ff_parse_creation_time_metadata(AVFormatContext *s, int64_t > *timestamp, int return_seconds) > { > AVDictionaryEntry *entry; > -- > 1.9.1 > > ___ > 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 1/3] avcodec/flacdec: avoid undefined shift
Fixes: shift exponent 32 is too large for 32-bit type 'unsigned int' Fixes: 4688/clusterfuzz-testcase-minimized-6572210748653568 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/flacdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c index 6c8ba15777..64bea76f98 100644 --- a/libavcodec/flacdec.c +++ b/libavcodec/flacdec.c @@ -460,7 +460,7 @@ static inline int decode_subframe(FLACContext *s, int channel) return AVERROR_INVALIDDATA; } -if (wasted) { +if (wasted && wasted < 32) { int i; for (i = 0; i < s->blocksize; i++) decoded[i] = (unsigned)decoded[i] << wasted; -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/3] avcodec/hevcdsp_template: Fix Invalid shifts in put_hevc_qpel_bi_w_h() and put_hevc_qpel_bi_w_w()
Fixes: left shift of negative value -1 Fixes: 4690/clusterfuzz-testcase-minimized-6117482428366848 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/hevcdsp_template.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/hevcdsp_template.c b/libavcodec/hevcdsp_template.c index 903aa3fe95..56cd9e605d 100644 --- a/libavcodec/hevcdsp_template.c +++ b/libavcodec/hevcdsp_template.c @@ -915,7 +915,7 @@ static void FUNC(put_hevc_qpel_bi_w_h)(uint8_t *_dst, ptrdiff_t _dststride, uint for (y = 0; y < height; y++) { for (x = 0; x < width; x++) dst[x] = av_clip_pixel(((QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) * wx1 + src2[x] * wx0 + -((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1)); +((ox0 + ox1 + 1) * (1 << log2Wd))) >> (log2Wd + 1)); src += srcstride; dst += dststride; src2 += MAX_PB_SIZE; @@ -970,7 +970,7 @@ static void FUNC(put_hevc_qpel_bi_w_v)(uint8_t *_dst, ptrdiff_t _dststride, uint for (y = 0; y < height; y++) { for (x = 0; x < width; x++) dst[x] = av_clip_pixel(((QPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8)) * wx1 + src2[x] * wx0 + -((ox0 + ox1 + 1) << log2Wd)) >> (log2Wd + 1)); +((ox0 + ox1 + 1) * (1 << log2Wd))) >> (log2Wd + 1)); src += srcstride; dst += dststride; src2 += MAX_PB_SIZE; -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/3] avcodec/flacdec: Fix overflow in multiplication in decode_subframe_fixed()
Fixes: signed integer overflow: 2 * 1629495328 cannot be represented in type 'int' Fixes: 4716/clusterfuzz-testcase-minimized-5835915940331520 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/flacdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c index 64bea76f98..c8eb456049 100644 --- a/libavcodec/flacdec.c +++ b/libavcodec/flacdec.c @@ -302,7 +302,7 @@ static int decode_subframe_fixed(FLACContext *s, int32_t *decoded, if (pred_order > 2) c = b - decoded[pred_order-2] + decoded[pred_order-3]; if (pred_order > 3) -d = c - decoded[pred_order-2] + 2*decoded[pred_order-3] - decoded[pred_order-4]; +d = c - decoded[pred_order-2] + 2U*decoded[pred_order-3] - decoded[pred_order-4]; switch (pred_order) { case 0: -- 2.15.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [FFmpeg-cvslog] avcodec/libx264: fix compilation with x264 builds >= 153
On 12/26/2017 7:22 PM, Michael Niedermayer wrote: > On Tue, Dec 26, 2017 at 02:58:19PM +, James Almer wrote: >> ffmpeg | branch: master | James Almer | Mon Dec 25 >> 19:41:09 2017 -0300| [2a111c99a60fdf4fe5eea2b073901630190c6c93] | committer: >> James Almer >> >> avcodec/libx264: fix compilation with x264 builds >= 153 >> >> x264 now supports multibitdepth builds, with a slightly changed API to >> request bitdepth during initialization. >> >> Reviewed-by: Ricardo Constantino >> Signed-off-by: James Almer >> >>> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2a111c99a60fdf4fe5eea2b073901630190c6c93 >> --- >> >> libavcodec/libx264.c | 29 ++--- >> 1 file changed, 26 insertions(+), 3 deletions(-) > > This breaks: > LD_PRELOAD=/usr/local/x264-10/lib/libx264.so.146 ./ffmpeg -i > ~/videos/mm-short.mpg -avcintra-class 100 -tune psnr -flags > +ildct-global_header -t 0.5 -pix_fmt yuv422p10 -vf scale=1920:1080 -an x.mov > > previously it encoded with high bit depth after the patch it attempts to use > 8bit > and fails: > [libx264 @ 0x3c36a80] This build of x264 requires high depth input. Rebuild > to support 8-bit input. > > IIUC this patch changes from the value at runtime to the value at > build time. That seems like a bad idea as they can differ and the value > of the library linked to is the one mattering Changed back to runtime. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] Adding mkdir option for img2enc (2nd attempt)
Hi All, Please would someone with an interest in img2enc take a look at my revised patches for a minor feature addition and consider committing it to the main line for me. Example: ffmpeg -i ~/trailer.mp4 -strftime 1 -mkdir 1 %Y/%m/%d/out_%H-%M-%S.jpg Without the new mkdir option, this command will fail if the directory hierarchy for the jpg files does not already exist, which can be difficult to predict for time-stamped directories. This patch adds a mkdir option to img2enc which invites it to make whatever directory hierarchy is necessary for each output file. When used in conjunction with the strftime then the jpg files will be located in a newly created (time-stamped) directory as processing progresses. My typical usage scenario is capturing a long-running live video feed (perhaps time-lapsed) and storing the resulting images in a time-stamped directory hierarchy fashion, rather than as a numbered sequence of files in a single directory. If you look at the code you will see that only a half dozen lines of code were required in img2enc. The function for creating directories already existed in hlsenc.c but I've moved into utils.c as I presumed that was a more generic location for it. All comments appreciated. Thanks ad Regards, Alan. On 17/12/17 22:46, Carl Eugen Hoyos wrote: 2017-12-17 23:41 GMT+01:00 Dr Alan Barclay : Please would someone with an interest in img2enc take a look at my minor feature addition and consider committing it to the main line for me. To be acceptable, the patch has to be split in two and please move the definition into internal.h Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel --- libavformat/hlsenc.c | 35 +-- libavformat/internal.h | 7 +++ libavformat/utils.c| 33 + 3 files changed, 41 insertions(+), 34 deletions(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index bbc2742dc7..633ddc309e 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -208,39 +208,6 @@ typedef struct HLSContext { AVIOContext *sub_m3u8_out; } HLSContext; -static int mkdir_p(const char *path) { -int ret = 0; -char *temp = av_strdup(path); -char *pos = temp; -char tmp_ch = '\0'; - -if (!path || !temp) { -return -1; -} - -if (!strncmp(temp, "/", 1) || !strncmp(temp, "\\", 1)) { -pos++; -} else if (!strncmp(temp, "./", 2) || !strncmp(temp, ".\\", 2)) { -pos += 2; -} - -for ( ; *pos != '\0'; ++pos) { -if (*pos == '/' || *pos == '\\') { -tmp_ch = *pos; -*pos = '\0'; -ret = mkdir(temp, 0755); -*pos = tmp_ch; -} -} - -if ((*(pos - 1) != '/') || (*(pos - 1) != '\\')) { -ret = mkdir(temp, 0755); -} - -av_free(temp); -return ret; -} - static int is_http_proto(char *filename) { const char *proto = avio_find_protocol_name(filename); return proto ? (!av_strcasecmp(proto, "http") || !av_strcasecmp(proto, "https")) : 0; @@ -1407,7 +1374,7 @@ static int hls_start(AVFormatContext *s, VariantStream *vs) return AVERROR(ENOMEM); } dir = av_dirname(fn_copy); -if (mkdir_p(dir) == -1 && errno != EEXIST) { +if (ff_mkdir_p(dir) == -1 && errno != EEXIST) { av_log(oc, AV_LOG_ERROR, "Could not create directory %s with use_localtime_mkdir\n", dir); av_free(fn_copy); return AVERROR(errno); diff --git a/libavformat/internal.h b/libavformat/internal.h index e76ac12371..f471019a45 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -551,6 +551,13 @@ static inline int ff_rename(const char *oldpath, const char *newpath, void *logc } /** + * Make the specified directory. + * + * @param path path for directory + */ +int ff_mkdir_p(const char *path); + +/** * Allocate extradata with additional AV_INPUT_BUFFER_PADDING_SIZE at end * which is always set to 0. * diff --git a/libavformat/utils.c b/libavformat/utils.c index 84e49208b8..aac58010b2 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -5606,3 +5606,36 @@ FF_ENABLE_DEPRECATION_WARNINGS return st->internal->avctx->time_base; #endif } + +int ff_mkdir_p(const char *path) { +int ret = 0; +char *temp = av_strdup(path); +char *pos = temp; +char tmp_ch = '\0'; + +if (!path || !temp) { +return -1; +} + +if (!strncmp(temp, "/", 1) || !strncmp(temp, "\\", 1)) { +pos++; +} else if (!strncmp(temp, "./", 2) || !strncmp(temp, ".\\", 2)) { +pos += 2; +} + +for ( ; *pos != '\0'; ++pos) { +if (*pos == '/' || *pos == '\\') { +tmp_ch = *pos; +*pos = '\0'; +ret = mkdir(temp, 0755); +*po
Re: [FFmpeg-devel] [PATCH] avfilter: add deconvolve filter
On Mon, Dec 25, 2017 at 21:38:41 +0100, Paul B Mahol wrote: > Signed-off-by: Paul B Mahol > --- > doc/filters.texi | 22 +++ > libavfilter/Makefile | 1 + > libavfilter/allfilters.c | 1 + > libavfilter/vf_convolve.c | 99 > ++- > 4 files changed, 113 insertions(+), 10 deletions(-) [...] > OBJS-$(CONFIG_DECIMATE_FILTER) += vf_decimate.o > +OBJS-$(CONFIG_DECONVOLVE_FILTER) += vf_convolve.o framesync.o > OBJS-$(CONFIG_DEFLATE_FILTER)+= vf_neighbor.o [...] > +AVFilter ff_vf_deconvolve = { > +.name = "deconvolve", Style question: Do separate filters within one source file not need to be #ifdef'd with #if CONFIG_CONVOLVE_FILTER, #if CONFIG_DECONVOLVE_FILTER ? Cheers, Moritz ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/6] mpeg: add experimental support for PSMF audio.
On Tue, Dec 26, 2017 at 10:24:07AM +0800, Misty De Meo wrote: > On Tue, Dec 26, 2017 at 8:42 AM, Michael Niedermayer > wrote: > > returning errors from the parse function will cause assertion failure at: > > > > Assertion index > -0x2000 failed at libavcodec/parser.c:185 > > > > [...] > > What would be the preferred way to handle that? parsers should not loose data, so when they are unable to determine frame boarders they should return the data with no byte removed or added and frame boarders placed on a best effort basis. [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I know you won't believe me, but the highest form of Human Excellence is to question oneself and others. -- Socrates signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/6] mpeg: add experimental support for PSMF audio.
On Tue, Dec 26, 2017 at 10:20:23AM +0800, Misty De Meo wrote: > I originally left this patch alone since it was another person's > commit; I can squash the fixes for that into this commit if you > prefer, though. no commit in a patchset should knowingly introduce a bug. That would make git bisect more difficult thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB No snowflake in an avalanche ever feels responsible. -- Voltaire signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [FFmpeg-cvslog] avcodec/libx264: fix compilation with x264 builds >= 153
On Tue, Dec 26, 2017 at 07:43:27PM -0300, James Almer wrote: > On 12/26/2017 7:22 PM, Michael Niedermayer wrote: > > On Tue, Dec 26, 2017 at 02:58:19PM +, James Almer wrote: > >> ffmpeg | branch: master | James Almer | Mon Dec 25 > >> 19:41:09 2017 -0300| [2a111c99a60fdf4fe5eea2b073901630190c6c93] | > >> committer: James Almer > >> > >> avcodec/libx264: fix compilation with x264 builds >= 153 > >> > >> x264 now supports multibitdepth builds, with a slightly changed API to > >> request bitdepth during initialization. > >> > >> Reviewed-by: Ricardo Constantino > >> Signed-off-by: James Almer > >> > >>> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2a111c99a60fdf4fe5eea2b073901630190c6c93 > >> --- > >> > >> libavcodec/libx264.c | 29 ++--- > >> 1 file changed, 26 insertions(+), 3 deletions(-) > > > > This breaks: > > LD_PRELOAD=/usr/local/x264-10/lib/libx264.so.146 ./ffmpeg -i > > ~/videos/mm-short.mpg -avcintra-class 100 -tune psnr -flags > > +ildct-global_header -t 0.5 -pix_fmt yuv422p10 -vf scale=1920:1080 -an > > x.mov > > > > previously it encoded with high bit depth after the patch it attempts to > > use 8bit > > and fails: > > [libx264 @ 0x3c36a80] This build of x264 requires high depth input. Rebuild > > to support 8-bit input. > > > > IIUC this patch changes from the value at runtime to the value at > > build time. That seems like a bad idea as they can differ and the value > > of the library linked to is the one mattering > > Changed back to runtime. thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Democracy is the form of government in which you can choose your dictator signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [RFC][PATCH] simple_idct: Template functions to support an input bitdepth parameter
For MPEG-4 Simple Studio Profile, I need to be able to support int32_t input coeffcients to the IDCT functions. I have attempted to implement this with the attached patch. Any comments would be appreciated, I'm pretty sure it is not optimal as-is. Regards, Kieran Kunhya 0001-simple_idct-Template-functions-to-support-an-input-b.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Adding mkdir option for img2enc (2nd attempt)
On Tue, Dec 26, 2017 at 10:44:31PM +, Dr Alan Barclay wrote: > Hi All, > > Please would someone with an interest in img2enc take a look at my revised > patches for a minor feature addition and consider committing it to the main > line for me. > > Example: > ffmpeg -i ~/trailer.mp4 -strftime 1 -mkdir 1 %Y/%m/%d/out_%H-%M-%S.jpg > > Without the new mkdir option, this command will fail if the directory > hierarchy for the jpg files does not already exist, which can be difficult > to predict for time-stamped directories. > > This patch adds a mkdir option to img2enc which invites it to make whatever > directory hierarchy is necessary for each output file. When used in > conjunction with the strftime then the jpg files will be located in a newly > created (time-stamped) directory as processing progresses. > > My typical usage scenario is capturing a long-running live video feed > (perhaps time-lapsed) and storing the resulting images in a time-stamped > directory hierarchy fashion, rather than as a numbered sequence of files in > a single directory. > > If you look at the code you will see that only a half dozen lines of code > were required in img2enc. The function for creating directories already > existed in hlsenc.c but I've moved into utils.c as I presumed that was a > more generic location for it. > > All comments appreciated. > > Thanks ad Regards, > Alan. > > > On 17/12/17 22:46, Carl Eugen Hoyos wrote: > >2017-12-17 23:41 GMT+01:00 Dr Alan Barclay : > > > >>Please would someone with an interest in img2enc take a look > >>at my minor feature addition and consider committing it to the > >>main line for me. > >To be acceptable, the patch has to be split in two and please > >move the definition into internal.h > > > >Carl Eugen > >___ > >ffmpeg-devel mailing list > >ffmpeg-devel@ffmpeg.org > >http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > hlsenc.c | 35 +-- > internal.h |7 +++ > utils.c| 33 + > 3 files changed, 41 insertions(+), 34 deletions(-) > 9560fd03958f79f77b01c0e02c55d98e3dc7b937 > 0001-Move-mkdir_p-renamed-ff_mkdir_p-from-hlsenc.c-to-uti.patch > --- > libavformat/hlsenc.c | 35 +-- > libavformat/internal.h | 7 +++ > libavformat/utils.c| 33 + > 3 files changed, 41 insertions(+), 34 deletions(-) these patches are missing commit messages patches should be genrated with git format-patch or git send-email [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Elect your leaders based on what they did after the last election, not based on what they say before an election. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2] frame: add an av_frame_new_side_data_from_buf function
On Tue, Oct 17, 2017 at 11:57:28PM +0100, Rostislav Pehlivanov wrote: > Signed-off-by: Rostislav Pehlivanov > --- > libavutil/frame.c | 38 -- > libavutil/frame.h | 13 + > 2 files changed, 33 insertions(+), 18 deletions(-) this seems not to build (anymore) as is, or i did something silly libavutil/frame.c: In function ‘av_frame_new_side_data_from_buf’: libavutil/frame.c:661:9: error: label ‘fail’ used but not defined goto fail; ^ [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Take away the freedom of one citizen and you will be jailed, take away the freedom of all citizens and you will be congratulated by your peers in Parliament. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2 2/3] avformat/hlsenc: configurable variant stream index position in filenames
On 12/26/17 4:29 PM, 刘歧 wrote: On 26 Dec 2017, at 18:38, Vishwanath Dixit wrote: On 12/26/17 3:37 PM, 刘歧 wrote: On 26 Dec 2017, at 17:53, vdi...@akamai.com wrote: From: Vishwanath Dixit --- doc/muxers.texi | 31 +-- libavformat/hlsenc.c | 153 ++- 2 files changed, 127 insertions(+), 57 deletions(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index 93db549..6af970d 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -575,6 +575,17 @@ Should a relative path be specified, the path of the created segment files will be relative to the current working directory. When use_localtime_mkdir is set, the whole expanded value of @var{filename} will be written into the m3u8 segment list. +When @code{var_stream_map} is set with two or more variant streams, the +@var{filename} pattern must contain the string "%v", this string specifies +the position of variant stream index in the generated segment file names. +@example +ffmpeg -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \ + -map 0:v -map 0:a -map 0:v -map 0:a -f hls -var_stream_map "v:0,a:0 v:1,a:1" \ + -hls_segment_filename 'file_%v_%03d.ts' out_%v.m3u8 +@end example +This example will produce the playlists segment file sets: +@file{file_0_000.ts}, @file{file_0_001.ts}, @file{file_0_002.ts}, etc. and +@file{file_1_000.ts}, @file{file_1_001.ts}, @file{file_1_002.ts}, etc. @item use_localtime Use strftime() on @var{filename} to expand the segment filename with localtime. @@ -701,6 +712,10 @@ the fmp4 files is used in hls after version 7. @item hls_fmp4_init_filename @var{filename} set filename to the fragment files header file, default filename is @file{init.mp4}. +When @code{var_stream_map} is set with two or more variant streams, the +@var{filename} pattern must contain the string "%v", this string specifies +the position of variant stream index in the generated init file names. + @item hls_flags @var{flags} Possible values: @@ -814,32 +829,36 @@ Expected string format is like this "a:0,v:0 a:1,v:1 ". Here a:, v:, s: are the keys to specify audio, video and subtitle streams respectively. Allowed values are 0 to 9 (limited just based on practical usage). +When there are two or more variant streams, the output filename pattern must +contain the string "%v", this string specifies the position of variant stream +index in the output media playlist filenames. + @example ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \ -map 0:v -map 0:a -map 0:v -map 0:a -f hls -var_stream_map "v:0,a:0 v:1,a:1" \ - http://example.com/live/out.m3u8 + http://example.com/live/out_%v.m3u8 @end example This example creates two hls variant streams. The first variant stream will contain video stream of bitrate 1000k and audio stream of bitrate 64k and the second variant stream will contain video stream of bitrate 256k and audio -stream of bitrate 32k. Here, two media playlist with file names out_1.m3u8 and -out_2.m3u8 will be created. +stream of bitrate 32k. Here, two media playlist with file names out_0.m3u8 and +out_1.m3u8 will be created. @example ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k \ -map 0:v -map 0:a -map 0:v -f hls -var_stream_map "v:0 a:0 v:1" \ - http://example.com/live/out.m3u8 + http://example.com/live/out_%v.m3u8 @end example This example creates three hls variant streams. The first variant stream will be a video only stream with video bitrate 1000k, the second variant stream will be an audio only stream with bitrate 64k and the third variant stream will be a video only stream with bitrate 256k. Here, three media playlist with file names -out_1.m3u8, out_2.m3u8 and out_3.m3u8 will be created. +out_0.m3u8, out_1.m3u8 and out_2.m3u8 will be created. @example ffmpeg -re -i in.ts -b:a:0 32k -b:a:1 64k -b:v:0 1000k -b:v:1 3000k \ -map 0:a -map 0:a -map 0:v -map 0:v -f hls \ -var_stream_map "a:0,agroup:aud_low a:1,agroup:aud_high v:0,agroup:aud_low v:1,agroup:aud_high" \ -master_pl_name master.m3u8 \ - http://example.com/live/out.m3u8 + http://example.com/live/out_%v.m3u8 @end example This example creates two audio only and two video only variant streams. In addition to the #EXT-X-STREAM-INF tag for each variant stream in the master diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index bd43336..76a4110 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -1536,7 +1536,7 @@ static const char * get_default_pattern_localtime_fmt(AVFormatContext *s) return (HAVE_LIBC_MSVCRT || !strftime(b, sizeof(b), "%s", p) || !strcmp(b, "%s")) ? "-%Y%m%d%H%M%S.ts" : "-%s.ts"; } -static int format_name(char *name, int name_buf_len, int i) +static int append_postfix(char *name, int name_buf_len, int i) { char *p; char extension[10] = {'\0'}; @@ -1555,6 +1555,53 @@ static int format_name(char *name, int name_buf_len, int i) return 0; } +static int validate_name(int nb_vs, const char *fn) +{ +const ch
Re: [FFmpeg-devel] [PATCH v2 2/3] avformat/hlsenc: configurable variant stream index position in filenames
> On 27 Dec 2017, at 11:43, Vishwanath Dixit wrote: > > > > On 12/26/17 4:29 PM, 刘歧 wrote: >> >>> On 26 Dec 2017, at 18:38, Vishwanath Dixit wrote: >>> >>> >>> >>> On 12/26/17 3:37 PM, 刘歧 wrote: > On 26 Dec 2017, at 17:53, vdi...@akamai.com wrote: > > From: Vishwanath Dixit > > --- > doc/muxers.texi | 31 +-- > libavformat/hlsenc.c | 153 > ++- > 2 files changed, 127 insertions(+), 57 deletions(-) > > diff --git a/doc/muxers.texi b/doc/muxers.texi > index 93db549..6af970d 100644 > --- a/doc/muxers.texi > +++ b/doc/muxers.texi > @@ -575,6 +575,17 @@ Should a relative path be specified, the path of the > created segment > files will be relative to the current working directory. > When use_localtime_mkdir is set, the whole expanded value of > @var{filename} will be written into the m3u8 segment list. > > +When @code{var_stream_map} is set with two or more variant streams, the > +@var{filename} pattern must contain the string "%v", this string > specifies > +the position of variant stream index in the generated segment file names. > +@example > +ffmpeg -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \ > + -map 0:v -map 0:a -map 0:v -map 0:a -f hls -var_stream_map "v:0,a:0 > v:1,a:1" \ > + -hls_segment_filename 'file_%v_%03d.ts' out_%v.m3u8 > +@end example > +This example will produce the playlists segment file sets: > +@file{file_0_000.ts}, @file{file_0_001.ts}, @file{file_0_002.ts}, etc. > and > +@file{file_1_000.ts}, @file{file_1_001.ts}, @file{file_1_002.ts}, etc. > > @item use_localtime > Use strftime() on @var{filename} to expand the segment filename with > localtime. > @@ -701,6 +712,10 @@ the fmp4 files is used in hls after version 7. > @item hls_fmp4_init_filename @var{filename} > set filename to the fragment files header file, default filename is > @file{init.mp4}. > > +When @code{var_stream_map} is set with two or more variant streams, the > +@var{filename} pattern must contain the string "%v", this string > specifies > +the position of variant stream index in the generated init file names. > + > @item hls_flags @var{flags} > Possible values: > > @@ -814,32 +829,36 @@ Expected string format is like this "a:0,v:0 > a:1,v:1 ". Here a:, v:, s: are > the keys to specify audio, video and subtitle streams respectively. > Allowed values are 0 to 9 (limited just based on practical usage). > > +When there are two or more variant streams, the output filename pattern > must > +contain the string "%v", this string specifies the position of variant > stream > +index in the output media playlist filenames. > + > @example > ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k -b:a:1 32k \ > -map 0:v -map 0:a -map 0:v -map 0:a -f hls -var_stream_map "v:0,a:0 > v:1,a:1" \ > - http://example.com/live/out.m3u8 > + http://example.com/live/out_%v.m3u8 > @end example > This example creates two hls variant streams. The first variant stream > will > contain video stream of bitrate 1000k and audio stream of bitrate 64k and > the > second variant stream will contain video stream of bitrate 256k and audio > -stream of bitrate 32k. Here, two media playlist with file names > out_1.m3u8 and > -out_2.m3u8 will be created. > +stream of bitrate 32k. Here, two media playlist with file names > out_0.m3u8 and > +out_1.m3u8 will be created. > @example > ffmpeg -re -i in.ts -b:v:0 1000k -b:v:1 256k -b:a:0 64k \ > -map 0:v -map 0:a -map 0:v -f hls -var_stream_map "v:0 a:0 v:1" \ > - http://example.com/live/out.m3u8 > + http://example.com/live/out_%v.m3u8 > @end example > This example creates three hls variant streams. The first variant stream > will > be a video only stream with video bitrate 1000k, the second variant > stream will > be an audio only stream with bitrate 64k and the third variant stream > will be a > video only stream with bitrate 256k. Here, three media playlist with file > names > -out_1.m3u8, out_2.m3u8 and out_3.m3u8 will be created. > +out_0.m3u8, out_1.m3u8 and out_2.m3u8 will be created. > @example > ffmpeg -re -i in.ts -b:a:0 32k -b:a:1 64k -b:v:0 1000k -b:v:1 3000k \ > -map 0:a -map 0:a -map 0:v -map 0:v -f hls \ > -var_stream_map "a:0,agroup:aud_low a:1,agroup:aud_high > v:0,agroup:aud_low v:1,agroup:aud_high" \ > -master_pl_name master.m3u8 \ > - http://example.com/live/out.m3u8 > + http://example.com/live/out_%v.m3u8 > @end example > This example creates two audio only and two video only variant streams. In > addition to the #EXT-X-STREAM-INF tag for each va
Re: [FFmpeg-devel] [PATCH] avformat/avio: check input URLContext value NULL
2017-11-20 15:58 GMT+08:00 Steven Liu : > fix ticket id: #6846 > > Signed-off-by: Steven Liu > --- > libavformat/avio.c | 10 ++ > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/libavformat/avio.c b/libavformat/avio.c > index 4dc468350c..63e82872f7 100644 > --- a/libavformat/avio.c > +++ b/libavformat/avio.c > @@ -625,13 +625,15 @@ int64_t ffurl_size(URLContext *h) > > int ffurl_get_file_handle(URLContext *h) > { > -if (!h->prot->url_get_file_handle) > +if (!h || !h->prot || !h->prot->url_get_file_handle) > return -1; > return h->prot->url_get_file_handle(h); > } > > int ffurl_get_multi_file_handle(URLContext *h, int **handles, int > *numhandles) > { > +if (!h || !h->prot) > +return AVERROR(ENOSYS); > if (!h->prot->url_get_multi_file_handle) { > if (!h->prot->url_get_file_handle) > return AVERROR(ENOSYS); > @@ -647,15 +649,15 @@ int ffurl_get_multi_file_handle(URLContext *h, int > **handles, int *numhandles) > > int ffurl_get_short_seek(URLContext *h) > { > -if (!h->prot->url_get_short_seek) > +if (!h || !h->prot || !h->prot->url_get_short_seek) > return AVERROR(ENOSYS); > return h->prot->url_get_short_seek(h); > } > > int ffurl_shutdown(URLContext *h, int flags) > { > -if (!h->prot->url_shutdown) > -return AVERROR(EINVAL); > +if (!h || !h->prot || !h->prot->url_shutdown) > +return AVERROR(ENOSYS); > return h->prot->url_shutdown(h, flags); > } > > -- > 2.13.6 (Apple Git-96) > > > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ping ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/avio: check input URLContext value NULL
On 12/27/17, 11:55 AM, "Steven Liu" wrote: >2017-11-20 15:58 GMT+08:00 Steven Liu : >> fix ticket id: #6846 >> >> Signed-off-by: Steven Liu >> --- >> libavformat/avio.c | 10 ++ >> 1 file changed, 6 insertions(+), 4 deletions(-) >> >>[…] >> int ffurl_shutdown(URLContext *h, int flags) >> { >> -if (!h->prot->url_shutdown) >> -return AVERROR(EINVAL); >> +if (!h || !h->prot || !h->prot->url_shutdown) >> +return AVERROR(ENOSYS); >> return h->prot->url_shutdown(h, flags); >> } >> >> -- >> 2.13.6 (Apple Git-96) >> >> >> >> ___ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >ping LGTM. In fact, I would like this change to be merged to handle some error cases in hlsenc as well. Thanks, Karthick ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2 1/2] avformat/hlsenc, utils: Moved is_http_proto from hlsenc to utils for re-use
2017-12-27 6:22 GMT+08:00 Aman Gupta : > On Sat, Dec 16, 2017 at 11:03 AM Karthick J wrote: > >> From: Karthick Jeyapal >> >> --- >> libavformat/hlsenc.c | 12 +++- >> libavformat/internal.h | 8 >> libavformat/utils.c| 5 + >> 3 files changed, 16 insertions(+), 9 deletions(-) >> >> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c >> index e3442c3..03d54c7 100644 >> --- a/libavformat/hlsenc.c >> +++ b/libavformat/hlsenc.c >> @@ -240,15 +240,10 @@ static int mkdir_p(const char *path) { >> return ret; >> } >> >> -static int is_http_proto(char *filename) { >> -const char *proto = avio_find_protocol_name(filename); >> -return proto ? (!av_strcasecmp(proto, "http") || >> !av_strcasecmp(proto, "https")) : 0; >> -} >> - >> static int hlsenc_io_open(AVFormatContext *s, AVIOContext **pb, char >> *filename, >>AVDictionary **options) { >> HLSContext *hls = s->priv_data; >> -int http_base_proto = filename ? is_http_proto(filename) : 0; >> +int http_base_proto = filename ? ff_is_http_proto(filename) : 0; >> int err = AVERROR_MUXER_NOT_FOUND; >> if (!*pb || !http_base_proto || !hls->http_persistent) { >> err = s->io_open(s, pb, filename, AVIO_FLAG_WRITE, options); >> @@ -264,8 +259,7 @@ static int hlsenc_io_open(AVFormatContext *s, >> AVIOContext **pb, char *filename, >> >> static void hlsenc_io_close(AVFormatContext *s, AVIOContext **pb, char >> *filename) { >> HLSContext *hls = s->priv_data; >> -int http_base_proto = filename ? is_http_proto(filename) : 0; >> - >> +int http_base_proto = filename ? ff_is_http_proto(filename) : 0; >> if (!http_base_proto || !hls->http_persistent || hls->key_info_file >> || hls->encrypt) { >> ff_format_io_close(s, pb); >> } else { >> @@ -275,7 +269,7 @@ static void hlsenc_io_close(AVFormatContext *s, >> AVIOContext **pb, char *filename >> >> static void set_http_options(AVFormatContext *s, AVDictionary **options, >> HLSContext *c) >> { >> -int http_base_proto = is_http_proto(s->filename); >> +int http_base_proto = ff_is_http_proto(s->filename); >> >> if (c->method) { >> av_dict_set(options, "method", c->method, 0); >> diff --git a/libavformat/internal.h b/libavformat/internal.h >> index 36a5721..8f168c9 100644 >> --- a/libavformat/internal.h >> +++ b/libavformat/internal.h >> @@ -619,6 +619,14 @@ int ff_format_output_open(AVFormatContext *s, const >> char *url, AVDictionary **op >> void ff_format_io_close(AVFormatContext *s, AVIOContext **pb); >> >> /** >> + * Utility function to check if the file uses http or https protocol >> + * >> + * @param s AVFormatContext >> + * @param filename URL or file name to open for writing >> + */ >> +int ff_is_http_proto(char *filename); > > > > +1 from me. This would be useful for some of the changes I'm making to the > hls demuxer as well. > > Any objections? > > Aman > > >> + >> +/** >> * Parse creation_time in AVFormatContext metadata if exists and warn if >> the >> * parsing fails. >> * >> diff --git a/libavformat/utils.c b/libavformat/utils.c >> index 84e4920..f18a7c8 100644 >> --- a/libavformat/utils.c >> +++ b/libavformat/utils.c >> @@ -5459,6 +5459,11 @@ void ff_format_io_close(AVFormatContext *s, >> AVIOContext **pb) >> *pb = NULL; >> } >> >> +int ff_is_http_proto(char *filename) { >> +const char *proto = avio_find_protocol_name(filename); >> +return proto ? (!av_strcasecmp(proto, "http") || >> !av_strcasecmp(proto, "https")) : 0; >> +} >> + >> int ff_parse_creation_time_metadata(AVFormatContext *s, int64_t >> *timestamp, int return_seconds) >> { >> AVDictionaryEntry *entry; >> -- >> 1.9.1 >> LGTM Thanks Steven ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/3] avformat/dashenc: Addition of #EXT-X-MEDIA tag and AUDIO attribute
2017-12-26 19:11 GMT+08:00 Karthick J : > From: Karthick Jeyapal > > This is required for AV playout from master.m3u8. > Otherwise master.m3u8 lists only video-only and/or audio-only streams. > --- > libavformat/dashenc.c | 24 ++-- > 1 file changed, 22 insertions(+), 2 deletions(-) > > diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c > index 478a384..a3eb522 100644 > --- a/libavformat/dashenc.c > +++ b/libavformat/dashenc.c > @@ -737,6 +737,9 @@ static int write_manifest(AVFormatContext *s, int final) > > if (c->hls_playlist && !c->master_playlist_created) { > char filename_hls[1024]; > +const char *audio_group = "A1"; > +int is_default = 1; > +int max_audio_bitrate = 0; > > if (*c->dirname) > snprintf(filename_hls, sizeof(filename_hls), "%s/master.m3u8", > c->dirname); > @@ -758,9 +761,26 @@ static int write_manifest(AVFormatContext *s, int final) > for (i = 0; i < s->nb_streams; i++) { > char playlist_file[64]; > AVStream *st = s->streams[i]; > +if (st->codecpar->codec_type != AVMEDIA_TYPE_AUDIO) > +continue; > +get_hls_playlist_name(playlist_file, sizeof(playlist_file), > NULL, i); > +ff_hls_write_audio_rendition(out, (char *)audio_group, > + playlist_file, i, is_default); > +max_audio_bitrate = FFMAX(st->codecpar->bit_rate, > max_audio_bitrate); > +is_default = 0; > +} > + > +for (i = 0; i < s->nb_streams; i++) { > +char playlist_file[64]; > +AVStream *st = s->streams[i]; > +char *agroup = NULL; > +int stream_bitrate = st->codecpar->bit_rate; > +if ((st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) && > max_audio_bitrate) { > +agroup = (char *)audio_group; > +stream_bitrate += max_audio_bitrate; > +} > get_hls_playlist_name(playlist_file, sizeof(playlist_file), > NULL, i); > -ff_hls_write_stream_info(st, out, st->codecpar->bit_rate, > -playlist_file, NULL); > +ff_hls_write_stream_info(st, out, stream_bitrate, playlist_file, > agroup); > } > avio_close(out); > if (use_rename) > -- > 1.9.1 > Patchset LGTM Thanks Steven ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel