Commit Graph

82 Commits

Author SHA1 Message Date
Aman Gupta 12ceaf0fba ffprobe: fix SEGV when new streams are added
Signed-off-by: Aman Gupta <aman@tmm1.net>
2018-05-09 12:30:17 -07:00
Tobias Rapp a150b2e3a0 fftools/ffmpeg: properly initialize output stream field order
Fixes stream field order written by avformat_write_header when "top"
option is specified on the command-line.

Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
2018-05-02 08:35:08 +02:00
James Almer e3866ea20d fftools/ffmpeg: fix mixed code and declarations
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-04-30 18:22:51 -03:00
Marton Balint 7033654f7f Use AV_PIX_FMT_FLAG_ALPHA for detecting transparency where nb_components was used
Temporarily keep the old method for ffmpeg_filters.c choose_pix_fmt and
avfiltergraph.c pick_format() until a paletted pixel format without alpha is
introduced.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-04-30 21:51:31 +02:00
André Camargo 1322b00060 fftools/ffmpeg: change fps progress log message to show two decimal digits
Useful when transcoding videos at 29.97 fps because delivers a more accurate result for monitoring.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-28 18:08:52 +02:00
Mark Wachsler 9d75354963 fftools/ffmpeg: Add system time and real time to benchmarking.
The -benchmark and -benchmark_all options now show user, system, and real time,
instead of just user time.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-28 18:08:52 +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
Matt Oliver 6be690685a ffplay: Fix realloc_texture when input texture is NULL.
SDL_QueryTexture and SDL_DestroyTexture require that the input texture
pointer be non-null. Debug builds of SDL will correctly check for this
and break program execution. This patch fixes this by checking the
status of the texture pointer.

Signed-off-by: Matt Oliver <protogonoi@gmail.com>
2018-04-18 18:57:07 +10:00
Timo Teräs c663dce031 ffprobe: report unavailable SAR correctly in stream info
av_guess_sample_aspect_ratio() will return undefined or missing
value as {0,1}. This fixes show_stream() to check numerator to
display 'N/A' when appropriate. show_frame() does this already
correctly.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
2018-04-17 20:11:31 +01:00
Timo Teräs 94d831f388 ffmpeg: allow setting attached_pic disposition
This is used to signal that image should be stored in metadata
as cover image.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-04 19:09:28 +02:00
wm4 d6fc031caf avutil/pixdesc: deprecate AV_PIX_FMT_FLAG_PSEUDOPAL
PSEUDOPAL pixel formats are not paletted, but carried a palette with the
intention of allowing code to treat unpaletted formats as paletted. The
palette simply mapped the byte values to the resulting RGB values,
making it some sort of LUT for RGB conversion.

It was used for 1 byte formats only: RGB4_BYTE, BGR4_BYTE, RGB8, BGR8,
GRAY8. The first 4 are awfully obscure, used only by some ancient bitmap
formats. The last one, GRAY8, is more common, but its treatment is
grossly incorrect. It considers full range GRAY8 only, so GRAY8 coming
from typical Y video planes was not mapped to the correct RGB values.
This cannot be fixed, because AVFrame.color_range can be freely changed
at runtime, and there is nothing to ensure the pseudo palette is
updated.

Also, nothing actually used the PSEUDOPAL palette data, except xwdenc
(trivially changed in the previous commit). All other code had to treat
it as a special case, just to ignore or to propagate palette data.

In conclusion, this was just a very strange old mechnaism that has no
real justification to exist anymore (although it may have been nice and
useful in the past). Now it's an artifact that makes the API harder to
use: API users who allocate their own pixel data have to be aware that
they need to allocate the palette, or FFmpeg will crash on them in
_some_ situations. On top of this, there was no API to allocate the
pseuo palette outside of av_frame_get_buffer().

This patch not only deprecates AV_PIX_FMT_FLAG_PSEUDOPAL, but also makes
the pseudo palette optional. Nothing accesses it anymore, though if it's
set, it's propagated. It's still allocated and initialized for
compatibility with API users that rely on this feature. But new API
users do not need to allocate it. This was an explicit goal of this
patch.

Most changes replace AV_PIX_FMT_FLAG_PSEUDOPAL with FF_PSEUDOPAL. I
first tried #ifdefing all code, but it was a mess. The FF_PSEUDOPAL
macro reduces the mess, and still allows defining FF_API_PSEUDOPAL to 0.

