1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

465 Commits

Author SHA1 Message Date
Anton Khirnov
44b0b85fe9 avconv: prefer user-forced input framerate when choosing output framerate 2012-08-26 07:50:06 +02:00
Anton Khirnov
3c0df90584 avconv: make -shortest a per-output file option. 2012-08-18 08:48:30 +02:00
Mans Rullgard
d752509b74 Use log2(x) instead of log(x) / log(2)
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-13 17:59:21 +01:00
Anton Khirnov
ab29609701 avconv: allow no input files.
It is now possible to use lavfi sources.
2012-08-08 21:56:26 +02:00
Anton Khirnov
a5fd7c607f avconv: prevent invalid reads in transcode_init() 2012-08-08 21:55:54 +02:00
Anton Khirnov
57d2422559 avconv: rename OutputStream.is_past_recording_time to finished.
The new name is shorter and more accurate, since this variable is no
longer used only for checking recording time constraint.
2012-08-08 21:55:45 +02:00
Anton Khirnov
0c00fd80ee avconv: split the code for processing input packets out of transcode() 2012-08-08 21:55:15 +02:00
Anton Khirnov
f154ef1ae5 avconv: send EOF to lavfi even if flushing the decoder fails 2012-08-08 20:16:29 +02:00
Anton Khirnov
cc2133b66a avconv: get rid of pointless temporary variable. 2012-08-08 20:16:13 +02:00
Anton Khirnov
8391602913 avconv: simplify transcode().
Operate with a pointer to InputFile instead of its index in input_files.
2012-08-08 20:15:36 +02:00
Anton Khirnov
c0fbf9713c avconv: cosmetics
Replace for (;foo == 0;) with while (!foo)
This is prettier.
2012-08-08 20:15:13 +02:00
Anton Khirnov
0b26ef4228 avconv: replace no_packet array in transcode() with a var in InputStream
This simplifies splitting code for reading from input out of
transcode().
2012-08-08 20:12:47 +02:00
Anton Khirnov
d64901f99d avconv: remove commented out cruft. 2012-08-08 20:12:11 +02:00
Anton Khirnov
a4f5011065 avconv: maintain sync on lavfi outputs.
Before this commit, poll_filters() reads all frames available on each
lavfi output. This does not work for lavfi sources that produce
an unlimited number of frames, e.g. color and similar.

With this commit, poll_filters() reads from output with the lowest
timestamp and returns to wait for more input if no frames are available
on it.
2012-08-08 20:04:27 +02:00
Anton Khirnov
fe2147e936 avconv: split configuring filter configuration to a separate file. 2012-08-08 11:11:52 +02:00
Anton Khirnov
f5e668273a avconv: split option parsing into a separate file. 2012-08-08 11:10:06 +02:00
Anton Khirnov
36ef5369ee Replace all CODEC_ID_* with AV_CODEC_ID_* 2012-08-07 16:00:24 +02:00
Mans Rullgard
82494835c4 rational: add av_inv_q() returning the inverse of an AVRational
This allows simplifying a few expressions.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-05 17:46:41 +01:00
Anton Khirnov
aba232cfa9 lavf: deprecate r_frame_rate.
According to its description, it is supposed to be the LCM of all the
frame durations. The usability of such a thing is vanishingly small,
especially since we cannot determine it with any amount of reliability.
Therefore get rid of it after the next bump.

Replace it with the average framerate where it makes sense.

FATE results for the wtv and xmv demux tests change. In the wtv case
this is caused by the file being corrupted (or possibly badly cut) and
containing invalid timestamps. This results in lavf estimating the
framerate wrong and making up wrong frame durations.
In the xmv case the file contains pts jumps, so again the estimated
framerate is far from anything sane and lavf again makes up different
frame durations.

In some other tests lavf starts making up frame durations from different
frame.
2012-07-29 08:06:30 +02:00
Ronald S. Bultje
dcb7ef5483 avprobe/avconv: fix tentative declaration compile errors on MSVS. 2012-07-28 11:48:18 -07:00
Anton Khirnov
5417efbbf3 avconv: print an error message when demuxing fails.
Also exit in such a case if -xerror is used.

Fixes bug 329.
2012-07-17 09:50:26 +02:00
Anton Khirnov
8a645bfc31 avconv: propagate fatal errors from lavfi. 2012-07-09 08:32:49 +02:00
Anton Khirnov
53ddd43f0c avconv: use only meaningful timestamps in start time check. 2012-07-06 12:59:11 +02:00
Anton Khirnov
b98c8f4f2b avconv: fix the check for -ss as an output option.
start time is already substracted from the frame timestamp, so it needs
to be checked against 0, not start time.
2012-07-06 12:54:52 +02:00
Reimar Döffinger
4c679750cb avconv: fix parsing of -force_key_frames option.
Currently it always exits with an error when more than
one position is specified.

