Commit Graph

52317 Commits

Author SHA1 Message Date
Clément Bœsch
a7c5b7a676 lavf/gif: correct the delay after the first frame.
To define accurately the delay between two frames, it is necessary to
have both available. Before this commit, the first frame had a delay of
0; while in practice the problem is not visible in most situation, it is
problematic with low frame rate and large scene change.

This commit notably fixes output generated with commands such as:

  ffmpeg -i big_buck_bunny_1080p_h264.mov
     -vf "select='gt(scene,0.4)',scale=320:-1,setpts=N/TB"
     -frames:v 5 -y out.gif

Also, to avoid odd loop delays, the N-1 delay is duplicated for the last
frame.
2013-04-19 12:02:19 +02:00
Anton Khirnov
5e83d9aced h264: fully support cropping.
Based on a patch by Vittorio Giovara <vittorio.giovara@gmail.com>

Fixes Bug 378.
2013-04-19 09:28:08 +02:00
Anton Khirnov
a7f46586bf ff_get_buffer(): allocate the frame for max(coded,display) dimensions
Needed e.g. for h264 cropping to work properly.
2013-04-19 09:26:53 +02:00
Michael Niedermayer
505642f182 mp3dec: fallback to generic seeking when a TOC is not present
Fixes seeking without a Xing/Info header.

CC: libav-stable@libav.org
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-04-19 09:26:34 +02:00
Paul B Mahol
b63f7b3ac7 lavfi/afade: use AV_OPT_TYPE_DURATION
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-04-19 00:56:55 +00:00
Clément Bœsch
7e57adb464 lavf/gif: fix timing.
pkt->duration can not be used since the values are only based on frame
rate.
2013-04-19 02:15:57 +02:00
Clément Bœsch
13478b270a gif: use only one graphic control extension block per image.
The encoder now doesn't produce any extra graphic control extension
block anymore. Only the image is encoded, and the muxer writing
its own GCE containing notably the timing information now includes the
optional palette transmitted through packet side data.

This commit avoid setting clashes between the two GCE, and reduce the
size of the generated file with pal8 output.
2013-04-19 02:10:59 +02:00
Clément Bœsch
7b80b3cef0 lavc/utils: merge side data after video encode.
This allows encoders to communicate side data to the muxers.
2013-04-19 02:10:12 +02:00
Clément Bœsch
3d786591b8 fate/gif: create meaningful gif encoding tests. 2013-04-19 02:05:01 +02:00
Marton Balint
007989c7a2 mxfdec: fix return variable type for avio_seek
Signed-off-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-19 01:29:35 +02:00
Reimar Döffinger
a39cd8766f Fix multithreaded MPEG-4 decoding.
Regression since c10d498bfd.
Unfortunately ff_thread_get_format can only be called from
a separate decode thread, running it during init will fail.
Fixes for that are welcome, for now just revert back to
calling avctx->get_format directly, which is correct
but having to decide on a case-by-case basis which approach
to use is a bit messy.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2013-04-19 01:26:54 +02:00
Michael Niedermayer
7254afdf1c Merge remote-tracking branch 'cigaes/master'
* cigaes/master:
  ffmpeg: make -aspect work with -vcodec copy.
  lavfi/vf_aspect: improve compatibility of parsing.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-19 01:02:21 +02:00
Michael Niedermayer
020c287f5e avformat: Dont stop probing before the whole id3 tag is read
When a file appears to start with a id3 tag and appears to
also be something else, then try to increase the probe buffer
size if its below its limit.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-18 23:48:32 +02:00
Stefano Sabatini
c6a43a7244 lavfi/mptestsrc: fix invalid access in case of negative linesize
In particular, fix crash with:
ffplay -f lavfi mptestsrc,vflip
2013-04-18 23:47:44 +02:00
Clément Bœsch
7c1a002c78 subtitles: introduce ASS codec id and use it.
Currently, we have a AV_CODEC_ID_SSA, which matches the way the ASS/SSA
markup is muxed in a standalone .ass/.ssa file. This means the AVPacket
data starts with a "Dialogue:" string, followed by a timing information
(start and end of the event as string) and a trailing CRLF after each
line. One packet can contain several lines. We'll refer to this layout
as "SSA" or "SSA lines".

In matroska, this markup is not stored as such: it has no "Dialogue:"
prefix, it contains a ReadOrder field, the timing information is not in
the payload, and it doesn't contain the trailing CRLF. See [1] for more
info. We'll refer to this layout as "ASS".

