Re: [FFmpeg-devel] [PATCH] avcodec/libopenh264enc: fix class_name
On 12.11.2018 18:10, Jan Ekström wrote: On Mon, Nov 12, 2018 at 6:11 PM Tobias Rapp wrote: Reverts some accidental change in commit e621b1ca646a2f268797adc3194b694a852548d2. Signed-off-by: Tobias Rapp --- libavcodec/libopenh264enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c index 5baa423..ae6d17c 100644 --- a/libavcodec/libopenh264enc.c +++ b/libavcodec/libopenh264enc.c @@ -75,7 +75,7 @@ static const AVOption options[] = { }; static const AVClass class = { -.class_name = "libvo_amrwbenc", +.class_name = "libopenh264enc", .item_name = av_default_item_name, .option = options, .version= LIBAVUTIL_VERSION_INT, -- Looking at the file name, definitely LGTM (also checked the history and this is what the string used to be). Pushed, thanks for review. Regards, Tobias ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avformat/hlsenc: remove the cannot reach result
fix CID: 1441166 because the logic have checked the vtt_dirname before Signed-off-by: Steven Liu --- libavformat/hlsenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index e0048aa9d8..8a687dc1bb 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -507,7 +507,7 @@ static int hls_delete_old_segments(AVFormatContext *s, HLSContext *hls, } p = (char *)av_basename(vtt_dirname); *p = '\0'; -sub_path_size = strlen(segment->sub_filename) + 1 + (vtt_dirname ? strlen(vtt_dirname) : 0); +sub_path_size = strlen(segment->sub_filename) + 1 + strlen(vtt_dirname); sub_path = av_malloc(sub_path_size); if (!sub_path) { ret = AVERROR(ENOMEM); -- 2.15.2 (Apple Git-101.1) ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH V2] libavcodec/vp8dec: fix the multi-thread HWAccel decode error
Ping? On Wed, Oct 17, 2018 at 8:01 PM Jun Zhao wrote: > > Fix the issue: https://github.com/intel/media-driver/issues/317 > > the root cause is update_dimensions call get_pixel_format will > trigger the hwaccel_uninit/hwaccel_init , in current context, > there are 3 situations in the update_dimensions(): > 1. First time calling. No matter single thread or multithread, >get_pixel_format() should be called after dimensions were >set; > 2. Dimention changed at the runtime. Dimention need to be >updated when macroblocks_base is already allocated, >get_pixel_format() should be called to recreate new frames >according to updated dimention; > 3. Multithread first time calling. After decoder init, the >other threads will call update_dimensions() at first time >to allocate macroblocks_base and set dimensions. >But get_pixel_format() is shouldn't be called due to low >level frames and context are already created. > > In this fix, we only call update_dimensions as need. > > Signed-off-by: Wang, Shaofei > Reviewed-by: Jun, Zhao > Reviewed-by: Haihao Xiang > --- > libavcodec/vp8.c |7 +-- > 1 files changed, 5 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c > index a06692c..c205868 100644 > --- a/libavcodec/vp8.c > +++ b/libavcodec/vp8.c > @@ -187,7 +187,7 @@ static av_always_inline > int update_dimensions(VP8Context *s, int width, int height, int is_vp7) > { > AVCodecContext *avctx = s->avctx; > -int i, ret; > +int i, ret, dim_reset = 0; > > if (width != s->avctx->width || ((width+15)/16 != s->mb_width || > (height+15)/16 != s->mb_height) && s->macroblocks_base || > height != s->avctx->height) { > @@ -196,9 +196,12 @@ int update_dimensions(VP8Context *s, int width, int > height, int is_vp7) > ret = ff_set_dimensions(s->avctx, width, height); > if (ret < 0) > return ret; > + > +dim_reset = (s->macroblocks_base != NULL); > } > > -if (!s->actually_webp && !is_vp7) { > +if ((s->pix_fmt == AV_PIX_FMT_NONE || dim_reset) && > + !s->actually_webp && !is_vp7) { > s->pix_fmt = get_pixel_format(s); > if (s->pix_fmt < 0) > return AVERROR(EINVAL); > -- > 1.7.1 > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel -- === Jun zhao/赵军 +++ ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] [HLS] Add LANGUAGE attribute to #EXT-X-MEDIA tag for audio-only variant streams.
> 在 2018年11月13日,上午6:36,Philippe Symons 写道: > > Hello everyone, > > This is my first patch to FFMpeg or any open-source project for that > matter. In this patch, I've added the LANGUAGE attribute to the > #EXT-X-MEDIA tag for for audio only variant streams for HLS streams. > > This attribute will be added to the output in > avformats' ff_hls_write_audio_rendition() function, if the language code > can be found in the metadata of the variant stream. > > The reason why I implemented this, was because I was working with a player > which needs this attribute to determine the language of the audio stream. > After asking the question on StackOverflow ( > https://stackoverflow.com/questions/53205283/ffmpeg-hls-multiple-audio-languages-with-var-stream-map-ext-x-mediatype-doesn/53206492#53206492), > I noticed that it wasn't implemented. > > I've tested these changes with the following command: > > ffmpeg -re -i /home/philippe/Videos/example.ts -map 0:v -c:v copy -map 0:a > -c:a copy -f hls -hls_time 6 -hls_list_size 10 -hls_flags > delete_segments+program_date_time -hls_segment_filename > "/var/www/html/live/stream_%v_%d.ts" -var_stream_map "v:0,agroup:lang > a:0,agroup:lang a:1,agroup:lang a:2,agroup:lang a: > 3,agroup:lang" -master_pl_name master.m3u8 /var/www/html/live/stream-%v.m3u8 > > Looking forward to your feedback. I hope it's okay. > Signed-off-by: Philippe Symons --- libavformat/dashenc.c | 2 +- libavformat/hlsenc.c | 24 ++-- libavformat/hlsplaylist.c | 6 +- libavformat/hlsplaylist.h | 2 +- 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index f8b3d106d5..ca5ef01e3f 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -897,7 +897,7 @@ static int write_manifest(AVFormatContext *s, int final) 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(c->m3u8_out, (char *)audio_group, +ff_hls_write_audio_rendition(c->m3u8_out, (char *)audio_group, NULL, playlist_file, i, is_default); max_audio_bitrate = FFMAX(st->codecpar->bit_rate + os->muxer_overhead, max_audio_bitrate); diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index e0048aa9d8..b31daa108e 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -1205,7 +1205,6 @@ static int create_master_playlist(AVFormatContext *s, } set_http_options(s, &options, hls); - ret = hlsenc_io_open(s, &hls->m3u8_out, hls->master_m3u8_url, &options); av_dict_free(&options); if (ret < 0) { @@ -1228,12 +1227,33 @@ static int create_master_playlist(AVFormatContext *s, /* For audio only variant streams add #EXT-X-MEDIA tag with attributes*/ for (i = 0; i < hls->nb_varstreams; i++) { +AVFormatContext* var_context; +char* language = NULL; + vs = &(hls->var_streams[i]); +var_context = vs->avf; if (vs->has_video || vs->has_subtitle || !vs->agroup) continue; m3u8_name_size = strlen(vs->m3u8_name) + 1; + +/* + * Try to obtain the language code of the audio stream. + * -if available- it will be used to write the LANGUAGE + * attribute in the #EXT-X-MEDIA tag + */ +if(var_context && var_context->nb_streams > 0) +{ if (var_context && var_context->nb_streams > 0) { +AVDictionary* meta_dict = vs->streams[0]->metadata; +AVDictionaryEntry *langEntry = av_dict_get(meta_dict, "language", NULL, 0); +if(langEntry) +{ if (langEntry) { +language = langEntry->value; +} +} + + two empty line? m3u8_rel_name = av_malloc(m3u8_name_size); if (!m3u8_rel_name) { ret = AVERROR(ENOMEM); @@ -1247,7 +1267,7 @@ static int create_master_playlist(AVFormatContext *s, goto fail; } -ff_hls_write_audio_rendition(hls->m3u8_out, vs->agroup, m3u8_rel_name, 0, 1); +ff_hls_write_audio_rendition(hls->m3u8_out, vs->agroup, language, m3u8_rel_name, 0, 1); av_freep(&m3u8_rel_name); } diff --git a/libavformat/hlsplaylist.c b/libavformat/hlsplaylist.c index efcbff0009..42c7cf5727 100644 --- a/libavformat/hlsplaylist.c +++ b/libavformat/hlsplaylist.c @@ -35,12 +35,16 @@ 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, +void ff_hls_write_audio_rendition(AVIOContext *out, char *agroup, char* language, char *filename, int name_id, int is_default) { if (!out || !agroup || !filename) return
Re: [FFmpeg-devel] [PATCH] avformat/async: remove unuse code
> 在 2018年11月13日,上午6:17,Michael Niedermayer 写道: > > On Mon, Nov 12, 2018 at 05:48:46PM +0800, Steven Liu wrote: >> Signed-off-by: Steven Liu >> --- >> libavformat/async.c | 208 >> >> 1 file changed, 208 deletions(-) > > Is this test done elsewhere ? (i think its not but i may have missed it) > If not then this should not be removed but rather repaired and enabled again Do you mean add and CONFIG for the compile, make it enabled? > > thx > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > In fact, the RIAA has been known to suggest that students drop out > of college or go to community college in order to be able to afford > settlements. -- The RIAA > ___ > 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] ffmpeg.c: add an option "detail_stats" to allow ffmpeg to output stats for each stream
On Mon, Nov 12, 2018 at 01:10:55PM -0800, Wang Cao wrote: > Friendly ping! i tried the code and for example -i matrixbench_mpeg2.mpg -map 0:a -map 0:a -map 0:a -map 0:a -map 0:v -map 0:v test.nut -map 0:a -map 0:a -map 0:v -map 0:a -map 0:v -map 0:v test2.nut generates when i stop it: cpb: bitrate max/min/avg: 0/0/20 buffer size: 0 vbv_delay: -1 [nut @ 0x3b419c0] Multiple keyframes with same PTSts/s speed=5.42x Last message repeated 6 times [nut @ 0x3b5abc0] Multiple keyframes with same PTS Last message repeated 271 times size=5285kB time=00:00:44.56 bitrate= 971.6kbits/s speed=5.39x size=5285kB time=00:00:44.56 bitrate= 971.6kbits/s speed=5.39x size=5285kB time=00:00:44.56 bitrate= 971.6kbits/s speed=5.39x size=5285kB time=00:00:44.56 bitrate= 971.6kbits/s speed=5.39x q=31.0 frame= 1115 fps=135 q=31.0 Lsize=5285kB time=00:00:44.56 bitrate= 971.6kbits/s speed=5.39x q=31.0 frame= 1115 fps=135 q=31.0 Lsize=5285kB time=00:00:44.56 bitrate= 971.6kbits/s speed=5.39x size=6285kB time=00:00:44.56 bitrate=1155.5kbits/s speed=5.39x size=6285kB time=00:00:44.56 bitrate=1155.5kbits/s speed=5.39x q=31.0 frame= 1115 fps=135 q=31.0 Lsize=6285kB time=00:00:44.56 bitrate=1155.5kbits/s speed=5.39x size=6285kB time=00:00:44.56 bitrate=1155.5kbits/s speed=5.39x q=31.0 frame= 1115 fps=135 q=31.0 Lsize=6285kB time=00:00:44.56 bitrate=1155.5kbits/s speed=5.39x q=31.0 frame= 1115 fps=135 q=31.0 Lsize=6285kB time=00:00:44.56 bitrate=1155.5kbits/s speed=5.39x video:3083kB audio:2147kB subtitle:0kB other streams:0kB global headers:16kB muxing overhead: 1.048231% video:4625kB audio:1610kB subtitle:0kB other streams:0kB global headers:12kB muxing overhead: 0.803826% Its not easy to read this and know which line represents which stream also this is the same audio stream stored 7 times yet the statistics look nonsensical, one would expect 7 identical bitrates and in fact not 971kbit/sec for a vorbis audio stream with default encoding parameters [...] -- 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 v3] fftools/ffmpeg: add an option to forbid the fallback to software path when hardware init fails
> -Original Message- > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf > Of Mark Thompson > Sent: Sunday, November 11, 2018 23:09 > To: ffmpeg-devel@ffmpeg.org > Subject: Re: [FFmpeg-devel] [PATCH v3] fftools/ffmpeg: add an option to > forbid the fallback to software path when hardware init fails > > On 09/11/18 09:05, Linjie Fu wrote: > > Currently ff_get_format will go through all usable choices if the chosen > > format was not supported. It will fallback to software path if the hardware > > init fails. > > > > Provided an option "-require_hwaccel 1" in user-code to detect frame- > >format and > > hwaccel_get_buffer in get_buffer. If hardware init fails, returns an error. > > > > Signed-off-by: Linjie Fu > > --- > > [v2] detect hardware init failures in get_buffer and modify in user-code > > [v3] changed the option name, add error message > > > > fftools/ffmpeg.c | 4 > > fftools/ffmpeg.h | 3 +++ > > fftools/ffmpeg_opt.c | 4 > > 3 files changed, 11 insertions(+) > > > > diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c > > index da4259a9a8..113ab6312a 100644 > > --- a/fftools/ffmpeg.c > > +++ b/fftools/ffmpeg.c > > @@ -2890,6 +2890,10 @@ static int get_buffer(AVCodecContext *s, > AVFrame *frame, int flags) > > > > if (ist->hwaccel_get_buffer && frame->format == ist->hwaccel_pix_fmt) > > return ist->hwaccel_get_buffer(s, frame, flags); > > +else if (ist->require_hwaccel) { > > +av_log(s, AV_LOG_ERROR, "Hardware acceleration is required and will > not fallback to try software path.\n"); > > +return AVERROR(EINVAL); > > +} > > Um, doesn't this just break every hardware case except QSV? The > hwaccel_get_buffer function is only used for QSV, and will be unset for any > other cases. (In fact, I don't think it does anything useful there anyway - > maybe it can be removed completely, I'll have a look.) > > I think the right place to make this decision (to force a hardware format) is > in > get_format(), rather than after when the decoder is already configured - this > avoids cases where the format you actually wanted was available but you > didn't pick it and then fail later. I had a patch lying around for another > purpose which gives you some support for this, just sent if you'd like to have > a look. > Thanks for the comments and hints. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 0/2] Update vf_bwdif to use yadif_common v2
Am So., 11. Nov. 2018 um 20:47 Uhr schrieb Philip Langdale < phil...@overt.org>: > vf_bwdif's frame management logic is almost identical to that of yadif. > The only difference is that it tracks the first and last fields in a > sequence, and that requires slight changes to the common code. > > Assuming it's reasonable to do that tracking even though yadif doesn't > need it, we can then remove all the duplicated logic. > > v2: Rename enum values as recommened by Thomas Mundt. > > Philip Langdale (2): > avfilter/yadif_common: Add field type tracking to help bwdif > avfilter/vf_bwdif: Use common yadif frame management logic > > libavfilter/bwdif.h | 34 + > libavfilter/vf_bwdif.c | 235 +--- > libavfilter/x86/vf_bwdif_init.c | 3 +- > libavfilter/yadif.h | 14 ++ > libavfilter/yadif_common.c | 12 +- > 5 files changed, 64 insertions(+), 234 deletions(-) > Patch lgtm. Regards, Thomas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] fmin/fmax/fminf/fmaxf implementation for djgpp libc
On Mon, Nov 12, 2018 at 11:51:26PM +1100, Peter Ross wrote: > --- > compat/djgpp/math.h | 22 ++ > configure | 1 + > 2 files changed, 23 insertions(+) > create mode 100644 compat/djgpp/math.h > > diff --git a/compat/djgpp/math.h b/compat/djgpp/math.h > new file mode 100644 > index 00..28fae5212e > --- /dev/null > +++ b/compat/djgpp/math.h > @@ -0,0 +1,22 @@ > +/* > + * 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 > + */ > + > +#define fmin(x, y) ((x) > (y) ? (y) : ((x) == (x) ? (x) : (y))) > +#define fmax(x, y) ((x) < (y) ? (y) : ((x) == (x) ? (x) : (y))) > +#define fminf(x, y) fmin(x, y) > +#define fmaxf(x, y) fmax(x, y) these evaluate the arguments multiple times. This could be unexpected also the way this tests for NaN is not guranteed to work i think [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Never trust a computer, one day, it may think you are the virus. -- Compn signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] mjpegdec: Fill raw huffman tables with default values too
On Mon, Nov 12, 2018 at 12:26 AM Mark Thompson wrote: > > These may be used by hwaccel decoders when the standard tables are not > otherwise available. At the same time, clean up that code into an array > so it's a little less repetitive. > --- > On 29/10/18 10:26, Jun Zhao wrote: > > From: Jun Zhao > > > > Now VA-API HWAccel MJPEG decoding uninitialized huffman table, it's > > will lead to the decoding error like"Failed to sync surface 0x5: 23 > > (internal decoding error)." in iHD open source driver. > > > > Signed-off-by: dlin2 > > Signed-off-by: Jun Zhao > > --- > > libavcodec/mjpegdec.c | 19 +++ > > 1 files changed, 19 insertions(+), 0 deletions(-) > > > > diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c > > index b0cb3ff..89effb6 100644 > > --- a/libavcodec/mjpegdec.c > > +++ b/libavcodec/mjpegdec.c > > @@ -75,6 +75,25 @@ static int build_vlc(VLC *vlc, const uint8_t *bits_table, > > static int build_basic_mjpeg_vlc(MJpegDecodeContext *s) > > { > > int ret; > > +int i; > > + > > +/* initialize default huffman tables */ > > +for (i = 0; i < 16; i++) > > +s->raw_huffman_lengths[0][0][i] = avpriv_mjpeg_bits_dc_luminance[i > > + 1]; > > +for (i = 0; i < 12; i++) > > +s->raw_huffman_values[0][0][i] = avpriv_mjpeg_val_dc[i]; > > +for (i = 0; i < 16; i++) > > +s->raw_huffman_lengths[0][1][i] = > > avpriv_mjpeg_bits_dc_chrominance[i + 1]; > > +for (i = 0; i < 12; i++) > > +s->raw_huffman_values[0][1][i] = avpriv_mjpeg_val_dc[i]; > > +for (i = 0; i < 16; i++) > > +s->raw_huffman_lengths[1][0][i] = avpriv_mjpeg_bits_ac_luminance[i > > + 1]; > > +for (i = 0; i < 162; i++) > > +s->raw_huffman_values[1][0][i] = avpriv_mjpeg_val_ac_luminance[i]; > > +for (i = 0; i < 16; i++) > > +s->raw_huffman_lengths[1][1][i] = > > avpriv_mjpeg_bits_ac_chrominance[i + 1]; > > +for (i = 0; i < 162; i++) > > +s->raw_huffman_values[1][1][i] = > > avpriv_mjpeg_val_ac_chrominance[i]; > > > > if ((ret = build_vlc(&s->vlcs[0][0], avpriv_mjpeg_bits_dc_luminance, > > avpriv_mjpeg_val_dc, 12, 0, 0)) < 0) > > > > Seems reasonable, but perhaps the enclosed patch instead makes it clearer > what is going on and easier to verify correctness? > > (Even better: the builtin tables would be in DHT form and we would just call > decode_dht() on them and avoid messing around with separate code, but since > they are used in multiple places that looks more inconvenient to arrange.) > > - Mark > > > libavcodec/mjpegdec.c | 67 +-- > 1 file changed, 39 insertions(+), 28 deletions(-) > > diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c > index 96c425515a..2f1635838a 100644 > --- a/libavcodec/mjpegdec.c > +++ b/libavcodec/mjpegdec.c > @@ -73,34 +73,45 @@ static int build_vlc(VLC *vlc, const uint8_t *bits_table, >huff_code, 2, 2, huff_sym, 2, 2, use_static); > } > > -static int build_basic_mjpeg_vlc(MJpegDecodeContext *s) > +static int init_default_huffman_tables(MJpegDecodeContext *s) > { > -int ret; > - > -if ((ret = build_vlc(&s->vlcs[0][0], avpriv_mjpeg_bits_dc_luminance, > - avpriv_mjpeg_val_dc, 12, 0, 0)) < 0) > -return ret; > - > -if ((ret = build_vlc(&s->vlcs[0][1], avpriv_mjpeg_bits_dc_chrominance, > - avpriv_mjpeg_val_dc, 12, 0, 0)) < 0) > -return ret; > - > -if ((ret = build_vlc(&s->vlcs[1][0], avpriv_mjpeg_bits_ac_luminance, > - avpriv_mjpeg_val_ac_luminance, 251, 0, 1)) < 0) > -return ret; > - > -if ((ret = build_vlc(&s->vlcs[1][1], avpriv_mjpeg_bits_ac_chrominance, > - avpriv_mjpeg_val_ac_chrominance, 251, 0, 1)) < 0) > -return ret; > - > -if ((ret = build_vlc(&s->vlcs[2][0], avpriv_mjpeg_bits_ac_luminance, > - avpriv_mjpeg_val_ac_luminance, 251, 0, 0)) < 0) > -return ret; > - > -if ((ret = build_vlc(&s->vlcs[2][1], avpriv_mjpeg_bits_ac_chrominance, > - avpriv_mjpeg_val_ac_chrominance, 251, 0, 0)) < 0) > -return ret; > +static const struct { > +int class; > +int index; > +const uint8_t *bits; > +const uint8_t *values; > +int codes; > +int length; > +} ht[] = { > +{ 0, 0, avpriv_mjpeg_bits_dc_luminance, > +avpriv_mjpeg_val_dc, 12, 12 }, > +{ 0, 1, avpriv_mjpeg_bits_dc_chrominance, > +avpriv_mjpeg_val_dc, 12, 12 }, > +{ 1, 0, avpriv_mjpeg_bits_ac_luminance, > +avpriv_mjpeg_val_ac_luminance, 251, 162 }, > +{ 1, 1, avpriv_mjpeg_bits_ac_chrominance, > +avpriv_mjpeg_val_ac_chrominance, 251, 162 }, > +{ 2, 0, avpriv_mjpeg_bits_ac_luminance, > +avpriv_mjpeg_val_ac_luminance, 251, 162 }, > +
Re: [FFmpeg-devel] [PATCH 1/4] h264_levels, h264_metadata_bsf: Fix levels typo
On Mon, Nov 12, 2018 at 03:18:12PM +0100, Andreas Rheinhardt wrote: > Signed-off-by: Andreas Rheinhardt > --- > libavcodec/h264_levels.c | 2 +- > libavcodec/h264_metadata_bsf.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) breaks fate-h264-levels, a change to the output needs to update the test too (after double checking that the change is correct) libavcodec/tests/h264_levels Test h264-levels failed. Look at tests/data/fate/h264-levels.err for details. Incorrect level for bitrate 115200 profile 66: expected 10, got 11. [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The worst form of inequality is to try to make unequal things equal. -- 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 v3 1/1] avcodec: implemented Media Foundation encoder wrapper
On Mon, Nov 12, 2018 at 02:42:36PM +0100, Paweł Wegner wrote: > Implemented the following encoders: > * ff_h264_mf_encoder > * ff_hevc_mf_encoder > * ff_aac_mf_encoder > * ff_ac3_mf_encoder > * ff_mp3_mf_encoder > > The code is based on the PLEX's FFmpeg fork which can be found here: > https://files.plexapp.com/elan/ffmpeg/plex-ffmpeg-2017-12-17.txz > > Signed-off-by: Paweł Wegner > --- > configure | 11 + > libavcodec/Makefile|1 + > libavcodec/allcodecs.c |5 + > libavcodec/mf_utils.c | 734 > libavcodec/mf_utils.h | 207 +++ > libavcodec/mfenc.c | 1242 > 6 files changed, 2200 insertions(+) > create mode 100644 libavcodec/mf_utils.c > create mode 100644 libavcodec/mf_utils.h > create mode 100644 libavcodec/mfenc.c breaks build for mingw64 CC libavcodec/mf_utils.o In file included from /usr/share/mingw-w64/include/wmcodecdsp.h:613:0, from src/libavcodec/mf_utils.h:26, from src/libavcodec/mf_utils.c:24: /usr/share/mingw-w64/include/strmif.h:15380:2: warning: #warning COM interfaces layout in this header has not been verified. [-Wcpp] #warning COM interfaces layout in this header has not been verified. ^ /usr/share/mingw-w64/include/strmif.h:15381:2: warning: #warning COM interfaces with incorrect layout may not work at all. [-Wcpp] #warning COM interfaces with incorrect layout may not work at all. ^ /usr/share/mingw-w64/include/strmif.h:15410:2: warning: #warning COM interfaces layout in this header has not been verified. [-Wcpp] #warning COM interfaces layout in this header has not been verified. ^ /usr/share/mingw-w64/include/strmif.h:15411:2: warning: #warning COM interfaces with incorrect layout may not work at all. [-Wcpp] #warning COM interfaces with incorrect layout may not work at all. ^ In file included from /usr/share/mingw-w64/include/wmcodecdsp.h:613:0, from src/libavcodec/mf_utils.h:26, from src/libavcodec/mf_utils.c:24: /usr/share/mingw-w64/include/strmif.h:15382:9: note: #pragma message: Interface IAMAsyncReaderTimestampScaling has unverified layout. __MINGW_BROKEN_INTERFACE(INTERFACE) ... [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Rewriting code that is poorly written but fully understood is good. Rewriting code that one doesnt understand is a sign that one is less smart then the original author, trying to rewrite it will not make it better. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/vp9_parser: export profile and pixel format
On Fri, Nov 2, 2018 at 4:57 PM Chris Cunningham wrote: > > Also, when dealing with a super frame, to get other values like pixel > > format and frame dimensions we'd have to make sure to parse the visible > > frame, and if it's an inter frame also keep the reference frames around > > to take said values from them. > > Could we avoid the challenges around reference and invisible frame by only > doing this parsing for key frames? IIUC these properties would only be > expected to change at the GOP boundary. > Friendly ping for feedback on this idea. > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] [HLS] Add LANGUAGE attribute to #EXT-X-MEDIA tag for audio-only variant streams.
Hello everyone, This is my first patch to FFMpeg or any open-source project for that matter. In this patch, I've added the LANGUAGE attribute to the #EXT-X-MEDIA tag for for audio only variant streams for HLS streams. This attribute will be added to the output in avformats' ff_hls_write_audio_rendition() function, if the language code can be found in the metadata of the variant stream. The reason why I implemented this, was because I was working with a player which needs this attribute to determine the language of the audio stream. After asking the question on StackOverflow ( https://stackoverflow.com/questions/53205283/ffmpeg-hls-multiple-audio-languages-with-var-stream-map-ext-x-mediatype-doesn/53206492#53206492), I noticed that it wasn't implemented. I've tested these changes with the following command: ffmpeg -re -i /home/philippe/Videos/example.ts -map 0:v -c:v copy -map 0:a -c:a copy -f hls -hls_time 6 -hls_list_size 10 -hls_flags delete_segments+program_date_time -hls_segment_filename "/var/www/html/live/stream_%v_%d.ts" -var_stream_map "v:0,agroup:lang a:0,agroup:lang a:1,agroup:lang a:2,agroup:lang a: 3,agroup:lang" -master_pl_name master.m3u8 /var/www/html/live/stream-%v.m3u8 Looking forward to your feedback. I hope it's okay. Best regards, Philippe Symons From 9ededcc20a3d3d9786e717acedcf55b6614c5b69 Mon Sep 17 00:00:00 2001 From: Philippe Symons Date: Mon, 12 Nov 2018 22:45:20 +0100 Subject: [PATCH] [HLS] Add LANGUAGE attribute to #EXT-X-MEDIA tag for audio-only variant streams. Signed-off-by: Philippe Symons --- libavformat/dashenc.c | 2 +- libavformat/hlsenc.c | 24 ++-- libavformat/hlsplaylist.c | 6 +- libavformat/hlsplaylist.h | 2 +- 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index f8b3d106d5..ca5ef01e3f 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -897,7 +897,7 @@ static int write_manifest(AVFormatContext *s, int final) 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(c->m3u8_out, (char *)audio_group, +ff_hls_write_audio_rendition(c->m3u8_out, (char *)audio_group, NULL, playlist_file, i, is_default); max_audio_bitrate = FFMAX(st->codecpar->bit_rate + os->muxer_overhead, max_audio_bitrate); diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index e0048aa9d8..b31daa108e 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -1205,7 +1205,6 @@ static int create_master_playlist(AVFormatContext *s, } set_http_options(s, &options, hls); - ret = hlsenc_io_open(s, &hls->m3u8_out, hls->master_m3u8_url, &options); av_dict_free(&options); if (ret < 0) { @@ -1228,12 +1227,33 @@ static int create_master_playlist(AVFormatContext *s, /* For audio only variant streams add #EXT-X-MEDIA tag with attributes*/ for (i = 0; i < hls->nb_varstreams; i++) { +AVFormatContext* var_context; +char* language = NULL; + vs = &(hls->var_streams[i]); +var_context = vs->avf; if (vs->has_video || vs->has_subtitle || !vs->agroup) continue; m3u8_name_size = strlen(vs->m3u8_name) + 1; + +/* + * Try to obtain the language code of the audio stream. + * -if available- it will be used to write the LANGUAGE + * attribute in the #EXT-X-MEDIA tag + */ +if(var_context && var_context->nb_streams > 0) +{ +AVDictionary* meta_dict = vs->streams[0]->metadata; +AVDictionaryEntry *langEntry = av_dict_get(meta_dict, "language", NULL, 0); +if(langEntry) +{ +language = langEntry->value; +} +} + + m3u8_rel_name = av_malloc(m3u8_name_size); if (!m3u8_rel_name) { ret = AVERROR(ENOMEM); @@ -1247,7 +1267,7 @@ static int create_master_playlist(AVFormatContext *s, goto fail; } -ff_hls_write_audio_rendition(hls->m3u8_out, vs->agroup, m3u8_rel_name, 0, 1); +ff_hls_write_audio_rendition(hls->m3u8_out, vs->agroup, language, m3u8_rel_name, 0, 1); av_freep(&m3u8_rel_name); } diff --git a/libavformat/hlsplaylist.c b/libavformat/hlsplaylist.c index efcbff0009..42c7cf5727 100644 --- a/libavformat/hlsplaylist.c +++ b/libavformat/hlsplaylist.c @@ -35,12 +35,16 @@ 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, +void ff_hls_write_audio_rendition(AVIOContext *out, char *agroup, char* language, char *filename, int name_id, int is
Re: [FFmpeg-devel] [PATCH] avformat/async: remove unuse code
On Mon, Nov 12, 2018 at 05:48:46PM +0800, Steven Liu wrote: > Signed-off-by: Steven Liu > --- > libavformat/async.c | 208 > > 1 file changed, 208 deletions(-) Is this test done elsewhere ? (i think its not but i may have missed it) If not then this should not be removed but rather repaired and enabled again thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB In fact, the RIAA has been known to suggest that students drop out of college or go to community college in order to be able to afford settlements. -- The RIAA 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] avfilter/af_silenceremove: fix maximum of AV_OPT_TYPE_DURATION params
On 11/12/18, Marton Balint wrote: > Signed-off-by: Marton Balint > --- > libavfilter/af_silenceremove.c | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) This are not that useful to be big values as this will alloc memory, so no point in increasing to 64bit. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] ffmpeg.c: add an option "detail_stats" to allow ffmpeg to output stats for each stream
Friendly ping! On Tue, Oct 16, 2018 at 3:39 PM Wang Cao wrote: > From: Wang Cao > > - Add an option "detail_stats" to ffmpeg to output stats for each > video/audio streams and each ouptut file ffmpeg output log in print_report. > - Make print_final_stats only output stats for one output instead of > aggregate stats. > > Signed-off-by: Wang Cao > --- > When creating multiple outputs, the original was to aggregate size of > all output files together and I find this may not be intuitive to > users and choose to output the stats for the first output file instead. > Using -detail_stats to ouptut stats for other output files. > > doc/ffmpeg.texi | 4 +++ > fftools/ffmpeg.c | 72 +++- > fftools/ffmpeg.h | 1 + > fftools/ffmpeg_opt.c | 4 ++- > 4 files changed, 59 insertions(+), 22 deletions(-) > > diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi > index 3717f22d42..53a5be9791 100644 > --- a/doc/ffmpeg.texi > +++ b/doc/ffmpeg.texi > @@ -1623,6 +1623,10 @@ rtp stream. (Requires at least one of the output > formats to be rtp). > Allows discarding specific streams or frames of streams at the demuxer. > Not all demuxers support this. > > +@item -detail_stats (@emph{global}) > +Allows printing stats for each output stream and output file at the end of > +processing. > + > @table @option > @item none > Discard no frame. > diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c > index da4259a9a8..7286e75c36 100644 > --- a/fftools/ffmpeg.c > +++ b/fftools/ffmpeg.c > @@ -1530,17 +1530,31 @@ static int reap_filters(int flush) > return 0; > } > > -static void print_final_stats(int64_t total_size) > +static void print_final_stats() > { > uint64_t video_size = 0, audio_size = 0, extra_size = 0, other_size = > 0; > uint64_t subtitle_size = 0; > uint64_t data_size = 0; > +int64_t total_size; > float percent = -1.0; > int i, j; > int pass1_used = 1; > - > -for (i = 0; i < nb_output_streams; i++) { > +int nb_display_streams = 0; > +AVFormatContext *oc; > + > +if (nb_output_streams > 0) { > +nb_display_streams = enable_detail_stats ? nb_output_streams : 1; > +} > +for (i = 0; i < nb_display_streams; i++) { > OutputStream *ost = output_streams[i]; > +if (i > 0 && ost->file_index != output_streams[i-1]->file_index) { > +video_size = 0; > +audio_size = 0; > +extra_size = 0; > +other_size = 0; > +subtitle_size = 0; > +data_size = 0; > +} > switch (ost->enc_ctx->codec_type) { > case AVMEDIA_TYPE_VIDEO: video_size += ost->data_size; break; > case AVMEDIA_TYPE_AUDIO: audio_size += ost->data_size; break; > @@ -1552,7 +1566,13 @@ static void print_final_stats(int64_t total_size) > if ( (ost->enc_ctx->flags & (AV_CODEC_FLAG_PASS1 | > AV_CODEC_FLAG_PASS2)) > != AV_CODEC_FLAG_PASS1) > pass1_used = 0; > -} > + > +// Print stats for each output file. > +if (i == nb_display_streams-1 || ost->file_index != > output_streams[i+1]->file_index) { > +oc = output_files[ost->file_index]->ctx; > +total_size = avio_size(oc->pb); > +if (total_size <= 0) // FIXME improve avio_size() so it works > with non seekable output too > +total_size = avio_tell(oc->pb); > > if (data_size && total_size>0 && total_size >= data_size) > percent = 100.0 * (total_size - data_size) / data_size; > @@ -1568,6 +1588,8 @@ static void print_final_stats(int64_t total_size) > else > av_log(NULL, AV_LOG_INFO, "unknown"); > av_log(NULL, AV_LOG_INFO, "\n"); > +} > +} > > /* print verbose per-stream stats */ > for (i = 0; i < nb_input_files; i++) { > @@ -1680,16 +1702,18 @@ static void print_report(int is_last_report, > int64_t timer_start, int64_t cur_ti > > t = (cur_time-timer_start) / 100.0; > > - > -oc = output_files[0]->ctx; > - > -total_size = avio_size(oc->pb); > -if (total_size <= 0) // FIXME improve avio_size() so it works with > non seekable output too > -total_size = avio_tell(oc->pb); > - > vid = 0; > av_bprint_init(&buf, 0, AV_BPRINT_SIZE_AUTOMATIC); > av_bprint_init(&buf_script, 0, AV_BPRINT_SIZE_AUTOMATIC); > + > +/* need to collect final pts upfront because final stats depend on > pts*/ > +for (i = 0; i < nb_output_streams; i++) { > +ost = output_streams[i]; > +/* compute min output value */ > +if (av_stream_get_end_pts(ost->st) != AV_NOPTS_VALUE) > +pts = FFMAX(pts, av_rescale_q(av_stream_get_end_pts(ost->st), > + ost->st->time_base, > AV_TIME_BASE_Q)); > +} > for (i = 0; i < nb_output_streams; i++) { > float q = -1; > ost = output_streams[i]; > @@ -1697,12 +1721,14 @@ static void print_report(in
[FFmpeg-devel] [PATCH 2/2] avfilter/af_silenceremove: fix maximum of AV_OPT_TYPE_DURATION params
Signed-off-by: Marton Balint --- libavfilter/af_silenceremove.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavfilter/af_silenceremove.c b/libavfilter/af_silenceremove.c index 335f55bb4e..8df8b6fc5b 100644 --- a/libavfilter/af_silenceremove.c +++ b/libavfilter/af_silenceremove.c @@ -105,16 +105,16 @@ typedef struct SilenceRemoveContext { static const AVOption silenceremove_options[] = { { "start_periods", NULL, OFFSET(start_periods), AV_OPT_TYPE_INT, {.i64=0}, 0, 9000, AF }, -{ "start_duration", "set start duration of non-silence part", OFFSET(start_duration_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT32_MAX, AF }, +{ "start_duration", "set start duration of non-silence part", OFFSET(start_duration_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT64_MAX, AF }, { "start_threshold", "set threshold for start silence detection", OFFSET(start_threshold), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, DBL_MAX, AF }, -{ "start_silence", "set start duration of silence part to keep", OFFSET(start_silence_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT32_MAX, AF }, +{ "start_silence", "set start duration of silence part to keep", OFFSET(start_silence_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT64_MAX, AF }, { "start_mode", "set which channel will trigger trimming from start", OFFSET(start_mode), AV_OPT_TYPE_INT, {.i64=T_ANY}, T_ANY, T_ALL, AF, "mode" }, { "any", 0, 0, AV_OPT_TYPE_CONST,{.i64=T_ANY}, 0, 0, AF, "mode" }, { "all", 0, 0, AV_OPT_TYPE_CONST,{.i64=T_ALL}, 0, 0, AF, "mode" }, { "stop_periods",NULL, OFFSET(stop_periods),AV_OPT_TYPE_INT, {.i64=0}, -9000, 9000, AF }, -{ "stop_duration", "set stop duration of non-silence part", OFFSET(stop_duration_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT32_MAX, AF }, +{ "stop_duration", "set stop duration of non-silence part", OFFSET(stop_duration_opt), AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT64_MAX, AF }, { "stop_threshold", "set threshold for stop silence detection", OFFSET(stop_threshold), AV_OPT_TYPE_DOUBLE, {.dbl=0}, 0, DBL_MAX, AF }, -{ "stop_silence","set stop duration of silence part to keep", OFFSET(stop_silence_opt),AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT32_MAX, AF }, +{ "stop_silence","set stop duration of silence part to keep", OFFSET(stop_silence_opt),AV_OPT_TYPE_DURATION, {.i64=0}, 0, INT64_MAX, AF }, { "stop_mode", "set which channel will trigger trimming from end", OFFSET(stop_mode), AV_OPT_TYPE_INT, {.i64=T_ANY}, T_ANY, T_ALL, AF, "mode" }, { "detection", "set how silence is detected", OFFSET(detection), AV_OPT_TYPE_INT, {.i64=D_RMS}, D_PEAK,D_RMS, AF, "detection" }, { "peak", "use absolute values of samples", 0, AV_OPT_TYPE_CONST,{.i64=D_PEAK},0, 0, AF, "detection" }, -- 2.16.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] avfilter/af_afade: fix duration maximum
Signed-off-by: Marton Balint --- libavfilter/af_afade.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavfilter/af_afade.c b/libavfilter/af_afade.c index 8c7678107a..751db7da4d 100644 --- a/libavfilter/af_afade.c +++ b/libavfilter/af_afade.c @@ -239,8 +239,8 @@ static const AVOption afade_options[] = { { "ns", "set number of samples for fade duration", OFFSET(nb_samples), AV_OPT_TYPE_INT64, {.i64 = 44100}, 1, INT64_MAX, FLAGS }, { "start_time", "set time to start fading", OFFSET(start_time), AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT64_MAX, FLAGS }, { "st", "set time to start fading", OFFSET(start_time), AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT64_MAX, FLAGS }, -{ "duration", "set fade duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT32_MAX, FLAGS }, -{ "d","set fade duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT32_MAX, FLAGS }, +{ "duration", "set fade duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT64_MAX, FLAGS }, +{ "d","set fade duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = 0. }, 0, INT64_MAX, FLAGS }, { "curve","set fade curve type", OFFSET(curve),AV_OPT_TYPE_INT,{.i64 = TRI }, 0, NB_CURVES - 1, FLAGS, "curve" }, { "c","set fade curve type", OFFSET(curve),AV_OPT_TYPE_INT,{.i64 = TRI }, 0, NB_CURVES - 1, FLAGS, "curve" }, { "tri", "linear slope",0, AV_OPT_TYPE_CONST, {.i64 = TRI }, 0, 0, FLAGS, "curve" }, -- 2.16.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] lavu: add locale-independent sscanf implementation
Tomas Härdin (2018-11-12): > Why not set locale instead? That would conflict with the wishes of the application. A library should never change global state. (Of course, the core of the problem is that locales are global state, this is braindead design.) 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 1/2] lavu: add locale-independent sscanf implementation
mån 2018-11-12 klockan 19:46 +0100 skrev Paul B Mahol: > Copied and adopted from musl implementation. > * converted all 'long double' to 'double' > > Signed-off-by: Paul B Mahol > --- > libavutil/avstring.c | 961 > Why not set locale instead? /Tomas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] ffmpeg: Add option to force a specific decode format
On Sun, Nov 11, 2018 at 02:54:41PM +, Mark Thompson wrote: > Fixes #7519. > --- > I've had this lying around for a bit with intent to use it to support > non-hwaccel hardware decoders (in particular, v4l2m2m), but it actually fixes > the force-hwaccel use-case too in a sensible way. > > > doc/ffmpeg.texi | 12 > fftools/ffmpeg.c | 4 > fftools/ffmpeg.h | 4 > fftools/ffmpeg_opt.c | 15 +++ > 4 files changed, 35 insertions(+) > > diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi > index 3717f22d42..9f9e693898 100644 > --- a/doc/ffmpeg.texi > +++ b/doc/ffmpeg.texi > @@ -920,6 +920,18 @@ would be more efficient. > When doing stream copy, copy also non-key frames found at the > beginning. > > +@item -decode_format[:@var{stream_specifier}] @var{pixfmt} > (@emph{input,per-stream}) > +Set the output format to be used by the decoder for this stream. If the > +decoder does not natively support this format for the input stream then > +decoding will fail rather than continuing with a different format. > + > +In general this should not be set - the decoder will select an output > +format based on the input stream parameters and available components, and > +that will be automatically converted to whatever the output requires. It > +may be useful to force a hardware decoder supporting output in multiple > +different memory types to pick the desired one, or to ensure that a > +hardware decoder is used when software fallback is also available. > + > @item -init_hw_device > @var{type}[=@var{name}][:@var{device}[,@var{key=value}...]] > Initialise a new hardware device of type @var{type} called @var{name}, using > the > given device parameters. > diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c > index 38c21e944a..73bed55e4d 100644 > --- a/fftools/ffmpeg.c > +++ b/fftools/ffmpeg.c > @@ -2800,6 +2800,10 @@ static enum AVPixelFormat get_format(AVCodecContext > *s, const enum AVPixelFormat > const AVCodecHWConfig *config = NULL; > int i; > > +if (ist->decode_format != AV_PIX_FMT_NONE && > +ist->decode_format != *p) > +continue; > + > if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) > break; > > diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h > index eb1eaf6363..88e0aa60ea 100644 > --- a/fftools/ffmpeg.h > +++ b/fftools/ffmpeg.h > @@ -125,6 +125,8 @@ typedef struct OptionsContext { > intnb_ts_scale; > SpecifierOpt *dump_attachment; > intnb_dump_attachment; > +SpecifierOpt *decode_formats; > +intnb_decode_formats; > SpecifierOpt *hwaccels; > intnb_hwaccels; > SpecifierOpt *hwaccel_devices; > @@ -334,6 +336,8 @@ typedef struct InputStream { > int top_field_first; > int guess_layout_max; > > +enum AVPixelFormat decode_format; > + I think this should be a list and not a single format either way, the patch LGTM thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB In a rich man's house there is no place to spit but his face. -- Diogenes of Sinope signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] lavu: add locale-independent sscanf implementation
Copied and adopted from musl implementation. * converted all 'long double' to 'double' * removed %m support Signed-off-by: Paul B Mahol --- libavutil/Makefile | 1 + libavutil/avsscanf.c | 971 +++ libavutil/avstring.c | 1 + libavutil/avstring.h | 6 + 4 files changed, 979 insertions(+) create mode 100644 libavutil/avsscanf.c diff --git a/libavutil/Makefile b/libavutil/Makefile index 9ed24cfc82..27b548d7cf 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -94,6 +94,7 @@ OBJS = adler32.o \ aes_ctr.o\ audio_fifo.o \ avstring.o \ + avsscanf.o \ base64.o \ blowfish.o \ bprint.o \ diff --git a/libavutil/avsscanf.c b/libavutil/avsscanf.c new file mode 100644 index 00..7c61b860ae --- /dev/null +++ b/libavutil/avsscanf.c @@ -0,0 +1,971 @@ +/* + * Copyright (c) 2005-2014 Rich Felker, et al. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include +#include +#include +#include + +#include "config.h" +#include "common.h" +#include "mem.h" +#include "avassert.h" +#include "avstring.h" +#include "bprint.h" + +typedef struct FFFILE { +size_t buf_size; +unsigned char *buf; +unsigned char *rpos, *rend; +unsigned char *shend; +off_t shlim, shcnt; +void *cookie; +size_t (*read)(struct FFFILE *, unsigned char *, size_t); +} FFFILE; + +#define SIZE_hh -2 +#define SIZE_h -1 +#define SIZE_def 0 +#define SIZE_l 1 +#define SIZE_L 2 +#define SIZE_ll 3 + +#define shcnt(f) ((f)->shcnt + ((f)->rpos - (f)->buf)) + +static int fftoread(FFFILE *f) +{ +f->rpos = f->rend = f->buf + f->buf_size; +return 0; +} + +static size_t ffstring_read(FFFILE *f, unsigned char *buf, size_t len) +{ +char *src = f->cookie; +size_t k = len+256; +char *end = memchr(src, 0, k); + +if (end) k = end-src; +if (k < len) len = k; +memcpy(buf, src, len); +f->rpos = (void *)(src+len); +f->rend = (void *)(src+k); +f->cookie = src+k; + +return len; +} + +static int ffuflow(FFFILE *f) +{ +unsigned char c; +if (!fftoread(f) && f->read(f, &c, 1)==1) return c; +return EOF; +} + +static void ffshlim(FFFILE *f, off_t lim) +{ +f->shlim = lim; +f->shcnt = f->buf - f->rpos; +/* If lim is nonzero, rend must be a valid pointer. */ +if (lim && f->rend - f->rpos > lim) +f->shend = f->rpos + lim; +else +f->shend = f->rend; +} + +static int ffshgetc(FFFILE *f) +{ +int c; +off_t cnt = shcnt(f); +if (f->shlim && cnt >= f->shlim || (c=ffuflow(f)) < 0) { +f->shcnt = f->buf - f->rpos + cnt; +f->shend = 0; +return EOF; +} +cnt++; +if (f->shlim && f->rend - f->rpos > f->shlim - cnt) +f->shend = f->rpos + (f->shlim - cnt); +else +f->shend = f->rend; +f->shcnt = f->buf - f->rpos + cnt; +if (f->rpos[-1] != c) f->rpos[-1] = c; +return c; +} + +#define shlim(f, lim) ffshlim((f), (lim)) +#define shgetc(f) (((f)->rpos != (f)->shend) ? *(f)->rpos++ : ffshgetc(f)) +#define shunget(f) ((f)->shend ? (void)(f)->rpos-- : (void)0) + +static const unsigned char table[] = { -1, +-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, +-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, +-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, +0, 1, 2, 3, 4, 5, 6, 7, 8, 9,-1,-1,-1,-1,-1,-1, +-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24, +25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,
Re: [FFmpeg-devel] [RFC] ffmpeg: Improved the performance of 1:N for adaptive bitrate scenario.
On 11/12/2018 4:05 PM, Michael Niedermayer wrote: > On Mon, Nov 12, 2018 at 03:37:05PM -0300, James Almer wrote: >> On 11/12/2018 3:28 PM, Michael Niedermayer wrote: >>> On Sun, Nov 11, 2018 at 07:07:18PM +0800, Jun Zhao wrote: Improved the performance of 1 decode + N filter graphs and adaptive bitrate scenario. With new option "-abr_pipeline" 1. It enabled multiple filter graph concurrency, which bring above about 5%~20% improvement in some 1:N scenario by CPU or GPU acceleration 2. Next step will continue to improve the concurrency of complex filter graph which can support high efficiency of filter net Below are some test cases and test result as reference. (Hardware platform: Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz) (Software: Intel iHD driver - 16.9.00100, CentOS 7) Command for Intel GPU acceleration case, 1 decode to N scaling: ffmpeg -vaapi_device /dev/dri/renderD128 -hwaccel vaapi \ -hwaccel_output_format vaapi \ -i ~/Videos/1920x1080p_30.00_x264_qp28.h264 \ -vf "scale_vaapi=1280:720:format=nv12,hwdownload" \ -pix_fmt nv12 -f null /dev/null \ -vf "scale_vaapi=720:480:format=nv12,hwdownload" \ -pix_fmt nv12 -f null /dev/null \ -abr_pipeline test results: 2 scale Improved ~34% Command for CPU only 1 decode to N scaling: ffmpeg -i ~/Videos/1920x1080p_30.00_x264_qp28.h264 \ -vf "scale=1280:720" -pix_fmt nv12 -f null /dev/null \ -vf "scale=720:480" -pix_fmt nv12 -f null /dev/null \ -abr_pipeline test results: 2 scale Improved ~25% Command for 1:N transcode by GPU acceleration: ./ffmpeg -vaapi_device /dev/dri/renderD128 -hwaccel vaapi \ -hwaccel_output_format vaapi \ -i ~/Videos/1920x1080p_30.00_x264_qp28.h264 \ -vf "scale_vaapi=1280:720" -c:v h264_vaapi -f null /dev/null \ -vf "scale_vaapi=720:480" -c:v h264_vaapi -f null /dev/null \ -abr_pipeline test results: 2 scale+enc Improved ~6.1% Signed-off-by: Wang, Shaofei Signed-off-by: Jun Zhao --- fftools/ffmpeg.c| 236 --- fftools/ffmpeg.h| 12 +++ fftools/ffmpeg_filter.c |6 + fftools/ffmpeg_opt.c|6 +- 4 files changed, 246 insertions(+), 14 deletions(-) >>> >>> this breaks build for mingw64 >>> >>> CC fftools/ffmpeg_filter.o >>> CC fftools/ffmpeg.o >>> src/fftools/ffmpeg_filter.c: In function ‘init_simple_filtergraph’: >>> src/fftools/ffmpeg_filter.c:231:39: error: incompatible types when >>> assigning to type ‘pthread_t’ from type ‘int’ >>> ist->filters[i]->f_thread = 0; >>>^ >>> make: *** [fftools/ffmpeg_filter.o] Error 1 >>> make: *** Waiting for unfinished jobs >>> src/fftools/ffmpeg.c: In function ‘pipeline_reap_filters’: >>> src/fftools/ffmpeg.c:1534:5: warning: ISO C90 forbids mixed declarations >>> and code [-Wdeclaration-after-statement] >>> OutputStream *ost = output_streams[i]; >>> ^ >>> src/fftools/ffmpeg.c: In function ‘do_streamcopy’: >>> src/fftools/ffmpeg.c:2177:5: warning: ‘av_copy_packet_side_data’ is >>> deprecated (declared at src/libavcodec/avcodec.h:4423) >>> [-Wdeprecated-declarations] >>> av_copy_packet_side_data(&opkt, pkt); >>> ^ >>> src/fftools/ffmpeg.c: In function ‘filter_pipeline’: >>> src/fftools/ffmpeg.c:2405:5: warning: ‘return’ with no value, in function >>> returning non-void [enabled by default] >>> return; >>> ^ >>> src/fftools/ffmpeg.c: In function ‘send_frame_to_filters’: >>> src/fftools/ffmpeg.c:2444:42: error: invalid operands to binary == (have >>> ‘pthread_t’ and ‘int’) >>> if(ist->filters[i]->f_thread == 0) { >> >> How old is your mingw64 toolchain? It should be using the w32threads >> wrapper or some library like winpthreads, but it's not. > > IIRC its the mingw that came with the distribution which is still ubuntu 14.04 > It will get upgraded when i update ubuntu on that box. Yeah, a build that old is probably missing CONDITION_VARIABLE and/or INIT_ONCE, which are needed by the wrapper. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] lavu: add locale-independent sscanf implementation
On 11/12/2018 3:46 PM, Paul B Mahol wrote: > Copied and adopted from musl implementation. > * converted all 'long double' to 'double' > > Signed-off-by: Paul B Mahol > --- > libavutil/avstring.c | 961 +++ > libavutil/avstring.h | 6 + > 2 files changed, 967 insertions(+) > > diff --git a/libavutil/avstring.c b/libavutil/avstring.c > index f03dd25141..8511ea2c16 100644 > --- a/libavutil/avstring.c > +++ b/libavutil/avstring.c > @@ -19,6 +19,29 @@ > * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 > USA > */ > > +/* > + * Copyright (c) 2005-2014 Rich Felker, et al. > + * > + * Permission is hereby granted, free of charge, to any person obtaining > + * a copy of this software and associated documentation files (the > + * "Software"), to deal in the Software without restriction, including > + * without limitation the rights to use, copy, modify, merge, publish, > + * distribute, sublicense, and/or sell copies of the Software, and to > + * permit persons to whom the Software is furnished to do so, subject to > + * the following conditions: > + * > + * The above copyright notice and this permission notice shall be > + * included in all copies or substantial portions of the Software. > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, > + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF > + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. > + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY > + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, > + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE > + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. > + */ Since this is a crapload of new code, and this notice only applies to the new code in question, maybe this should be added as a separate file instead. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] lavu: add locale-independent sscanf implementation
On Mon, Nov 12, 2018 at 07:46:45PM +0100, Paul B Mahol wrote: > Copied and adopted from musl implementation. > * converted all 'long double' to 'double' > > Signed-off-by: Paul B Mahol > --- > libavutil/avstring.c | 961 +++ > libavutil/avstring.h | 6 + > 2 files changed, 967 insertions(+) [...] > +static int ff_vfscanf(FFFILE *f, const char *fmt, va_list ap) > +{ > +int width; > +int size; > +int base; > +const unsigned char *p; > +int c, t; > +char *s; > +void *dest=NULL; > +int invert; > +int matches=0; > +unsigned long long x; > +double y; > +off_t pos = 0; > +unsigned char scanset[257]; > +size_t i, k; > + > +for (p=(const unsigned char *)fmt; *p; p++) { > + > +if (av_isspace(*p)) { > +while (av_isspace(p[1])) p++; > +shlim(f, 0); > +while (av_isspace(shgetc(f))); > +shunget(f); > +pos += shcnt(f); > +continue; > +} > +if (*p != '%' || p[1] == '%') { > +shlim(f, 0); > +if (*p == '%') { > +p++; > +while (av_isspace((c=shgetc(f; > +} else { > +c = shgetc(f); > +} > +if (c!=*p) { > +shunget(f); > +if (c<0) goto input_fail; > +goto match_fail; > +} > +pos += shcnt(f); > +continue; > +} > + > +p++; > +if (*p=='*') { > +dest = 0; p++; > +} else if (av_isdigit(*p) && p[1]=='$') { > +dest = arg_n(ap, *p-'0'); p+=2; > +} else { > +dest = va_arg(ap, void *); > +} > + > +for (width=0; av_isdigit(*p); p++) { > +width = 10*width + *p - '0'; > +} > + > +if (*p=='m') { > +s = 0; > +p++; > +} > + > +size = SIZE_def; > +switch (*p++) { > +case 'h': > +if (*p == 'h') p++, size = SIZE_hh; > +else size = SIZE_h; > +break; > +case 'l': > +if (*p == 'l') p++, size = SIZE_ll; > +else size = SIZE_l; > +break; > +case 'j': > +size = SIZE_ll; > +break; > +case 'z': > +case 't': > +size = SIZE_l; > +break; > +case 'L': > +size = SIZE_L; > +break; > +case 'd': case 'i': case 'o': case 'u': case 'x': > +case 'a': case 'e': case 'f': case 'g': > +case 'A': case 'E': case 'F': case 'G': case 'X': > +case 's': case 'c': case '[': > +case 'S': case 'C': > +case 'p': case 'n': > +p--; > +break; > +default: > +goto fmt_fail; > +} > + > +t = *p; > + > +/* C or S */ > +if ((t&0x2f) == 3) { > +t |= 32; > +size = SIZE_l; > +} > + > +switch (t) { > +case 'c': > +if (width < 1) width = 1; > +case '[': > +break; > +case 'n': > +store_int(dest, size, pos); > +/* do not increment match count, etc! */ > +continue; > +default: > +shlim(f, 0); > +while (av_isspace(shgetc(f))); > +shunget(f); > +pos += shcnt(f); > +} > + > +shlim(f, width); > +if (shgetc(f) < 0) goto input_fail; > +shunget(f); > + > +switch (t) { > +case 's': > +case 'c': > +case '[': > +if (t == 'c' || t == 's') { > +memset(scanset, -1, sizeof scanset); > +scanset[0] = 0; > +if (t == 's') { > +scanset[1+'\t'] = 0; > +scanset[1+'\n'] = 0; > +scanset[1+'\v'] = 0; > +scanset[1+'\f'] = 0; > +scanset[1+'\r'] = 0; > +scanset[1+' '] = 0; > +} > +} else { > +if (*++p == '^') p++, invert = 1; > +else invert = 0; > +memset(scanset, invert, sizeof scanset); > +scanset[0] = 0; > +if (*p == '-') p++, scanset[1+'-'] = 1-invert; > +else if (*p == ']') p++, scanset[1+']'] = 1-invert; > +for (; *p != ']'; p++) { > +if (!*p) goto fmt_fail; > +if (*p=='-' && p[1] && p[1] != ']') > +for (c=p++[-1]; c<*p; c++) > +scanset[1+c] = 1-invert; > +scanset[1+*p] = 1-invert; > +} > +} > +
Re: [FFmpeg-devel] [RFC] ffmpeg: Improved the performance of 1:N for adaptive bitrate scenario.
On Mon, Nov 12, 2018 at 03:37:05PM -0300, James Almer wrote: > On 11/12/2018 3:28 PM, Michael Niedermayer wrote: > > On Sun, Nov 11, 2018 at 07:07:18PM +0800, Jun Zhao wrote: > >> Improved the performance of 1 decode + N filter graphs and adaptive > >> bitrate scenario. > >> > >> With new option "-abr_pipeline" > >> 1. It enabled multiple filter graph concurrency, which bring above > >> about 5%~20% improvement in some 1:N scenario by CPU or GPU > >> acceleration > >> 2. Next step will continue to improve the concurrency of complex > >> filter graph which can support high efficiency of filter net > >> > >> Below are some test cases and test result as reference. > >> (Hardware platform: Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz) > >> (Software: Intel iHD driver - 16.9.00100, CentOS 7) > >> > >> Command for Intel GPU acceleration case, 1 decode to N scaling: > >> ffmpeg -vaapi_device /dev/dri/renderD128 -hwaccel vaapi \ > >> -hwaccel_output_format vaapi \ > >> -i ~/Videos/1920x1080p_30.00_x264_qp28.h264 \ > >> -vf "scale_vaapi=1280:720:format=nv12,hwdownload" \ > >> -pix_fmt nv12 -f null /dev/null \ > >> -vf "scale_vaapi=720:480:format=nv12,hwdownload" \ > >> -pix_fmt nv12 -f null /dev/null \ > >> -abr_pipeline > >> > >> test results: > >> 2 scale > >> Improved ~34% > >> > >> Command for CPU only 1 decode to N scaling: > >> ffmpeg -i ~/Videos/1920x1080p_30.00_x264_qp28.h264 \ > >> -vf "scale=1280:720" -pix_fmt nv12 -f null /dev/null \ > >> -vf "scale=720:480" -pix_fmt nv12 -f null /dev/null \ > >> -abr_pipeline > >> > >> test results: > >> 2 scale > >> Improved ~25% > >> > >> Command for 1:N transcode by GPU acceleration: > >> ./ffmpeg -vaapi_device /dev/dri/renderD128 -hwaccel vaapi \ > >> -hwaccel_output_format vaapi \ > >> -i ~/Videos/1920x1080p_30.00_x264_qp28.h264 \ > >> -vf "scale_vaapi=1280:720" -c:v h264_vaapi -f null /dev/null \ > >> -vf "scale_vaapi=720:480" -c:v h264_vaapi -f null /dev/null \ > >> -abr_pipeline > >> > >> test results: > >> 2 scale+enc > >> Improved ~6.1% > >> > >> Signed-off-by: Wang, Shaofei > >> Signed-off-by: Jun Zhao > >> --- > >> fftools/ffmpeg.c| 236 > >> --- > >> fftools/ffmpeg.h| 12 +++ > >> fftools/ffmpeg_filter.c |6 + > >> fftools/ffmpeg_opt.c|6 +- > >> 4 files changed, 246 insertions(+), 14 deletions(-) > > > > this breaks build for mingw64 > > > > CC fftools/ffmpeg_filter.o > > CC fftools/ffmpeg.o > > src/fftools/ffmpeg_filter.c: In function ‘init_simple_filtergraph’: > > src/fftools/ffmpeg_filter.c:231:39: error: incompatible types when > > assigning to type ‘pthread_t’ from type ‘int’ > > ist->filters[i]->f_thread = 0; > >^ > > make: *** [fftools/ffmpeg_filter.o] Error 1 > > make: *** Waiting for unfinished jobs > > src/fftools/ffmpeg.c: In function ‘pipeline_reap_filters’: > > src/fftools/ffmpeg.c:1534:5: warning: ISO C90 forbids mixed declarations > > and code [-Wdeclaration-after-statement] > > OutputStream *ost = output_streams[i]; > > ^ > > src/fftools/ffmpeg.c: In function ‘do_streamcopy’: > > src/fftools/ffmpeg.c:2177:5: warning: ‘av_copy_packet_side_data’ is > > deprecated (declared at src/libavcodec/avcodec.h:4423) > > [-Wdeprecated-declarations] > > av_copy_packet_side_data(&opkt, pkt); > > ^ > > src/fftools/ffmpeg.c: In function ‘filter_pipeline’: > > src/fftools/ffmpeg.c:2405:5: warning: ‘return’ with no value, in function > > returning non-void [enabled by default] > > return; > > ^ > > src/fftools/ffmpeg.c: In function ‘send_frame_to_filters’: > > src/fftools/ffmpeg.c:2444:42: error: invalid operands to binary == (have > > ‘pthread_t’ and ‘int’) > > if(ist->filters[i]->f_thread == 0) { > > How old is your mingw64 toolchain? It should be using the w32threads > wrapper or some library like winpthreads, but it's not. IIRC its the mingw that came with the distribution which is still ubuntu 14.04 It will get upgraded when i update ubuntu on that box. [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Good people do not need laws to tell them to act responsibly, while bad people will find a way around the laws. -- Plato signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] lavu: add locale-independent sscanf implementation
Copied and adopted from musl implementation. * converted all 'long double' to 'double' Signed-off-by: Paul B Mahol --- libavutil/avstring.c | 961 +++ libavutil/avstring.h | 6 + 2 files changed, 967 insertions(+) diff --git a/libavutil/avstring.c b/libavutil/avstring.c index f03dd25141..8511ea2c16 100644 --- a/libavutil/avstring.c +++ b/libavutil/avstring.c @@ -19,6 +19,29 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +/* + * Copyright (c) 2005-2014 Rich Felker, et al. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + #include #include #include @@ -30,6 +53,7 @@ #include "avassert.h" #include "avstring.h" #include "bprint.h" +#include "float.h" int av_strstart(const char *str, const char *pfx, const char **ptr) { @@ -458,3 +482,940 @@ int av_match_list(const char *name, const char *list, char separator) return 0; } + +typedef struct FFFILE { +size_t buf_size; +unsigned char *buf; +unsigned char *rpos, *rend; +unsigned char *shend; +off_t shlim, shcnt; +void *cookie; +size_t (*read)(struct FFFILE *, unsigned char *, size_t); +} FFFILE; + +#define SIZE_hh -2 +#define SIZE_h -1 +#define SIZE_def 0 +#define SIZE_l 1 +#define SIZE_L 2 +#define SIZE_ll 3 + +#define shcnt(f) ((f)->shcnt + ((f)->rpos - (f)->buf)) + +static int fftoread(FFFILE *f) +{ +f->rpos = f->rend = f->buf + f->buf_size; +return 0; +} + +static size_t ffstring_read(FFFILE *f, unsigned char *buf, size_t len) +{ +char *src = f->cookie; +size_t k = len+256; +char *end = memchr(src, 0, k); + +if (end) k = end-src; +if (k < len) len = k; +memcpy(buf, src, len); +f->rpos = (void *)(src+len); +f->rend = (void *)(src+k); +f->cookie = src+k; + +return len; +} + +static int ffuflow(FFFILE *f) +{ +unsigned char c; +if (!fftoread(f) && f->read(f, &c, 1)==1) return c; +return EOF; +} + +static void ffshlim(FFFILE *f, off_t lim) +{ +f->shlim = lim; +f->shcnt = f->buf - f->rpos; +/* If lim is nonzero, rend must be a valid pointer. */ +if (lim && f->rend - f->rpos > lim) +f->shend = f->rpos + lim; +else +f->shend = f->rend; +} + +static int ffshgetc(FFFILE *f) +{ +int c; +off_t cnt = shcnt(f); +if (f->shlim && cnt >= f->shlim || (c=ffuflow(f)) < 0) { +f->shcnt = f->buf - f->rpos + cnt; +f->shend = 0; +return EOF; +} +cnt++; +if (f->shlim && f->rend - f->rpos > f->shlim - cnt) +f->shend = f->rpos + (f->shlim - cnt); +else +f->shend = f->rend; +f->shcnt = f->buf - f->rpos + cnt; +if (f->rpos[-1] != c) f->rpos[-1] = c; +return c; +} + +#define shlim(f, lim) ffshlim((f), (lim)) +#define shgetc(f) (((f)->rpos != (f)->shend) ? *(f)->rpos++ : ffshgetc(f)) +#define shunget(f) ((f)->shend ? (void)(f)->rpos-- : (void)0) + +static const unsigned char table[] = { -1, +-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, +-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, +-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, +0, 1, 2, 3, 4, 5, 6, 7, 8, 9,-1,-1,-1,-1,-1,-1, +-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24, +25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1, +-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24, +25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1, +-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, +-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, +-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, +-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, +-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, +-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, +-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, +-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, +}; + +static unsigned long long ffintscan(FFFILE *f, unsigned base, int pok, unsigned long long lim) +{ +
[FFmpeg-devel] [PATCH] avcodec/libvpxenc: add VP8 temporal scalability configuration options
Thanks for the suggestion. I have updated the patch. Ard --- doc/encoders.texi | 28 +++ libavcodec/libvpxenc.c | 79 ++ 2 files changed, 107 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index 899faac49b..6ecd572ea3 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -1654,6 +1654,34 @@ Set number of frames to look ahead for frametype and ratecontrol. @item error-resilient Enable error resiliency features. +@item VP8-specific options +@table @option +@item ts-parameters +Sets the temporal scalability configuration using a :-separated list of +key=value pairs. For example, to specify temporal scalability parameters +with @code{ffmpeg}: +@example +ffmpeg -i INPUT -c:v libvpx -ts-parameters ts_number_layers=3:\ +ts_target_bitrate=25,50,100:ts_rate_decimator=4,2,1:\ +ts_periodicity=4:ts_layer_id=0,2,1,2 OUTPUT +@end example +Below is a brief explanation of each of the parameters, please +refer to @code{struct vpx_codec_enc_cfg} in @code{vpx/vpx_encoder.h} for more +details. +@table @option +@item ts_number_layers +Number of temporal coding layers. +@item ts_target_bitrate +Target bitrate for each temporal layer. +@item ts_rate_decimator +Frame rate decimation factor for each temporal layer. +@item ts_periodicity +Length of the sequence defining frame temporal layer membership. +@item ts_layer_id +Template defining the membership of frames to temporal layers. +@end table +@end table + @item VP9-specific options @table @option @item lossless diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index 09f7a88452..161f952d65 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -33,6 +33,7 @@ #include "libavutil/avassert.h" #include "libvpx.h" #include "profiles.h" +#include "libavutil/avstring.h" #include "libavutil/base64.h" #include "libavutil/common.h" #include "libavutil/internal.h" @@ -98,6 +99,8 @@ typedef struct VPxEncoderContext { int rc_undershoot_pct; int rc_overshoot_pct; +char *vp8_ts_parameters; + // VP9-only int lossless; int tile_columns; @@ -165,6 +168,7 @@ static av_cold void dump_enc_cfg(AVCodecContext *avctx, { int width = -30; int level = AV_LOG_DEBUG; +int i; av_log(avctx, level, "vpx_codec_enc_cfg\n"); av_log(avctx, level, "generic settings\n" @@ -204,6 +208,25 @@ static av_cold void dump_enc_cfg(AVCodecContext *avctx, " %*s%u\n %*s%u\n", width, "rc_undershoot_pct:", cfg->rc_undershoot_pct, width, "rc_overshoot_pct:", cfg->rc_overshoot_pct); +av_log(avctx, level, "temporal layering settings\n" + " %*s%u\n", width, "ts_number_layers:", cfg->ts_number_layers); +av_log(avctx, level, + "\n %*s", width, "ts_target_bitrate:"); +for (i = 0; i < VPX_TS_MAX_LAYERS; i++) +av_log(avctx, level, "%u ", cfg->ts_target_bitrate[i]); +av_log(avctx, level, "\n"); +av_log(avctx, level, + "\n %*s", width, "ts_rate_decimator:"); +for (i = 0; i < VPX_TS_MAX_LAYERS; i++) +av_log(avctx, level, "%u ", cfg->ts_rate_decimator[i]); +av_log(avctx, level, "\n"); +av_log(avctx, level, + "\n %*s%u\n", width, "ts_periodicity:", cfg->ts_periodicity); +av_log(avctx, level, + "\n %*s", width, "ts_layer_id:"); +for (i = 0; i < VPX_TS_MAX_PERIODICITY; i++) +av_log(avctx, level, "%u ", cfg->ts_layer_id[i]); +av_log(avctx, level, "\n"); av_log(avctx, level, "decoder buffer model\n" " %*s%u\n %*s%u\n %*s%u\n", width, "rc_buf_sz:", cfg->rc_buf_sz, @@ -321,6 +344,39 @@ static av_cold int vpx_free(AVCodecContext *avctx) return 0; } +static void vp8_ts_parse_int_array(int* dest, char *value, size_t value_len, int max_entries) +{ +int dest_idx = 0; +char *value_end = value + value_len; +while (value < value_end && dest_idx < max_entries) { +dest[dest_idx] = strtoul(value, &value, 10); +while (value < value_end && (*value == ',' || av_isspace(*value))) +value++; +dest_idx++; +} +} + +static int vp8_ts_param_parse(struct vpx_codec_enc_cfg *enccfg, char *key, char *value) +{ +size_t value_len = strlen(value); + +if (!value_len) +return -1; + +if (!strcmp(key, "ts_number_layers")) +enccfg->ts_number_layers = strtoul(value, &value, 10); +else if (!strcmp(key, "ts_target_bitrate")) +vp8_ts_parse_int_array(enccfg->ts_target_bitrate, value, value_len, VPX_TS_MAX_LAYERS); +else if (!strcmp(key, "ts_rate_decimator")) + vp8_ts_parse_int_array(enccfg->ts_rate_decimator, value, value_len, VPX_TS_MAX_LAYERS); +else if (!strcmp(key, "ts_periodicity")) +enccfg->ts_periodicity = strtoul(value, &value, 10); +else if (!strcmp(key, "ts_layer_id")) +vp8_ts_parse_int_array(enccfg->ts_layer_id, value, value_len, VPX_TS_MAX_PERIODICITY)
Re: [FFmpeg-devel] [RFC] ffmpeg: Improved the performance of 1:N for adaptive bitrate scenario.
On 11/12/2018 3:28 PM, Michael Niedermayer wrote: > On Sun, Nov 11, 2018 at 07:07:18PM +0800, Jun Zhao wrote: >> Improved the performance of 1 decode + N filter graphs and adaptive >> bitrate scenario. >> >> With new option "-abr_pipeline" >> 1. It enabled multiple filter graph concurrency, which bring above >> about 5%~20% improvement in some 1:N scenario by CPU or GPU >> acceleration >> 2. Next step will continue to improve the concurrency of complex >> filter graph which can support high efficiency of filter net >> >> Below are some test cases and test result as reference. >> (Hardware platform: Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz) >> (Software: Intel iHD driver - 16.9.00100, CentOS 7) >> >> Command for Intel GPU acceleration case, 1 decode to N scaling: >> ffmpeg -vaapi_device /dev/dri/renderD128 -hwaccel vaapi \ >> -hwaccel_output_format vaapi \ >> -i ~/Videos/1920x1080p_30.00_x264_qp28.h264 \ >> -vf "scale_vaapi=1280:720:format=nv12,hwdownload" \ >> -pix_fmt nv12 -f null /dev/null \ >> -vf "scale_vaapi=720:480:format=nv12,hwdownload" \ >> -pix_fmt nv12 -f null /dev/null \ >> -abr_pipeline >> >> test results: >> 2 scale >> Improved ~34% >> >> Command for CPU only 1 decode to N scaling: >> ffmpeg -i ~/Videos/1920x1080p_30.00_x264_qp28.h264 \ >> -vf "scale=1280:720" -pix_fmt nv12 -f null /dev/null \ >> -vf "scale=720:480" -pix_fmt nv12 -f null /dev/null \ >> -abr_pipeline >> >> test results: >> 2 scale >> Improved ~25% >> >> Command for 1:N transcode by GPU acceleration: >> ./ffmpeg -vaapi_device /dev/dri/renderD128 -hwaccel vaapi \ >> -hwaccel_output_format vaapi \ >> -i ~/Videos/1920x1080p_30.00_x264_qp28.h264 \ >> -vf "scale_vaapi=1280:720" -c:v h264_vaapi -f null /dev/null \ >> -vf "scale_vaapi=720:480" -c:v h264_vaapi -f null /dev/null \ >> -abr_pipeline >> >> test results: >> 2 scale+enc >> Improved ~6.1% >> >> Signed-off-by: Wang, Shaofei >> Signed-off-by: Jun Zhao >> --- >> fftools/ffmpeg.c| 236 >> --- >> fftools/ffmpeg.h| 12 +++ >> fftools/ffmpeg_filter.c |6 + >> fftools/ffmpeg_opt.c|6 +- >> 4 files changed, 246 insertions(+), 14 deletions(-) > > this breaks build for mingw64 > > CCfftools/ffmpeg_filter.o > CCfftools/ffmpeg.o > src/fftools/ffmpeg_filter.c: In function ‘init_simple_filtergraph’: > src/fftools/ffmpeg_filter.c:231:39: error: incompatible types when assigning > to type ‘pthread_t’ from type ‘int’ > ist->filters[i]->f_thread = 0; >^ > make: *** [fftools/ffmpeg_filter.o] Error 1 > make: *** Waiting for unfinished jobs > src/fftools/ffmpeg.c: In function ‘pipeline_reap_filters’: > src/fftools/ffmpeg.c:1534:5: warning: ISO C90 forbids mixed declarations and > code [-Wdeclaration-after-statement] > OutputStream *ost = output_streams[i]; > ^ > src/fftools/ffmpeg.c: In function ‘do_streamcopy’: > src/fftools/ffmpeg.c:2177:5: warning: ‘av_copy_packet_side_data’ is > deprecated (declared at src/libavcodec/avcodec.h:4423) > [-Wdeprecated-declarations] > av_copy_packet_side_data(&opkt, pkt); > ^ > src/fftools/ffmpeg.c: In function ‘filter_pipeline’: > src/fftools/ffmpeg.c:2405:5: warning: ‘return’ with no value, in function > returning non-void [enabled by default] > return; > ^ > src/fftools/ffmpeg.c: In function ‘send_frame_to_filters’: > src/fftools/ffmpeg.c:2444:42: error: invalid operands to binary == (have > ‘pthread_t’ and ‘int’) > if(ist->filters[i]->f_thread == 0) { How old is your mingw64 toolchain? It should be using the w32threads wrapper or some library like winpthreads, but it's not. In any case, the issue is a missing #if HAVE_THREADS check for the newly added ffmpeg.h fields. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [RFC] ffmpeg: Improved the performance of 1:N for adaptive bitrate scenario.
On Sun, Nov 11, 2018 at 07:07:18PM +0800, Jun Zhao wrote: > Improved the performance of 1 decode + N filter graphs and adaptive > bitrate scenario. > > With new option "-abr_pipeline" > 1. It enabled multiple filter graph concurrency, which bring above > about 5%~20% improvement in some 1:N scenario by CPU or GPU > acceleration > 2. Next step will continue to improve the concurrency of complex > filter graph which can support high efficiency of filter net > > Below are some test cases and test result as reference. > (Hardware platform: Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz) > (Software: Intel iHD driver - 16.9.00100, CentOS 7) > > Command for Intel GPU acceleration case, 1 decode to N scaling: > ffmpeg -vaapi_device /dev/dri/renderD128 -hwaccel vaapi \ > -hwaccel_output_format vaapi \ > -i ~/Videos/1920x1080p_30.00_x264_qp28.h264 \ > -vf "scale_vaapi=1280:720:format=nv12,hwdownload" \ > -pix_fmt nv12 -f null /dev/null \ > -vf "scale_vaapi=720:480:format=nv12,hwdownload" \ > -pix_fmt nv12 -f null /dev/null \ > -abr_pipeline > > test results: > 2 scale > Improved ~34% > > Command for CPU only 1 decode to N scaling: > ffmpeg -i ~/Videos/1920x1080p_30.00_x264_qp28.h264 \ > -vf "scale=1280:720" -pix_fmt nv12 -f null /dev/null \ > -vf "scale=720:480" -pix_fmt nv12 -f null /dev/null \ > -abr_pipeline > > test results: > 2 scale > Improved ~25% > > Command for 1:N transcode by GPU acceleration: > ./ffmpeg -vaapi_device /dev/dri/renderD128 -hwaccel vaapi \ > -hwaccel_output_format vaapi \ > -i ~/Videos/1920x1080p_30.00_x264_qp28.h264 \ > -vf "scale_vaapi=1280:720" -c:v h264_vaapi -f null /dev/null \ > -vf "scale_vaapi=720:480" -c:v h264_vaapi -f null /dev/null \ > -abr_pipeline > > test results: > 2 scale+enc > Improved ~6.1% > > Signed-off-by: Wang, Shaofei > Signed-off-by: Jun Zhao > --- > fftools/ffmpeg.c| 236 > --- > fftools/ffmpeg.h| 12 +++ > fftools/ffmpeg_filter.c |6 + > fftools/ffmpeg_opt.c|6 +- > 4 files changed, 246 insertions(+), 14 deletions(-) this breaks build for mingw64 CC fftools/ffmpeg_filter.o CC fftools/ffmpeg.o src/fftools/ffmpeg_filter.c: In function ‘init_simple_filtergraph’: src/fftools/ffmpeg_filter.c:231:39: error: incompatible types when assigning to type ‘pthread_t’ from type ‘int’ ist->filters[i]->f_thread = 0; ^ make: *** [fftools/ffmpeg_filter.o] Error 1 make: *** Waiting for unfinished jobs src/fftools/ffmpeg.c: In function ‘pipeline_reap_filters’: src/fftools/ffmpeg.c:1534:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] OutputStream *ost = output_streams[i]; ^ src/fftools/ffmpeg.c: In function ‘do_streamcopy’: src/fftools/ffmpeg.c:2177:5: warning: ‘av_copy_packet_side_data’ is deprecated (declared at src/libavcodec/avcodec.h:4423) [-Wdeprecated-declarations] av_copy_packet_side_data(&opkt, pkt); ^ src/fftools/ffmpeg.c: In function ‘filter_pipeline’: src/fftools/ffmpeg.c:2405:5: warning: ‘return’ with no value, in function returning non-void [enabled by default] return; ^ src/fftools/ffmpeg.c: In function ‘send_frame_to_filters’: src/fftools/ffmpeg.c:2444:42: error: invalid operands to binary == (have ‘pthread_t’ and ‘int’) if(ist->filters[i]->f_thread == 0) { ^ src/fftools/ffmpeg.c: In function ‘init_output_stream’: src/fftools/ffmpeg.c:3747:9: warning: ‘avcodec_copy_context’ is deprecated (declared at src/libavcodec/avcodec.h:4195) [-Wdeprecated-declarations] ret = avcodec_copy_context(ost->st->codec, ost->enc_ctx); ^ src/fftools/ffmpeg.c:3747:9: warning: ‘codec’ is deprecated (declared at src/libavformat/avformat.h:878) [-Wdeprecated-declarations] src/fftools/ffmpeg.c:3793:9: warning: ‘codec’ is deprecated (declared at src/libavformat/avformat.h:878) [-Wdeprecated-declarations] ost->st->codec->codec= ost->enc_ctx->codec; ^ src/fftools/ffmpeg.c: In function ‘check_keyboard_interaction’: src/fftools/ffmpeg.c:4174:13: warning: ‘codec’ is deprecated (declared at src/libavformat/avformat.h:878) [-Wdeprecated-declarations] debug = input_streams[0]->st->codec->debug<<1; ^ src/fftools/ffmpeg.c:4197:13: warning: ‘codec’ is deprecated (declared at src/libavformat/avformat.h:878) [-Wdeprecated-declarations] input_streams[i]->st->codec->debug = debug; ^ make: *** [fftools/ffmpeg.o] Error 1 [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Those who are too smart to engage in politics are punished by being governed by those who are dumber. -- Plato signature.asc Description: PGP signature _
Re: [FFmpeg-devel] [PATCH] ffmpeg: Add option to force a specific decode format
> -Original Message- > From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of Mark > Thompson > Sent: Sunday, November 11, 2018 6:55 AM > To: ffmpeg-devel@ffmpeg.org > Subject: [FFmpeg-devel] [PATCH] ffmpeg: Add option to force a specific decode > format > > Fixes #7519. > --- > I've had this lying around for a bit with intent to use it to support > non-hwaccel hardware decoders (in particular, v4l2m2m), but it > actually fixes the force-hwaccel use-case too in a sensible way. > > > doc/ffmpeg.texi | 12 > fftools/ffmpeg.c | 4 > fftools/ffmpeg.h | 4 > fftools/ffmpeg_opt.c | 15 +++ > 4 files changed, 35 insertions(+) > > diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi > index 3717f22d42..9f9e693898 100644 > --- a/doc/ffmpeg.texi > +++ b/doc/ffmpeg.texi > @@ -920,6 +920,18 @@ would be more efficient. > When doing stream copy, copy also non-key frames found at the > beginning. > > +@item -decode_format[:@var{stream_specifier}] @var{pixfmt} > (@emph{input,per-stream}) > +Set the output format to be used by the decoder for this stream. If the > +decoder does not natively support this format for the input stream then > +decoding will fail rather than continuing with a different format. > + > +In general this should not be set - the decoder will select an output > +format based on the input stream parameters and available components, and > +that will be automatically converted to whatever the output requires. It > +may be useful to force a hardware decoder supporting output in multiple > +different memory types to pick the desired one, or to ensure that a > +hardware decoder is used when software fallback is also available. > + > @item -init_hw_device > @var{type}[=@var{name}][:@var{device}[,@var{key=value}...]] > Initialise a new hardware device of type @var{type} called @var{name}, using > the > given device parameters. > diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c > index 38c21e944a..73bed55e4d 100644 > --- a/fftools/ffmpeg.c > +++ b/fftools/ffmpeg.c > @@ -2800,6 +2800,10 @@ static enum AVPixelFormat get_format(AVCodecContext > *s, const enum AVPixelFormat > const AVCodecHWConfig *config = NULL; > int i; > > +if (ist->decode_format != AV_PIX_FMT_NONE && > +ist->decode_format != *p) > +continue; > + > if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) > break; > > diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h > index eb1eaf6363..88e0aa60ea 100644 > --- a/fftools/ffmpeg.h > +++ b/fftools/ffmpeg.h > @@ -125,6 +125,8 @@ typedef struct OptionsContext { > intnb_ts_scale; > SpecifierOpt *dump_attachment; > intnb_dump_attachment; > +SpecifierOpt *decode_formats; > +intnb_decode_formats; > SpecifierOpt *hwaccels; > intnb_hwaccels; > SpecifierOpt *hwaccel_devices; > @@ -334,6 +336,8 @@ typedef struct InputStream { > int top_field_first; > int guess_layout_max; > > +enum AVPixelFormat decode_format; > + > int autorotate; > > int fix_sub_duration; > diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c > index d4851a2cd8..0e3e8b99fe 100644 > --- a/fftools/ffmpeg_opt.c > +++ b/fftools/ffmpeg_opt.c > @@ -701,6 +701,7 @@ static void add_input_streams(OptionsContext *o, > AVFormatContext *ic) > AVStream *st = ic->streams[i]; > AVCodecParameters *par = st->codecpar; > InputStream *ist = av_mallocz(sizeof(*ist)); > +char *decode_format = NULL; > char *framerate = NULL, *hwaccel_device = NULL; > const char *hwaccel = NULL; > char *hwaccel_output_format = NULL; > @@ -797,6 +798,17 @@ static void add_input_streams(OptionsContext *o, > AVFormatContext *ic) > ist->top_field_first = -1; > MATCH_PER_STREAM_OPT(top_field_first, i, ist->top_field_first, > ic, st); > > +MATCH_PER_STREAM_OPT(decode_formats, str, decode_format, ic, st); > +if (decode_format) { > +ist->decode_format = av_get_pix_fmt(decode_format); > +if (ist->decode_format == AV_PIX_FMT_NONE) { > +av_log(NULL, AV_LOG_FATAL, "Unrecognised decode format: > %s", > + decode_format); > +} > +} else { > +ist->decode_format = AV_PIX_FMT_NONE; > +} > + > MATCH_PER_STREAM_OPT(hwaccels, str, hwaccel, ic, st); > if (hwaccel) { > // The NVDEC hwaccels use a CUDA device, so remap the name > here. > @@ -3583,6 +3595,9 @@ const OptionDef options[] = { > "audio bitrate (please use -b:a)", "bitrate" }, > { "b",OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, > { .func_arg = opt_bitrate }, > "video bitrate (please use -b:v)", "bitrate" }, > +{ "decode_format", OPT_VIDEO | OPT_STRIN
[FFmpeg-devel] [PATCH] avcodec/huffyuvenc: add support for gbrp16
Signed-off-by: Paul B Mahol --- Funny thing is that support was already there, just encoder missed pixel format. --- libavcodec/huffyuvenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/huffyuvenc.c b/libavcodec/huffyuvenc.c index 8be752844b..3662c173ec 100644 --- a/libavcodec/huffyuvenc.c +++ b/libavcodec/huffyuvenc.c @@ -1118,7 +1118,7 @@ AVCodec ff_ffvhuff_encoder = { AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV411P, AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV440P, AV_PIX_FMT_GBRP, -AV_PIX_FMT_GBRP9, AV_PIX_FMT_GBRP10, AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRP14, +AV_PIX_FMT_GBRP9, AV_PIX_FMT_GBRP10, AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRP14, AV_PIX_FMT_GBRP16, AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY16, AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA444P, AV_PIX_FMT_GBRAP, -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/libopenh264enc: fix class_name
On Mon, Nov 12, 2018 at 6:11 PM Tobias Rapp wrote: > > Reverts some accidental change in commit > e621b1ca646a2f268797adc3194b694a852548d2. > > Signed-off-by: Tobias Rapp > --- > libavcodec/libopenh264enc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c > index 5baa423..ae6d17c 100644 > --- a/libavcodec/libopenh264enc.c > +++ b/libavcodec/libopenh264enc.c > @@ -75,7 +75,7 @@ static const AVOption options[] = { > }; > > static const AVClass class = { > -.class_name = "libvo_amrwbenc", > +.class_name = "libopenh264enc", > .item_name = av_default_item_name, > .option = options, > .version= LIBAVUTIL_VERSION_INT, > -- Looking at the file name, definitely LGTM (also checked the history and this is what the string used to be). Jan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avcodec/libopenh264enc: fix class_name
Reverts some accidental change in commit e621b1ca646a2f268797adc3194b694a852548d2. Signed-off-by: Tobias Rapp --- libavcodec/libopenh264enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c index 5baa423..ae6d17c 100644 --- a/libavcodec/libopenh264enc.c +++ b/libavcodec/libopenh264enc.c @@ -75,7 +75,7 @@ static const AVOption options[] = { }; static const AVClass class = { -.class_name = "libvo_amrwbenc", +.class_name = "libopenh264enc", .item_name = av_default_item_name, .option = options, .version= LIBAVUTIL_VERSION_INT, -- 2.7.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v3 1/1] avcodec: implemented Media Foundation encoder wrapper
2018-11-12 14:42 GMT+01:00, Paweł Wegner : > Implemented the following encoders: > * ff_h264_mf_encoder > * ff_hevc_mf_encoder > * ff_aac_mf_encoder > * ff_ac3_mf_encoder > * ff_mp3_mf_encoder > > The code is based on the PLEX's FFmpeg fork which can be found here: > https://files.plexapp.com/elan/ffmpeg/plex-ffmpeg-2017-12-17.txz You don't have to remove this link but if you are not the original author of this patch, please add the name(s) of the original author to the commit message. Weren't you already told this? Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v3 1/1] avcodec: implemented Media Foundation encoder wrapper
2018-11-12 14:42 GMT+01:00, Paweł Wegner : > +case AV_CODEC_ID_MSMPEG4V1: > +case AV_CODEC_ID_MSMPEG4V2: return &ff_MFVideoFormat_MP42; This looks unexpected: Is v1 encoding really still supported? > +case AV_CODEC_ID_MP1: return &MFAudioFormat_MPEG; > +case AV_CODEC_ID_MP2: return &MFAudioFormat_MPEG; This looks wrong, mp1 and mp2 are not the same. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 0/4] Level 1b in h264_levels and h264_metadata
There are currently several issues with level 1b in h264_levels and h264_metadata: 1. The most obvious is that the table in h264_levels.c is simply wrong: The level_idc for 1b and profile 66, 77 or 88 is 11, not 10. The first patch corrects this. 2. If profile is 66, 77 or 88 and one lets h264_metadata guess the level and if the guess is 1b, then it currently simply writes the level_idc corresponding to this profile; it does not set the sps->constraint_set3_flag. If the standard used the current table, then this meant that some tracks that should be set to 1b would be set to 1, a level too low; with the corrected table it means that a track guessed to be 1b will be set to 1.1, a level higher than 1b. (Both of this presumes that constraint_set3_flag wasn't already set.) 3. If the profile is 66, 77 or 88 and one lets h264_metadata set the level to the level that shares the level_idc with 1b, but isn't 1b, then it might be that the end result is nevertheless declared to be 1b: If constraint_set3_flag was set at the beginning, it isn't unset. If the new level has a different level_idc than 1b, then this implies that the output uses a level/profile/constraint_set3_flag combination that is reserved by ITU-T|ISO/IEC. Not good. There are also two more patches included: 4. ff_h264_get_level currently does not give a correct result when used with any of the High intra profiles: One either gets level 1b (when the level_idc provided coincides with the level_idc of level 1b; notice that this is the wrong answer in this case) or nothing (all other cases). The function can simply be changed to give the correct answer in all cases except when the input has is one of the High intra flavours whose level_idc happens to agree with the level_idc of level 1b (for profiles 66, 77 and 88), i.e. with 11. This remaining case is unfixable given that the arguments to the functions do not contain the profile. 5. If the bitstream_restriction-block in the VUI is absent and it is not one of the intra-profiles, then max_dec_frame_buffering is currently inferred to be H264_MAX_DPB_FRAMES, i.e. 16. This is wrong (the value to infer depends upon the level and the DPB size). But this makes ff_h264_guess_level very cautious: It only guesses levels so high that 16 frames fit into the DPB. I am not saying that being cautious is wrong, but relying on a faulty parsing is. Instead my last patch explicitly uses H264_MAX_DPB_FRAMES when max_dec_frame_buffering is only inferred (if one wants to change the level, then it is likely that something is wrong with the level so that it doesn't make sense to use a value inferred from the old level to guess the new level). Andreas Rheinhardt (4): h264_levels,h264_metadata_bsf: Fix levels typo h264_levels: Make get_level intra-profile friendly h264_metadata: Fix handling of level 1b h264_metadata: Don't use inferred value of buffering frames libavcodec/h264_levels.c | 6 +++--- libavcodec/h264_metadata_bsf.c | 27 ++- 2 files changed, 25 insertions(+), 8 deletions(-) -- 2.19.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/4] h264_levels: Make get_level intra-profile friendly
Currently ff_h264_get_level does not provide the correct level for any of the High Intra profiles. Now only High Intra profiles with level 1.1 get misdetected. Signed-off-by: Andreas Rheinhardt --- libavcodec/h264_levels.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/h264_levels.c b/libavcodec/h264_levels.c index 7a55116773..02efaa38dc 100644 --- a/libavcodec/h264_levels.c +++ b/libavcodec/h264_levels.c @@ -80,8 +80,8 @@ const H264LevelDescriptor *ff_h264_get_level(int level_idc, { int i; for (i = 0; i < FF_ARRAY_ELEMS(h264_levels); i++) { -if (h264_levels[i].level_idc== level_idc && -h264_levels[i].constraint_set3_flag == constraint_set3_flag) +if (h264_levels[i].level_idc == level_idc && +(constraint_set3_flag || !h264_levels[i].constraint_set3_flag)) return &h264_levels[i]; } return NULL; -- 2.19.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 4/4] h264_metadata: Don't use inferred value of buffering frames
Using the value of buffering frames inferred from the old level is not a sensible approach when one wants to guess the level. Signed-off-by: Andreas Rheinhardt --- libavcodec/h264_metadata_bsf.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libavcodec/h264_metadata_bsf.c b/libavcodec/h264_metadata_bsf.c index 7fe213e8cd..cb3e45e8b3 100644 --- a/libavcodec/h264_metadata_bsf.c +++ b/libavcodec/h264_metadata_bsf.c @@ -222,7 +222,7 @@ static int h264_metadata_update_sps(AVBSFContext *bsf, if (ctx->level == LEVEL_AUTO) { const H264LevelDescriptor *desc; int64_t bit_rate; -int width, height; +int width, height, frames; if (sps->vui.nal_hrd_parameters_present_flag) { bit_rate = (sps->vui.nal_hrd_parameters.bit_rate_value_minus1[0] + 1) * @@ -236,13 +236,16 @@ static int h264_metadata_update_sps(AVBSFContext *bsf, bit_rate = 0; } +// Don't use max_dec_frame_buffering if it is only inferred. +frames = sps->vui.bitstream_restriction_flag + ? sps->vui.max_dec_frame_buffering : H264_MAX_DPB_FRAMES; + width = 16 * (sps->pic_width_in_mbs_minus1 + 1); height = 16 * (sps->pic_height_in_map_units_minus1 + 1) * (2 - sps->frame_mbs_only_flag); desc = ff_h264_guess_level(sps->profile_idc, bit_rate, - width, height, - sps->vui.max_dec_frame_buffering); + width, height, frames); if (desc) { if ((desc->level_idc == 11) && desc->constraint_set3_flag) // This ensures that for level 1b the correct level -- 2.19.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/4] h264_levels, h264_metadata_bsf: Fix levels typo
Signed-off-by: Andreas Rheinhardt --- libavcodec/h264_levels.c | 2 +- libavcodec/h264_metadata_bsf.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/h264_levels.c b/libavcodec/h264_levels.c index 737b7dcf06..7a55116773 100644 --- a/libavcodec/h264_levels.c +++ b/libavcodec/h264_levels.c @@ -25,7 +25,7 @@ static const H264LevelDescriptor h264_levels[] = { // | level_idc | MaxFS|MaxCPB| MaxMvsPer2Mb // | | cs3f| | MaxDpbMbs | | MaxVmvR | | { "1", 10, 0, 1485, 99,396, 64,175, 64, 2, 0 }, -{ "1b", 10, 1, 1485, 99,396,128,350, 64, 2, 0 }, +{ "1b", 11, 1, 1485, 99,396,128,350, 64, 2, 0 }, { "1b", 9, 0, 1485, 99,396,128,350, 64, 2, 0 }, { "1.1", 11, 0, 3000,396,900,192,500, 128, 2, 0 }, { "1.2", 12, 0, 6000,396, 2376,384, 1000, 128, 2, 0 }, diff --git a/libavcodec/h264_metadata_bsf.c b/libavcodec/h264_metadata_bsf.c index bf37528234..521bc36b7e 100644 --- a/libavcodec/h264_metadata_bsf.c +++ b/libavcodec/h264_metadata_bsf.c @@ -258,7 +258,7 @@ static int h264_metadata_update_sps(AVBSFContext *bsf, if (sps->profile_idc == 66 || sps->profile_idc == 77 || sps->profile_idc == 88) { -sps->level_idc = 10; +sps->level_idc = 11; sps->constraint_set3_flag = 1; } else { sps->level_idc = 9; -- 2.19.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/4] h264_metadata: Fix handling of level 1b
The earlier logic had two errors: 1. If level 1b for a non-High profile had been guessed, level 1b was not always written to the output, because constraint_set3_flag wasn't set. 2. If a level different from 1b that shares its level_idc with 1b was intended to be set, constraint_set3_flag wasn't cleared so that the output could mistakenly be read as 1b (in case none of the High profiles is in use). Signed-off-by: Andreas Rheinhardt --- libavcodec/h264_metadata_bsf.c | 16 +++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/libavcodec/h264_metadata_bsf.c b/libavcodec/h264_metadata_bsf.c index 521bc36b7e..7fe213e8cd 100644 --- a/libavcodec/h264_metadata_bsf.c +++ b/libavcodec/h264_metadata_bsf.c @@ -244,7 +244,12 @@ static int h264_metadata_update_sps(AVBSFContext *bsf, width, height, sps->vui.max_dec_frame_buffering); if (desc) { -level_idc = desc->level_idc; +if ((desc->level_idc == 11) && desc->constraint_set3_flag) +// This ensures that for level 1b the correct level +// will be inferred below. +level_idc = 9; +else +level_idc = desc->level_idc; } else { av_log(bsf, AV_LOG_WARNING, "Stream does not appear to " "conform to any level: using level 6.2.\n"); @@ -264,6 +269,15 @@ static int h264_metadata_update_sps(AVBSFContext *bsf, sps->level_idc = 9; } } else { +// If the earlier level was 1b or the new level +// is in danger of being mistaken for 1b, +// we clear constraint_set3_flag. +if ((level_idc== 11 || + sps->level_idc == 11) && +(sps->profile_idc == 66 || + sps->profile_idc == 77 || + sps->profile_idc == 88)) +sps->constraint_set3_flag = 0; sps->level_idc = level_idc; } } -- 2.19.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH v3 1/1] avcodec: implemented Media Foundation encoder wrapper
Implemented the following encoders: * ff_h264_mf_encoder * ff_hevc_mf_encoder * ff_aac_mf_encoder * ff_ac3_mf_encoder * ff_mp3_mf_encoder The code is based on the PLEX's FFmpeg fork which can be found here: https://files.plexapp.com/elan/ffmpeg/plex-ffmpeg-2017-12-17.txz Signed-off-by: Paweł Wegner --- configure | 11 + libavcodec/Makefile|1 + libavcodec/allcodecs.c |5 + libavcodec/mf_utils.c | 734 libavcodec/mf_utils.h | 207 +++ libavcodec/mfenc.c | 1242 6 files changed, 2200 insertions(+) create mode 100644 libavcodec/mf_utils.c create mode 100644 libavcodec/mf_utils.h create mode 100644 libavcodec/mfenc.c diff --git a/configure b/configure index b02b4ccb2e..f50a621ce2 100755 --- a/configure +++ b/configure @@ -301,6 +301,7 @@ External library support: --enable-mbedtls enable mbedTLS, needed for https support if openssl, gnutls or libtls is not used [no] --enable-mediacodec enable Android MediaCodec support [no] + --enable-mf enable decoding via MediaFoundation [auto] --enable-libmysofa enable libmysofa, needed for sofalizer filter [no] --enable-openal enable OpenAL 1.1 capture support [no] --enable-opencl enable OpenCL processing [no] @@ -1651,6 +1652,7 @@ EXTERNAL_AUTODETECT_LIBRARY_LIST=" libxcb_shape libxcb_xfixes lzma +mf schannel sdl2 securetransport @@ -2318,6 +2320,7 @@ CONFIG_EXTRA=" lpc lzf me_cmp +mf mpeg_er mpegaudio mpegaudiodsp @@ -2806,6 +2809,8 @@ zlib_decoder_deps="zlib" zlib_encoder_deps="zlib" zmbv_decoder_deps="zlib" zmbv_encoder_deps="zlib" +mf_deps="mftransform_h" +mf_extralibs="-ldxva2 -levr -lmf -lmfplat -lmfuuid -lole32 -lstrmiids -luuid -loleaut32 -lshlwapi" # hardware accelerators crystalhd_deps="libcrystalhd_libcrystalhd_if_h" @@ -3155,6 +3160,11 @@ vapoursynth_demuxer_deps="vapoursynth" videotoolbox_suggest="coreservices" videotoolbox_deps="corefoundation coremedia corevideo" videotoolbox_encoder_deps="videotoolbox VTCompressionSessionPrepareToEncodeFrames" +aac_mf_encoder_deps="mf" +ac3_mf_encoder_deps="mf" +h264_mf_encoder_deps="mf" +hevc_mf_encoder_deps="mf" +mp3_mf_encoder_deps="mf" # demuxers / muxers ac3_demuxer_select="ac3_parser" @@ -5910,6 +5920,7 @@ check_headers io.h check_headers linux/perf_event.h check_headers libcrystalhd/libcrystalhd_if.h check_headers malloc.h +check_headers mftransform.h check_headers net/udplite.h check_headers poll.h check_headers sys/param.h diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 05be02ec7d..684b4cb213 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -1002,6 +1002,7 @@ OBJS-$(CONFIG_LIBXAVS_ENCODER)+= libxavs.o OBJS-$(CONFIG_LIBXAVS2_ENCODER) += libxavs2.o OBJS-$(CONFIG_LIBXVID_ENCODER)+= libxvid.o OBJS-$(CONFIG_LIBZVBI_TELETEXT_DECODER) += libzvbi-teletextdec.o ass.o +OBJS-$(CONFIG_MF) += mfenc.o mf_utils.o # parsers OBJS-$(CONFIG_AAC_LATM_PARSER) += latm_parser.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 2c17db5a70..b6777d6537 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -653,7 +653,9 @@ extern AVCodec ff_xsub_decoder; /* external libraries */ extern AVCodec ff_aac_at_encoder; extern AVCodec ff_aac_at_decoder; +extern AVCodec ff_aac_mf_encoder; extern AVCodec ff_ac3_at_decoder; +extern AVCodec ff_ac3_mf_encoder; extern AVCodec ff_adpcm_ima_qt_at_decoder; extern AVCodec ff_alac_at_encoder; extern AVCodec ff_alac_at_decoder; @@ -665,6 +667,7 @@ extern AVCodec ff_ilbc_at_decoder; extern AVCodec ff_mp1_at_decoder; extern AVCodec ff_mp2_at_decoder; extern AVCodec ff_mp3_at_decoder; +extern AVCodec ff_mp3_mf_encoder; extern AVCodec ff_pcm_alaw_at_encoder; extern AVCodec ff_pcm_alaw_at_decoder; extern AVCodec ff_pcm_mulaw_at_encoder; @@ -738,6 +741,7 @@ extern AVCodec ff_h264_qsv_encoder; extern AVCodec ff_h264_v4l2m2m_encoder; extern AVCodec ff_h264_vaapi_encoder; extern AVCodec ff_h264_videotoolbox_encoder; +extern AVCodec ff_h264_mf_encoder; #if FF_API_NVENC_OLD_NAME extern AVCodec ff_nvenc_encoder; extern AVCodec ff_nvenc_h264_encoder; @@ -751,6 +755,7 @@ extern AVCodec ff_hevc_qsv_encoder; extern AVCodec ff_hevc_v4l2m2m_encoder; extern AVCodec ff_hevc_vaapi_encoder; extern AVCodec ff_hevc_videotoolbox_encoder; +extern AVCodec ff_hevc_mf_encoder; extern AVCodec ff_libkvazaar_encoder; extern AVCodec ff_mjpeg_cuvid_decoder; extern AVCodec ff_mjpeg_qsv_encoder; diff --git a/libavcodec/mf_utils.c b/libavcodec/mf_utils.c new file mode 100644 index 00..77c2cbcabf --- /dev/null +++ b/libavcodec/mf_utils.c @@ -0,0 +1,734 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU
[FFmpeg-devel] [PATCH v3 0/1] avcodec/mf: implemented Media Foundation wrapper
I renamed mf.c to mfenc.c and left only the encoders for now. This lowered the line count of the biggest file to 1242, don't know how to split this up more for now. MF is now autodetected. The commit message now contains the origin of the code. HWContext stuff removed. Paweł Wegner (1): avcodec: implemented Media Foundation encoder wrapper configure | 11 + libavcodec/Makefile|1 + libavcodec/allcodecs.c |5 + libavcodec/mf_utils.c | 734 libavcodec/mf_utils.h | 207 +++ libavcodec/mfenc.c | 1242 6 files changed, 2200 insertions(+) create mode 100644 libavcodec/mf_utils.c create mode 100644 libavcodec/mf_utils.h create mode 100644 libavcodec/mfenc.c -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavf/dashenc: Add support for per-stream container type selection.
On 11/12/18 3:12 PM, Jeyapal, Karthick wrote: On 11/12/18 5:20 PM, Andrey Semashev wrote: On 11/12/18 8:20 AM, Jeyapal, Karthick wrote: On 11/8/18 10:27 PM, Andrey Semashev wrote: This commit restores the ability to create DASH streams with codecs that require different containers that was lost after commit 2efdbf7367989cf9d296c25fa3d2aff8d6e25fdd. It extends the dash_segment_type option syntax to allow to specify segment container types for individual streams, in addition to the default container type that is applied to all streams. The extended syntax is backward compatible with the previous syntax. Thanks for sending the patch. I understand your requirement completely. But I feel that this option for mapping streams with container format is little confusing. Also, the relevant code is relatively big, and thus difficult to maintain in future. I have a middle ground suggestion. If your goal is to achieve the earlier behavior broken commits, then I propose the following. Option "dash_segment_type" could take one more option "auto" (instead of mp4 or webm). When "auto" is chosen, the muxer could choose webm format for VP8, VP9, vorbis, opus streams and mp4 format for all other streams. In this method the previous behavior of dashenc muxer could be restored with little addition to the overall code. Also it's usage will be simpler and easier to understand. This solution might be ok for just restoring the previous capability, but I think the ability for selecting the container format by the user is still more useful. For example, Opus can be muxed in both mp4 (although, with experimental flag) and webm, and it may make sense to some users to select mp4. (In my case, though, I wanted webm, hence the patch.) In that case they could select "dash_segment_type" as "mp4", in which case all streams including opus will be muxed in mp4 format. I don't see a use-case where somebody wants opus in mp4 and would want other streams in webm format. Suppose you want to create a DASH stream consisting of VP8, H264, Vorbis and Opus substreams to cover the best compatibility with clients (which are mostly web browsers, but not necessarilly all of them). AFAIK, you cannot put all these codecs neither in mp4 nor webm. An "auto" option would put Opus in webm container, leaving clients not supporting webm not able to play audio. With explicit container selection one could put Opus content in mp4 or both webm and mp4 (in which case the substream would be duplicated). An example of a client that is picky about container format is Safari on OS X High Sierra. I don't have one to test, but reportedly it supports Opus only in caf format, and I've read someone hacked it to play Opus in mp4 if disguised as AAC. I know lavf/dashenc doesn't support caf (yet) but it may support it in the future, so the container format selection would become even more relevant then. Besides the parser, it doesn't add much code, and if I can improve the patch, please let me know how. If you absolutely don't want this functionality, that's ok, I'll keep this patch for my local builds and submit an "auto" option patch instead. I am not absolutely against this patch. But I am just trying to find if there is a use-case for such an advanced option. If there is a practical requirement for such a use-case, then I agree that we should review and push this patch for sure. But if the requirement is just theoretical at this point, then I would prefer the "auto" option patch. Maybe we could revisit this advanced options patch when a real requirement comes up. --- doc/muxers.texi | 8 ++- libavformat/dashenc.c | 161 +++--- 2 files changed, 140 insertions(+), 29 deletions(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index 62f4091e31..4418b38c76 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -289,8 +289,12 @@ Set container format (mp4/webm) options using a @code{:} separated list of key=value parameters. Values containing @code{:} special characters must be escaped. -@item dash_segment_type @var{dash_segment_type} -Possible values: +@item -dash_segment_type @var{dash_segment_type} +Sets the container type for dash segment files. Syntax is " :a,b,c :d,e" where is +the container type and a, b, c, d and e are the indices of the mapped streams. When no indices are specified, +the container type is set for all streams. + +Possible container type values: @item mp4 If this flag is set, the dash segment files will be in in ISOBMFF format. This is the default format. diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index f8b3d106d5..626dc76413 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -84,6 +84,8 @@ typedef struct OutputStream { int64_t first_pts, start_pts, max_pts; int64_t last_dts, last_pts; int bit_rate; +SegmentType segment_type; +const char *format_name; char codec_str
[FFmpeg-devel] [PATCH 2/2] fmin/fmax/fminf/fmaxf implementation for djgpp libc
--- compat/djgpp/math.h | 22 ++ configure | 1 + 2 files changed, 23 insertions(+) create mode 100644 compat/djgpp/math.h diff --git a/compat/djgpp/math.h b/compat/djgpp/math.h new file mode 100644 index 00..28fae5212e --- /dev/null +++ b/compat/djgpp/math.h @@ -0,0 +1,22 @@ +/* + * 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 + */ + +#define fmin(x, y) ((x) > (y) ? (y) : ((x) == (x) ? (x) : (y))) +#define fmax(x, y) ((x) < (y) ? (y) : ((x) == (x) ? (x) : (y))) +#define fminf(x, y) fmin(x, y) +#define fmaxf(x, y) fmax(x, y) diff --git a/configure b/configure index 6db4333f25..97778df1ae 100755 --- a/configure +++ b/configure @@ -5462,6 +5462,7 @@ EOF elif test_${pfx}cpp_condition sys/version.h "defined __DJGPP__"; then eval ${pfx}libc_type=djgpp add_cppflags -U__STRICT_ANSI__ +add_cflags "-include $source_path/compat/djgpp/math.h" fi test_${pfx}cc < -- 2.17.1 -- Peter (A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B) signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] configure: detect djgpp libc
--- DOS builds are currently broken. patch 1 adds djgpp libc detection. patch 2 adds float min/max functions just for djggp libc (these functions were removed from libm.h in 4436a8f44dedc83767b3d9da9beb85d1fae2ca30) configure | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 00b5d9795e..6db4333f25 100755 --- a/configure +++ b/configure @@ -5291,7 +5291,6 @@ case $target_os in network_extralibs="-lsocket" objformat="coff" enable dos_paths -add_cppflags -U__STRICT_ANSI__ ;; linux) enable section_data_rel_ro @@ -5460,6 +5459,9 @@ EOF elif test_${pfx}cpp_condition sys/brand.h "defined LABELED_BRAND_NAME"; then eval ${pfx}libc_type=solaris add_${pfx}cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600 +elif test_${pfx}cpp_condition sys/version.h "defined __DJGPP__"; then +eval ${pfx}libc_type=djgpp +add_cppflags -U__STRICT_ANSI__ fi test_${pfx}cc < -- 2.17.1 -- Peter (A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B) signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] lavu: add locale-independent sscanf implementation
Paul B Mahol (2018-11-12): > How to document copyright of multiple authors? What is the issue? libavcodec/j2kenc.c does it quite well. 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 1/2] lavu: add locale-independent sscanf implementation
On 11/12/18, Nicolas George wrote: > Paul B Mahol (2018-11-12): >> Its origin is musl libc. Multiple authors. > > The mailing-list is not the proper place to document that. > > Do you realize you just did an unintentional copyright infringement? If > you were to commit as is, you would cause the project to make one more > severe. How to document copyright of multiple authors? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavf/dashenc: Add support for per-stream container type selection.
On 11/12/18 5:20 PM, Andrey Semashev wrote: > On 11/12/18 8:20 AM, Jeyapal, Karthick wrote: >> >> On 11/8/18 10:27 PM, Andrey Semashev wrote: >>> This commit restores the ability to create DASH streams with codecs >>> that require different containers that was lost after commit >>> 2efdbf7367989cf9d296c25fa3d2aff8d6e25fdd. It extends the dash_segment_type >>> option syntax to allow to specify segment container types for individual >>> streams, in addition to the default container type that is applied to >>> all streams. The extended syntax is backward compatible with the previous >>> syntax. >> Thanks for sending the patch. I understand your requirement completely. >> But I feel that this option for mapping streams with container format is >> little confusing. Also, the relevant code is relatively big, and thus >> difficult to maintain in future. >> I have a middle ground suggestion. If your goal is to achieve the earlier >> behavior broken commits, then I propose the following. >> Option "dash_segment_type" could take one more option "auto" (instead of mp4 >> or webm). >> When "auto" is chosen, the muxer could choose webm format for VP8, VP9, >> vorbis, opus streams and mp4 format for all other streams. >> In this method the previous behavior of dashenc muxer could be restored with >> little addition to the overall code. Also it's usage will be simpler and >> easier to understand. > > This solution might be ok for just restoring the previous capability, but I > think the ability for selecting the container format by the user is still > more useful. For example, Opus can be muxed in both mp4 (although, with > experimental flag) and webm, and it may make sense to some users to select > mp4. (In my case, though, I wanted webm, hence the patch.) In that case they could select "dash_segment_type" as "mp4", in which case all streams including opus will be muxed in mp4 format. I don't see a use-case where somebody wants opus in mp4 and would want other streams in webm format. > > Besides the parser, it doesn't add much code, and if I can improve the patch, > please let me know how. If you absolutely don't want this functionality, > that's ok, I'll keep this patch for my local builds and submit an "auto" > option patch instead. I am not absolutely against this patch. But I am just trying to find if there is a use-case for such an advanced option. If there is a practical requirement for such a use-case, then I agree that we should review and push this patch for sure. But if the requirement is just theoretical at this point, then I would prefer the "auto" option patch. Maybe we could revisit this advanced options patch when a real requirement comes up. > >>> --- >>> doc/muxers.texi | 8 ++- >>> libavformat/dashenc.c | 161 +++--- >>> 2 files changed, 140 insertions(+), 29 deletions(-) >>> >>> diff --git a/doc/muxers.texi b/doc/muxers.texi >>> index 62f4091e31..4418b38c76 100644 >>> --- a/doc/muxers.texi >>> +++ b/doc/muxers.texi >>> @@ -289,8 +289,12 @@ Set container format (mp4/webm) options using a >>> @code{:} separated list of >>> key=value parameters. Values containing @code{:} special characters must >>> be >>> escaped. >>> -@item dash_segment_type @var{dash_segment_type} >>> -Possible values: >>> +@item -dash_segment_type @var{dash_segment_type} >>> +Sets the container type for dash segment files. Syntax is " >>> :a,b,c :d,e" where is >>> +the container type and a, b, c, d and e are the indices of the mapped >>> streams. When no indices are specified, >>> +the container type is set for all streams. >>> + >>> +Possible container type values: >>> @item mp4 >>> If this flag is set, the dash segment files will be in in ISOBMFF format. >>> This is the default format. >>> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c >>> index f8b3d106d5..626dc76413 100644 >>> --- a/libavformat/dashenc.c >>> +++ b/libavformat/dashenc.c >>> @@ -84,6 +84,8 @@ typedef struct OutputStream { >>> int64_t first_pts, start_pts, max_pts; >>> int64_t last_dts, last_pts; >>> int bit_rate; >>> +SegmentType segment_type; >>> +const char *format_name; >>> char codec_str[100]; >>> int written_len; >>> @@ -131,8 +133,7 @@ typedef struct DASHContext { >>> int64_t timeout; >>> int index_correction; >>> char *format_options_str; >>> -SegmentType segment_type; >>> -const char *format_name; >>> +const char *segment_types_str; >>> } DASHContext; >>> static struct codec_string { >>> @@ -188,14 +189,6 @@ static void dashenc_io_close(AVFormatContext *s, >>> AVIOContext **pb, char *filenam >>> } >>> } >>> -static const char *get_format_str(SegmentType segment_type) { >>> -int i; >>> -for (i = 0; i < SEGMENT_TYPE_NB; i++) >>> -if (formats[i].segment_type == segment_type) >>> -return formats[i].str; >>> -return NULL; >>> -} >>> - >>> stat
Re: [FFmpeg-devel] [PATCH 1/2] lavu: add locale-independent sscanf implementation
Paul B Mahol (2018-11-12): > Its origin is musl libc. Multiple authors. The mailing-list is not the proper place to document that. Do you realize you just did an unintentional copyright infringement? If you were to commit as is, you would cause the project to make one more severe. 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 1/2] lavu: add locale-independent sscanf implementation
On 11/12/18, Nicolas George wrote: > Paul B Mahol (2018-11-12): >> > Did you write this function? >> No > > Then the authorship and origin need to be documented. Its origin is musl libc. Multiple authors. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] lavu: add locale-independent sscanf implementation
Paul B Mahol (2018-11-12): > > Did you write this function? > No Then the authorship and origin need to be documented. Regards, -- Nicolas George ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavf/dashenc: Add support for per-stream container type selection.
On 11/12/18 8:20 AM, Jeyapal, Karthick wrote: On 11/8/18 10:27 PM, Andrey Semashev wrote: This commit restores the ability to create DASH streams with codecs that require different containers that was lost after commit 2efdbf7367989cf9d296c25fa3d2aff8d6e25fdd. It extends the dash_segment_type option syntax to allow to specify segment container types for individual streams, in addition to the default container type that is applied to all streams. The extended syntax is backward compatible with the previous syntax. Thanks for sending the patch. I understand your requirement completely. But I feel that this option for mapping streams with container format is little confusing. Also, the relevant code is relatively big, and thus difficult to maintain in future. I have a middle ground suggestion. If your goal is to achieve the earlier behavior broken commits, then I propose the following. Option "dash_segment_type" could take one more option "auto" (instead of mp4 or webm). When "auto" is chosen, the muxer could choose webm format for VP8, VP9, vorbis, opus streams and mp4 format for all other streams. In this method the previous behavior of dashenc muxer could be restored with little addition to the overall code. Also it's usage will be simpler and easier to understand. This solution might be ok for just restoring the previous capability, but I think the ability for selecting the container format by the user is still more useful. For example, Opus can be muxed in both mp4 (although, with experimental flag) and webm, and it may make sense to some users to select mp4. (In my case, though, I wanted webm, hence the patch.) Besides the parser, it doesn't add much code, and if I can improve the patch, please let me know how. If you absolutely don't want this functionality, that's ok, I'll keep this patch for my local builds and submit an "auto" option patch instead. --- doc/muxers.texi | 8 ++- libavformat/dashenc.c | 161 +++--- 2 files changed, 140 insertions(+), 29 deletions(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index 62f4091e31..4418b38c76 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -289,8 +289,12 @@ Set container format (mp4/webm) options using a @code{:} separated list of key=value parameters. Values containing @code{:} special characters must be escaped. -@item dash_segment_type @var{dash_segment_type} -Possible values: +@item -dash_segment_type @var{dash_segment_type} +Sets the container type for dash segment files. Syntax is " :a,b,c :d,e" where is +the container type and a, b, c, d and e are the indices of the mapped streams. When no indices are specified, +the container type is set for all streams. + +Possible container type values: @item mp4 If this flag is set, the dash segment files will be in in ISOBMFF format. This is the default format. diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index f8b3d106d5..626dc76413 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -84,6 +84,8 @@ typedef struct OutputStream { int64_t first_pts, start_pts, max_pts; int64_t last_dts, last_pts; int bit_rate; +SegmentType segment_type; +const char *format_name; char codec_str[100]; int written_len; @@ -131,8 +133,7 @@ typedef struct DASHContext { int64_t timeout; int index_correction; char *format_options_str; -SegmentType segment_type; -const char *format_name; +const char *segment_types_str; } DASHContext; static struct codec_string { @@ -188,14 +189,6 @@ static void dashenc_io_close(AVFormatContext *s, AVIOContext **pb, char *filenam } } -static const char *get_format_str(SegmentType segment_type) { -int i; -for (i = 0; i < SEGMENT_TYPE_NB; i++) -if (formats[i].segment_type == segment_type) -return formats[i].str; -return NULL; -} - static int check_file_extension(const char *filename, const char *extension) { char *dot; if (!filename || !extension) @@ -375,6 +368,8 @@ static void dash_free(AVFormatContext *s) c->nb_as = 0; } +av_freep(&c->segment_types_str); + if (!c->streams) return; for (i = 0; i < s->nb_streams; i++) { @@ -621,13 +616,13 @@ static int write_adaptation_set(AVFormatContext *s, AVIOContext *out, int as_ind if (as->media_type == AVMEDIA_TYPE_VIDEO) { AVStream *st = s->streams[i]; avio_printf(out, "\t\t\tformat_name, os->codec_str, bandwidth_str, s->streams[i]->codecpar->width, s->streams[i]->codecpar->height); +i, os->format_name, os->codec_str, bandwidth_str, s->streams[i]->codecpar->width, s->streams[i]->codecpar->height); if (st->avg_frame_rate.num) avio_printf(out, " frameRate=\"%d/%d\"", st->avg_frame_rate.num, st->avg_frame_rate.den); avio_printf(out, ">\n"); } e
Re: [FFmpeg-devel] [PATCH 1/2] lavu: add locale-independent sscanf implementation
On 11/12/18, Carl Eugen Hoyos wrote: > 2018-11-11 17:41 GMT+01:00, Paul B Mahol : > >> +static long long scanexp(FFFILE *f, int pok) >> +{ >> +int c; >> +int x; >> +long long y; >> +int neg = 0; >> + >> +c = shgetc(f); >> +if (c=='+' || c=='-') { >> +neg = (c=='-'); >> +c = shgetc(f); >> +if (c-'0'>=10U && pok) shunget(f); >> +} >> +if (c-'0'>=10U) { >> +shunget(f); >> +return LLONG_MIN; >> +} >> +for (x=0; c-'0'<10U && x> +x = 10*x + c-'0'; >> +for (y=x; c-'0'<10U && y> +y = 10*y + c-'0'; >> +for (; c-'0'<10U; c = shgetc(f)); >> +shunget(f); >> +return neg ? -y : y; >> +} > > Did you write this function? No > The style looks a little unusual for FFmpeg... Yes ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2 1/1] avcodec/mf: implemented Media Foundation wrapper
2018-11-12 12:37 GMT+01:00, Paul B Mahol : > On 11/12/18, Carl Eugen Hoyos wrote: >> 2018-11-12 12:22 GMT+01:00, Kirill Gavrilov : >>> On Tue, Nov 6, 2018 at 3:51 PM, Carl Eugen Hoyos >>> wrote: >>> If the dll(s) necessary for Media Foundation at run-time are installed on every supported Windows system >>> >>> I think Media Foundation is excluded from Windows 10 N editions: >> >> The question is now if current default FFmpeg binaries run on >> Windows 10 N. > > Why would they not? Because of the D3D and DXVA dependencies. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] lavu: add locale-independent sscanf implementation
2018-11-11 17:41 GMT+01:00, Paul B Mahol : > +static long long scanexp(FFFILE *f, int pok) > +{ > +int c; > +int x; > +long long y; > +int neg = 0; > + > +c = shgetc(f); > +if (c=='+' || c=='-') { > +neg = (c=='-'); > +c = shgetc(f); > +if (c-'0'>=10U && pok) shunget(f); > +} > +if (c-'0'>=10U) { > +shunget(f); > +return LLONG_MIN; > +} > +for (x=0; c-'0'<10U && x +x = 10*x + c-'0'; > +for (y=x; c-'0'<10U && y +y = 10*y + c-'0'; > +for (; c-'0'<10U; c = shgetc(f)); > +shunget(f); > +return neg ? -y : y; > +} Did you write this function? The style looks a little unusual for FFmpeg... Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] avcodec/videotoolbox: fix cropping with HEVC and h264 videos
2018-11-10 16:46 GMT+01:00, der richter : > This fixes an issue that was reported on the mpv issue tracker. some more > informations can be found there including test files. > > https://github.com/mpv-player/mpv/issues/6153 Patch applied. Thank you, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2 1/1] avcodec/mf: implemented Media Foundation wrapper
On 11/12/18, Carl Eugen Hoyos wrote: > 2018-11-12 12:22 GMT+01:00, Kirill Gavrilov : >> On Tue, Nov 6, 2018 at 3:51 PM, Carl Eugen Hoyos >> wrote: >> >>> If the dll(s) necessary for Media Foundation at run-time are installed >>> on every supported Windows system >> >> I think Media Foundation is excluded from Windows 10 N editions: > > The question is now if current default FFmpeg binaries run on > Windows 10 N. Why would they not? Your sentence does not make any sense. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2 1/1] avcodec/mf: implemented Media Foundation wrapper
2018-11-12 12:22 GMT+01:00, Kirill Gavrilov : > On Tue, Nov 6, 2018 at 3:51 PM, Carl Eugen Hoyos > wrote: > >> If the dll(s) necessary for Media Foundation at run-time are installed >> on every supported Windows system > > I think Media Foundation is excluded from Windows 10 N editions: The question is now if current default FFmpeg binaries run on Windows 10 N. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v2 1/1] avcodec/mf: implemented Media Foundation wrapper
On Tue, Nov 6, 2018 at 3:51 PM, Carl Eugen Hoyos wrote: > If the dll(s) necessary for Media Foundation at run-time are installed on > every supported Windows system > I think Media Foundation is excluded from Windows 10 N editions: > Excluded features > ... > - Media Foundation: Provides support for content protection, audio and > video quality, and interoperability for DRM. > https://support.microsoft.com/en-us/help/3010081/media-feature-pack-for-windows-10-n-and-windows-10-kn-editions I wasn't able using such a Windows edition, though, because AMD Radeon drivers (at least control panel) crashed at every Windows startup without even saying anything... ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [RFC] ffmpeg: Improved the performance of 1:N for adaptive bitrate scenario.
Jun Zhao 于2018年11月11日周日 下午7:07写道: > > Improved the performance of 1 decode + N filter graphs and adaptive > bitrate scenario. > > With new option "-abr_pipeline" > 1. It enabled multiple filter graph concurrency, which bring above > about 5%~20% improvement in some 1:N scenario by CPU or GPU > acceleration > 2. Next step will continue to improve the concurrency of complex > filter graph which can support high efficiency of filter net > > Below are some test cases and test result as reference. > (Hardware platform: Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz) > (Software: Intel iHD driver - 16.9.00100, CentOS 7) > > Command for Intel GPU acceleration case, 1 decode to N scaling: > ffmpeg -vaapi_device /dev/dri/renderD128 -hwaccel vaapi \ > -hwaccel_output_format vaapi \ > -i ~/Videos/1920x1080p_30.00_x264_qp28.h264 \ > -vf "scale_vaapi=1280:720:format=nv12,hwdownload" \ > -pix_fmt nv12 -f null /dev/null \ > -vf "scale_vaapi=720:480:format=nv12,hwdownload" \ > -pix_fmt nv12 -f null /dev/null \ > -abr_pipeline > > test results: > 2 scale > Improved ~34% > > Command for CPU only 1 decode to N scaling: > ffmpeg -i ~/Videos/1920x1080p_30.00_x264_qp28.h264 \ > -vf "scale=1280:720" -pix_fmt nv12 -f null /dev/null \ > -vf "scale=720:480" -pix_fmt nv12 -f null /dev/null \ > -abr_pipeline > > test results: > 2 scale > Improved ~25% > > Command for 1:N transcode by GPU acceleration: > ./ffmpeg -vaapi_device /dev/dri/renderD128 -hwaccel vaapi \ > -hwaccel_output_format vaapi \ > -i ~/Videos/1920x1080p_30.00_x264_qp28.h264 \ > -vf "scale_vaapi=1280:720" -c:v h264_vaapi -f null /dev/null \ > -vf "scale_vaapi=720:480" -c:v h264_vaapi -f null /dev/null \ > -abr_pipeline > > test results: > 2 scale+enc > Improved ~6.1% > > Signed-off-by: Wang, Shaofei > Signed-off-by: Jun Zhao > --- > fftools/ffmpeg.c| 236 > --- > fftools/ffmpeg.h| 12 +++ > fftools/ffmpeg_filter.c |6 + > fftools/ffmpeg_opt.c|6 +- > 4 files changed, 246 insertions(+), 14 deletions(-) > > diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c > index 38c21e9..5dc80fd 100644 > --- a/fftools/ffmpeg.c > +++ b/fftools/ffmpeg.c > @@ -1523,6 +1523,110 @@ static int reap_filters(int flush) > return 0; > } > > +static int pipeline_reap_filters(int flush, InputFilter * ifilter) > +{ > +AVFrame *filtered_frame = NULL; > +int i; > + > +for (i = 0; i < nb_output_streams; i++) { > +if (ifilter == output_streams[i]->filter->graph->inputs[0]) break; > +} > +OutputStream *ost = output_streams[i]; > +OutputFile*of = output_files[ost->file_index]; > +AVFilterContext *filter; > +AVCodecContext *enc = ost->enc_ctx; > +int ret = 0; > + > +if (!ost->filter || !ost->filter->graph->graph) > +return 0; > +filter = ost->filter->filter; > + > +if (!ost->initialized) { > +char error[1024] = ""; > +ret = init_output_stream(ost, error, sizeof(error)); > +if (ret < 0) { > +av_log(NULL, AV_LOG_ERROR, "Error initializing output stream > %d:%d -- %s\n", > + ost->file_index, ost->index, error); > +exit_program(1); > +} > +} > + > +if (!ost->filtered_frame && !(ost->filtered_frame = av_frame_alloc())) { > +return AVERROR(ENOMEM); > +} > +filtered_frame = ost->filtered_frame; > + > +while (1) { > +double float_pts = AV_NOPTS_VALUE; // this is identical to > filtered_frame.pts but with higher precision > +ret = av_buffersink_get_frame_flags(filter, filtered_frame, > + AV_BUFFERSINK_FLAG_NO_REQUEST); > +if (ret < 0) { > +if (ret != AVERROR(EAGAIN) && ret != AVERROR_EOF) { > +av_log(NULL, AV_LOG_WARNING, > + "Error in av_buffersink_get_frame_flags(): %s\n", > av_err2str(ret)); > +} else if (flush && ret == AVERROR_EOF) { > +if (av_buffersink_get_type(filter) == AVMEDIA_TYPE_VIDEO) > +do_video_out(of, ost, NULL, AV_NOPTS_VALUE); > +} > +break; > +} > +if (ost->finished) { > +av_frame_unref(filtered_frame); > +continue; > +} > +if (filtered_frame->pts != AV_NOPTS_VALUE) { > +int64_t start_time = (of->start_time == AV_NOPTS_VALUE) ? 0 : > of->start_time; > +AVRational filter_tb = av_buffersink_get_time_base(filter); > +AVRational tb = enc->time_base; > +int extra_bits = av_clip(29 - av_log2(tb.den), 0, 16); > + > +tb.den <<= extra_bits; > +float_pts = > +av_rescale_q(filtered_frame->pts, filter_tb, tb) - > +av_rescale_q(start_time, AV_TIME_BASE_Q, tb); > +
[FFmpeg-devel] [PATCH] avformat/async: remove unuse code
Signed-off-by: Steven Liu --- libavformat/async.c | 208 1 file changed, 208 deletions(-) diff --git a/libavformat/async.c b/libavformat/async.c index 54dbd2312a..d755f3471b 100644 --- a/libavformat/async.c +++ b/libavformat/async.c @@ -489,211 +489,3 @@ const URLProtocol ff_async_protocol = { .priv_data_class = &async_context_class, }; -#if 0 - -#define TEST_SEEK_POS(1536) -#define TEST_STREAM_SIZE (2048) - -typedef struct TestContext { -AVClass*class; -int64_t logical_pos; -int64_t logical_size; - -/* options */ -int opt_read_error; -} TestContext; - -static int async_test_open(URLContext *h, const char *arg, int flags, AVDictionary **options) -{ -TestContext *c = h->priv_data; -c->logical_pos = 0; -c->logical_size = TEST_STREAM_SIZE; -return 0; -} - -static int async_test_close(URLContext *h) -{ -return 0; -} - -static int async_test_read(URLContext *h, unsigned char *buf, int size) -{ -TestContext *c = h->priv_data; -int i; -int read_len = 0; - -if (c->opt_read_error) -return c->opt_read_error; - -if (c->logical_pos >= c->logical_size) -return AVERROR_EOF; - -for (i = 0; i < size; ++i) { -buf[i] = c->logical_pos & 0xFF; - -c->logical_pos++; -read_len++; - -if (c->logical_pos >= c->logical_size) -break; -} - -return read_len; -} - -static int64_t async_test_seek(URLContext *h, int64_t pos, int whence) -{ -TestContext *c = h->priv_data; -int64_t new_logical_pos; - -if (whence == AVSEEK_SIZE) { -return c->logical_size; -} else if (whence == SEEK_CUR) { -new_logical_pos = pos + c->logical_pos; -} else if (whence == SEEK_SET){ -new_logical_pos = pos; -} else { -return AVERROR(EINVAL); -} -if (new_logical_pos < 0) -return AVERROR(EINVAL); - -c->logical_pos = new_logical_pos; -return new_logical_pos; -} - -#define OFFSET(x) offsetof(TestContext, x) -#define D AV_OPT_FLAG_DECODING_PARAM - -static const AVOption async_test_options[] = { -{ "async-test-read-error", "cause read fail", -OFFSET(opt_read_error), AV_OPT_TYPE_INT, { .i64 = 0 }, INT_MIN, INT_MAX, .flags = D }, -{NULL}, -}; - -#undef D -#undef OFFSET - -static const AVClass async_test_context_class = { -.class_name = "Async-Test", -.item_name = av_default_item_name, -.option = async_test_options, -.version= LIBAVUTIL_VERSION_INT, -}; - -const URLProtocol ff_async_test_protocol = { -.name= "async-test", -.url_open2 = async_test_open, -.url_read= async_test_read, -.url_seek= async_test_seek, -.url_close = async_test_close, -.priv_data_size = sizeof(TestContext), -.priv_data_class = &async_test_context_class, -}; - -int main(void) -{ -URLContext *h = NULL; -int i; -int ret; -int64_t size; -int64_t pos; -int64_t read_len; -unsigned char buf[4096]; -AVDictionary *opts = NULL; - -ffurl_register_protocol(&ff_async_protocol); -ffurl_register_protocol(&ff_async_test_protocol); - -/* - * test normal read - */ -ret = ffurl_open(&h, "async:async-test:", AVIO_FLAG_READ, NULL, NULL); -printf("open: %d\n", ret); - -size = ffurl_size(h); -printf("size: %"PRId64"\n", size); - -pos = ffurl_seek(h, 0, SEEK_CUR); -read_len = 0; -while (1) { -ret = ffurl_read(h, buf, sizeof(buf)); -if (ret == AVERROR_EOF) { -printf("read-error: AVERROR_EOF at %"PRId64"\n", ffurl_seek(h, 0, SEEK_CUR)); -break; -} -else if (ret == 0) -break; -else if (ret < 0) { -printf("read-error: %d at %"PRId64"\n", ret, ffurl_seek(h, 0, SEEK_CUR)); -goto fail; -} else { -for (i = 0; i < ret; ++i) { -if (buf[i] != (pos & 0xFF)) { -printf("read-mismatch: actual %d, expecting %d, at %"PRId64"\n", - (int)buf[i], (int)(pos & 0xFF), pos); -break; -} -pos++; -} -} - -read_len += ret; -} -printf("read: %"PRId64"\n", read_len); - -/* - * test normal seek - */ -ret = ffurl_read(h, buf, 1); -printf("read: %d\n", ret); - -pos = ffurl_seek(h, TEST_SEEK_POS, SEEK_SET); -printf("seek: %"PRId64"\n", pos); - -read_len = 0; -while (1) { -ret = ffurl_read(h, buf, sizeof(buf)); -if (ret == AVERROR_EOF) -break; -else if (ret == 0) -break; -else if (ret < 0) { -printf("read-error: %d at %"PRId64"\n", ret, ffurl_seek(h, 0, SEEK_CUR)); -goto fai
Re: [FFmpeg-devel] [PATCH] avfilter/vf_fade: fix start/duration max value
On 11/12/18, Mark Harris wrote: > A fade out (usually at the end of a video) can easily start beyond > INT32_MAX (about 36 minutes). Regression since d40dc64173. > --- > libavfilter/vf_fade.c | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) LGTM ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: removed specific filename format code for non-zero segment sizes
Stephen Dawkins 于2018年11月11日周日 下午8:07写道: > > This patch removes some duplicate code in hls_start that prevents the usage > of strftime base filenames in conjuction with hls_segment_size. > > Signed-off-by: Stephen Dawkins > --- > libavformat/hlsenc.c | 13 - > 1 file changed, 13 deletions(-) > > diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c > index f8f060d065..4557951f0b 100644 > --- a/libavformat/hlsenc.c > +++ b/libavformat/hlsenc.c > @@ -1468,19 +1468,6 @@ static int hls_start(AVFormatContext *s, VariantStream > *vs) > return AVERROR(ENOMEM); > ff_format_set_url(vtt_oc, new_name); > } > -} else if (c->max_seg_size > 0) { > -char *filename = NULL; > -if (replace_int_data_in_filename(&filename, > -#if FF_API_HLS_WRAP > -vs->basename, 'd', c->wrap ? vs->sequence % c->wrap : > vs->sequence) < 1) { > -#else > -vs->basename, 'd', vs->sequence) < 1) { > -#endif > -av_free(filename); > -av_log(oc, AV_LOG_ERROR, "Invalid segment filename template > '%s', you can try to use -strftime 1 with it\n", vs->basename); > -return AVERROR(EINVAL); > -} > -ff_format_set_url(oc, filename); > } else { > if (c->use_localtime) { > time_t now0; > -- > 2.19.1 > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel LGTM Thanks ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel