Commit Graph

110212 Commits

Author SHA1 Message Date
Anton Khirnov e1fe6c5577 fftools/ffmpeg: use stack variables to shorten code 2023-04-09 15:47:45 +02:00
Anton Khirnov e1e0c2c7f2 fftools/ffmpeg: drop unnecessary indirection
init_output_stream() can print log messages directly, there is no need
to ship them to the caller.
2023-04-09 15:47:45 +02:00
Anton Khirnov 237f9b9682 fftools/ffmpeg: stop handling AVMEDIA_TYPE_DATA in init_output_stream_encode()
We do not support data encoders, so this should never be reached.
2023-04-09 15:47:45 +02:00
Anton Khirnov 923c6ab170 fftools/ffmpeg: use sync queues for enforcing audio frame size
The code currently uses lavfi for this, which creates a sort of
configuration dependency loop - the encoder should be ideally
initialized with information from the first audio frame, but to get this
frame one needs to first open the encoder to know the frame size. This
necessitates an awkward workaround, which causes audio handling to be
different from video.

With this change, audio encoder initialization is congruent with video.
2023-04-09 15:47:45 +02:00
Anton Khirnov f9d3c06533 fftools/sync_queue: allow requesting a specific number of audio samples
This will be made useful in following commits.
2023-04-09 15:47:45 +02:00
Anton Khirnov 81cca3dae3 fftools/sync_queue: make sure audio duration matches sample count
For audio AVFrames, nb_samples is typically more trustworthy than
duration. Since sync queues look at durations, make sure they match the
sample count.

The last audio frame in the fate-shortest test is now gone. This is more
correct, since it outlasts the last video frame.
2023-04-09 15:47:45 +02:00
Anton Khirnov 9a85245adf fftools/sync_queue: support operation with no limiting streams
ffmpeg CLI will not create such queues currently, but this will become
useful in following commits.
2023-04-09 15:47:45 +02:00
Anton Khirnov 98b41d0bd2 fftools/sync_queue: document overall design 2023-04-09 15:47:45 +02:00
Anton Khirnov 090950f832 fftools/sync_queue: use timebase from input frames/packets
They are always properly set now. Avoid a separate timebase-setting
call, which duplicates the knowledge of the timebase being used.
2023-04-09 15:47:45 +02:00
Anton Khirnov 87e9f5ad3c fftools/ffmpeg: move initializing next_[pd]ts to add_input_streams()
They are initialized to constants, so it makes most sense to do it as
soon as possible.
2023-04-09 15:47:45 +02:00
Anton Khirnov 8e23a62eff fftools/ffmpeg: drop InputStream.processing_needed
It is equivalent to !InputStream.discard.
2023-04-09 15:47:45 +02:00
Anton Khirnov e1d12aaa45 fftools/ffmpeg: do not return finished streams from choose_output() 2023-04-09 15:47:45 +02:00
Anton Khirnov 416e2661ea fftools/ffmpeg: make sure non-lavfi streams are closed on input EOF 2023-04-09 15:47:45 +02:00
Zhao Zhili 862a626c9d avcodec/mediacodecenc: warning when global header is requested.
Add suggests to use extract_extradata bsf.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-04-09 21:44:29 +08:00
Zhao Zhili 34b8af7963 avformat/flvenc: use extract_extradata bsf when necessary
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-04-09 21:44:29 +08:00
Jun Zhao 639ded10e3 lavc/videotoolbox: fix warnings
fix mixing declarations and code warnings

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2023-04-09 18:12:26 +08:00
Jun Zhao aa8ff2240c lavc/videotoolboxenc: fix warnings
fix mixing declarations and code and function
declaration without a prototype warnings

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2023-04-09 18:11:58 +08:00
James Almer 82a14f3602 avformat/matroskadec: also validate the mapping when BlockAddIDType is 0
Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-08 15:24:44 -03:00
Jerome Martinez 05e34523bc avcodec/dpx: fix check of minimal data size for unpadded content
stride value is not relevant with unpadded content and the total count
of pixels (width x height) must be used instead of the rounding based on
width only then multiplied by height

unpadded_10bit value computing is moved sooner in the code in order to
be able to use it during computing of minimal content size. Also make sure to
only set it for 10bit.

Fix 'Overread buffer' error when the content is not lucky enough to have
(enough) padding bytes at the end for not being rejected by the formula
based on the stride value