CC: libav-stable@libav.org
2012-07-05 13:15:36 +02:00
Martin Storsjö
715129cdc4 avconv: Set audio filter time base to the sample rate
If the output frame size is smaller than the input sample rate,
and the input stream time base corresponds exactly to the input
frame size (getting input packet timestamps like 0, 1, 2, 3, 4 etc),
the output timestamps from the filter will be like
0, 1, 2, 3, 4, 4, 5 ..., leadning to non-monotone timestamps later.

A concrete example is input mp3 data having frame sizes of 1152
samples, transcoded to aac with 1024 sample frames.

By setting the audio filter time base to the sample rate, we will
get sensible timestamps for all output packets, regardless of
the ratio between the input and output frame sizes.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-05 09:57:04 +03:00
Martin Storsjö
d3ed1c9571 cmdutils: Pass the actual chosen encoder to filter_codec_opts
This allows passing the right options to encoders when there's more
than one encoder for a certain codec id.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-30 15:44:10 +03:00
Anton Khirnov
c29c1a1b6b avconv: add an assert to silence an uninitialized variable warning.
The warning silenced was:
avconv.c: In function ‘opt_output_file’:
avconv.c:3380:21: warning: ‘meta_out’ may be used uninitialized in this function [-Wuninitialized]
avconv.c:3315:20: note: ‘meta_out’ was declared here
2012-06-26 19:32:41 +02:00
Anton Khirnov
74853ed3f8 avconv: shut up an uninitialized variable warning.
The warning silenced was:
avconv.c: In function ‘configure_filtergraph’:
avconv.c:603:8: warning: ‘ist’ may be used uninitialized in this function [-Wuninitialized]
avconv.c:549:18: note: ‘ist’ was declared here
2012-06-26 19:31:51 +02:00
Anton Khirnov
b8c632a720 avconv: don't include vsrc_buffer.h, which doesn't exist anymore 2012-06-26 14:33:01 +02:00
Anton Khirnov
19ad567311 avconv: fix -force_key_frames
parse_forced_keyframes() relies in encoder timebase being set, so call
it from transcode_init() after it is known.
2012-06-26 13:10:33 +02:00
Anton Khirnov
fd269d6253 avconv: remove a forgotten debugging printf. 2012-06-24 07:15:32 +02:00
Anton Khirnov
df98bf22cb avconv: use more descriptive names for hardcoded filters.
Also ensure that all such filters get a non-NULL name. Should fix FATE
failures on some architectures after
58b049f2fa.
2012-06-24 07:15:32 +02:00
Anton Khirnov
6fc7d9a078 avconv: remove redundant handling of async.
Because of a mistake during merging the code for simple and complex
filtergraphs, -async inserts an asyncts filter both on input and output.
Remove the output hunk.
2012-06-24 07:15:31 +02:00
Mans Rullgard
896bb0d742 Replace usleep() calls with av_usleep()
This reduces the dependency on unistd.h which is not available
on all systems.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-06-22 17:15:36 +01:00
Mans Rullgard
6501dcfb5e Remove unnecessary inclusions of [sys/]time.h
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-06-20 11:46:46 +01:00
Anton Khirnov
9034b0ed66 avconv: don't try to free threads that were not initialized. 2012-06-14 10:33:10 +02:00
Anton Khirnov
9d0bfc5052 lavfi: make AVFilterPad opaque after two major bumps.
It will allow adding new fields to it without ABI breaks.
2012-06-13 11:11:33 +02:00
Anton Khirnov
47b812e9ce avconv: support only native pthreads.
Our w32pthreads wrapper has various issues and is only supposed to be
used in libavcodec.
2012-06-12 13:44:38 +02:00
Anton Khirnov
5db5169e46 avconv: multithreaded demuxing.
When there are multiple input files, run demuxing for each input file in
a separate thread, so reading packets does not block.

This is useful for achieving low latency when reading from multiple
(possibly slow) input streams.
2012-06-10 08:12:23 +02:00
Anton Khirnov
d55c2e05b5 avtools: move buffer management code from avconv to cmdutils.
It will be used by avplay.
2012-06-05 09:35:58 +02:00
Anton Khirnov
3ffa233595 avconv: don't use InputStream in the buffer management code.
Use just the pointer to the head of the buffer pool.

