Commit Graph

214 Commits

Author SHA1 Message Date
Anton Khirnov
a545cb2b9d fftools/cmdutils: split common option handlers into their own file 2022-03-22 18:49:43 +01:00
James Almer
e78173557d ffmpeg: make the ac option set the demuxer's ch_layout AVOption
channels is deprecated on all supported raw demuxers.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-22 08:45:39 -03:00
James Almer
639c2f0049 ffmpeg: add a ch_layout option as an alias to channel_layout
This ensures it's parsed as a CLI option instead of the AVCodecContext AVOption.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-22 08:45:38 -03:00
James Almer
bc99e3a9d6 ffmpeg: replace custom channel_layout code with an SpecifierOpt based one
This is cleaner and allows fine tuning which stream the option is applied to.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-22 08:45:38 -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
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
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
Anton Khirnov
e6469e68cc ffmpeg: switch to new FIFO API 2022-02-07 00:31:23 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Haihao Xiang
ecee3b07cd qsvdec: add support for HW_DEVICE_CTX method
This allows user set hw_device_ctx instead of hw_frames_ctx for QSV
decoders, hence we may remove the ad-hoc libmfx setup code from FFmpeg.

"-hwaccel_output_format format" is applied to QSV decoders after
removing the ad-hoc libmfx code. In order to keep compatibility with old
commandlines, the default format is set to AV_PIX_FMT_QSV, but this
behavior will be removed in the future. Please set "-hwaccel_output_format qsv"
explicitly if AV_PIX_FMT_QSV is expected.

The normal device stuff works for QSV decoders now, user may use
"-init_hw_device args" to initialise device and "-hwaccel_device
devicename" to select a device for QSV decoders.

"-qsv_device device" which was added for workarounding device selection
in the ad-hoc libmfx code still works

For example:

$> ffmpeg -init_hw_device qsv=qsv:hw_any,child_device=/dev/dri/card0
-hwaccel qsv -c:v h264_qsv -i input.h264  -f null -

/dev/dri/renderD128 is actually open for h264_qsv decoder in the above
command without this patch. After applying this patch, /dev/dri/card0
is used.

$> ffmpeg -init_hw_device vaapi=va:/dev/dri/card0 -init_hw_device
qsv=hw@va -hwaccel_device hw -hwaccel qsv -c:v h264_qsv -i input.h264
-f null -

device hw of type qsv is not usable in the above command without this
patch. After applying this patch, this command works as expected.

Reviewed-by: Soft Works <softworkz@hotmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-08-11 13:45:36 -03:00
Gyan Doshi
c50f5460d2 ffmpeg_opt: restore documented stream selection behaviour
11d3b03fcb added consideration of default stream disposition for audio
and video when choosing the 'best' stream among all the inputs. This can
lead to video streams with lower resolution or audio streams with fewer
channels being selected.

Stream disposition, however, only sets a priority for a stream
among all other streams in the *same input*. It cannot set a priority
for a stream across all inputs.

This patch sets a middle-way and selects the best stream from each file
with default disposition considered. Then it discards disposition weight
and selects best stream as per the original criteria of highest
resolution for video and most channels for audio.
2021-08-01 09:51:07 +05:30
Andreas Rheinhardt
57b5ec6ba7 avcodec/avcodec: Stop including bsf.h in avcodec.h
Also include bsf.h directly wherever it is used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-22 11:14:16 +02:00
Gyan Doshi
c320b78e95 ffmpeg: add option readrate
Allows to read inputs at arbitrary rates.
-re is equivalent to -readrate 1