Fixes ticket #10259.

Signed-off-by: Jerome Martinez <jerome@mediaarea.net>
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-04-08 20:08:18 +02:00
Devin Heitmueller 12d1f7c4b7 avdevice/decklink_enc: Add support for compressed AC-3 output over SDI
Extend the decklink output to include support for compressed AC-3,
encapsulated using the SMPTE ST 377:2015 standard.

This functionality can be exercised by using the "copy" codec when
the input audio stream is AC-3.  For example:

./ffmpeg -i ~/foo.ts -codec:a copy -f decklink 'UltraStudio Mini Monitor'

Note that the default behavior continues to be to do PCM output,
which means without specifying the copy codec a stream containing
AC-3 will be decoded and downmixed to stereo audio before output.

Thanks to Marton Balint for providing feedback.

Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-04-08 20:08:18 +02:00
James Almer 30f1f89572 fate/matroska: add HDR10+ muxing tests
Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-08 10:28:41 -03:00
James Almer bda44f0f39 avformat/matroskaenc: support writing Dynamic HDR10+ packet side data
Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-08 10:28:41 -03:00
James Almer e1f691b2e8 avformat/matroskadec: remove itu_t_t35 flag from MatroskaTrack
It's no longer needed after 88de01d878.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-08 10:21:56 -03:00
James Almer 6d31619af2 avformat/matroskadec: validate MaxBlockAdditionID in the presence of BlockAdditions
The Matroska spec requires it to be equal to the highest BlockAddID value in a
BlockAdditions, but being purely an informative element, only abort if strict
compliance is requested, as demuxing is otherwise unaffected.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-07 14:13:03 -03:00
James Almer 2133cadfcf avformat/matroskadec: reindent after the previous commit
Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-07 11:57:17 -03:00
James Almer 88de01d878 avformat/matroskadec: parse all BlockAdditionMapping elements and export the correct value as BlockAdditional side data
Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-07 11:55:47 -03:00
J. Dekker b564ad8eac lavc/aarch64: add hevc deblock chroma 8-12bit
Benched on Ampere Altra:

hevc_h_loop_filter_chroma8_c: 367.7
hevc_h_loop_filter_chroma8_neon: 31.0
hevc_h_loop_filter_chroma10_c: 396.7
hevc_h_loop_filter_chroma10_neon: 27.5
hevc_h_loop_filter_chroma12_c: 377.0
hevc_h_loop_filter_chroma12_neon: 31.7
hevc_v_loop_filter_chroma8_c: 369.0
hevc_v_loop_filter_chroma8_neon: 55.0
hevc_v_loop_filter_chroma10_c: 389.0
hevc_v_loop_filter_chroma10_neon: 54.0
hevc_v_loop_filter_chroma12_c: 389.5
hevc_v_loop_filter_chroma12_neon: 53.0

Signed-off-by: J. Dekker <jdek@itanimul.li>
2023-04-06 06:54:26 +02:00
J. Dekker 68c151cb1b checkasm: add hevc_deblock chroma test
Signed-off-by: J. Dekker <jdek@itanimul.li>
2023-04-06 06:16:57 +02:00
Jerome Martinez feeeefc3db
avformat/mxfenc: reject unsupported ffv1 versions
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-04-06 00:50:01 +02:00
Jerome Martinez f0cd5610e0
avcodec/ffv1dec: reject unsupported ffv1 versions
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-04-06 00:50:01 +02:00
Michael Niedermayer 916be62da1
tests/fate/vcodec.mak: drop strict experimental from j2k tests
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-04-06 00:49:34 +02:00
Devin Heitmueller 33ef8778e0 avdevice/decklink_enc: Add support for output of Active Format Description (AFD)
Implement support for including AFD in decklink output when putting
out 10-bit VANC data.

Updated to reflect feedback in 2018 from Marton Balint <cus@passwd.hu>,
Carl Eugen Hoyos <ceffmpeg@gmail.com> and Aaron Levinson
<alevinsn_dev@levland.net>.  Also includes fixes to set the AR field
based on the SAR, as well as now sending the AFD info in both fields
for interlaced formats.

Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-04-06 00:40:42 +02:00
Marton Balint 88da4b5fcd fate: split mxf test dependencies to DV and MPEG2
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-04-06 00:40:42 +02:00
Marton Balint 8f534618b5 avformat/mxfdec: treat Random Index Pack as end of file
RIP, if exists is the last KLV item in the MXF files therefore we can stop
parsing the file if it is encountered. This allows us to support files created by
broken muxers such as OpenCube MXFTk Advanced 2.8.0.0.1. which dumps some extra
garbage after the RIP.