Passes FATE with FF_API_PSEUDOPAL enabled and disabled. In addition,
FATE passes with FF_API_PSEUDOPAL set to 1, but with allocation
functions manually changed to not allocating a palette.
2018-04-03 17:53:00 +02:00
Tobias Rapp 4b736bc921 fftools/cmdutils: add support for level flag in loglevel option parser
Allows to manage the AV_LOG_PRINT_LEVEL flag as a prefix to the loglevel
option value, similar to the existing AV_LOG_SKIP_REPEATE flag. Adds
support for setting flags relative to the existing value by using a +/-
prefix.

Previous version reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
2018-04-03 10:17:38 +02:00
Josh de Kock 89029bd2c7 lav*,tests: remove several register_all calls
avdevice_register_all() is still required to register devices into
lavf (this is required due to lavd being somewhat of a hack).

Signed-off-by: Josh de Kock <josh@itanimul.li>
2018-04-02 03:26:22 +01:00
Jun Zhao 9b125826ed cmdutils: fix new API break the "ffmpeg -muxers/demuxers"
fix commit 2238190 break the "ffmpeg -muxers/demuxers".

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
Signed-off-by: Josh de Kock <josh@itanimul.li>
2018-04-02 02:19:26 +01:00
Jan Ekström e760c12aee ffmpeg: prevent premature EOF in sub2video with nullptr AVSubtitles
With certain types of input and the filter chain getting re-initialized
or re-configured, multiple nullptr AVSubtitles can get pushed into
sub2video_update() in a row from sub2video_heartbeat.

This causes end_pts, and on the next round pts, to become INT64_MAX,
latter of which signals EOF in framesync, leading to complete loss of
subtitles from that point on.

Thus, check that the sub2video.end_pts is smaller than INT64_MAX
in a similar fashion to sub2video_flush before sending out the
nullptr AVSubtitle. This keeps premature EOFs from happening in
framesync and the subtitle overlay is kept past the filter chain
re-initializations/configurations.
2018-04-01 13:56:31 +03:00
Josh de Kock 22381906f3 cmdutils: use new APIs
Signed-off-by: Josh de Kock <josh@itanimul.li>
2018-03-31 23:26:31 +01:00
Carl Eugen Hoyos 11f8f9547d fftools/ffmpeg: Remove an unused variable.
Fixes a warning:
fftools/ffmpeg.c:2201:22: warning: unused variable 'fg'
2018-03-30 12:01:58 +02:00
Marton Balint 0031eab61c ffmpeg: do not finish output streams manually on eof even if no input is provided
The generic code should be able to finish the streams just fine initializing
and flushing the filters and codecs properly.

Fixes the following command:

ffmpeg -f lavfi -i "testsrc=d=0.1[out0];aevalsrc=0:d=0[out1]" -af apad -shortest -f framecrc -

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-03-29 00:07:39 +02:00
Marton Balint 60c9a25530 ffmpeg: fallback to codecpar parameters on input filter eof
Fixes ticket #6854 and the following simpler case:

ffmpeg -f lavfi -i testsrc=d=1 -f lavfi -i testsrc=d=0 -filter_complex overlay -f null none

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-03-29 00:07:39 +02:00
James Almer 231a73308f ffmpeg: pass reference counted packet on codec copy when possible
Should prevent unnecessary copy of data in cases where new references
to the packet are created within the muxer or a bitstream filter.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-03-23 22:05:25 -03:00
James Almer f5ceb15bb6 ffmpeg: remove dead call to av_parser_change()
It's been a noop for years, and it's been argued that in-band headers
should not be forcedly removed without the user's explicit request.

Also, as the FIXME line stated, this is a job for a bitstream filter
like extract_extradata, remove_extradata, dump_extradata, and
filter_units.

Signed-off-by: James Almer <jamrial@gmail.com>
2018-03-23 22:03:22 -03:00
James Almer ead257db56 cmdutils: print supported codecs in show_help_bsf()
Tested-by: Jun Zhao <mypopydev@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-03-22 00:15:05 -03:00
Gyan Doshi 8ad83044b4 ffmpeg.c - drain all decoded frames during stream_loop flush
When a decoded stream is being looped, after each post-EOF rewind,
decoders are flushed in seek_to_start(). This only drains 1 frame, and
thus the output has a few frames missing at the tail of each iteration
except the last.

With this patch, process_input is looped till process_input_packet
reaches EOF.