Tested with -copyts {+ start_at_zero}, -ss, streamcopied & decoded streams.
2021-07-17 20:34:21 +05:30
Gyan Doshi
79ebdbb9b9 ffmpeg: add option recast_media
Allows forcing decoders of different media type.
Needed to decode media data muxed as data streams.
2021-07-11 11:54:20 +05:30
James Almer
ab4f299e23 fftools/ffmpeg: remove usage of internal timestamp AVStream fields
They should not be accessed outside of libavformat.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-06-04 22:36:39 -03:00
James Almer
4d3474432f ffmpeg: stop accessing private AVStream.codec_info_nb_frames
Use AVSTREAM_EVENT_FLAG_NEW_PACKETS instead, which should provide the
same information in this case.
Finishes removing all uses of this field as started by 87f0c8280c.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-05-02 00:44:19 -03:00
James Almer
3749eede66 avformat: remove deprecated AVStream.codec
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 11:47:24 -03:00
Andreas Rheinhardt
14fa0a4efb avformat/avformat: Constify AVFormatContext.*_codec pointers
This also allows to exclusively use pointers to const AVCodec in
fftools/ffmpeg_opt.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:13 -03:00
Andreas Rheinhardt
56450a0ee4 avformat: Constify the API wrt AV(In|Out)putFormat
Also constify AVProbeData.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:08 -03:00
James Almer
82bd02a2c7 fftools/ffmpeg: use av_packet_alloc() to allocate packets
Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-17 15:19:38 -03:00
Andreas Rheinhardt
988deae6da fftools: Switch to const AVCodec * where possible
The obstacle to do so was in filter_codec_opts: It uses searches
the AVCodec for options via the AV_OPT_SEARCH_FAKE_OBJ method, which
requires using a void * that points to a pointer to a const AVClass.
When using const AVCodec *, one can not simply use a pointer that points
to the AVCodec's pointer to its AVClass, as said pointer is const, too.
This is fixed by using a temporary pointer to the AVClass.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-02 08:20:10 +01:00
Gyan Doshi
d99cc17825 ffmpeg: add -fpsmax to clamp output framerate
Useful when encoding in batch or with aberrant inputs.
2021-02-05 22:54:18 +05:30
Limin Wang
81c462ad95 avformat/mxfenc: prefer to use the configured metadata
The metadata company_name, product_name, product_version from input
file will be deleted to avoid overwriting information
Please to test with below commands:
./ffmpeg -i ../fate-suite/mxf/Sony-00001.mxf -c:v copy -c:a copy out.mxf
and
./ffmpeg -i ../fate-suite/mxf/Sony-00001.mxf -c:v copy -c:a copy \
        -metadata company_name="xxx" \
        -metadata product_name="xxx" \
        -metadata product_version="xxx" \
        out.mxf

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-02-05 09:27:06 +08:00
James Almer
a423bc9dc2 ffmpeg_opts: remove lowres check
The st->codec values are updated based on the lowres factor by
avformat_find_stream_info() when it runs an instance of the decoder internally,
and the same thing happens in ffmpeg.c when we open ist->dec_ctx with
avcodec_open2(), so these assignments are redundant.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-01-21 10:22:41 -03:00
Gyan Doshi
0fff6c039c doc/ffmpeg: document max_error_rate 2021-01-10 19:14:37 +05:30
Andreas Rheinhardt
2c6f532e0a Mark some pointers as const
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-01-01 15:25:48 +01:00
Gyan Doshi
842714b5cb ffmpeg: add option stats_period
At present, progress stats are updated at a hardcoded interval of
half a second. For long processes, this can lead to bloated
logs and progress reports.

Users can now set a custom period using option -stats_period
Default is kept at 0.5 seconds.
2020-12-23 00:41:07 +05:30
Jan Ekström
453b2f3c15 ffmpeg: add a data size threshold for muxing queue size
This way the old max queue size limit based behavior for streams
where each individual packet is large is kept, while for smaller
streams more packets can be buffered (current default is at 50
megabytes per stream).

For some explanation, by default ffmpeg copies packets from before
the appointed seek point/start time and puts them into the local
muxing queue. Before, it getting utilized was much less likely
since as soon as the filter chain was initialized, the encoder
(and thus output stream) was also initialized.

Now, since we will be pushing the encoder initialization to when the
first AVFrame is decoded and filtered - which only happens after
the exact seek point is hit as packets are ignored until then -
this queue will be seeing much more usage.

In more layman's terms, this attempts to fix cases such as where:
- seek point ends up being 5 seconds before requested time.
- audio is set to copy, and thus immediately begins filling the
  muxing queue.
- video is being encoded, and thus all received packets are skipped
  until the requested time is hit.
