]> git.sesse.net Git - ffmpeg/log
ffmpeg
4 years agoavformat/mov: Use AV_DICT_DONT_STRDUP_VAL to avoid av_strdup
Andreas Rheinhardt [Sun, 10 Nov 2019 04:07:33 +0000 (05:07 +0100)]
avformat/mov: Use AV_DICT_DONT_STRDUP_VAL to avoid av_strdup

This will likely also fix CID 1452574 and 1452565, false positives
resulting from Coverity thinking that av_dict_set() automatically
frees its key and value parameters (even without the
AV_DICT_DONT_STRDUP_* flags).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavfilter/vf_showinfo: fix the integer handling issues
Limin Wang [Thu, 9 Jan 2020 01:02:11 +0000 (09:02 +0800)]
avfilter/vf_showinfo: fix the integer handling issues

Fixes CID 1457606 and 1457607

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/utils: replace avctx->internal with avci for better readability
Limin Wang [Thu, 9 Jan 2020 01:04:33 +0000 (09:04 +0800)]
avcodec/utils: replace avctx->internal with avci for better readability

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavfilter/f_metadata: allow direct flushing when printing to file
Gyan Doshi [Tue, 7 Jan 2020 12:00:34 +0000 (17:30 +0530)]
avfilter/f_metadata: allow direct flushing when printing to file

Useful for monitoring sparse data in realtime

4 years agofate: Don't use depreceated keepside option
Andreas Rheinhardt [Mon, 30 Dec 2019 12:43:27 +0000 (13:43 +0100)]
fate: Don't use depreceated keepside option

The tests for concat use this option which is scheduled for removal and
does nothing any more. So remove it; otherwise, these tests would fail
at the next major version bump.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavfilter/af_afir: add support for switching impulse response streams at runtime
Paul B Mahol [Thu, 9 Jan 2020 19:06:57 +0000 (20:06 +0100)]
avfilter/af_afir: add support for switching impulse response streams at runtime

Currently, switching is not free of artifacts, to be resolved later.

4 years agoavfilter/af_afir: add support for even smaller partition sizes
Paul B Mahol [Thu, 9 Jan 2020 17:32:11 +0000 (18:32 +0100)]
avfilter/af_afir: add support for even smaller partition sizes

4 years agoavfilter/af_afir: split input frames from impulse response frames
Paul B Mahol [Wed, 8 Jan 2020 18:23:45 +0000 (19:23 +0100)]
avfilter/af_afir: split input frames from impulse response frames

4 years agoavformat/id3v2enc: fix bad ID3v2 tag length
Gilles Bouthenot [Wed, 8 Jan 2020 18:47:55 +0000 (19:47 +0100)]
avformat/id3v2enc: fix bad ID3v2 tag length

4 years agomovenc: Write durations based on pts into mvhd/mdhd/tkhd/elst
Martin Storsjö [Fri, 13 Dec 2019 23:00:20 +0000 (01:00 +0200)]
movenc: Write durations based on pts into mvhd/mdhd/tkhd/elst

Keep all the existing data fields as they are (there's lots and
lots of nontrivial calculation and heuristics based on them in
their current form), but derive the duration as the difference
between the pts of the first packet to the maximum pts+duration
(not necessarily the last packet); use this duration in any box
where the actual presentation duration is supposed to be.

Fixes: 8420
Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agonvenc: implement flush to help allow an encoder to be re-used
Philip Langdale [Fri, 20 Dec 2019 23:34:33 +0000 (15:34 -0800)]
nvenc: implement flush to help allow an encoder to be re-used

It can be useful to re-use an encoder instance when doing segmented
encodings, and this requires flushing the encoder at the start of
each segment.

4 years agoavformat/utils: Remove redundant save+restore
Andreas Rheinhardt [Tue, 8 Oct 2019 05:41:15 +0000 (07:41 +0200)]
avformat/utils: Remove redundant save+restore

If the size of the input packet is zero, av_grow_packet() used to call
av_new_packet() which would initialize the packet and (in particular)
reset the pos field. This behaviour (which was never documented and
arguably always contradicted the documented behaviour) was changed in
2fe04630. This means that it is unnecessary to save and restore the
packet's position in append_packet_chunked().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/proresenc_anatoliy: Fix invalid left shift of negative number
Andreas Rheinhardt [Wed, 8 Jan 2020 18:29:13 +0000 (19:29 +0100)]
avcodec/proresenc_anatoliy: Fix invalid left shift of negative number

This fixes ticket #7997 as well as the vsynth*-prores_# FATE-tests
(where * ranges over { 1, 2, 3, _lena } and # over { , _int, _444,
_444_int }).

