Commit Graph

466 Commits

Author SHA1 Message Date
Martin Storsjö 884c597659 libavdevice: Split version.h
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-16 14:05:26 +02:00
Martin Storsjö 4eb9232c6e libavformat: Split version.h
Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-16 14:05:26 +02:00
Martin Storsjö f2da2e1458 libavcodec: Split version.h
This avoids including version.h in all source files, avoiding
unnecessary rebuilds when the version number is bumped. Only
version_major.h is included by the main header, which defines
availability of e.g. FF_API_* macros, and which is bumped much
less often.

This isn't done for libavutil/version.h, because that header needs
to be included essentially everywhere due to LIBAVUTIL_VERSION_INT
being used wherever an AVClass is constructed.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-03-16 14:04:35 +02:00
James Almer 0995e1f1b3 ffplay: convert to new channel layout-API
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:46 -03:00
James Almer a8b885f294 ffprobe: convert to new channel layout-API
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:46 -03:00
James Almer 987763ac35 ffmpeg: convert to new channel layout-API
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:46 -03:00
Andreas Rheinhardt f497731260 fftools/ffmpeg_opt: Apply copyinkf for all stream types
The earlier code has ignored it for all stream types except
video and subtitles, probably because audio was presumed
to only consist of keyframes. Yet this assumption is not true
for e.g. TrueHD.

Reviewed-by: Jan Ekström <jeebjp@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-04 21:39:42 +01:00
Andreas Rheinhardt 6559858de9 fftools/ffmpeg: Don't presume frame_queue to have been allocated
Fixes segfaults upon allocation failure.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-03 03:48:04 +01:00
Andreas Rheinhardt 88b02e5829 fftools/ffmpeg_opt: Simplify adding complex filtergraph
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-03 03:48:04 +01:00
Andreas Rheinhardt 09e532c575 fftools/ffmpeg_opt: Simplify adding new input/output streams
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-03 03:48:04 +01:00
Limin Wang 316e0ff752 fftool/ffprobe: support for CUVA HDR Vivid metadata
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2022-03-01 09:08:43 +08:00
James Almer d75e7a9a83 ffmpeg: ensure a keyframe was not seen before skipping packets
A keyframe could be buffered in the bsf and not be output until more packets
had been fed to it.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-02-28 12:11:24 -03:00
James Almer afe485ee6b ffmpeg: flush delayed frames in codec copy scenarios
Bitstream filters inserted between the input and output were never drained,
resulting in packets being lost if the bsf had any buffered.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-02-28 12:10:51 -03:00
Andreas Rheinhardt 047a4e580e fftools/ffprobe: Remove redundant checks
A decoder is only opened if there is a decoder for the codec,
so every AVCodecContext here has AVCodecContext.codec set.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-02-23 11:50:48 +01:00
Andreas Rheinhardt 26cce232d7 fftools/ffprobe: Flush decoder after draining
This is a prerequisite to continue using the decoder at all
to decode the next interval (if any).
This fixes a regression introduced in commit
2a88ebd096 and reported in ticket #8657.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-02-23 11:50:48 +01:00
Anton Khirnov e85958ece8 fftools/ffmpeg: fix (a)buffer src names 2022-02-15 10:16:16 +01:00
Danny Wu 68595b46cb fftools/ffmpeg: Restore DTS correction for VP9 copies
Fixes ticket 9086.

Since early 2021, some of YouTube's VP9 encodes have non-monotonous DTS.
This makes ffmpeg fatally fail when trying to copy or encode the V9 video.

ffmpeg already includes functionality to correct this, however it was
disabled without explanation for VP9 stream copies in
2e6636aa87

This patch restores the DTS correction logic, and allows ffmpeg to correctly
encode (invalid) videos produced by youtube.com. I have verified that frames
are NOT being cut (so it does not re-introduce 4313).

Reviwed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-02-13 10:46:47 -03:00
Anton Khirnov e6469e68cc ffmpeg: switch to new FIFO API 2022-02-07 00:31:23 +01:00
Anton Khirnov bdf9ed41fe ffplay: switch to new FIFO API 2022-02-07 00:31:23 +01:00
Gyan Doshi e1a14479a8 ffprobe: allow side-data selection by element
At present, side data printing forces display for all levels i.e.
stream, packets and frames. This can bloat output and also force
decode of all frames in selected streams.