2020-10-29 16:59:48 +02:00
Anton Khirnov
87f0c8280c ffmpeg.c: stop accessing private AVStream.codec_info_nb_frames
Use AVSTREAM_EVENT_FLAG_NEW_PACKETS instead, which should provide the
same information in this case.
2020-10-28 13:58:32 +01:00
Anton Khirnov
201b1246e2 ffmpeg.c: rename 'area' to 'score'
Other factors besides area are used to pick the best video stream, so
the name 'area' is misleading.
2020-10-28 13:57:38 +01:00
Nicolas George
697fb09e3d ffmpeg: add auto_conversion_filters option. 2020-09-08 14:16:08 +02:00
Marton Balint
53a4620fba fftools/ffmpeg: make specifying thread_queue_size turn on threaded input
Threaded input can increase smoothness of e.g. x11grab significantly. Before
this patch, in order to activate threaded input the user had to specify a
"dummy" additional input, with this change it is no longer required.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-07-29 23:10:12 +02:00
Linjie Fu
0b511bd9a5 fftools/ffmpeg_filter: add -autoscale to disable/enable the default scale
Currently, ffmpeg inserts scale filter by default in the filter graph
to force the whole decoded stream to scale into the same size with the
first frame. It's not quite make sense in resolution changing cases if
user wants the rawvideo without any scale.

Using autoscale/noautoscale as an output option to indicate whether auto
inserting the scale filter in the filter graph:
    -noautoscale or -autoscale 0:
    disable the default auto scale filter inserting.

ffmpeg -y -i input.mp4 out1.yuv -noautoscale out2.yuv -autoscale 0 out3.yuv

Update docs.

Suggested-by:  Mark Thompson <sw@jkqxz.net>
Reviewed-by:   Nicolas George <george@nsup.org>
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
Signed-off-by: Linjie Fu <linjie.fu@intel.com>
2020-06-18 16:31:09 +08:00
Marton Balint
efe7a59364 fftools/ffmpeg: add new abort_on flag which aborts if there is a stream which received no packets
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-05-26 21:50:50 +02:00
Marton Balint
f821ae8591 fftools/ffmpeg: use a bsf list instead of individual bsfs
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-05-02 19:14:08 +02:00
Mark Thompson
79c173cc19 ffmpeg: Remove the hw_device_ctx global
The ad-hoc libmfx setup code is the only place its still used, so move it
into that file.
2020-04-26 18:38:25 +01:00
Andreas Rheinhardt
889ad93c88 fftools/ffmpeg_opt: Check attachment filesize
The data of an attachment file is put into an AVCodecParameter's
extradata. The corresponding size field has type int, yet there was no
check for the size to fit into an int. As a consequence, it was possible
to create extradata with negative size (by using a big enough max_alloc).

Other errors were also possible: If SIZE_MAX < INT64_MAX (e.g. on 32bit
systems) then the file size might be truncated before the allocation;
and avio_read() takes an int, too, so one would not have read as much
as one desired.

Furthermore, the extradata is now padded as is required.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-04-17 01:34:07 +02:00
Jun Zhao
5633f9a8a2 fftools: fix hwaccels option dump redundancy
When QSV is enabled in FFmpeg, the command "ffmpeg -hwaccels" shows a
duplicate entry in acceleration methods for QSV:

Hardware acceleration methods:
vaapi
qsv
drm
opencl
qsv

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-04-14 11:42:29 +08:00
Andreas Rheinhardt
d9f38b99dd fftools/ffmpeg_opt: Fix [u]int64_t specifier string
PRId64 and PRIu64 already expand to the complete specifier; adding
another 'd' at the end is wrong and just leads to warnings that say
that only an option like '-frames:v 2d' will be used, although said
option won't be accepted at all ('Expected int64 for frames:v but found
2d').

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-03-19 20:06:12 +01:00
Marton Balint
60e2634662 fftools/ffmpeg_opt: remove bogus warning of multiple -af and -vf usage
This is redundant after the last patch and also fixes ticket #7712.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-03-08 18:38:31 +01:00
Marton Balint
5d7788f9e8 fftools/ffmpeg_opt: warn about overwritten parsed options
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-03-08 18:38:31 +01:00
Timo Rothenpieler
cb3c77cfee ffmpeg: default hwaccel_output_format to cuda when hwaccel is cuvid
This ensures old commandlines using -hwaccel cuvid don't break due to
the recent removal of the the cuvid-specific hwaccel bringup.
2020-03-07 13:13:55 +01:00
James Almer
60b1f85b67 ffmpeg: remove superfluous custom cuvid hwaccel
It's a duplicate of the properly implemented nvdec libavcodec hwaccel

Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-03-03 18:11:28 -03:00
Andreas Rheinhardt
21265f42ec fftools/ffmpeg_opt: Fix leak of options when parsing options fails
Fixes #8094.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-02-29 22:31:01 +01:00
Steven Liu
6087692a60 cmdutils: add show_help_protocol for get protocol options
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
2020-01-30 17:10:21 +08:00
Carl Eugen Hoyos
2e700ec3a7 fftools/ffmpeg_opt: Add a missing closing brackets.
Fixes ticket #8447.
2019-12-28 20:11:01 +01:00
Andreas Rheinhardt
fc7b6d5574 fftools/ffmpeg_opt: Fix mixed declarations and code
Introduced in ed3c317d.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-06 20:38:03 +01:00
Jun Zhao
ed3c317dea fftools/ffmpeg_opt: add error handle if av_asprintf return null
add error handle if av_asprintf return null.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-10-18 09:56:51 +08:00
Lou Logan
04858650b1 ffmpeg_opt: remove errant space
Signed-off-by: Lou Logan <lou@lrcd.com>
2019-09-27 15:17:15 -08:00
Lou Logan
419e5e7942 doc/ffmpeg: -timelimit is in user time
Signed-off-by: Lou Logan <lou@lrcd.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-27 12:11:39 -08:00
Andreas Rheinhardt
2b1fcba8dd fftools/ffmpeg_opt: Fix signed integer overflow
Fixes ticket #8154.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-09-17 14:41:07 +02:00
Jun Zhao
11d3b03fcb ffmpeg_opt: Respect default disposition when select audio/video
Respect default disposition when select audio/video

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-07-03 10:33:44 +08:00
Carl Eugen Hoyos
301cee61fa ffmpeg_opt: Print a warning if more than one -vf/-af option was specified.
Fixes ticket #4184.
2019-01-15 00:27:05 +01:00
Gyan Doshi
3ba5eef2c7 ffmpeg: allow disabling streams by type for inputs
-vn/-an/-sn/-dn now works for input. Streams are still registered in
input_streams but they can't be automatically selected or mapped or
filtered.
2019-01-03 16:13:51 +05:30
Gyan Doshi
54109b1d14 ffmpeg: skip disabled streams
Fully discarded streams can't be selected for output or mapped or filtered.
Previously, a few packets from such streams, probably buffered for
stream probing, would get smuggled into output files.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-01-02 22:29:11 +01:00
xiaofeng
e78016b04a ffmpeg: break loop when dts_heuristic check done
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-09-30 22:23:02 +02:00
Gyan Doshi
acc9684dcd ffmpeg: block output == input for files
Fixes #4655
2018-09-17 13:48:28 +05:30
Gyan Doshi
4ac88ba548 fftools/ffmpeg: check sseof value and clash with ss
Prioritize -ss
2018-06-26 09:47:32 +05:30
Gyan Doshi
9c12938ec5 ffmpeg: mark sseof as an input-only option 2018-06-09 00:37:03 +05:30
Vishwanath Dixit
146cdf7e4b fftools/ffmpeg: fix for all forced key frames when 'copyts' is enabled
Forced key frames generation functionality was assuming the first PTS
value as zero, but, when 'copyts' is enabled, the first PTS can be any
big number. This was eventually forcing all the frames as key frames.
To resolve this issue, update has been made to use first input pts as
reference pts.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-06-04 22:26:55 +02:00
Paul B Mahol
0b360cae1c make swresample optional for ffmpeg
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2018-04-25 12:38:03 +02:00
Jun Zhao
a675eed175 ffmpeg: support dump bit stream filter options.
Support dump bit stream filter option in ffmpeg -h full and
ffmpeg -h bsf=FooBar.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-16 02:09:59 +01:00
Jun Zhao
74afa54528 ffmpeg_opt: fix max_error_rate help info display issue.
ffmpeg -h display "max_error_rate" option help information have
been cut off, the root cause is used a wrong initial order.