(Given that prev_dc is in the range -0xC000..0x3FFF, no overflow can
happen upon multiplication with 2.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agocmdutils: Fix compilation on cygwin wrt SetDllDirectory and GetModuleHandle
Martin Storsjö [Wed, 8 Jan 2020 11:29:07 +0000 (13:29 +0200)]
cmdutils: Fix compilation on cygwin wrt SetDllDirectory and GetModuleHandle

After 06ec9c4746ebc1d3b613c1847e434bbd0b4407b4 we check for these
functions in configure (which will succeed in cygwin), but cmdutils.c
only includes windows.h if _WIN32 is defined (which it isn't in cygwin).

Retain the old intent from before 06ec9c4746ebc1d3b613c1847e434bbd0b4407b4,
that these functions only would be used when _WIN32 is defined, while
only using them if configure has agreed that they do exist.

Signed-off-by: Martin Storsjö <martin@martin.st>
4 years agoavfilter/aformat: add shorthand names for options
Gyan Doshi [Tue, 7 Jan 2020 10:20:09 +0000 (15:50 +0530)]
avfilter/aformat: add shorthand names for options

4 years agoavformat/wtvdec: Cosmetics
Andreas Rheinhardt [Tue, 7 Jan 2020 13:55:49 +0000 (14:55 +0100)]
avformat/wtvdec: Cosmetics

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavformat/wtvdec: Fix memleak when reading header fails
Andreas Rheinhardt [Tue, 7 Jan 2020 13:55:48 +0000 (14:55 +0100)]
avformat/wtvdec: Fix memleak when reading header fails

Fixes #8314.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavcodec/h264_metadata_bsf: Fix for the incorrect user data with hyphens
Limin Wang [Tue, 7 Jan 2020 05:03:52 +0000 (13:03 +0800)]
avcodec/h264_metadata_bsf: Fix for the incorrect user data with hyphens

How to reproduce:
./ffmpeg -f lavfi -i testsrc -c:v libx264 -g 25 -bsf:v h264_metadata=sei_user_data=186f3693-b7b3-4f2c-9653-21492feee5b8+hello -frames:v 1 h264.mp4

master:
[Parsed_showinfo_0 @ 0x7fc8a0703180] UUID=186f3693-7030-4f2c-6030-21492feee5b8
[Parsed_showinfo_0 @ 0x7fc8a0703180] User Data=hello

Applied the patch:
[Parsed_showinfo_0 @ 0x7f969d408e00] UUID=186f3693-b7b3-4f2c-9653-21492feee5b8
[Parsed_showinfo_0 @ 0x7f969d408e00] User Data=hello

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agolavf/libsrt: Fix typo
Anthony Delannoy [Mon, 6 Jan 2020 17:36:18 +0000 (18:36 +0100)]
lavf/libsrt: Fix typo

Reviewed-by: "mypopy@gmail.com" <mypopy@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/dashenc: Fix leak of AVFormatContext on error
Andreas Rheinhardt [Tue, 7 Jan 2020 13:55:46 +0000 (14:55 +0100)]
avformat/dashenc: Fix leak of AVFormatContext on error

The Dash muxer uses submuxers and when one such submuxer has been allocated,
it is initially only stored in a temporary variable. Therefore it leaks
if an error happens between the allocation and storing it permanently.
This commit changes this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: "Jeyapal, Karthick" <kjeyapal@akamai.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/mpjpeg: Remove mpjpeg_write_trailer
Andreas Rheinhardt [Tue, 7 Jan 2020 13:55:45 +0000 (14:55 +0100)]
avformat/mpjpeg: Remove mpjpeg_write_trailer

It does nothing.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat: Improve returned error codes
Andreas Rheinhardt [Tue, 7 Jan 2020 13:55:44 +0000 (14:55 +0100)]
avformat: Improve returned error codes

This commit improves returned error codes by forwarding error codes. In
some instances, the hardcoded returned error codes made no sense at all:
The normal error code for failure of av_new_packet() is AVERROR(ENOMEM),
yet there were instances where AVERROR(EIO) was returned.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/fitsdec: Fix potential leak of string in AVBPrint
Andreas Rheinhardt [Tue, 7 Jan 2020 13:55:42 +0000 (14:55 +0100)]
avformat/fitsdec: Fix potential leak of string in AVBPrint

by freeing it a bit earlier.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/avs: Remove avs_read_close()
Andreas Rheinhardt [Tue, 7 Jan 2020 13:55:41 +0000 (14:55 +0100)]
avformat/avs: Remove avs_read_close()

It did nothing.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat: convert some avio_flush() calls to avio_write_marker(AVIO_DATA_MARKER_FLUSH...
Marton Balint [Fri, 27 Dec 2019 12:53:00 +0000 (13:53 +0100)]
avformat: convert some avio_flush() calls to avio_write_marker(AVIO_DATA_MARKER_FLUSH_POINT)

Converting explicit avio_flush() calls helps us to buffer more data and avoid
flushing the IO context too often which causes reduced IO throughput for
non-streamed file output.

The user can control FLUSH_POINT flushing behaviour using the -flush_packets
option, the default typically means to flush unless a non-streamed file output
is used, so this change should have no adverse effect on streaming even if it
is assumed that after an avio_flush() the output buffer is clean so small
seekbacks within the output buffer will work even when the IO context is not
seekable.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavformat: remove more unneeded avio_flush() calls
Marton Balint [Sat, 4 Jan 2020 20:14:46 +0000 (21:14 +0100)]
avformat: remove more unneeded avio_flush() calls

These instances are simply redundant or present because avio_flush() used to be
required before doing a seekback. That is no longer the case, aviobuf code does
the flush automatically on seek.

This only affects code which is either disabled for streaming IO contexts or
does no seekbacks after the flush, so this change should have no adverse effect
on streaming.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavformat: remove avio_flush() calls from the end of write_packet functions
Marton Balint [Sat, 4 Jan 2020 19:32:26 +0000 (20:32 +0100)]
avformat: remove avio_flush() calls from the end of write_packet functions

Removing explicit avio_flush() calls helps us to buffer more data and avoid
flushing the IO context too often which causes reduced IO throughput for
non-streamed file output.

The user can control flushing behaviour at the end of every packet using the
-flush_packets option, the default typically means to flush unless a
non-streamed file output is used.

Therefore this change should have no adverse effect on streaming, even if it is
assumed that a new packet has a clean buffer so small seekbacks within the
output buffer work even when the IO context is not seekable.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavformat: remove unneeded avio_flush() calls from the end of write_trailer functions
Marton Balint [Sat, 4 Jan 2020 18:31:14 +0000 (19:31 +0100)]
avformat: remove unneeded avio_flush() calls from the end of write_trailer functions

The IO context is always flushed by libavformat/mux.c after write_trailer is
called, so this change should have no effect at all.

4 years agoavformat: remove avio_flush() calls from the end of write_header functions
Marton Balint [Sat, 4 Jan 2020 18:03:24 +0000 (19:03 +0100)]
avformat: remove avio_flush() calls from the end of write_header functions

To make it consistent with other muxers.

The user can still control the generic flushing behaviour after write_header
(same way as after packets) using the -flush_packets option, the default
typically means to flush unless a non-streamed file output is used.

Therefore this change should have no adverse effect on streaming, even if it is
assumed that the first packet has a clean buffer, so small seekbacks within the
output buffer work even when the IO context is not seekable.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavformat: remove unneeded avio_flush() calls before calling avio_close_dyn_buf()
Marton Balint [Fri, 27 Dec 2019 13:18:20 +0000 (14:18 +0100)]
avformat: remove unneeded avio_flush() calls before calling avio_close_dyn_buf()

avio_close_dyn_buf() also does avio_flush().

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agovf_dnn_processing: add support for more formats gray8 and grayf32
Guo, Yejun [Fri, 27 Dec 2019 08:34:20 +0000 (16:34 +0800)]
vf_dnn_processing: add support for more formats gray8 and grayf32

The following is a python script to halve the value of the gray
image. It demos how to setup and execute dnn model with python+tensorflow.
It also generates .pb file which will be used by ffmpeg.

import tensorflow as tf
import numpy as np
from skimage import color
from skimage import io
in_img = io.imread('input.jpg')
in_img = color.rgb2gray(in_img)
io.imsave('ori_gray.jpg', np.squeeze(in_img))
in_data = np.expand_dims(in_img, axis=0)
in_data = np.expand_dims(in_data, axis=3)
filter_data = np.array([0.5]).reshape(1,1,1,1).astype(np.float32)
filter = tf.Variable(filter_data)
x = tf.placeholder(tf.float32, shape=[1, None, None, 1], name='dnn_in')
y = tf.nn.conv2d(x, filter, strides=[1, 1, 1, 1], padding='VALID', name='dnn_out')
sess=tf.Session()
sess.run(tf.global_variables_initializer())
graph_def = tf.graph_util.convert_variables_to_constants(sess, sess.graph_def, ['dnn_out'])
tf.train.write_graph(graph_def, '.', 'halve_gray_float.pb', as_text=False)
print("halve_gray_float.pb generated, please use \
path_to_ffmpeg/tools/python/convert.py to generate halve_gray_float.model\n")
output = sess.run(y, feed_dict={x: in_data})
output = output * 255.0
output = output.astype(np.uint8)
io.imsave("out.jpg", np.squeeze(output))

To do the same thing with ffmpeg:
- generate halve_gray_float.pb with the above script
- generate halve_gray_float.model with tools/python/convert.py
- try with following commands
  ./ffmpeg -i input.jpg -vf format=grayf32,dnn_processing=model=halve_gray_float.model:input=dnn_in:output=dnn_out:dnn_backend=native out.native.png
  ./ffmpeg -i input.jpg -vf format=grayf32,dnn_processing=model=halve_gray_float.pb:input=dnn_in:output=dnn_out:dnn_backend=tensorflow out.tf.png

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
4 years agovf_dnn_processing: remove parameter 'fmt'
Guo, Yejun [Fri, 27 Dec 2019 08:34:15 +0000 (16:34 +0800)]
vf_dnn_processing: remove parameter 'fmt'

do not request AVFrame's format in vf_ddn_processing with 'fmt',
but to add another filter for the format.

command examples:
./ffmpeg -i input.jpg -vf format=bgr24,dnn_processing=model=halve_first_channel.model:input=dnn_in:output=dnn_out:dnn_backend=native -y out.native.png
./ffmpeg -i input.jpg -vf format=rgb24,dnn_processing=model=halve_first_channel.model:input=dnn_in:output=dnn_out:dnn_backend=native -y out.native.png

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
4 years agoavcodec/libvpxenc,cosmetics: prefer sizeof(var)
James Zern [Fri, 3 Jan 2020 23:01:43 +0000 (15:01 -0800)]
avcodec/libvpxenc,cosmetics: prefer sizeof(var)

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: James Zern <jzern@google.com>
4 years agoavcodec/vmdaudio: Check block_align more
Michael Niedermayer [Mon, 6 Jan 2020 00:38:21 +0000 (01:38 +0100)]
avcodec/vmdaudio: Check block_align more

Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
Fixes: 19788/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VMDAUDIO_fuzzer-5743379690553344
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavfilter/vf_showinfo: Fix erroneous results for mean and stdev with pixel bits >8
Limin Wang [Mon, 6 Jan 2020 19:54:17 +0000 (20:54 +0100)]
avfilter/vf_showinfo: Fix erroneous results for mean and stdev with pixel bits >8

Have tested with be and le pixel format on be and le system for >8bit.
System:
lmwang@ubuntu:~/ffmpeg.git.mips$ grep HAVE_BIGENDIAN config.h
ffmpeg.git git:(showinfo) ✗ grep HAVE_BIGENDIAN config.h

Test result:
1, yuv420p
./ffmpeg -f lavfi  -i color=black:duration=1:r=1:size=1280x720,format=yuv420p,showinfo
Master:
mean:[16 128 128] stdev:[0.0 0.0 0.0]
After applied the patch:
 mean:[16 128 128] stdev:[0.0 0.0 0.0]

2, yuv420p10le
./ffmpeg -f lavfi  -i color=black:duration=1:r=1:size=1280x720,format=yuv420p10le,showinfo
Master:
mean:[32 1 1] stdev:[32.0 1.0 1.0]
After applied the patch:
mean:[64 512 512] stdev:[0.0 0.0 0.0]

3, yuv420p10be
./ffmpeg -f lavfi  -i color=black:duration=1:r=1:size=1280x720,format=yuv420p10be,showinfo
Master:
mean:[32 1 1] stdev:[32.0 1.0 1.0]
After applied the patch:
mean:[64 512 512] stdev:[0.0 0.0 0.0]

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/aviobuf: Honor avio_open[2] documentation
Andreas Rheinhardt [Mon, 6 Jan 2020 14:51:49 +0000 (15:51 +0100)]
avformat/aviobuf: Honor avio_open[2] documentation

The documentation of both avio_open() as well as avio_open2() states
that on failure, the pointer to an AVIOContext given to this function
(via a pointer to a pointer to an AVIOContext) will be set to NULL. Yet
it didn't happen upon failure of ffurl_open_whitelist() or when allocating
the internal buffer failed. This commit changes this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/decode: replace avctx->internal with avci for better readability
Limin Wang [Mon, 6 Jan 2020 10:31:03 +0000 (18:31 +0800)]
avcodec/decode: replace avctx->internal with avci for better readability

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agovf_tonemap_vaapi: Fix memory leak in error case
Mark Thompson [Mon, 6 Jan 2020 23:56:10 +0000 (23:56 +0000)]
vf_tonemap_vaapi: Fix memory leak in error case

Fixes CID 1457236.

4 years agoconfigure: Change the configure check for tonemap_vaapi
Xinpeng Sun [Mon, 30 Dec 2019 07:32:56 +0000 (15:32 +0800)]
configure: Change the configure check for tonemap_vaapi

"VAProcFilterParameterBufferHDRToneMapping" was defined in libva 2.4.1, which will lead to
build failure for the filter tonemap_vaapi for libva 2.3.0 with current check. This patch
is to fix this build error.

Signed-off-by: Xinpeng Sun <xinpeng.sun@intel.com>
4 years agolavc/vdpau_vp9: Do not mix declarations and code.
Carl Eugen Hoyos [Mon, 6 Jan 2020 21:57:54 +0000 (22:57 +0100)]
lavc/vdpau_vp9: Do not mix declarations and code.

Fixes the following gcc warning:
libavcodec/vdpau_vp9.c:45:5: warning: ISO C90 forbids mixed declarations and code

4 years agoSilence "string-plus-int" warning shown by clang.
Carl Eugen Hoyos [Mon, 6 Jan 2020 15:16:18 +0000 (16:16 +0100)]
Silence "string-plus-int" warning shown by clang.

libswscale/utils.c:89:42: warning: adding 'unsigned long' to a string does not append to the string [-Wstring-plus-int]

4 years agoavfilter/af_sidechaincompress: add support for commands
Paul B Mahol [Mon, 6 Jan 2020 18:40:07 +0000 (19:40 +0100)]
avfilter/af_sidechaincompress: add support for commands

4 years agodoc/filters: mention commands for crystalizer filter
Paul B Mahol [Mon, 6 Jan 2020 18:08:56 +0000 (19:08 +0100)]
doc/filters: mention commands for crystalizer filter

4 years agodoc/filters: indicate commands for scale2ref
Gyan Doshi [Mon, 6 Jan 2020 15:40:09 +0000 (21:10 +0530)]
doc/filters: indicate commands for scale2ref

4 years agodoc/filters: indicate commands for zscale
Gyan Doshi [Mon, 6 Jan 2020 15:39:00 +0000 (21:09 +0530)]
doc/filters: indicate commands for zscale

4 years agoavfilter/af_dynaudnorm: add support for commands
Paul B Mahol [Sun, 5 Jan 2020 11:09:01 +0000 (12:09 +0100)]
avfilter/af_dynaudnorm: add support for commands

4 years agodoc/filters: add entry for mean and stdev in showinfo
Limin Wang [Mon, 6 Jan 2020 01:30:52 +0000 (09:30 +0800)]
doc/filters: add entry for mean and stdev in showinfo

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Gyan Doshi <ffmpeg@gyani.pro>
4 years agolavc/ffv1: Properly check that the 4th and 5th quant tables are zeroes
Derek Buitenhuis [Sun, 5 Jan 2020 14:43:07 +0000 (14:43 +0000)]
lavc/ffv1: Properly check that the 4th and 5th quant tables are zeroes

Currently, the decoder checks the 128th value of the 4th quant table during
while deriving the context on each sample, in order to speed itself up. This
is due to relying on the behavior of FFmpeg's FFV1 encoder, in which if that
value is zero, the entire 4th and 5th quant tables are assumed to be entirely
zero.

This does not match the FFV1 spec, which has no such restriction, and after
some discussion, it was decided to fix FFmpeg to abide by the spec, rather
than change the spec.

We will now check whether the 4th and 5th quant tables are zero properly,
by checking the 128th valye of both tables (which means they are zero due
to the way they're coded in the bitstream).

For further context, the FFV1 issue in question is located at:

    https://github.com/FFmpeg/FFV1/issues/169

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
4 years agolibavformat: fix spelling in ID3v1 genres and extend the list of Winamp extensions.
Ulrich Spörlein [Thu, 19 Dec 2019 15:12:46 +0000 (16:12 +0100)]
libavformat: fix spelling in ID3v1 genres and extend the list of Winamp extensions.

Sources include various lists on the Internet, as well as the current
Wikipedia page at
https://en.wikipedia.org/w/index.php?title=List_of_ID3v1_Genres&oldid=896774343
but most importantly the list as used by taglib at
https://github.com/taglib/taglib/commit/3e60e339a4bc46e2a1a7aea782502480561a8acf#diff-f86455366624350770f41b4940925dde

Further patches to harmonize the spelling have been sent to taglib and
libid3tag. See also https://github.com/taglib/taglib/pull/942/

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/pgssubdec: Free subtitle on error
Michael Niedermayer [Sat, 4 Jan 2020 20:58:28 +0000 (21:58 +0100)]
avcodec/pgssubdec: Free subtitle on error

Fixes: Assertion failure
Fixes: 19753/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PGSSUB_fuzzer-5688461843759104
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agodoc/volume: correct placement of replaygain_noclip
Gyan Doshi [Sun, 5 Jan 2020 16:16:08 +0000 (21:46 +0530)]
doc/volume: correct placement of replaygain_noclip

In the merge commit 878f8b0d26, entry for replaygain_noclip
was placed in commands, which it is not, instead of among
the options.

4 years agoavfilter/af_dynaudnorm: use already available pointer
Paul B Mahol [Sun, 5 Jan 2020 09:22:57 +0000 (10:22 +0100)]
avfilter/af_dynaudnorm: use already available pointer

Instead of dereferencing same thing again.

4 years agoavfilter/af_dynaudnorm: move channels variable setup first
Paul B Mahol [Sun, 5 Jan 2020 09:20:27 +0000 (10:20 +0100)]
avfilter/af_dynaudnorm: move channels variable setup first

4 years agoffmpeg: don't force source-tracked keyframes for duplicates
Gyan Doshi [Fri, 3 Jan 2020 07:00:09 +0000 (12:30 +0530)]
ffmpeg: don't force source-tracked keyframes for duplicates

Prevents a run of consecutive duplicate frames from all being encoded
as keyframes, when force_key_frames is set to source.

4 years agoffmpeg: remove premature rescaling of forced_keyframe times
Gyan Doshi [Thu, 2 Jan 2020 15:29:00 +0000 (20:59 +0530)]
ffmpeg: remove premature rescaling of forced_keyframe times

The user-set forced KF times are parsed *after* this deleted
loop and rescaled right after parsing.

4 years agodoc/ffmpeg: document value source for -force_key_frames
Gyan Doshi [Sat, 20 Apr 2019 08:46:09 +0000 (14:16 +0530)]
doc/ffmpeg: document value source for -force_key_frames

Also clarify behaviour in case of specified timestamps

4 years agoswscale/aarch64: use multiply accumulate and shift-right narrow
Sebastian Pop [Mon, 9 Dec 2019 14:25:01 +0000 (14:25 +0000)]
swscale/aarch64: use multiply accumulate and shift-right narrow

This patch rewrites the innermost loop of ff_yuv2planeX_8_neon to avoid zips and
horizontal adds by using fused multiply adds. The patch also uses ld1r to load
one element and replicate it across all lanes of the vector. The patch also
improves the clipping code by removing the shift right instructions and
performing the shift with the shift-right narrow instructions.

I see 8% difference on an m6g instance with neoverse-n1 CPUs:
$ ffmpeg -nostats -f lavfi -i testsrc2=4k:d=2 -vf bench=start,scale=1024x1024,bench=stop -f null -
before: t:0.014015 avg:0.014096 max:0.015018 min:0.013971
after:  t:0.012985 avg:0.013013 max:0.013996 min:0.012818

Tested with `make check` on aarch64-linux.

Signed-off-by: Sebastian Pop <spop@amazon.com>
Reviewed-by: Clément Bœsch <u@pkh.me>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavcodec/bsf: replace ctx->internal-> with bsfi-> for better readability
Limin Wang [Mon, 16 Dec 2019 05:01:49 +0000 (13:01 +0800)]
avcodec/bsf: replace ctx->internal-> with bsfi-> for better readability

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agodoc: Fix a typo.
Carl Eugen Hoyos [Sat, 4 Jan 2020 19:58:10 +0000 (20:58 +0100)]
doc: Fix a typo.

4 years agolavfi/buffersrc: Remove redundant free after ff_filter_frame() failure
Jun Zhao [Wed, 1 Jan 2020 05:22:13 +0000 (13:22 +0800)]
lavfi/buffersrc: Remove redundant free after ff_filter_frame() failure

ff_filter_frame() always frees the frame in case of error, so we don't
need to free the frame after ff_filter_frame() fails.

Fix CID 1457230.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
4 years agoavfilter/af_dynaudnorm: fix another clipping with custom peak value
Paul B Mahol [Sat, 4 Jan 2020 18:10:06 +0000 (19:10 +0100)]
avfilter/af_dynaudnorm: fix another clipping with custom peak value

This always happened at start with alternative boundary mode disabled.
The clipping only occurred if starting samples where high enough.

4 years agoavfilter/af_dynaudnorm: implement threshold option
Paul B Mahol [Sat, 4 Jan 2020 17:17:32 +0000 (18:17 +0100)]
avfilter/af_dynaudnorm: implement threshold option

4 years agoavfilter/af_dynaudnorm: do not clip audio
Paul B Mahol [Sat, 4 Jan 2020 09:27:46 +0000 (10:27 +0100)]
avfilter/af_dynaudnorm: do not clip audio

Clipping can happen when smoothed gain is higher than maximum
allowed gain factor for current frame and peak value option is
set to enough low value.

4 years agolibavutil/opt: fix memory leak after av_dict_parse_string fail
Jun Zhao [Wed, 1 Jan 2020 04:35:31 +0000 (12:35 +0800)]
libavutil/opt: fix memory leak after av_dict_parse_string fail

In case of failure, all the successfully set entries are stored in
*pm. We need to manually free the created dictionary to avoid
memory leak.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
4 years agolavfi/coreimage: fix memory leak after av_dict_parse_string fail
Jun Zhao [Wed, 1 Jan 2020 04:27:18 +0000 (12:27 +0800)]
lavfi/coreimage: fix memory leak after av_dict_parse_string fail

In case of failure, all the successfully set entries are stored in
*pm. We need to manually free the created dictionary to avoid
memory leak.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
4 years agolavc/libkvazaar: fix memory leak after av_dict_parse_string fail
Jun Zhao [Wed, 1 Jan 2020 04:09:52 +0000 (12:09 +0800)]
lavc/libkvazaar: fix memory leak after av_dict_parse_string fail

In case of failure, all the successfully set entries are stored in
*pm. We need to manually free the created dictionary to avoid
memory leak.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
4 years agolavc/bsf: fix memory leak after av_dict_parse_string fail
Jun Zhao [Wed, 1 Jan 2020 04:06:47 +0000 (12:06 +0800)]
lavc/bsf: fix memory leak after av_dict_parse_string fail

In case of failure, all the successfully set entries are stored in
*pm. We need to manually free the created dictionary to avoid
memory leak.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
4 years agoavdevice/decklink: deprecate the -list_devices option
Marton Balint [Wed, 21 Aug 2019 21:02:51 +0000 (23:02 +0200)]
avdevice/decklink: deprecate the -list_devices option

The user should use ffmpeg -sources decklink or ffmpeg -sinks decklink instead.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavdevice/decklink_dec: remove -bm_v210 option
Marton Balint [Wed, 21 Aug 2019 20:52:10 +0000 (22:52 +0200)]
avdevice/decklink_dec: remove -bm_v210 option

Deprecated since Sep 28, 2017.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavdevice/decklink_dec: remove the @mode syntax
Marton Balint [Wed, 21 Aug 2019 20:40:11 +0000 (22:40 +0200)]
avdevice/decklink_dec: remove the @mode syntax

Deprecated since March 28, 2017.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavformat/img2enc: fix writing multiple streams in write_muxed_file
Marton Balint [Thu, 26 Dec 2019 22:33:26 +0000 (23:33 +0100)]
avformat/img2enc: fix writing multiple streams in write_muxed_file

Maybe we should just reject multiple streams for the image2 muxer instead?

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavformat/img2enc: minor simplification
Marton Balint [Thu, 26 Dec 2019 21:58:45 +0000 (22:58 +0100)]
avformat/img2enc: minor simplification

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavformat/img2enc: cleanup IO contexts on error
Marton Balint [Thu, 26 Dec 2019 20:08:22 +0000 (21:08 +0100)]
avformat/img2enc: cleanup IO contexts on error

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavformat/img2enc: reindent after last commit
Marton Balint [Thu, 26 Dec 2019 19:54:14 +0000 (20:54 +0100)]
avformat/img2enc: reindent after last commit

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavformat/img2enc: factorize piped write_packet
Marton Balint [Thu, 26 Dec 2019 19:51:19 +0000 (20:51 +0100)]
avformat/img2enc: factorize piped write_packet

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavformat/img2enc: factorize writing fully muxed file
Marton Balint [Thu, 26 Dec 2019 18:57:04 +0000 (19:57 +0100)]
avformat/img2enc: factorize writing fully muxed file

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agodoc/muxers: fix order of options and examples for image2 muxer
Marton Balint [Thu, 26 Dec 2019 23:34:11 +0000 (00:34 +0100)]
doc/muxers: fix order of options and examples for image2 muxer

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavfilter/af_dynaudnorm: fix previous commit
Paul B Mahol [Thu, 2 Jan 2020 16:24:01 +0000 (17:24 +0100)]
avfilter/af_dynaudnorm: fix previous commit

We still need to analyze frame for amplification at EOF.

4 years agoavfilter/af_dynaudnorm: do not enqueue flush buffers
Paul B Mahol [Thu, 2 Jan 2020 15:22:47 +0000 (16:22 +0100)]
avfilter/af_dynaudnorm: do not enqueue flush buffers

4 years agoavcodec/mpeg12dec: always submit the first field to hwaccel
Zhong Li [Mon, 23 Oct 2017 07:43:30 +0000 (15:43 +0800)]
avcodec/mpeg12dec: always submit the first field to hwaccel

Though this patch to fix ticket #6668, I belive it
is unnecessary to set SLICE_FLAG_ALLOW_FIELD flag to other
hwaccels(dxva, vdpau, etc). Please also refer the orginal comment
of 9cb150c9ab520eba5636bbcf925db6a70e67f3e5

Should also fix ticket #8442.

Signed-off-by: Zhong Li <zhong.li@intel.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
4 years agoavcodec/nvdec_mpeg12: set field flags
Timo Rothenpieler [Thu, 2 Jan 2020 12:15:27 +0000 (13:15 +0100)]
avcodec/nvdec_mpeg12: set field flags

4 years agoavcodec/librav1e: use AV_OPT_TYPE_DICT for rav1e-params
Marton Balint [Wed, 25 Dec 2019 00:55:25 +0000 (01:55 +0100)]
avcodec/librav1e: use AV_OPT_TYPE_DICT for rav1e-params

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavcodec/libxavs2: use AV_OPT_TYPE_DICT for xavs2-params
Marton Balint [Wed, 25 Dec 2019 00:13:48 +0000 (01:13 +0100)]
avcodec/libxavs2: use AV_OPT_TYPE_DICT for xavs2-params

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavcodec/libx265: use AV_OPT_TYPE_DICT for x265-params
Marton Balint [Wed, 25 Dec 2019 00:50:36 +0000 (01:50 +0100)]
avcodec/libx265: use AV_OPT_TYPE_DICT for x265-params

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavcodec/libx264: use AV_OPT_TYPE_DICT for x264-params
Marton Balint [Wed, 25 Dec 2019 00:46:37 +0000 (01:46 +0100)]
avcodec/libx264: use AV_OPT_TYPE_DICT for x264-params

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavcodec/libvpxenc: use AV_OPT_TYPE_DICT for ts-parameters
Marton Balint [Wed, 25 Dec 2019 01:02:30 +0000 (02:02 +0100)]
avcodec/libvpxenc: use AV_OPT_TYPE_DICT for ts-parameters

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavformat/tee: use AV_OPT_TYPE_DICT for fifo_options
Marton Balint [Wed, 25 Dec 2019 10:32:48 +0000 (11:32 +0100)]
avformat/tee: use AV_OPT_TYPE_DICT for fifo_options

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavformat/segment: use AV_OPT_TYPE_DICT for segment_format_options
Marton Balint [Tue, 24 Dec 2019 23:48:00 +0000 (00:48 +0100)]
avformat/segment: use AV_OPT_TYPE_DICT for segment_format_options

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavformat/hlsenc: use AV_OPT_TYPE_DICT for hls_ts_options
Marton Balint [Sun, 22 Dec 2019 22:50:18 +0000 (23:50 +0100)]
avformat/hlsenc: use AV_OPT_TYPE_DICT for hls_ts_options

Simplifies code and avoids memory leaks.

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavformat/fifo: use AV_OPT_TYPE_DICT for format_opts
Marton Balint [Wed, 25 Dec 2019 01:13:22 +0000 (02:13 +0100)]
avformat/fifo: use AV_OPT_TYPE_DICT for format_opts

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavformat/dashenc: use AV_OPT_TYPE_DICT for format_options
Marton Balint [Tue, 24 Dec 2019 23:58:24 +0000 (00:58 +0100)]
avformat/dashenc: use AV_OPT_TYPE_DICT for format_options

Signed-off-by: Marton Balint <cus@passwd.hu>
4 years agoavcodec/libx265: export encoded frame stats
James Almer [Sat, 28 Dec 2019 16:34:19 +0000 (13:34 -0300)]
avcodec/libx265: export encoded frame stats

Signed-off-by: James Almer <jamrial@gmail.com>
(cherry picked from commit 66b6005301894823052b437a950003ffbe3ba6de)

4 years agoavcodec/libx265: add a qp option and apply the relevant global AVCodecContext setting...
James Almer [Wed, 14 Aug 2019 01:09:34 +0000 (22:09 -0300)]
avcodec/libx265: add a qp option and apply the relevant global AVCodecContext settings to the encoder context

Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavcodec/libx265: apply some global AVCodecContext settings to the encoder context
James Almer [Wed, 14 Aug 2019 01:07:08 +0000 (22:07 -0300)]
avcodec/libx265: apply some global AVCodecContext settings to the encoder context

There's no reason to ignore them if set.

Signed-off-by: James Almer <jamrial@gmail.com>
4 years agoavformat/matroskadec: Use AV_DICT_DONT_STRDUP_VAL to save av_strdup
Andreas Rheinhardt [Sun, 10 Nov 2019 04:07:31 +0000 (05:07 +0100)]
avformat/matroskadec: Use AV_DICT_DONT_STRDUP_VAL to save av_strdup

This will likely also fix CID 1452562, a false positive resulting from
Coverity thinking that av_dict_set() automatically frees its key and
value parameters (even without the AV_DICT_DONT_STRDUP_* flags).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/matroskaenc: Check return value of ff_isom_write_hvcc()
Andreas Rheinhardt [Wed, 1 Jan 2020 00:58:22 +0000 (01:58 +0100)]
avformat/matroskaenc: Check return value of ff_isom_write_hvcc()

The Matroska muxer currently does not check the return value of
ff_isom_write_hvcc(), the function used to write mp4-style
HEVC-extradata as Matroska also uses it. This was intentionally done in
7a5356c72 to allow remuxing from mpeg-ts.

But if ff_isom_write_hvcc() fails, it has not output anything and the
file ends up without CodecPrivate and, if the input was Annex B, with
Annex B data, which is against the spec. So check the return value
again.

The underlying issue of not having extradata seems to have been fixed by
the introduction of the extract_extradata bitstream filter.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: "mypopy@gmail.com" <mypopy@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/matroskaenc: Adapt documentation of put_ebml_num
Andreas Rheinhardt [Wed, 1 Jan 2020 00:58:21 +0000 (01:58 +0100)]
avformat/matroskaenc: Adapt documentation of put_ebml_num

to its actual behaviour: That it uses the least amount of bytes unless
overridden.

The current documentation leaves it undefined how many bytes will be used
when no number to use has been given explicitly. But several estimates
(used to write EBML Master elements with a small length field) require
this number to be the least amount of bytes to work. Therefore change
the documentation; and remove a comment about writing length fields
indicating "unkown length". It has been outdated since 0580a122.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavformat/mpeg: Remove secondary packet for reading VobSub
Andreas Rheinhardt [Tue, 8 Oct 2019 05:41:14 +0000 (07:41 +0200)]
avformat/mpeg: Remove secondary packet for reading VobSub

When vobsub_read_packet() reads a packet, it uses a dedicated AVPacket
to get the subtitle timing and position from an FFDemuxSubtitlesQueue
(which has been filled with this data during reading the idx file in
vobsub_read_header); afterwards the actual subtitle data is read into
the packet destined for output and the timing and position are copied
to this packet. Afterwards, the local packet is unreferenced.

This can be simplified: Simply use the output packet to get the timing
and position from the FFDemuxSubtitlesQueue. The packet's size will be
zero afterwards, so that it can be directly used to read the actual
subtitle data. This makes copying the packet fields as well as
unreferencing the local packet unecessary and also removes an instance
of usage of sizeof(AVPacket) in libavformat.

The only difference is that the returned packet will already be flagged
as a keyframe. This currently only happens in compute_pkt_fields().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agocompat/avisynth: Fix unicode compilation.
Matt Oliver [Mon, 30 Dec 2019 16:00:40 +0000 (03:00 +1100)]
compat/avisynth: Fix unicode compilation.

Reviewed-by: Stephen Hutchinson <qyot27@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
4 years agoavfilter/af_dynaudnorm: do not hang forever if only EOF is received
Paul B Mahol [Wed, 1 Jan 2020 12:35:31 +0000 (13:35 +0100)]
avfilter/af_dynaudnorm: do not hang forever if only EOF is received