Now, stream_side_data[=type], packet_side_data[=type] &
frame_side_data[=type] can be used with -show_entries to specify carrier
element.
2022-02-03 16:04:24 +05:30
Andreas Rheinhardt bbf00916e4 fftools/cmdutils: Fix undefined 1 << 31
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-11 00:20:35 +01:00
Anton Khirnov 1b24a1ea14 ffmpeg: remove a redundant assignment of interrupt_callback
It is already set in open_output_file().
2022-01-10 15:57:22 +01:00
Jan Ekström a3f4148319 ffprobe: Support AV_FRAME_DATA_DOVI_METADATA
Co-authored-by: Niklas Haas <git@haasn.dev>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 11:59:41 +01:00
Diederick Niehorster 5c90c13a56 fftools: provide media type info for devices
fftools now print info about what media type(s), if any, are provided by
sink and source avdevices.

Signed-off-by: Diederick Niehorster <dcnieho@gmail.com>
Reviewed-by: Roger Pack <rogerdpack2@gmail.com>
2021-12-24 14:06:56 +05:30
Andreas Rheinhardt 04133eb2d5 fftools/ffmpeg_filter: Avoid inserting hflip filter
The transpose filter has modes equivalent to "rotation by 90°/270°"
followed by horizontal flips.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-23 18:09:46 +01:00
Andreas Rheinhardt 4e21fff19d fftools/ffmpeg_filter: Fix autorotation
In case of an orthogonal transformation av_display_rotation_get()
returns the (anticlockwise) degree that the unit vector in x-direction
gets rotated by; get_rotation in cmdutils.c makes a clockwise degree
out of this. So if one inserts a transpose filter corresponding to
this degree, then the x-vector gets mapped correctly and there are
two possibilities for image of the y-vector, namely the two unit
vectors orthogonal to the image of the x-vector.

E.g. if the x-vector gets rotated by 90° clockwise, then the two
possibilities for the y-vector are the unit vector in x direction
or its opposite. The latter case is a simple 90° rotation for both
vectors* whereas the former is a simple 90° clockwise rotation followed
by a horizontal flip. These two cases can be distinguished by looking
at the x-coordinate of the image of the y-vector, i.e. by looking
at displaymatrix[3]. Similarly for the case of a 270° clockwise
rotation.

These two cases were previously wrong (they were made to match
wrongly parsed exif rotation tag values).

*: For display matrices, the y-axis points downward.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-23 18:09:46 +01:00
James Almer 131dbb9a7a ffprobe: add missing separator when printing side data in compact output
Should fix ticket #7153

Signed-off-by: James Almer <jamrial@gmail.com>
2021-12-22 09:41:13 -03:00
Yu Yang a4580bf959 fftools/cmdutils: Avoid crash when opts could not be allocated
If 'opts' could not be allocated, exiting the program to avoid crash when release it.

Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Yu Yang <yuyang14@kuaishou.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-16 11:56:00 +01:00
Marton Balint 8d66a07d65 fftools/ffmpeg: close output files before cleanup
This allows us to check the return value of avio_closep().

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-12-12 00:32:20 +01:00
Anton Khirnov 9f717ca92f ffmpeg: handle errors in print_sdp()
Do not continue as if nothing happened.
2021-12-07 11:23:45 +01:00
Anton Khirnov 9145c6d3b2 ffmpeg: move setting video sync method to new_video_stream()
do_video_out() is the wrong place for it, since the necessary
information is already known when creating the stream and its value
should never change.
2021-12-07 11:23:45 +01:00
Anton Khirnov 6ce9546428 ffmpeg: deprecate passing numbers to -vsync
There is never a reason to do this, using symbolic names is always
preferred.
2021-12-07 11:23:45 +01:00
Anton Khirnov 011114f3e1 ffmpeg: change vsync value to an enum
Stop explicitly defining VSCFR and DROP values, which were never
documented.
2021-12-07 11:23:45 +01:00
Anton Khirnov bb6f591c49 ffmpeg: drop useless framerate assignments
If the input stream framerate is known, it will be configured on the
relevant filtergraph input and get propagated to the output stream in
the above line. That makes these assignments redundant.
2021-12-07 11:23:45 +01:00
Andreas Rheinhardt 6fc0fc5441 fftools/ffmpeg_opt: Improve alloc/truncation checks when reading lines
Do this by switching from the dynamic buffer API to the AVBPrint API;
the former has no defined way to check for errors.
This also avoids allocating an AVIOContext.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-07 10:01:41 +01:00
Andreas Rheinhardt f3a8d208c0 fftools/ffmpeg_opt: Improve checks for truncation/alloc error
Do this by switching from the dynamic buffer API to the AVBPrint API;
the former has no defined way to check for errors.
This also avoids allocating an AVIOContext.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-07 10:01:34 +01:00
Andreas Rheinhardt fc01a703de fftools/ffmpeg: Avoid creating unnecessary reference
The only caller of do_video_out() doesn't need the frame afterwards,
ergo one can replace an av_frame_ref() by av_frame_move_ref().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-05 13:27:38 +01:00
Andreas Rheinhardt b886512ef2 fftools/ffmpeg: Avoid allocating+freeing frame, check allocations
Fixes a potential crash upon av_frame_alloc() failure.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-05 13:27:38 +01:00
Andreas Rheinhardt 2d0bfbd0fa fftools/cmdutils: Use av_dynarray_add_nofree()
Simplifies code and reduces the number of allocations a bit
by overallocating.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-05 13:27:38 +01:00
Andreas Rheinhardt 2e7ef008e3 fftools/cmdutils: Make allocate_array_elem() return ptr to new element
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-05 13:27:38 +01:00
Andreas Rheinhardt 9d73967b40 fftools/ffmpeg_(filter|opt): Use dedicated pointer for array elem access
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-05 13:27:37 +01:00
Andreas Rheinhardt 3ca1e31e63 fftools/cmdutils: Atomically add elements to list of pointers, fix crash
Currently, adding a (separately allocated) element to a list of pointers
works by first reallocating the array of pointers and (on success)
incrementing its size and only then allocating the new element.
If the latter allocation fails, the size is inconsistent, i.e.
array[nb_array_elems - 1] is NULL. Our cleanup code crashes in such
scenarios.