Signed-off-by: Jun Zhao <jun.zhao@intel.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-24 04:50:55 +01:00
Marton Balint
25a2d269bd fftools, tools, examples: migrate to AVFormatContext->url
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-01-28 23:06:43 +01:00
Carl Eugen Hoyos
6874945fbf fftools/ffmpeg_opt: Remove a write-only variable.
Fixes a warning:
fftools/ffmpeg_opt.c:2057:21: warning: variable 'file_oformat' set but not used
2018-01-08 00:17:00 +01:00
Rostislav Pehlivanov
6b35a83214 Remove the ffserver program
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
2018-01-06 18:31:37 +00:00
James Almer
414a49d671 ffmpeg: use thread wrappers for the thread message functionality
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-01-04 15:22:09 -03:00
Carl Eugen Hoyos
ed4a0c7923 ffmpeg_opt: Constify hwaccel pointer.
Fixes a warning:
fftools/ffmpeg_opt.c:804:29: warning: assignment discards ‘const’ qualifier from pointer target type
2017-11-29 00:15:10 +01:00
Pan Bian
2ba6d7cb82 ffmpeg: Check read_ffserver_streams() return value
The function avformat_alloc_context() will return a NULL pointer on
failure. However, in function read_ffserver_streams(), its return value
is not validated and the subsequent dereference may result in a bad
memory access bug. Check its return value against NULL and avoid
potential NULL dereference.

Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-11-28 01:18:22 +01:00
Mark Thompson
b0cd14fb1d ffmpeg: Use codec hardware config to configure hwaccels
Removes specific support for all hwaccels supported by the generic code
(DXVA2, D3D11VA, NVDEC, VAAPI and VDPAU).
2017-11-26 21:41:19 +00:00
Vitaly _Vi Shukela
80ef3c8360 ffmpeg: Allow "-to" on input files in addition to "-t"
For some strange reason "-t" option was only implemented
for input files while both "-t" and "-to" were available
for use for output files. This made extracting a range from
input file inconvenient.

This patch enables -to option for input so one can do

    ffmpeg -ss 1:23:20 -to 1:27:22.3 -i myinput.mkv ...

Signed-off-by: Vitaly _Vi Shukela <vi0oss@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-11-19 04:38:29 +01:00
James Almer
e9025beacb ffmpeg: remove usage of AVCodecContext accessors
Signed-off-by: James Almer <jamrial@gmail.com>
2017-11-15 01:14:22 -03:00
Anton Khirnov
0e00624389 h264dec: add a NVDEC hwaccel
Some parts of the code are based on a patch by
Timo Rothenpieler <timo@rothenpieler.org>

Merges Libav commit b9129ec466.

Due to the name clash with our cuvid decoder, rename it to nvdec.

This commit also changes the Libav code to dynamic loading of the
cuda/cuvid libraries.

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2017-11-10 22:48:53 +01:00
James Almer
5cc5130c81 ffmpeg: remove usage of deprecated getter functions
Signed-off-by: James Almer <jamrial@gmail.com>
2017-10-29 14:42:48 -03:00
James Almer
ca2b779423 avformat: remove use of deprecated AVFMT_FLAG_KEEP_SIDE_DATA flag
It has no effect whatsoever since the major bump.
Replace the flag's documentation to reflect this as well.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-10-29 00:09:52 -03:00
James Almer
7b550c5f84 Merge commit 'b3739599bda740ac12d3dde31a331b744df99123'
* commit 'b3739599bda740ac12d3dde31a331b744df99123':
  lavc: Drop deprecated emu edge functionality

Merged-by: James Almer <jamrial@gmail.com>
2017-10-23 16:04:31 -03:00
Michael Niedermayer
2c9fa4162b ffmpeg: add -bitexact flag to simplify enabling bitexact mode in (de)muxer and (de/en)coder
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-10-23 12:41:04 +02:00
Clément Bœsch
2b32031827 lavc: drop VDA
Deprecated (aka removed) in OSX 10.11, and we have a replacement for it
(VideoToolbox).
2017-10-23 11:56:15 +02:00
Jun Zhao
2e94490225 ffmpeg: remove hwaccel_lax_profile_check option
This has been unused for a long time, and the original purpose has been
replaced by the per-stream hwaccel_flags.

Signed-off-by: Jun Zhao <jun.zhao@intel.com>
Signed-off-by: Mark Thompson <sw@jkqxz.net>
2017-10-16 22:38:11 +01:00
James Almer
fd5f4ac081 Merge commit 'c95169f0ec68bdeeabc5fde8aa4076f406242524'
* commit 'c95169f0ec68bdeeabc5fde8aa4076f406242524':
  build: Move cli tool sources to a separate subdirectory

Merged-by: James Almer <jamrial@gmail.com>
2017-10-01 18:26:36 -03:00