This will allow sharing the code with avplay.
2012-06-05 09:35:39 +02:00
Anton Khirnov
e58b75f7ff avconv: fix exiting when max frames is reached.
frame number should never be strictly larger than max frames, so the
if() was never triggered.
2012-06-05 09:35:08 +02:00
Anton Khirnov
bb7431f4fc avconv: check output stream recording time before each frame returned from filters
There may be multiple frames returned, so with just one check we can
write more than requested to the output.
2012-06-04 14:18:34 +02:00
Anton Khirnov
a508e7a1ff avconv: split selecting input file out of transcode(). 2012-06-04 14:18:18 +02:00
Anton Khirnov
2f51ec2b94 avconv: split checking for active outputs out of transcode(). 2012-06-04 14:17:52 +02:00
Anton Khirnov
c9cc76290f avconv: extend -r to work on any input stream.
This is done by automatically inserting a setpts filter.
2012-05-29 19:19:17 +02:00
Anton Khirnov
cf6c38c62b avconv: don't print filters inserted by avconv in stream mappings. 2012-05-29 19:19:16 +02:00
Anton Khirnov
8daf21d567 avconv: merge configuration code for complex and simple filters
Some tests change because -s now inserts the scaler to the end instead
of beginning of the filtergraph.
2012-05-29 19:19:16 +02:00
Anton Khirnov
a977d91e28 avconv: split configuring input filters out of configure_complex_filter 2012-05-29 19:19:16 +02:00
Martin Storsjö
a1a6cdc26e avconv: Display the error returned by avformat_write_header
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-05-26 13:35:44 +03:00
Anton Khirnov
0629f6128e avconv: rename transcode_audio/video to decode_audio/video.
Those functions do only decoding now, encoding is run from
poll_filters().
2012-05-22 21:29:06 +02:00
Anton Khirnov
39885a4bd7 avconv: reindent 2012-05-18 19:41:58 +02:00
Anton Khirnov
74b961db77 avconv: replace -vsync cfr code with the fps filter.
Invented timestamps for the h264 tests return to something resembling
sanity.

In the idroq-video-encode test when converting 25 fps -> 30 fps the
fifth frame gets duplicated instead of the sixth.
2012-05-18 19:38:40 +02:00
Anton Khirnov
0ad26cdf24 avconv: add support for audio in complex filtergraphs. 2012-05-18 19:27:00 +02:00
Anton Khirnov
01e98b1b00 avconv: fix behavior with -ss as an output option.
Don't return from poll_filters() immediately, there may be other frames
and/or other streams to handle.

Fixes a memleak.
2012-05-17 19:37:58 +02:00
Anton Khirnov
6eeb9a0433 avconv: automatically insert asyncts when -async is used.
Deprecate -async.
2012-05-14 21:36:11 +02:00
Anton Khirnov
369cb092ec avconv: add support for audio filters.
The FATE changes are all off-by-one due to different rounding being used
(lrintf vs av_rescale_q).
2012-05-14 21:36:11 +02:00
Anton Khirnov
720c6b78d1 buffersrc: add av_buffersrc_write_frame().
It's the same as av_vsrc_buffer_add_frame(), except it doesn't take pts
or pixel_aspect parameters. Those are read from AVFrame.

Deprecate av_vsrc_buffer_add_frame().
2012-05-14 21:36:11 +02:00
Mans Rullgard
4f1500689d avconv: use lrint() for rounding double timestamps
Converting the double to float for lrintf() loses precision when
the value is not exactly representable as a single-precision float.
Apart from being inaccurate, this causes discrepancies in some
configurations due to differences in rounding.

Note that the changed timestamp in the vc1-ism test is a bogus,
made-up value.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-05-10 22:54:27 +01:00
Anton Khirnov
a5117a2444 lavc: pad last audio frame with silence when needed. 2012-05-09 17:46:54 +02:00
Anton Khirnov
ac71230902 lavfi: add video buffer sink, and use it in avtools
Also add the public interface libavfilter/buffersink.h.

Based on a commit by Stefano Sabatini.
2012-05-09 08:59:37 +02:00
Anton Khirnov
dce415e7f1 avconv: remove stray useless comment. 2012-05-06 16:20:26 +02:00
Mans Rullgard
3527a73933 avutil: add av_parse_cpu_flags() function
This moves the cpu flag parsing code from avconv to avutil so
it can be accessed elsewhere.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-04-25 23:19:40 +01:00
Justin Ruggles
bcb82fe1f4 avconv: use libavresample 2012-04-24 23:38:54 -04:00
Anton Khirnov
8c4022aceb avconv: fix a segfault on -c copy with -filter_complex. 2012-04-24 06:30:02 +02:00
Luca Barbato
1381081cdb avconv: fix off by one check in complex_filter
nb_input_files is already an invalid index.
2012-04-22 17:23:50 -07:00
Mans Rullgard
d526c5338d ARM: allow runtime masking of CPU features
This allows masking CPU features with the -cpuflags avconv option
which is useful for testing different optimisations without rebuilding.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-04-22 12:30:45 +01:00
Mans Rullgard
2bcbd98459 Remove lowres video decoding
This feature is complex, of questionable utility, and slows down
normal decoding.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-04-21 18:56:19 +01:00
Anton Khirnov
2994913d70 avconv: fix a segfault when default encoder for a format doesn't exist.
Fail earlier and with a more descriptive error message.
2012-04-21 06:48:28 +02:00
Justin Ruggles
d8b06521a9 avconv: check for an incompatible changing channel layout
The decoder can change the layout and channel count during decoding,
but currently we only validate that the two are compatible when opening
the codec. This checks for incompatibilities after each decoded frame.
2012-04-18 21:02:16 -04:00
Justin Ruggles
b1041f8048 avconv: only set the "channels" option when it exists for the specified input format
This allows the user to specify an input channel layout without avconv aborting because the
"channels" option was not found.
2012-04-16 23:44:49 -04:00
Anton Khirnov
9e8aae443b avconv: flush decoders immediately after an EOF.
Prevents extensive buffering when overlaying a single picture.
2012-04-15 20:37:47 +02:00
Anton Khirnov
89605e4aa0 avconv: send EOF to vsrc_buffer. 2012-04-15 20:37:47 +02:00
Anton Khirnov
3e901cbc75 avconv: reindent. 2012-04-15 20:37:42 +02:00
Anton Khirnov
3b266da3d3 avconv: add support for complex filtergraphs. 2012-04-15 20:32:09 +02:00
Anton Khirnov
560f7774a4 avconv: make filtergraphs global.
This is the first step towards supporting complex filtergraphs with more
than one input and/or output.
2012-04-15 20:27:32 +02:00
Anton Khirnov
836ce90566 avconv: move filtered_frame from InputStream to OutputStream.
It more properly belongs to output, not input.
2012-04-15 20:24:07 +02:00
Anton Khirnov
6c9eac1998 avconv: don't set output width/height directly from input value.
Always take it from lavfi. This way we don't need a clearly defined
corresponding input stream.
2012-04-15 20:23:09 +02:00
Anton Khirnov
e77c86629f avconv: move resample_{width,height,pix_fmt} to InputStream.
This is a more proper place for them, since they store parameters of the
input, not output, stream.
2012-04-15 20:23:09 +02:00
Anton Khirnov
9dced85426 avconv: remove a useless variable from OutputStream. 2012-04-15 20:22:36 +02:00
Anton Khirnov
b7327887ea avconv: get output pixel format from lavfi.
This way we don't require a clearly defined corresponding input stream.