Fix this by adding an auxiliary function that atomically allocates
and adds a new element to a list of pointers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-05 13:27:37 +01:00
Anton Khirnov ab3ef54c8c ffmpeg: only copy bits_per_sample from decoder when it remains valid
I.e. when the only filters that are applied do not modify the frame
data.
2021-12-04 14:08:17 +01:00
Anton Khirnov 4258893961 ffmpeg: make -bits_per_raw_sample a per-output-stream option
Also, document it and make it apply to audio in addition to video.
2021-12-04 14:07:36 +01:00
Andreas Rheinhardt efc323062c fftools/ffmpeg_filter: Avoid DynBuf API to improve error checks
choose_pix_fmts() used the dynamic buffer API to write strings;
as is common among uses of this API, only opening the dynamic buffer
was checked, but not the end result, leading to crashes in case
of allocation failure.
Furthermore, some static strings were duplicated; the allocations
performed here were not properly checked: Allocation failure would
be treated as "could not determine pixel format".
The first issue is fixed by switching to the AVBPrint API which allows
to easily perform checks at the end. Furthermore, the internal buffer
avoids almost all allocations in case the AVBPrint is used.
The AVBPrint also allows to solve the second issue in an elegant way,
because it allows to return the static strings directly.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-03 16:12:52 +01:00
Andreas Rheinhardt cf8925a096 fftools/ffmpeg_filter: Avoid DynBuf-API for writing strings
It is not really natural, it requires internal allocations
of its own and its error handling is horrible (i.e. the implicit
(re)allocations here are unchecked).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-03 16:11:01 +01:00
James Almer c1818cb947 ffmpeg: fix usage of -shortest in codec copy scenarios
Don't mark all streams as finished, instead make sync_opts keep track of the
stream's duration, and set recording_time to it, same as in transcoding paths.

Fixes tickets #9512 and #9513.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-12-01 18:16:56 -03:00
Andreas Rheinhardt e22dff43e7 fftools/ffmpeg_opt: Don't set source_index redundantly
It is already set in new_output_stream().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-30 12:06:02 +01:00
Andreas Rheinhardt 4913f05ccf fftools/ffmpeg_opt: Don't duplicate array unnecessarily
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-30 11:53:22 +01:00
softworkz 939711905a fftools/ffprobe: print size of attachment streams (extradata_size)
Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-11-29 21:30:11 +01:00
rcombs 4b54818981 ffmpeg: remove ffmpeg_videotoolbox
This was almost completely redundant. The only functionality that's no longer
available after this removal is the videotoolbox_pixfmt arg, which has been
obsolete for several years.
2021-11-28 16:40:43 -06:00
Andreas Rheinhardt 81be19b906 fftools/ffmpeg: Take type limitations of AVFifo API into account
The types used by the AVFifo API are inconsistent:
av_fifo_(space|size)() returns an int; av_fifo_alloc() takes an
unsigned, other parts use size_t. This commit therefore ensures
that the size of the muxing_queue FIFO never exceeds INT_MAX.

