Commit Graph

467 Commits

Author SHA1 Message Date
Vittorio Giovara
059a934806 lavc: Consistently prefix input buffer defines
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-27 15:24:59 +01:00
Vittorio Giovara
def97856de lavc: AV-prefix all codec capabilities
Express bitfields more simply.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-27 15:24:58 +01:00
Vittorio Giovara
7c6eb0a1b7 lavc: AV-prefix all codec flags
Convert doxygen to multiline and express bitfields more simply.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-27 15:24:58 +01:00
Vittorio Giovara
40cf1bbacc Deprecate avctx.coded_frame
The rationale is that coded_frame was only used to communicate key_frame,
pict_type and quality to the caller, as well as a few other random fields,
in a non predictable, let alone consistent way.

There was agreement that there was no use case for coded_frame, as it is
a full-sized AVFrame container used for just 2-3 int-sized properties,
which shouldn't even belong into the AVCodecContext in the first place.

The appropriate AVPacket flag can be used instead of key_frame, while
quality is exported with the new AVPacketSideData quality factor.
There is no replacement for the other fields as they were unreliable,
mishandled or just not used at all.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-20 15:06:50 +01:00
Vittorio Giovara
5d3addb937 Add a quality factor packet side data
This is necessary to preserve the quality information currently exported
with coded_frame. Add the new side data to every encoder that needs it,
and use it in avconv.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-20 15:06:47 +01:00
Anton Khirnov
6d592fbd0d avconv: split creating and (re-)configuring complex filtergraphs
The current code is less than straightforward due to the fact that
output streams can be created based on filtergraph definitions. This
change should make the code simpler and more readable. It will also be
useful in the future commits.
2015-07-19 09:38:53 +02:00
Anton Khirnov
1959351aec avconv: move the no streams failure to open_output_file()
It is a better place for it, there is no reason to wait until
transcode_init().
2015-07-19 09:38:28 +02:00
Anton Khirnov
ab7b038906 avconv: factor out the output stream initialization 2015-07-19 09:38:25 +02:00
Anton Khirnov
6d5d924604 avconv: move handling the 2pass logfile into avconv_opt
It more logically belongs there.
2015-07-19 09:34:24 +02:00
Anton Khirnov
59245e0c5e avconv: set the encoding/decoding_needed flags earlier
This will be useful in the following commits.
2015-07-19 09:34:08 +02:00
Anton Khirnov
56c2f37727 avconv: drop update_sample_fmt()
There is only one decoder left that supports this (libopus, which is not
used by default since we have a native one) and this code goes against
the avconv design, since it propagates information back from the encoder
to decoder.
2015-07-19 09:33:51 +02:00
Anton Khirnov
9a5e4fbec8 avconv: do not stop processing the input packet on decoding error
We still want to flush the filters on EOF and possibly apply streamcopy.
2015-06-27 16:45:41 +02:00
Anton Khirnov
b114f6d48a avconv: factor out flushing the filters
This also ensures this is always done, avoiding infinite loops if an
error occurs at the end of the input.
2015-06-27 16:45:04 +02:00
Martin Storsjö
16302246b1 avconv: Add an option for automatically rotating video according to display matrix
The option is enabled by default, but can be disabled.

If this is enabled, such side data isn't copied into the output stream
(except when doing stream copy).

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-05-02 22:09:06 +03:00
Himangi Saraogi
aa1a1b2496 avconv: Avoid theoretical NULL dereferences
Bug-Id: CID 1292519

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-04-04 19:32:10 +02:00
Anton Khirnov
3892bdab9b avconv: do not overwrite the stream codec context for streamcopy
Since we are not doing encoding, there is no point in ever touching the
separate encoding context. Always use the stream codec context.

Fixes writing attachments.