The result for the xwd test changes because rgb24 is now chosen instead
of bgra.
2012-04-15 20:22:36 +02:00
Anton Khirnov
2e21526790 avconv: change {input,output}_{streams,files} into arrays of pointers.
Right now, they are arrays of structs, reallocated when new
streams/files are added. This makes storing pointers to those structs
harder than necessary.
2012-04-15 20:20:03 +02:00
Anton Khirnov
ea9367e921 avconv: don't pass input/output streams to some functions.
They are globals, no point in pretending they are not.
2012-04-15 20:20:03 +02:00
Stefano Sabatini
91d3cbe0fd avfiltergraph: make the AVFilterInOut alloc/free API public
This is required for letting applications to create and destroy
AVFilterInOut structs in a convenient way.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-04-14 09:25:46 +02:00
Justin Ruggles
d3c59d5003 avconv: use default channel layouts when they are unknown
If either input or output layout is known and the channel counts match,
use the known layout for both. Otherwise choose the default layout based on
av_get_default_channel_layout().

Changed some FATE references due to some WAVE files now having a non-zero
channel mask.
2012-04-10 11:30:01 -04:00
Justin Ruggles
95a8dac57b avconv: parse channel layout string
This allows the user to use channel layout names instead of having to use the
channel mask values.
2012-04-10 11:30:01 -04:00
Justin Ruggles
b073819bc9 avconv: allow '-async -1' to disable timestamp sync for audio encoding
This will allow a workaround for cases where input timestamps are invalid or
when decoder delay of 1 packet or more confuses avconv into using the wrong
timestamps as a sync reference.
2012-04-09 13:47:11 -04:00
Justin Ruggles
679a973e97 avconv: use default alignment for audio buffer 2012-04-09 10:20:35 -04:00
Anton Khirnov
b6c4518a87 avconv: remove OutputStream.picref.
It's only used inside transcode_video() and there's no point in
preserving it between subsequent calls. So use a local variable instead.
2012-04-09 05:13:00 +02:00
Anton Khirnov
695ec04e6a avconv: only set SAR once on the decoded frame.
No point in repeating the assignment for each output stream.
2012-04-09 05:10:38 +02:00
Anton Khirnov
d4936548f4 avconv: remove an unused function parameter. 2012-04-06 20:21:07 +02:00
Anton Khirnov
4648fe6324 avconv: remove now pointless variables. 2012-04-06 20:21:07 +02:00
Anton Khirnov
e06d2dfcde avconv: drop support for building without libavfilter.
Since the mandatory memcpy in vsrc_buffer has been eliminated, there
shouldn't be any significant reason to build without lavfi anymore.