Since we have only one common codec for both formats, the matroska
demuxer is constructing an AVPacket following the "SSA lines" format.
This causes several problems, so it was decided to change this into
clean ASS packets.

Some insight about what is changed or unchanged in this commit:

  CODECS
  ------

  - the decoding process still writes "SSA lines" markup inside the ass
    fields of the subtitles rectangles (sub->rects[n]->ass), which is
    still the current common way of representing decoded subtitles
    markup. It is meant to change later.

  - new ASS codec id: AV_CODEC_ID_ASS (which is different from the
    legacy AV_CODEC_ID_SSA)

  - lavc/assdec: the "ass" decoder is renamed into "ssa" (instead of
    "ass") for consistency with the codec id and allows to add a real
    ass decoder. This ass decoder receives clean ASS lines (so it starts
    with a ReadOrder, is followed by the Layer, etc). We make sure this
    is decoded properly in a new ass-line rectangle of the decoded
    subtitles (the ssa decoder OTOH is doing a simple straightforward
    copy). Using the packet timing instead of data string makes sure the
    ass-line now contains the appropriate timing.

  - lavc/assenc: just like the ass decoder, the "ssa" encoder is renamed
    into "ssa" (instead of "ass") for consistency with the codec id, and
    allows to add a real "ass" encoder.

    One important thing about this encoder is that it only supports one
    ass rectangle: we could have put several dialogue events in the
    AVPacket (separated by a \0 for instance) but this would have cause
    trouble for the muxer which needs not only the start time, but also
    the duration: typically, you have merged events with the same start
    time (stored in the AVPacket->pts) but a different duration. At the
    moment, only the matroska do the merge with the SSA-line codec.

    We will need to make sure all the decoders in the future can't add
    more than one rectangle (and only one Dialogue line in it
    obviously).

  FORMATS
  -------

  - lavf/assenc: the .ass/.ssa muxer can take both SSA and ASS packets.
    In the case of ASS packets as input, it adds the timing based on the
    AVPacket pts and duration, and mux it with "Dialogue:", trailing
    CRLF, etc.

  - lavf/assdec: unchanged; it currently still only outputs SSA-lines
    packets.

  - lavf/mkv: the demuxer can now output ASS packets without the need of
    any "SSA-lines" reconstruction hack. It will become the default at
    next libavformat bump, and the SSA support will be dropped from the
    demuxer. The muxer can take ASS packets since it's muxed normally,
    and still supports the old SSA packets. All the SSA support and
    hacks in Matroska code will be dropped at next lavf bump.

[1]: http://www.matroska.org/technical/specs/subtitles/ssa.html
2013-04-18 23:23:59 +02:00
Nicolas George
b1cc12d0e3 ffmpeg: make -aspect work with -vcodec copy. 2013-04-18 22:59:54 +02:00
Nicolas George
b42827ffd9 lavfi/vf_aspect: improve compatibility of parsing.
Try to accept both the old "num:den" and the new "num/den"
syntax. Fix "aspect=2" being ignored due to a missing den.

Also remove a duplicated #include.
2013-04-18 20:51:55 +02:00
Michael Niedermayer
5b9675b5ac Merge remote-tracking branch 'cigaes/master'
* cigaes/master:
  examples/filtering_audio: fix frame leak.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-18 20:15:47 +02:00
Michael Niedermayer
23daee0dcc avcodec/mpegvideo_motion: Check P field references
If a reference is unavailable use a field from the current
picture
Fixes null pointer dereference

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-18 20:13:22 +02:00
Michael Niedermayer
4c8ce750ab svq3: use memmove to avoid overlap in memcpy.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-18 17:56:45 +02:00
Paul B Mahol
212960eea4 colorchannelmixer filter
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-04-18 15:31:35 +00:00
Paul B Mahol
449cdd547b colorbalance filter
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-04-18 15:30:10 +00:00
Nicolas George
300ca0763b examples/filtering_audio: fix frame leak.
The frame is not used after being added to the filter
graph, there is no need to keep the reference.
2013-04-18 17:03:01 +02:00
Paul B Mahol
3e9c0217fd lavu: add av_clipd_c
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-04-18 14:38:21 +00:00
Michael Niedermayer
5ae484e350 evrcdec: use memmove() instead of memcpy() when regions can overlap.
This occurs also with valid files.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-18 16:20:49 +02:00
Clément Bœsch
90a56ebbe5 lavc/gif: avoid encoding 0x0 images.
It seems browsers don't like it very much.
2013-04-18 15:30:02 +02:00
Clément Bœsch
9db1c6455e lavf/gif: support only GIF codec. 2013-04-18 13:53:47 +02:00
Clément Bœsch
01367b0fca lavf/gif: merge gif_write_{packet,video}.
Avoid a pointless split.
2013-04-18 13:42:26 +02:00
Clément Bœsch
b7a3f14360 lavf/gif: trim unnecessarily long netscape ext code.
Extension description comments are now placed along the avio calls, the
always defined macro removed, and the always true loop_count check as
well (loop option is bound to 0-65535).
2013-04-18 13:42:14 +02:00
Clément Bœsch
0a0e6877ff lavf/gif: remove unused fields. 2013-04-18 13:40:45 +02:00
Clément Bœsch
28f9858c91 lavf/gif: simplify streams type checking. 2013-04-18 13:40:45 +02:00
Michael Niedermayer
978e373499 cmdutils: make the "-help filter=" output less confusing
Example:
Filter overlay
  Overlay a video source on top of the input.
    Inputs:
       #0: main (video)
       #1: overlay (video)
    Outputs:
       #0: default (video)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-18 13:03:00 +02:00