CC:libav-devel@libav.org
2015-04-03 13:10:03 +02:00
Luca Barbato
22a6d48b0d avconv: Print the avfilter errors
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-03-20 18:42:26 +01:00
Anton Khirnov
dc7536ca3d avconv: do not abort immediately if initializing hwaccel fails
exit_program() will try to free the decoders, which is not a good idea
from within get_format().
Return an error instead.
2015-03-10 07:40:11 +01:00
Anton Khirnov
88b32673db avconv: copy stream-level side data when streamcopying 2014-10-24 09:03:16 +02:00
Martin Storsjö
d0c0930219 avconv: Use av_gettime_relative
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-24 09:53:45 +03:00
Anton Khirnov
59b55c494e lavc: deprecate unused me_threshold field 2014-10-18 05:26:56 +02:00
Vittorio Giovara
c92965dbfb avconv: check return value
CC: libav-stable@libav.org
Bug-Id: CID 1224275
2014-10-17 09:55:46 +01:00
Anton Khirnov
557d4c4eca avconv: replace AVCodecContext.time_base with framerate 2014-10-15 06:38:16 +00:00
Luca Barbato
6cfbe1de5a avconv: Use only audio and video to guess discontinuities
Data and subtitle streams might cause false positive.
2014-09-26 20:56:16 +02:00
Gabriel Dume
f929ab0569 cosmetics: Write NULL pointer equality checks more compactly
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-08-15 03:18:18 -07:00
Anton Khirnov
aa51b0492b avconv: rename output_packet() to process_input_packet()
It more accurately describes what this function does
2014-08-13 17:24:18 +00:00
Anton Khirnov
3f3232a371 avconv: set the output stream timebase
This is required by the new API.
2014-07-09 13:30:33 +00:00
Anton Khirnov
452860d7e0 Use av_packet_rescale_ts() to simplify code. 2014-06-20 14:14:48 +02:00
Anton Khirnov
71d6551e67 avconv: use the correct variable in comparison 2014-06-17 09:01:26 +02:00
Anton Khirnov
48e5092133 avconv: make -shortest work with streamcopy
CC: libav-stable@libav.org
2014-06-12 08:17:50 +02:00
Luca Barbato
39ec5e1cf8 avconv: Report the codec and the encoder separately
Bug-Id: 694
2014-06-04 13:04:40 +02:00
Anton Khirnov
383136264e avconv: do not use the stream codec context for encoding 2014-06-01 08:33:21 +02:00
Anton Khirnov
41776ba9c0 avconv: do not use the stream codec context for decoding 2014-06-01 08:33:11 +02:00
Anton Khirnov
dc40d88625 avconv: do not use poorly defined and undocumented AVStream.pts
Use OutputStream.last_mux_dts as an approximation of 'current' output
time instead.
2014-05-19 07:14:11 +02:00
Anton Khirnov
6656370b85 avconv: set the "encoder" tag when transcoding 2014-05-18 20:33:46 +02:00
Anton Khirnov
93afb6c98d avconv: set output avg_frame_rate when known 2014-05-18 10:24:36 +02:00
Anton Khirnov
9580818c5d avconv: rename OutputStream.opts to OutputStream.encoder_opts
This makes it more clear what is this variable for exactly.
2014-05-03 21:44:24 +02:00
Anton Khirnov
01947f07b8 avconv: remove a useless line
Doing anything with that field when we are doing streamcopy (so the
encoder is not opened) should have absolutely no effect.
2014-05-03 21:44:10 +02:00
Anton Khirnov
65ed9e7585 avconv: rename 'codec' to 'enc_ctx'
This more clearly describes what is the variable used for.