This will make upcoming support for complex filtergraphs easier to do.
2012-04-06 20:21:07 +02:00
Ronald S. Bultje
bc1ef85520 lavc/avconv: support changing frame sizes in codecs with frame mt.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-03-24 21:29:16 +01:00
Justin Ruggles
4094fc9971 avconv: fix the resampling safety factors for output audio buffer allocation
This matches the output size required for audio_resample()
2012-03-23 01:19:43 -04:00
Justin Ruggles
9869e963a6 avconv: move audio output buffer allocation to a separate function
Allows for removing a goto and makes the code easier to follow.
2012-03-23 01:19:43 -04:00
Justin Ruggles
f3ab3e1aee avconv: make the async buffer global and free it in exit_program() 2012-03-23 01:19:42 -04:00
Justin Ruggles
c9594fe0fb avconv: free packet in write_frame() when discarding due to frame number limit
Fixes a memleak when using the -frames option with audio.
2012-03-20 15:51:58 -04:00
Justin Ruggles
9b9fc9ba32 avconv: pass input stream timestamps to audio encoders
5 FATE test references updated due to using demuxer-generated timestamps that
are either not sample-accurate or are slightly off in the input file.
2012-03-20 14:12:54 -04:00
Anton Khirnov
251422982b avconv: remove pointless checks.
OutputStream.picref is guaranteed to be non-NULL if
get_filtered_video_frame() succeeds.
2012-03-15 09:01:18 +01:00
Anton Khirnov
ce326c1130 avconv: check for get_filtered_frame() failure. 2012-03-15 09:00:55 +01:00
Anton Khirnov
2636e691ce avconv: remove a pointless check.
output_video_filter is always guaranteed to be set and is in fact
dereferenced right above the check.
2012-03-15 09:00:49 +01:00
Anton Khirnov
64334ddbbc avconv: reindent
CC: libav-stable@libav.org
2012-03-13 12:21:44 +01:00
Anton Khirnov
6e8be949f1 avconv: link '-passlogfile' option to libx264 'stats' AVOption.
Fixes bug 204.

CC: libav-stable@libav.org
2012-03-13 12:21:14 +01:00
Anton Khirnov
4138cd2907 avconv: add -cpuflags option for setting supported cpuflags.
Useful for testing.
2012-03-06 15:03:22 +01:00
Anton Khirnov
39da3b223f avconv: fix counting encoded video size.
avcodec_encode_video2() return value is 0 on success, encoded frame size
is stored in the packet.
2012-03-06 10:06:21 +01:00
Anton Khirnov
13f6917ca9 avconv: set discard on input streams automatically. 2012-02-26 19:30:50 +01:00
Anton Khirnov
832ba44d8d avconv: saner output video timebase.
r_frame_rate should in theory have something to do with input framerate,
but in practice it is often made up from thin air by lavf. So unless we
are targeting a constant output framerate, it's better to just use input
stream timebase.

Brings back dropped frames in nuv and cscd tests introduced in
cd1ad18a65
2012-02-26 07:48:45 +01:00
Anton Khirnov
d43040e28b avconv: refactor vsync code.
No functional changes, just make it more readable.
2012-02-26 07:28:27 +01:00
Justin Ruggles
f320fb894c bethsoftvid: pass palette in side data instead of in a separate packet.
Update FATE reference to account for now non-existent palette packet.
This also fixes the FATE test if frame data is not initialized in
get_buffer(), so update comment in avconv accordingly.
2012-02-16 10:47:11 -05:00
Martin Storsjö
ae5a935574 avconv: Don't split out inline sequence headers when stream copying VC1
This is required when stream copying VC1 in ismv - there's one
global header in the moov atom, but keyframes have a separate
sequence header prepended.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-14 16:12:15 +02:00
Andrey Utkin
c22e2ec9d1 avconv: set AVFormatContext.duration from '-t'
Set output files duration to recording_time option, if given.
Rationale: to save duration into metadata for file that is written to
non-seekable output, for formats like FLV (with metadata at beginning).

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-12 17:15:41 +01:00
Justin Ruggles
a75bc764ec avcodec: for audio encoding, set packet dts to packet pts.
There are no audio encoders which do frame reordering.
2012-02-09 21:51:29 -05:00
Anton Khirnov
8e37038a34 avconv: switch to avcodec_encode_video2(). 2012-02-08 21:00:00 +01:00
Anton Khirnov
722410ade5 avconv: estimate next_dts from framerate if it is set. 2012-02-07 20:14:54 +01:00
Anton Khirnov
b34856a116 avconv: better next_dts usage.
next_dts is used for estimating the dts of the next packet if it's
missing. Therefore, it makes no sense to set it from the pts of the last
decoded frame. Also it should be estimated from the current packet
duration/ticks_per_frame always, not only when a frame was successfully
decoded.
2012-02-07 20:14:41 +01:00
Anton Khirnov
23576b3fbb avconv: rename InputStream.pts to last_dts.
It more accurately describes what does this variable store.
2012-02-07 20:13:15 +01:00
Anton Khirnov
6e98390258 avconv: reduce overloading for InputStream.pts.
It currently has different meanings at different times (dts of the last
read packet/pts of the last decoded frame). Reduce obfuscation by
storing pts of the decoded frame in the frame itself.
2012-02-07 20:12:04 +01:00
Anton Khirnov
3101bb6669 avconv: rename InputStream.next_pts to next_dts.
It's used to predict dts, not pts.
2012-02-07 20:11:22 +01:00
Anton Khirnov
1270e12e49 avconv: rework -t handling for encoding.
Current code compares the desired recording time with InputStream.pts,
which has a very unclear meaning. Change the code to use actual
timestamps of the frames passed to the encoder.