Signed-off-by: Marton Balint <cus@passwd.hu>
2023-04-06 00:40:42 +02:00
James Almer 61b27b15fc avutil/hdr_dynamic_metadata: allow av_dynamic_hdr_plus_to_t35() to accept an existing buffer
The function now accepts an existing buffer to avoid unnecessary allocations,
as well as only reporting the needed amount of bytes if you pass a NULL pointer
as input for data.
For this, both parameters become input and output, as well as making data
optional. This is backwards compatible, and as such not breaking any existing
use of the function in external code (if there's any).

Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-05 09:47:12 -03:00
James Almer 1c2a1e0750 avformat/matroskaenc: write a MaxBlockAdditionID element
A non zero value is mandatory for Matroska if the track has blocks with BlockAdditions.

Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-05 09:47:12 -03:00
James Almer 00fde8063a avformat/matroska: add a few more Block Addition ID Type enum values
Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-05 09:47:12 -03:00
James Almer c73cf41f1e avformat/matroskadec: export Dynamic HDR10+ packet side data
Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-05 09:47:12 -03:00
James Almer 6def862559 avformat/matroskadec: set the default value for BlockAddIDType
Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-05 09:47:12 -03:00
James Almer 44513156e3 avformat/matroskadec: support parsing more than one BlockMore element
Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-05 09:47:12 -03:00
Anton Khirnov 2244722f1f doc/ffmpeg: rewrite the introductory paragraph
This is not the place to boast about high-quality polyphase filters -
the most important feature of the program is its universality.
2023-04-04 11:45:51 +02:00
Anton Khirnov bf6df790c2 doc/ffmpeg: refine program title
It is a media converter, not just a video converter.
2023-04-04 11:45:44 +02:00
Anton Khirnov 1d3f7178ae lavf/mux: clarify log messages when choosing oformat fails
Current log messages talk about 'suitable' output formats. This is
confusing, because it suggests that some formats are suitable, while
others are not, which is not the case.

Also, suggest possible user actions when format cannot be guessed from a
filename.
2023-04-04 11:44:54 +02:00
Anton Khirnov dffb058f3b lavf: fall back to a more meaningful log instance name
An uninitialized AVFormatContext instance with neither iformat nor
oformat set will currently log as 'NULL', which is confusing and
unhelpful. Print 'AVFormatContext' instead, which provides more
information.

This happens e.g. if choosing an output format fails in
avformat_alloc_output_context2().

E.g. with the following commandline:
 ffmpeg -i <input> -f foobar -y /dev/null
before: [NULL @ 0x5580377834c0] Requested output format 'foobar' is not a suitable output format
after:  [AVFormatContext @ 0x55fa15bb34c0] Requested output format 'foobar' is not a suitable output format
2023-04-04 11:42:52 +02:00
James Almer 97c95961f0 avcodec/libfdk-aaceenc: add a flush callback
Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-03 20:15:13 -03:00
James Almer 4c00aa036e avcodec/libx264: add a flush callback
Signed-off-by: James Almer <jamrial@gmail.com>
2023-04-03 20:15:13 -03:00
Kyle Manning 9a245bdf5d avcodec/nvenc: fix b-frame DTS behavior with fractional framerates
When using fractional framerates (or any fraction with a numerator != 1),
DTS values for packets would be calculated incorrectly.

Signed-off-by: Kyle Manning <tt2468@irltoolkit.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2023-04-03 11:59:36 +02:00
Gyan Doshi 6941788d24 avformat/movenc: correct loci parameter handling
3GPP TS 26.244 Table 8.10 specifies that longitude is written before
latitude. The MOV demuxer already expects the correct order. So, write
them in that order.

However, the user supplied string may also be used in MOV mode which
requires ISO 6709 format which specifies latitude first. The demuxer
also exports the loci value in that format. So parser adjusted as well.
2023-04-03 15:00:16 +05:30
Michael Niedermayer c6dedaf491
tests: Add more j2k tests to cover a wider range of cases
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-04-02 23:54:52 +02:00
Michael Niedermayer 5666c3b8be
avcodec/j2kenc: Add alpha support
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2023-04-02 23:54:52 +02:00