Also, move its declaration into the block where it is actually used.
2014-05-03 21:43:43 +02:00
Anton Khirnov
650a5206a9 avconv: rename 'icodec' to 'dec_ctx'
This more clearly describes what is the variable used for.
2014-05-03 21:43:24 +02:00
Anton Khirnov
f3a6ad22c9 avconv: rename InputStream.opts to InputStream.decoder_opts
This makes it more clear what is this variable for exactly.
2014-05-03 21:43:05 +02:00
Anton Khirnov
73ed8558a6 avconv: simplify exit_program() by using more local vars 2014-05-03 21:42:02 +02:00
Anton Khirnov
1ae8198bca avconv: always reset packet pts after decoding an audio frame
Currently, if a decoder sets AVFrame.pts, we'd send the same timestamp
to it twice, which is wrong.
2014-04-22 07:45:49 +02:00
Vittorio Giovara
aa499568af avconv: More descriptive message about framedrop 2014-03-25 12:26:24 +01:00
Anton Khirnov
d1780e01b8 avconv: don't warn on multiple frames per packet for codecs that expect it 2014-03-24 06:21:13 +01:00
Anton Khirnov
4754345027 avconv: print verbose per-stream transcoding statistics 2014-03-24 06:20:38 +01:00
Anton Khirnov
a220b07b0f avconv: split printing the final statistics into a separate function 2014-03-24 06:17:19 +01:00
Anton Khirnov
baeb59d89b avconv: rewrite output data size tracking
Store a variable per OutputStream instead of globals for
audio/video/extradata. This makes the code simpler and cleaner and fixes
2pass with multiple output streams.
2014-03-24 06:17:04 +01:00
Anton Khirnov
f759f66e36 avconv: explicitly report when the muxing overhead is unknown 2014-03-24 06:16:58 +01:00
Anton Khirnov
781d97fd54 avconv: remove unused nb_frames_dup
Frame duplication now happens in vf_fps.
2014-03-24 06:16:31 +01:00
Anton Khirnov
59444c76e6 avconv: add stream-global side data to the first demuxed packet 2014-03-24 06:07:51 +01:00
Anton Khirnov
67f2a68814 avconv: remove a write-only variable 2014-02-24 17:30:48 +01:00
Luca Barbato
5c79d2e12d avconv: Do not divide by zero 2014-02-20 18:58:38 +01:00
Anton Khirnov
2ce8bca51f avconv: print a warning when falling back to default 25fps 2014-01-17 10:30:45 +01:00
Anton Khirnov
674fa49110 avconv: do not call avcodec_get_frame_defaults()
Strictly speaking it is not correct to call it on refcounted frames, in
any case it is unnecessary, since filtered_frame is always unreferenced
after poll_filter() returns.
2013-12-11 20:39:54 +01:00
Anton Khirnov
eb891b3114 Replace all uses of avcodec_free_frame with av_frame_free(). 2013-12-11 20:39:54 +01:00
Diego Biurrun
8f8bc92365 Add missing #includes for *INT64_MAX and *INT64_C 2013-11-23 21:55:52 +01:00
Anton Khirnov
07fd0a2219 avconv: add infrastructure for using hwaccels 2013-11-23 11:55:43 +01:00
Anton Khirnov
5b9c3b4505 Replace all instances of avcodec_alloc_frame() with av_frame_alloc(). 2013-11-16 12:44:20 +01:00
Anton Khirnov
ccc7129845 lavc: deprecate FF_DEBUG_MV and remove all traces of its use
It has not been actually used since
37045e4229, when the broken vismv code was
removed.
2013-10-31 20:21:13 +01:00
Anton Khirnov
c872d310cd avconv: stop accessing AVStream.parser
It is private and must not be touched from outside of lavf.
2013-10-29 14:19:10 +01:00
Anton Khirnov
ddc589ce98 avconv: drop a now useless variable 2013-10-27 21:32:37 +01:00
Anton Khirnov
488a0fa689 avconv: support -t as an input option.
It limits the duration of the data read from a given input.
2013-08-05 10:54:19 +02:00
Anton Khirnov
56ee3f9de7 avconv: distinguish between -ss 0 and -ss not being used
Using -ss 0 to drop frames with negative timestamps is a perfectly valid
use case.
2013-08-05 10:53:12 +02:00
Luca Barbato
636ced8e1d cmdutils: wrap exit explicitly
Some C runtime implementations deadlock when calling threading functions
on the atexit() handler.

Use a simpler wrapper similar to av_log to call the cleanup function
before exit.

Bug-Id: 523
2013-07-07 21:43:23 +02:00
Derek Buitenhuis
7798a59dc1 avconv: Don't include colorspace.h
The header is private, and avconv.c doesn't use it
for anything.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2013-06-29 14:24:02 -04:00
Luca Barbato
42cc6cefd3 avconv: report the error for codec open failure
External codec may have corner case reason to fail at init, better
report them instead having the user wonder.
2013-06-22 20:54:59 +02:00
Luca Barbato
1e340af8d6 avconv: drop additional strerror fallback
strerror_r is called by av_strerror already.
2013-06-22 20:54:59 +02:00
Anton Khirnov
274e134e49 avconv: check that the output format context exists before accessing it
Fixes a segfault in exit_program() if opening an output file fails.
2013-06-04 17:20:04 +02:00
Anton Khirnov
538bf76737 avconv: make -aspect work with streamcopy 2013-05-27 21:26:06 +02:00
Anton Khirnov
481575d255 avconv: remove -deinterlace
It is incompatible with refcounted frames and since it's been deprecated
for a long time now, fixing it is not worth the effort.
2013-05-07 12:31:55 +02:00
Anton Khirnov
76d23f4031 avconv: do not send non-monotonous DTS to the muxers.
Hack partially based on a commit by Michael Niedermayer <michaelni@gmx.at>
Should fix (or work around) bug 458.
2013-05-03 09:59:48 +02:00
Anton Khirnov
b4a5a29227 avconv: improve -re implementation
Integrate the code in the packet reading function, instead of inserting
sleeps in many places.
This is simpler to follow and should work better.
2013-05-03 09:57:13 +02:00
Anton Khirnov
8cd472d3f9 avconv: make output -ss insert trim/atrim filters.
This makes output -ss sample-accurate for audio and will allow further
simplication in the future.
2013-04-30 12:00:55 +02:00
Anton Khirnov
a83c0da539 avconv: make -t insert trim/atrim filters.
This makes -t sample-accurate for audio and will allow further
simplication in the future.

