Commit Graph

212 Commits

Author SHA1 Message Date
Marton Balint babbb5a4ba fftools/ffprobe: use av_timecode_make_smpte_tc_string2
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-09-13 17:51:57 +02:00
Andreas Rheinhardt 0086432fc7 fftools, libavcodec, libavfilter: Add const to some AVCodec *
The user has no business modifying the underlying AVCodec.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-11 14:42:36 +02:00
Zhao Zhili 99e12b5736 ffplay: fix autoexit doesn't work in the case of pb->error
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-09-08 19:59:17 +02:00
Nicolas George 697fb09e3d ffmpeg: add auto_conversion_filters option. 2020-09-08 14:16:08 +02:00
Andreas Rheinhardt 426c16d61a fftools/ffmpeg: Fix leak of AVFilterInOut in case of error
The AVFilterInOuts normally get freed in init_output_filter() when
the corresponding streams get created; yet if an error happens before
one reaches said point, they leak. Therefore this commit makes
ffmpeg_cleanup free them, too.

Fixes ticket #8267.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-23 19:57:42 +02:00
Nicolas George 973540118a ffplay: do not set redundant channel count on abuffersink. 2020-08-20 12:49: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
Derek Buitenhuis f43a8112dd ffprobe: Allow unknown format private AVOptions
This useful, because by ffprobe's very nature, you use it to probe
a file and find out what it is. Requiring every format private option
to be known to the demuxer forces one to run ffprobe twice, if one
wants to use ffprobe in a generic way.

For example, say one wants to probe all user-uploaded files, while
also ignoring edit lists for any MP4s that are uploaded. Currently,
you'd have to run ffprobe twice: once to identify the format, and
once again to actually probe the metadata you want. After this
patch, you could set -ignore_editlist 1 on every call and only
probe once.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2020-07-02 19:24:56 +01: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
Anton Khirnov e0fbb6cf2b fftools: switch to the new child class iteration API 2020-06-10 12:36:44 +02:00
Andriy Gelman 6cd198860d fftools/ffmpeg: update text requesting samples
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
Reviewed-by: Marton Balint <cus@passwd.hu>
2020-06-01 14:39:52 -04: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
Anton Khirnov f30a41a608 Stop hardcoding align=32 in av_frame_get_buffer() calls.
Use 0, which selects the alignment automatically.
2020-05-22 14:38:57 +02:00
Anton Khirnov 8cfab9fa8c cmdutils: drop libavformat/network.h include
It is not a public header and has not been used since
10173c0e58
2020-05-22 14:38:57 +02:00
James Almer cbb1760afa fftools/cmdutils: remove lossless and intra only capability entries from print_codec()
They are codec properties, not encoder capabilities.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-05-21 12:32:15 -03:00
James Almer 0a3ba58b44 fftools/ffmpeg_filter: check the codec's descriptor to see if it's lossless
Signed-off-by: James Almer <jamrial@gmail.com>
2020-05-21 12:32:15 -03:00
Limin Wang 683e421bcf fftools/ffmpeg: use local variable with same contents directly
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-05-06 23:02:00 +08:00
Mark Thompson 706ed34ce7 ffmpeg: Don't require a known device to pass a frames context to an encoder
The previous code here did not handle passing a frames context when
ffmpeg itself did not know about the device it came from (for example,
because it was created by device derivation inside a filter graph), which
would break encoders requiring that input.  Fix that by checking for HW
frames and device context methods independently, and prefer to use a
frames context method if possible.  At the same time, revert the encoding
additions to the device matching function because the additional
complexity was not relevant to decoding.