While just at it, also make sure not to call av_fifo_size()
unnecessarily often.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-26 18:55:58 +01:00
Anton Khirnov 9dd104f6e2 ffmpeg: drop obsolete rotation API remnants
No demuxers export the "rotate" metadata tag anymore.
2021-11-23 11:36:59 +01:00
Anton Khirnov 823cea5197 ffmpeg: drop -isync, which did nothing since 2012 2021-11-23 11:36:59 +01:00
Anton Khirnov 84cb255c20 ffmpeg: drop -sameq/-samequant options
They did nothing but return an error since 2012.
2021-11-23 11:36:59 +01:00
Anton Khirnov 5ebdf9bb50 ffmpeg: drop the -tvstd option
It is undocumented and has been deprecated since 2012.
2021-11-23 11:36:59 +01:00
Anton Khirnov a44098152b ffmpeg: drop the -vc option
It is undocumented and has been deprecated since 2012.
2021-11-23 11:36:59 +01:00
Anton Khirnov d013453caa ffmpeg: drop the -deinterlace option
It is undocumented and has been deprecated since 2013.
2021-11-23 11:36:59 +01:00
Anton Khirnov 9d4e290ec4 ffmpeg: drop the -intra option
It is undocumented and has been marked as deprecated since 2012.
2021-11-23 11:36:59 +01:00
Anton Khirnov e8380bbae6 ffmpeg: do not copy chroma_sample_location from the input stream
It will be set from the supplied AVFrame later on.
2021-11-23 11:36:59 +01:00
Andreas Rheinhardt a132614bba fftools/ffmpeg: Avoid temporary frame
send_frame_to_filters() sends a frame to all the filters that
need said frame; for every filter except the last one this involves
creating a reference to the frame, because
av_buffersrc_add_frame_flags() by default takes ownership of
the supplied references. Yet said function has a flag which
changes its behaviour to create a reference itself.
This commit uses this flag and stops creating the references itself;
this allows to remove the spare AVFrame holding the temporary
references; it also avoids unreferencing said frame.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-20 00:07:47 +01:00
James Almer 405685dec7 ffmpeg: remove unused hw_frames_ctx AVBufferRef from InputStream
Signed-off-by: James Almer <jamrial@gmail.com>
2021-11-19 15:26:11 -03:00
James Almer 379f8b8ec6 ffmpeg: remove unused hwaccel_get_buffer function pointer
As well as the custom get_buffer2() implementation which would become a
redundant wrapper for avcodec_default_get_buffer2() after this

Signed-off-by: James Almer <jamrial@gmail.com>
2021-11-19 15:26:11 -03:00
James Almer e7f3279ba0 ffmpeg: Allocate InputStream.decoded_frame early
Based on a commit by Andreas Rheinhardt.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-11-19 11:21:04 -03:00
James Almer ee3d6a20f6 ffmpeg: Allocate (In|Out)putStream.filter_frame early
Based on a commit by Andreas Rheinhardt.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-11-19 11:21:04 -03:00
Chad Fraleigh a185b526a9 fftools: Constify values from av_dict_get()
Treat values returned from av_dict_get() as const, since they are
internal to AVDictionary.

Signed-off-by: Chad Fraleigh <chadf@triularity.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-18 19:43:32 +01:00
Paul B Mahol e5367b481b ffmpeg: fix loosing gaps between audio frame timestamps when filtering 2021-11-18 12:54:17 +01:00
Anton Khirnov bd55552d69 ffmpeg: rewrite setting the stream disposition
Currently, the code doing this is spread over several places and may
behave in unexpected ways. E.g. automatic 'default' marking is only done
for streams fed by complex filtergraphs. It is also applied in the order
in which the output streams are initialized, which is effectively
random.

Move processing the dispositions at the end of open_output_file(), when
we already have all the necessary information.

Apply the automatic default marking only if no explicit -disposition
options were supplied by the user, and apply it to the first stream of
each type (excluding attached pics) when there is more than one stream
of that type and no default markings were copied from the input streams.

Explicitly document the new behavior.