In several tests, one less frame is encoded, which is more correct.

In the idroq test one more frame is encoded, which is again more
correct.

Behavior with stream copy should be unchanged.
2012-02-07 20:11:11 +01:00
Anton Khirnov
c9af832623 avconv: set encoder timebase for subtitles.
The actual number (1/1000) will probably require some
discussion/tweaking in the future, but should be good enough for now,
since the timestamps in AVSubtitle are in this timebase by definition.
2012-02-07 20:07:14 +01:00
Anton Khirnov
324fbadff9 avconv: remove debugging cruft from do_video_out(). 2012-02-03 13:45:02 +01:00
Anton Khirnov
61a099680c avconv: factorize setting stream_index for the output packet. 2012-02-03 13:44:59 +01:00
Anton Khirnov
d7edd359ec avconv: deprecate the -deinterlace option
Its quality is horrible, yadif should always be used instead.
2012-01-30 21:43:08 +01:00
Mans Rullgard
3715d841a6 Fix non-C89 declarations in for loops
Some compilers still do not support this syntax.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-01-29 23:26:04 +00:00
Diego Biurrun
abe655a472 Drop unnecessary prefix from *sink* variable and struct names. 2012-01-25 12:28:36 +01:00
Janne Grunau
2473a45c85 threads: change the default for threads back to 1
Using threaded decoding by default breaks backward compatibility if
AVHWAccel is used or if an appliction sets threadunsafe callbacks.
Avconv and avplay still use -threads auto if not specified.
2012-01-21 13:26:44 +01:00
Diego Biurrun
45f2908d02 cosmetics: Rename ffsink to avsink. 2012-01-19 00:19:43 +01:00
Anton Khirnov
9993284793 avconv: fix -frames for video encoders with delay.
Frames must be counted when they are passed to the encoder, not when
they come out.

Fixes Bug 202.
2012-01-17 09:39:32 +01:00
Justin Ruggles
ee458cb1fa avconv: use avcodec_encode_audio2() 2012-01-15 21:24:18 -05:00
Anton Khirnov
b2ce3b998b avconv: use AVFrame.width/height/format instead of corresponding AVCodecContext fields 2012-01-12 09:02:01 +01:00
Anton Khirnov
ac64607682 avconv: reinitialize the filtergraph on resolution change.
This is a hopefully temporary solution until lavfi can properly deal
with resolution changes.
2012-01-10 16:47:15 +01:00
Anton Khirnov
7b9373db89 avconv: fix -copyinkf.
This option only applies to streamcopy, but is currently processed only
when encoding.
2012-01-10 16:47:15 +01:00
Anton Khirnov
e8c04f6240 avconv: add symbolic names for -vsync parameters 2012-01-04 21:25:25 +01:00
Anton Khirnov
c88d53199b avconv: remove the 'codec framerate is different from stream' warning
Codec timebase is not framerate and the situation when it's different
from AVStream.r_frame_rate is quite common, nothing to warn about.
2012-01-02 14:15:09 +01:00
Anton Khirnov
f15f02c204 avconv: make -frames work for all types of streams, not just video. 2012-01-01 22:27:52 +01:00
Janne Grunau
1135a07146 avconv: free bitstream filters 2012-01-01 21:48:50 +01:00
Aneesh Dogra
7636c8c6a3 avconv: K&R cosmetics
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-12-29 21:45:44 +01:00
Anton Khirnov
04a14d4d25 avconv: avoid memcpy in vsrc_buffer when possible.
Decoding Sintel.2010.1080p.mkv with 4 threads on an i7 2600K goes from
260s to 244s.
2011-12-25 16:18:57 +01:00
Anton Khirnov
64dca32cdf avconv: implement get_buffer()/release_buffer().
This will allow memcpy-free passing frames to lavfi.
2011-12-25 16:18:57 +01:00
Alex Converse
4bf3c8f226 mov: Don't stick the QuickTime field ordering atom in extradata.
The 'fiel' atoms can be found in H.264 tracks clobbering the extradata.
MJPEG supports non field based extradata, and this data should be
preserved when copying.
2011-12-21 22:04:37 -08:00
Alexandra Khirnova
a7b5e841ff avconv: support stream specifiers in -metadata and -map_metadata
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-12-16 21:12:53 +01:00
Anton Khirnov
cd3716b9aa Replace all uses of av_close_input_file() with avformat_close_input(). 2011-12-12 20:34:38 +01:00
Janne Grunau
f6cf4be821 avconv: update -map option help text 2011-12-12 14:36:04 +01:00
Diego Biurrun
da9cea77e3 Fix a bunch of common typos. 2011-12-11 00:32:25 +01:00
Anton Khirnov
5bf6638022 avconv: drop code for special handling of avserver streams.
It's broken and doesn't work anyway.