Carl Eugen Hoyos
99818ac4d3 Fix libswscale compilation with --disable-optimizations on x86-32.
Fixes ticket #2477.
2013-04-18 12:47:16 +02:00
Michael Niedermayer
ee94362c8a Merge remote-tracking branch 'cehoyos/master'
* cehoyos/master:
  Fix pgc compilation with --disable-optimizations.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-18 03:00:31 +02:00
Michael Niedermayer
6998af4a40 avcodec/bitstream: check codes in ff_init_vlc_sparse()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-18 02:57:03 +02:00
Michael Niedermayer
fb3e3808ae avcodec/bitstream: Check bits in ff_init_vlc_sparse()
Fixes out of array reads

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-18 02:47:50 +02:00
Carl Eugen Hoyos
2ade23a7ad Fix pgc compilation with --disable-optimizations.
-O1 disables dead code elimination on pgc, use -O instead.
2013-04-18 02:20:04 +02:00
Michael Niedermayer
bdfe60c769 xan: Check for overlapping copies
No valid samples i found use such copies

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-18 01:55:42 +02:00
Clément Bœsch
32cc7ba8a7 fate: hot fix for gif failure. 2013-04-18 01:41:23 +02:00
Clément Bœsch
b6408ffc45 lavf/gif: fix assert in avio API after dfb3231. 2013-04-18 01:13:17 +02:00
Clément Bœsch
91a5b4d480 gif: remove outdated comments. 2013-04-18 00:43:38 +02:00
Clément Bœsch
8694e87127 lavc/gif: return more meaningful error code. 2013-04-18 00:24:25 +02:00
Clément Bœsch
71411b69a2 lavc/gif: merge two allocation checks. 2013-04-18 00:24:25 +02:00
Clément Bœsch
dfb323109c lavf/gif: simplify palette writing. 2013-04-18 00:24:25 +02:00
Clément Bœsch
7b972d82b6 gif: reindent after previous commits. 2013-04-18 00:24:25 +02:00
Clément Bœsch
e065e8a4ea lavc/gif: crop image when possible.
Increase compression when pictures are similar.

-f lavfi testsrc=300: 61M -> 21M
2013-04-18 00:24:25 +02:00
Clément Bœsch
635389ccfa Cleanse GIF muxer and encoder.
This commit removes the badly duplicated code between the encoder and
the muxer. That may sound surprising, but the encoder is now responsible
from the encoding of the picture when muxing to a .gif file. It also
does not require anymore a manual user intervention such as a -pix_fmt
rgb24 to work properly. To summarize, output gif are now easier to
generate, code is saner and simpler, and files are smaller (thanks to
the lzw encoding which was unused so far with the default .gif output).
We can certainly make things even better, but this is the first step.

FATE is updated because of the output being produced by the encoder and
not the muxer (no lzw in the muxer), and in the seek test only the size
mismatches.

Fixes Ticket #2262
2013-04-18 00:24:25 +02:00
Stefano Sabatini
1efcab02b6 lavfi/aspect: apply hot fix for NUM:DEN syntax 2013-04-17 23:37:22 +02:00
Stefano Sabatini
f04ec05f0e lavfi/setdar: fix num/den swapping in log message 2013-04-17 23:37:22 +02:00
Stefano Sabatini
f212c2380a lavfi/setsar: remove spurious #if FF_API_OLD_FILTER_OPTS around init field 2013-04-17 23:37:05 +02:00