Changes the results of some tests, where the output file gets a default
disposition, while it previously did not.
2021-11-16 10:51:32 +01:00
Anton Khirnov d4ae2a20e8 cmdutils: add an option for listing stream dispositions 2021-11-16 10:51:32 +01:00
Anton Khirnov a4c5d241ec lavf: add "disposition" AVOption to AVStream AVClass
Use it to remove custom disposition parsing code from ffmpeg.c
2021-11-16 10:51:32 +01:00
Soft Works f3b6e3e81a fftools/cmdutils: Print bit depths when executing 'ffmpeg -pix_fmts'
New output looks like this:

Pixel formats:
I.... = Supported Input  format for conversion
.O... = Supported Output format for conversion
..H.. = Hardware accelerated format
...P. = Paletted format
....B = Bitstream format
FLAGS NAME            NB_COMPONENTS BITS_PER_PIXEL BIT_DEPTHS
-----
IO... yuv420p                3             12      8-8-8
IO... yuyv422                3             16      8-8-8
IO... rgb24                  3             24      8-8-8
IO... bgr24                  3             24      8-8-8
IO... yuv422p                3             16      8-8-8
IO... yuv444p                3             24      8-8-8

[..]

Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-11-13 19:55:32 +01:00
Soft Works ce47ce079a fftools/ffmpeg: Output log message when interactive q command is received
When viewing logs, it's sometimes useful to be able to see whether
execution was ended via q command.

Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-11-13 19:55:32 +01:00
Soft Works bcbedd2749 fftools/ffmpeg: Fix indentation after change
Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-11-13 19:55:32 +01:00
Soft Works 0a99c8322a fftools/ffmpeg: Remove redundant loop
Signed-off-by: softworkz <softworkz@hotmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-11-13 19:55:32 +01:00
Andreas Rheinhardt 44c65c6cc0 fftools/ffmpeg_opt: Fix copyinkf option name in warning message
Reviewed-by: Jan Ekström <jeebjp@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-10 15:20:12 +01:00
Zane van Iperen 783935de18
fftools/ffplay: don't disable x11 compositing
Prevents desktop stutters caused by the change (specifically on KDE).
We're not a game, we don't actually need it disabled.

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-10-29 12:17:41 +10:00
Andreas Rheinhardt 21914e7a4e fftools/ffmpeg, ffmpeg_opt: Allocate (In|Out)putStream.pkt early
Avoids checks lateron in the hot path.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-08 16:03:21 +02:00
Andreas Rheinhardt f1df856fb6 fftools/ffmpeg: Remove unnecessary av_packet_unref()
avcodec_receive_packet() already unreferences the packet on its own.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-08 15:51:17 +02:00
Andreas Rheinhardt fb215798c7 fftools/ffmpeg: Fix crash when flushing non-fully setup output stream
The output stream's packet may not have been allocated
at that point. This happens when quitting in the following command line:
$ ./ffmpeg -lavfi abuffer=sample_fmt=u8:sample_rate=48000:channel_layout=stereo -f null -

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-08 12:06:00 +02:00
Andreas Rheinhardt 8a23159797 fftools/ffmpeg, doc/examples: Remove redundant av_packet_unref
av_interleaved_write_frame() already returns blank packets.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-03 20:50:49 +02:00
Andreas Rheinhardt d15efbdd5e fftools/ffmpeg_opt: Remove write-only variable
Unused since 6b35a83214 (the removal of
ffserver).

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-02 18:34:35 +02:00
James Almer ed1a70469e ffmpeg_filter: don't try to autorotate frames with hwaccel pixel formats
The transpose, rotate, hflip, and vflip filters don't support them.
Fixes ticket #9432.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-09-21 10:41:16 -03:00
Andreas Rheinhardt 01f106000b fftools/ffmpeg_opt: Add missing AV_OPT_SEARCH_FAKE_OBJ
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-20 02:19:56 +02:00
Andreas Rheinhardt 1ea3650823 Replace all occurences of av_mallocz_array() by av_calloc()
They do the same.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-20 01:03:52 +02:00
Andreas Rheinhardt 3b6c25c925 avfilter/vf_subtitles, fftools/ffmpeg: Don't set sub_text_format
Unnecessary since 1f63665ca5, because
the value the option is set to coincides with the default value.