This patch means that avconv will ignore encoding options from the ffm
file and will instead use whatever is provided on the commandline as for
normal output.
2011-12-10 22:02:44 +01:00
Luca Barbato
f75e3d25d0 avconv: remove unsubstantiated comment
All the currently supported OS-es manage to use return values
properly.
2011-12-08 12:47:34 +01:00
Justin Ruggles
9179f27c64 avconv: only allocate 1 AVFrame per input stream
This avoids allocating/freeing an AVFrame for each packet decode. It also
simplifies error handling in transcode_audio() and transcode_video().
2011-12-05 11:54:24 -05:00
Justin Ruggles
110d2af28e avconv: fix memleaks due to not freeing the AVFrame for audio 2011-12-05 10:53:29 -05:00
Justin Ruggles
d1241ff3b2 avconv: use avcodec_decode_audio4() instead of avcodec_decode_audio3() 2011-12-04 18:29:51 -05:00
Mans Rullgard
150ddbc148 Do not memcpy raw video frames when using null muxer
Commit 035af99 made avconv always call an encoder when using the
null muxer.  While useful for 2-pass encodes, it inadvertently
caused an extra memcpy of raw frames when decoding only.

This hack restores the old behaviour when only decoding while
allowing use of the null muxer with encoded streams as well.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-12-02 18:49:50 +00:00
Anton Khirnov
7bb3e62594 avconv: make copy_tb on by default.
I.e. on streamcopy set output codec timebase from input stream timebase
(as opposed to input codec timebase). This should be more sane, because
since the stream is not decoded, the input codec tb has no relation to
the timestamps of the copied packets.
2011-11-30 07:47:43 +01:00
Anton Khirnov
741a05a293 avconv: compute next_pts from input packet duration when possible. 2011-11-30 07:47:43 +01:00
Anton Khirnov
91b412e786 avconv: update InputStream.pts in the streamcopy case.
This was broken in 2a651b719c.
2011-11-30 07:47:43 +01:00
Alex Converse
fdab793a46 avconv: Handle audio sync for non-S16 sample formats.
Also fix reporting of the number of samples added/dropped.
2011-11-28 22:18:09 -08:00
Janne Grunau
aa38cff2c6 avconv: fix segfault at EOF with delayed pictures
At EOF it makes no sense to modify avpkt.{data,size} in output_packet
since no data is consumed. Frame threading with more than 1 threads
hits the segfault.
2011-11-24 00:33:02 +01:00
Anton Khirnov
06d4e2fa5a avconv: remove a now unused parameter from output_packet(). 2011-11-23 22:03:32 +01:00
Anton Khirnov
8b0268a853 avconv: formatting fixes in output_packet() 2011-11-23 22:02:59 +01:00
Anton Khirnov
ffa0674e5a avconv: declare some variables in blocks where they are used 2011-11-23 22:01:32 +01:00
Anton Khirnov
af8ad892bf avconv: use the same behavior when decoding audio/video/subs
I.e. if the packet was only partially consumed, pass the rest of it into
the decoder again.