Most of the FATE changes are due to audio now being sample accurate. In
some cases a video frame was incorrectly passed with the old code, while
its was over the limit.
2013-04-30 11:53:12 +02:00
Anton Khirnov
fa2a34cd40 lavfi: change the filter registering system to match the other libraries
Removes an arbitrary hardcoded limit on the number of filters.
2013-04-11 20:44:03 +02:00
Anton Khirnov
38f0c0781a lavfi: merge avfiltergraph.h into avfilter.h
We do not support using filters without AVFilterGraph in practice
anyway, so there is no point in pretending we do.
2013-04-11 20:33:33 +02:00
Anton Khirnov
a4208b9b7d avconv: add options for reading filtergraphs from a file. 2013-03-28 07:55:48 +01:00
Anton Khirnov
9b2dc29534 avconv: convert to new refcounted AVFrame API 2013-03-08 07:40:50 +01:00
Ronald S. Bultje
54b298fe56 lavc: Deprecate the deinterlace functions in libavcodec
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-03-07 09:35:24 +02:00
Martin Storsjö
df0229a7ca avconv: Apply codec options to streams that are copied as well
This allows setting/overriding e.g. the bitrate parameter, which
is required for the smoothstreaming muxer. Normally, the bitrate
is set by the demuxer in these cases, but not all demuxers can
provide it. This allows stream copy of data to the smoothstreaming
muxer from such inputs.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-02-28 18:30:42 +02:00
Justin Ruggles
5c7db097eb avconv: pass libavresample options to AVFilterGraph 2013-02-23 17:07:54 -05:00
Martin Storsjö
a23abaf302 avconv: Increase the SDP buffer size to fit xiph SDPs
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-20 18:20:47 +02:00
Anton Khirnov
77bd1bc73a avconv: use new options parser. 2012-12-18 20:14:54 +01:00
Justin Ruggles
9a71d362a6 avconv: deprecate the -vol option
Remove the code for volume scaling in avconv.c and instead auto-insert a
volume filter into the beginning of the filter chain.
2012-12-05 11:23:37 -05:00
Justin Ruggles
a903f8f087 Include libavutil/channel_layout.h instead of libavutil/audioconvert.h
Also reorder some other #include when applicable.
2012-11-11 13:35:12 -05:00
Justin Ruggles
3ba416408a avconv: rescale packet duration to muxer time base when flushing encoders
Fixes Bug 385
2012-11-08 13:57:34 -05:00
Anton Khirnov
c8977f6d26 avconv: do not free muxed packet on streamcopy.
The packet belongs to lavf, the caller must not free it or access it in
any other way.
No change in practice, since destruct is set to NULL anyway.
2012-11-02 18:28:56 +01:00
Diego Biurrun
70478746a9 avconv: Drop unused function argument from do_video_stats() 2012-10-29 19:07:58 +01:00
Janne Grunau
1b891d17c5 avconv: fix bitrate report when writing to /dev/null
avio_size() reports the filesize which returns 0 for /dev/null.
avio_tell() reports the current position.

Also handle errors from avio_tell().
2012-10-25 15:00:15 +02:00
Anton Khirnov
8e84f2055c avconv: remove now unneeded calls to avcodec_get_frame_defaults(). 2012-10-24 08:46:45 +02:00
Mans Rullgard
3f65eff408 Include sys/time.h before sys/resource.h
Some systems require sys/time.h being explicitly included before
sys/resource.h.  The configure check already does this.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-10-23 12:00:21 +01:00
Nathan Caldwell
c854102da7 avcodec: handle AVERROR_EXPERIMENTAL
Error out on init if a codec with CODEC_CAP_EXPERIMENTAL is requested
and strict_std_compliance is not FF_COMPLIANCE_EXPERIMENTAL.

Move the check from avconv to avcodec_open2() and return
AVERROR_EXPERIMENTAL accordingly.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2012-10-21 23:03:26 +02:00
Diego Biurrun
c1ef30a6ba De-doxygenize some top-level files 2012-10-12 20:56:54 +02:00
Anton Khirnov
fb722a900f avconv: remove -same_quant
It has not worked for anything other than fringe codecs (asv1/2, mdec,
mjpeg[b]) since about 2003 and nobody ever noticed or complained. This
sufficiently proves that there are no users of this option who have a
clue of what they are doing, so it is completely useless.
2012-10-09 20:32:34 +02:00
Diego Biurrun
8be5b0d6d5 avconv/avprobe: Add missing 'void' to exit_program() definition 2012-10-03 18:07:49 +02:00
Diego Elio Pettenò
5e3f9979fa Use atexit() instead of defining a custom exit_program() interface. 2012-10-01 17:17:42 -04:00
Justin Ruggles
fd41cb4370 avconv: improve sample format negotiation for decoder request
This takes into account planar vs. packed when comparing to find the closest
sample format match.
2012-10-01 13:42:43 -04:00
Anton Khirnov
11d1ca4b2c Use avcodec_free_frame() to free AVFrames. 2012-09-24 12:31:25 +02:00
Janne Grunau
2f34021d57 avconv: flush filtered frames before reconfiguring filters
This prevents lost frames after a resolution change.
2012-09-17 10:49:27 +02:00