Fixes #7081

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-20 22:59:40 +01:00
James Almer 055f60e874 cmdutils: remove a superfluous line break
Signed-off-by: James Almer <jamrial@gmail.com>
2018-03-17 12:12:37 -03: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
Marton Balint 68f5384804 ffprobe: fix infinite loop in subtitle decoding
Fixes a regression since 2a88ebd096 which caused
an infinite loop in the subtitle decoding.

Fixes ticket #6796.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-03-12 21:11:06 +01:00
Tobias Rapp 69995a94d8 fftools/ffmpeg: update print_report to use AVBPrint API
Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
2018-03-05 09:24:55 +01:00
Tobias Rapp a194e9c415 fftools/ffmpeg: fix progress log message in case pts is not available
Also fixes sign prefix for progress report.

Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
2018-03-05 09:24:40 +01:00
Tobias Rapp fa0c9d69d3 fftools/ffmpeg: replace call to av_strerror with av_err2str
Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
2018-02-27 08:34:35 +01:00
Tomas Härdin 5caae27979 Don't complain about codec2's 700 bit/s modes in ffmpeg.c 2018-02-24 17:06:31 +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
Aman Gupta 4f40d64e00 avformat/mpegts: set AV_DISPOSITION_DEPENDENT for mix_type=0 supplementary audio
Signed-off-by: Aman Gupta <aman@tmm1.net>
2018-02-23 13:47:29 -08:00
James Almer cb97400f93 Revert "cmdutils: make use of new iteration APIs"
This reverts commit cdc78058c7.

It introduced several issues in the command line tools, and it's
implementing a new API that may still see some changes.
Revert for the time being until the state of the API is defined.

Signed-off-by: James Almer <jamrial@gmail.com>
2018-02-08 13:20:36 -03:00
Josh de Kock 26d879c1ce lavc/bsf: make BSF iteration the same as other iterators 2018-02-06 18:57:43 +00:00
Josh de Kock cdc78058c7 cmdutils: make use of new iteration APIs 2018-02-06 18:57:43 +00:00
James Almer 94eb5505ad ffprobe: remove usage of deprecation warning removal pragmas
Fixes compilation in non Windows targets.

Signed-off-by: James Almer <jamrial@gmail.com>
2018-02-02 17:51:24 -03:00
Zhong Li 19b1d905b8 ffprobe: Initialize coded_width/height
coded_width/height are unnitialized and will be overwritten by
dec_ctx->width/height in avcodec_open2()

This fixes tiket #6958.

Signed-off-by: Zhong Li <zhong.li@intel.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-02-02 16:40:40 -03: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
Mark Thompson 74cf4a75f7 ffmpeg: Ignore SIGPIPE
On systems which deliver SIGPIPE (Unices), a broken pipe will currently
result in the immediate termination of the ffmpeg process (the default
disposition as required by POSIX).  This is undesirable, because while
the broken pipe is likely fatal to useful cleanup of whatever component
is writing to it, there might be other components which can do useful
cleanup - for example, a muxer on another stream may still need to write
indexes to complete a file.  Therefore, set the signal disposition for
SIGPIPE to ignore the signal - the call which caused the signal will
fail with EPIPE and the error will be propagated upwards like any other
I/O failure on a single stream.
2018-01-25 22:54:10 +00: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
wm4 e24f192a9f ffplay: drop lock manager use
Deprecated and useless.
2017-12-26 02:50:00 +01: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
Mark Thompson 3650cb2dfa lavu,lavfi,ffmpeg: Remove experimental OpenCL API
This was added in early 2013 and abandoned several months later; as far as
I can tell, there are no external users.  Future OpenCL use will be via
hwcontext, which requires neither special OpenCL-only API nor global state
in libavutil.

All internal users are also deleted - this is just the unsharp filter
(replaced by unsharp_opencl, which is more flexible) and the deshake filter
(no replacement).
2017-11-22 23:20:39 +00:00
Jun Zhao a5870cb37f ffmpeg: add return value check to supress the build warning.
add return value check to supress the build warning message like
"warning: ignoring return value" when use attribute -Wunused-result.

Signed-off-by: Jun Zhao <jun.zhao@intel.com>
Reviewed-by: 刘歧 <lq@chinaffmpeg.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-11-21 03:13:03 +01:00
pkviet 77b6e3ee27 ffmpeg: add ui64 type to SpecifierOpt
Adds ui64 (uint64_t) as a possible type for SpecifierOpt. This enables
 use of uint64_t options with SpecifierOpt such as channel_layout
 when expressed as a 64 bit channel mask.

Signed-off-by: pkviet <pkv.stream@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-11-20 02:40:30 +01: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