Also simplify the code so it's the same for video/audio/subs.
2011-11-23 21:58:53 +01:00
Anton Khirnov
e1edfbcb24 avconv: use vsync 0 for AVFMT_NOTIMESTAMPS formats.
Prevent avconv from duplicating or dropping frames for formats where it
makes even less sense than usual, e.g. image2.
2011-11-23 21:38:17 +01:00
Alex Converse
105ab61c5f avconv: Consistently use PIX_FMT_NONE.
Use PIX_FMT_NONE instead of -1 when dealing with PixelFormat variables.
2011-11-22 14:33:11 -08:00
Anton Khirnov
82963f8f04 avconv: cleanup the transcoding loop in output_packet(). 2011-11-21 21:43:48 +01:00
Anton Khirnov
9595234c94 avconv: split subtitle transcoding out of output_packet(). 2011-11-21 18:12:38 +01:00
Anton Khirnov
45d4b66f6f avconv: split video transcoding out of output_packet(). 2011-11-21 18:12:38 +01:00
Anton Khirnov
ded28ba35b avconv: split audio transcoding out of output_packet(). 2011-11-21 18:12:38 +01:00
Anton Khirnov
78162b4ea2 avconv: reindent. 2011-11-21 18:12:38 +01:00
Anton Khirnov
2a651b719c avconv: move streamcopy-only code out of decoding loop. 2011-11-21 18:12:37 +01:00
Anton Khirnov
51aeb69452 avconv: remove an always true condition and reindent. 2011-11-21 18:12:37 +01:00
Anton Khirnov
7204ec1a88 avconv: split off streamcopy handling into a separate loop.
This is easier to understand and is less likely to break horribly when a
stream is to be both decoded and copied.
2011-11-21 18:12:37 +01:00
Anton Khirnov
03f30c837b avconv: cosmetics, reformat transcode_init()
Fix spacing, vertically align, break some long lines, add some empty
lines for readability.
2011-11-21 08:13:37 +01:00
Anton Khirnov
1bb77e51a8 avconv: rename 'os' variable to 'oc'
Output AVFormatContext is called 'oc' in most other places.
2011-11-21 08:13:32 +01:00
Martin Storsjö
2abe947ac0 avconv: Set new interrupt callbacks for all AVFormatContexts, use avio_open2() everywhere
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-11-18 11:01:16 +01:00
Anton Khirnov
492cc1bef3 avconv: remove some codec-specific hacks
The problem they are supposed to fix is handled in riff.c, so those
hacks are pointless.
2011-11-10 11:55:58 +01:00
Anton Khirnov
059fb8c884 avconv: remove some redundant temporary variables. 2011-11-06 18:38:54 +01:00
Anton Khirnov
f8c314c81f avconv: fix broken indentation 2011-11-06 18:38:53 +01:00
Anton Khirnov
a2aeeb2263 avconv: move copy_initial_nonkeyframes to the options context.
Also document it.
2011-11-06 18:38:53 +01:00
Anton Khirnov
9a414d8962 avconv: use file:stream instead of file.stream in log messages. 2011-11-06 18:38:53 +01:00
Martin Storsjö
776f2bb91a Call avformat_network_init/deinit in the programs
Calling the init function will become mandatory at some later
point. By calling it, more heavy network init (such as SSL/TLS
library init) can be done once at startup, instead of implicitly
when used (which could lead to it being done a number of times).

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-11-06 18:31:39 +02:00
Anton Khirnov
a2c0b830d5 avconv: add -dump_attachment option. 2011-11-03 07:29:29 +01:00
Anton Khirnov
4dbc6ceef5 avconv: add -attach option.
It allows attaching arbitrary files, e.g. fonts to Matroska files.
2011-11-03 07:28:21 +01:00
Anton Khirnov
e6674f685b avconv: make negative mappings disable only streams from the specified file 2011-11-03 07:28:08 +01:00
Martin Storsjö
02170990fd cmdutils: Rename read_file to cmdutils_read_file
This symbol name clashes with a symbol in gnutls, if linking
statically to that library.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-10-31 16:29:29 +02:00
Justin Ruggles
d0a196962a g722dec: remove the use of lowres for half-rate decoding.
It is broken because an AVCodecContext can be opened/closed multiple
times, and sample_rate is getting divided by 2 each time that happens.

This removes the only use of lowres for audio.
2011-10-25 11:30:50 -04:00
Anton Khirnov
3d813e4c54 lavf: deprecate AVStream.stream_copy
It's only used in avconv, so it properly belongs to OutputStream struct
there.
2011-10-25 16:30:00 +02:00
Anton Khirnov
1b648c7cdb avconc: split choose_codec() to choose_decoder/choose_encoder.
Prevents -c copy from working for input streams and allows to move
stream_copy variable from AVStream to OutputStream.
2011-10-25 16:29:01 +02:00
Anton Khirnov
f172132f82 mpegenc: add preload private option.
Deprecate AVFormatContext.preload.
2011-10-25 16:27:48 +02:00
Anton Khirnov
84ad31ff18 lavf: replace av_new_stream->avformat_new_stream part II.
Manual replacements are done in this commit.

In many cases, the id is some constant made up number (e.g. 0 for video
and 1 for audio), which is then not used in the demuxer for anything.
Those ids are removed.
2011-10-19 17:02:11 +02:00
Alexandra Khirnova
3ec344626c avconv: add presets
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-10-17 22:24:17 +02:00
Anton Khirnov
7a6cd9957d cmdutils/avtools: simplify show_help() by using av_opt_child_class_next() 2011-10-12 16:51:17 +02:00
Anton Khirnov
3b3ea34655 Remove all uses of deprecated AVOptions API. 2011-10-12 16:51:16 +02:00
Mans Rullgard
8124d8ad66 avtools: add -v as alias for -loglevel
This saves a bit of typing.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-10-09 16:53:06 +01:00
Anton Khirnov
f5646a325b avconv: always print stats with AV_LOG_INFO
It's now possible to disable printing stats during encoding with
-nostats, so there's no reason to print them differently depending on
whether it's last report or not.
2011-10-09 17:15:18 +02:00
Anton Khirnov
3460dd8acf avconv: add -stats option to enable/disable printing encoding progress 2011-10-09 17:15:18 +02:00
Anton Khirnov
c6007065ed avconv: in output_packet() don't set decoded_data_size for video.
It's only used for audio.
2011-10-09 17:15:18 +02:00
Anton Khirnov
515901fad2 avconv: remove pointless always true condition 2011-10-09 17:15:18 +02:00
Anton Khirnov
11fdb7e197 avconv: factorize common code in transcode_init() 2011-10-09 17:15:18 +02:00
Alex Converse
daf9890811 avconv: Reformat s16 volume adjustment. 2011-09-28 12:33:51 -07:00
Alex Converse
4bb0b31f76 avconv: Initialize return value for codec copy path. 2011-09-27 19:32:26 -07:00