Found-by: Soft Works <softworkz@hotmail.com>
Reviewed-by: Soft Works <softworkz@hotmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-20 00:27:47 +02:00
Andreas Rheinhardt c5c6871a22 fftools/cmdutils: Don't report AV_CODEC_CAP_TRUNCATED
It is deprecated.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-20 00:21:57 +02:00
James Almer 42fce6fffe ffmpeg: take into account image flipping in the display matrix
This covers only standard rotations.
Fixes part of ticket #6945.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-09-16 12:57:06 -03:00
James Almer 535a835e51 ffmpeg: use display matrix frame side data for autorotation
And give it priority over stream side data when present.
Fixes part of ticket #6945.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-09-16 12:46:07 -03:00
James Almer a8bd8d46f9 cmdutils: round rotation value to nearest integer
As recommended by the doxy for av_display_rotation_get().

Signed-off-by: James Almer <jamrial@gmail.com>
2021-09-16 12:46:07 -03:00
Andreas Rheinhardt 6b08ed9f95 fftools/ffprobe: Don't access AVProgram.(start|end)_time
These are internal fields.

Reviewed-by: Tobias Rapp <t.rapp@noa-archive.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-14 19:17:19 +02:00
Haihao Xiang 6803d8b440 ffmpeg_hw: make hardware selection for filters more user friendly
When a device is derived from a source device, there are at least 2
devices, and usually the derived device is the expected device, so let's
pick the last device if user doesn't specify the filter device with
filter_hw_device option

After applying this patch, the command below can work:

$> ffmpeg -init_hw_device vaapi=va:/dev/dri/renderD128 -init_hw_device
qsv=hw@va -f lavfi -i yuvtestsrc  -vf
format=nv12,hwupload=extra_hw_frames=64 -c:v h264_qsv -y out.h264

Reviewed-by: Soft Works <softworkz@hotmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-09-12 13:33:50 -03:00
Andreas Rheinhardt b36b703c29 fftools/cmdutils: Use %c, not %s to write a single char
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-05 11:55:01 +02:00
Andreas Rheinhardt 5312208f12 Revert "ffmpeg: force 128k default audio bitrate if nothing is specified and there is no specific default"
This reverts commit 628a73f8f3.

At the time of said commit there was talk of removing the audio bitrate
"ab" option to bring FFmpeg in line with what Libav has done in 2012 in
commit 041cd5a0c5. By having different
option flags for the "ab" and the ordinay bitrate "b" option is is
possible to have different default bitrates for audio and video. In
order to maintain this behaviour and not break user scripts the commit
to be reverted added code to ffmpeg.c that set the bitrate value to the
audio default for audio codecs, but only if AVCodec.defaults didn't
exist (as in this case the default would be codec-default and not
affected by the "ab" removal).

This had the downside of being an API violation, because
AVCodec.defaults is not a public field. Given that the "ab" option
and its audio-specific default value have never been removed,
said API violation can be simply fixed by reverting said commit.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-05 11:55:01 +02:00
James Almer 7453d3482a ffmpeg: let AVFilterGraph parse the filter_threads option
This way the CLI accepts for "filter_threads" the same values as for the
libavcodec specific option "threads".

Fixes FATE with THREADS=auto which was broken in bdc1bdf3f5.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-09-04 10:35:07 -03:00
Andreas Rheinhardt 70f06dd63c fftools/cmdutils: Use %c, not %s, to write single char
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-04 08:12:56 +02:00
Andreas Rheinhardt 23b83adb6d fftools/cmdutils: Don't access AV(In|Out)putformat.get_device_list
It is not part of the public API.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-04 08:12:56 +02:00
Andreas Rheinhardt bc046b715e fftools/ffmpeg: Remove unused fields
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-03 19:43:53 +02:00
Andreas Rheinhardt f3f9041302 fftools: Remove remnants of resample_opts
These were intended to pass options to auto-inserted avresample
resampling filters. Yet FFmpeg uses swresample for this purpose
(with its own AVDictionary swr_opts similar to resample_opts).
Therefore said options were not forwarded any more since commit
911417f0b34e611bf084319c5b5a4e4e630da940; moreover since commit
420cedd497 avresample options are
not even recognized and ignored any more. Yet there are still
remnants of all of this. This commit gets rid of them.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-03 16:08:19 +02:00
Limin Wang c500dc7cca fftools/cmdutils: Fix warning for initialization makes integer from pointer without a cast
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-09-01 09:32:24 +08:00
Linjie Fu 7352c370fa Revert "fftools/ffmpeg_filter: fix the flags parsing for scaler"
This reverts commit b3a0548a98.

This breaks the usage of swscale options, scale_sws_opts should be
passed to auto-inserted scale-filters.

Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
2021-08-30 21:27:50 +08:00