Also fixes #8637, which is the same case but with the device creation
hidden in the ad-hoc libmfx setup code.
2020-05-03 16:04:27 +01: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
vectronic a75924ec88 fftools/ffprobe: show closed caption info in the stream dump
Signed-off-by: vectronic <hello.vectronic@gmail.com>
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
Mark Thompson 8abd3b2028 ffmpeg: Use hardware config metadata with encoders
This can support encoders which want frames and/or device contexts.  For
the device case, it currently picks the first initialised device of the
desired type to give to the encoder - a new option would be needed if it
were necessary to choose between multiple devices of the same type.
2020-04-26 18:38:25 +01:00
Mark Thompson e254212405 ffmpeg: Make filter hardware device selection clearer
Also move it into a dedicated function in the hardware file.
2020-04-26 18:38:25 +01:00
Peter Ross 6cfb33f976 ffplay: set stream_index to -1 earlier to prevent segfault
Signed-off-by: Peter Ross <pross@xvid.org>
Reviewed-by: Marton Balint <cus@passwd.hu>
2020-04-25 12:11:11 +10:00
Jun Zhao e689a759c6 fftools/ffprobe: support DOVI sidedata
support DOVI sidedata.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-04-23 08:06:07 +08:00
Anton Khirnov 4cde83c780 cmdutils: stop using deprecated av_codec_next()
Signed-off-by: Josh de Kock <josh@itanimul.li>
2020-04-20 14:50:03 +00: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
Carl Eugen Hoyos d5bf704f50 ffmpeg: Do not clip timestamps at LONG_MAX.
Fixes ticket #8612.
2020-04-15 19:59:13 +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
Marton Balint 4e0cf81b49 fftools/ffmpeg: also flush encoders which have a variable frame size
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-04-13 00:31:24 +02:00
Michael Niedermayer 64c59b626f fftools/ffmpeg: Disable copy_ts on timestamp wraparound
This allows handling more than 26.5h of mpeg* input

Fixes: Ticket 7876

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-04-04 22:09:46 +02:00
Gyan Doshi b195b5f2ba ffplay: flush correct stream after stats update
Stats and logs are written to stderr, not stdout.
2020-04-04 16:01:57 +05:30
Gyan Doshi 2d6a89872e ffplay: always show stats at all log levels if requested by user
Since 3b491c5a50, stats would be hidden if loglevel was lower than
info, even if -stats was set.

Fixes #6962
2020-04-04 15:17:24 +05:30
Carl Eugen Hoyos b5a8ad5623 ffmpeg: Print an error instead of a debug message on exit.
Reported-by: Forum user NewPlaza
2020-03-31 00:41:13 +02:00
Andreas Rheinhardt 3362330741 ffplay, avcodec, avformat: Don't initialize before av_packet_ref()
It already initializes the packet.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-03-28 04:17:20 +01: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
Paul B Mahol d64cbd4fda remove CHAR_MIN/CHAR_MAX usage
It is not needed at all.
2020-03-17 22:46:36 +01:00
Jan Ekström 7ba3ea212f ffmpeg: explicitly handle sub2video subpicture initialization
Each time the sub2video structure is initialized, the sub2video
subpicture is initialized together with the first received heartbeat.
The heartbeat's PTS is utilized as the subpicture start time.

Additionally, add some documentation on the stages.
2020-03-16 19:35:17 +02: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
Marton Balint af7ec793d4 fftools/ffplay: fix possible memory leak in decoder
Fixes ticket #8549.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-03-08 12:56:08 +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
Michael Niedermayer 4f4ad33d96 fftools/ffmpeg: Fix integer overflow in duration computation in seek_to_start()
Fixes: signed integer overflow: -9223372036854775808 - 9223372036854775807 cannot be represented in type 'long'
Fixes: Ticket8142

Found-by: Suhwan
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-02-16 15:13:20 +01:00
Andreas Rheinhardt c2c65d1d1f fftools/ffprobe: Remove unneeded casts
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-02-14 16:26:57 +01:00
Andreas Rheinhardt 13dc90396d fftools/ffmpeg: Integrate two checks
For audio packets with dts != AV_NOPTS_VALUEs the dts was converted
twice to the muxer's timebase during streamcopy, once as a normal
packet and once specifically as an audio packet. This has been changed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-02-13 00:40:47 +01:00
Jun Zhao b99ed6e428 cmdutils: fix crash if no name for "ffmpeg -h protocol"
fix crash when used the command like:
- ffmpeg -h protocol
- ffmpeg -h protocol=

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-01-30 12:50:22 -03: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 26c7f91e66 ffmpeg: Do not print "SDP:" on top of sdp files.
Fixes ticket #7068.
2020-01-27 22:45:06 +01:00