Commit Graph

39 Commits

Author SHA1 Message Date
Gyan Doshi 38c322681e avformat/ivfenc: remove unused var
sum_delta_pts is unused since 3b358f151d
2024-04-17 18:31:06 +05:30
Andreas Rheinhardt f4167842c1 avformat/mux: Add flag for "not more than one stream of each type"
More exactly: Not more than one stream of each type for which
a default codec (i.e. AVOutputFormat.(audio|video|subtitle)_codec)
is set; for those types for which no such codec is set (or for
which no designated default codec in AVOutputFormat exists at all)
no streams are permitted.

Given that with this flag set the default codecs become more important,
they are now set explicitly to AV_CODEC_ID_NONE for "unset";
the earlier code relied on AV_CODEC_ID_NONE being equal to zero,
so that default static initialization set it accordingly;
but this is not how one is supposed to use an enum.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-22 23:57:19 +01:00
Dai, Jianhui J 3b358f151d avformat/ivfenc: Set the "number of frames" in IVF header
Should set "number of frames" to bytes 24-27 of IVF header, not
duration.
It is described by [1], and confirmed by parsing all IVF files in [2].

This commit also updates the md5sum of refs to pass fate-cbs.

[1] Duck IVF - MultimediaWiki
https://wiki.multimedia.cx/index.php/Duck_IVF

[2] webm/vp8-test-vectors
https://chromium.googlesource.com/webm/vp8-test-vectors

Signed-off-by: Jianhui Dai <jianhui.j.dai@intel.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2023-07-09 16:56:58 -04:00
Andreas Rheinhardt 59c9dc82f4 avformat/avformat: Move AVOutputFormat internals out of public header
This commit does for AVOutputFormat what commit
20f9727018 did for AVCodec:
It adds a new type FFOutputFormat, moves all the internals
of AVOutputFormat to it and adds a now reduced AVOutputFormat
as first member.

This does not affect/improve extensibility of both public
or private fields for muxers (it is still a mess due to lavd).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2023-02-09 15:24:15 +01:00
Andreas Rheinhardt 7547f13548 avformat/utils: Move ff_stream_add_bitstream_filter to mux.c
It is muxing-only; in fact, it should be considered part of
the core muxing code.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-10 07:27:36 +02:00
Andreas Rheinhardt bc70684e74 avformat: Constify all muxer/demuxers
This is possible now that the next-API is gone.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 11:48:06 -03:00
Ronald S. Bultje d29ec02d48 ivfenc: write duration for frame_cnt=1. 2021-03-03 07:22:02 -05:00
James Almer 2932905255 avformat/ivfenc: move bsf insertion to the init function
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2020-05-11 19:41:59 -03:00
James Almer 8e12f09a25 avformat/ivfenc: add an AVOutputFormat.init() function
Signed-off-by: James Almer <jamrial@gmail.com>
2020-05-11 19:40:40 -03:00
Andreas Rheinhardt 7b79c59fba avformat/ivfenc: Don't use size_t for size of file
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-28 19:40:05 +01:00
Raphaël Zumer d3807467b2 avformat/ivfenc: Change the length fields to 32 bits
There is no change in the encoded bitstream, but this
ensures that the written field length is consistent
with the reference implementation.

Unused bytes are zeroed out for backwards compatibility.

Signed-off-by: Raphaël Zumer <rzumer@tebako.net>
2019-10-08 21:44:41 -04:00
Raphaël Zumer eeb1c515a8 avformat/ivfenc: Comment the length field encoding process
Signed-off-by: Raphaël Zumer <rzumer@tebako.net>
2019-10-08 21:44:36 -04:00
James Almer 2d2af23349 avformat/ivfenc: use the av1_metadata bsf to insert Temporal Delimiter OBUs if needed
Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-11-01 22:55:22 -03:00
James Almer e50cb8b2f4 avformat/ivfenc: fix writing codec tag
The value in AVCodecParameters->codec_tag may not be correct for IVF,
as it's the case when remuxing AV1 streams from mp4, so ignore it and
write the correct value based on codec ID instead.

Reviewed-by: Jan Ekström <jeebjp@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-09-24 16:15:30 -03:00
James Almer cbd5e737fe Merge commit '44a1731011e87fbf4180d026aefb8bfe85d8c7dc'
* commit '44a1731011e87fbf4180d026aefb8bfe85d8c7dc':
  ivf: Support VP9 and AV1 as well

See e8f0a463b0

Merged-by: James Almer <jamrial@gmail.com>
2018-03-28 15:46:59 -03:00
Luca Barbato 44a1731011 ivf: Support VP9 and AV1 as well 2018-03-12 08:12:43 +01:00
Tristan Matthews e8f0a463b0 ivfenc: add AV1 support
libaom tools work with ivf files.
2017-12-13 15:10:07 +00:00
James Almer 4de591e6fb Merge commit '83548fe894cdb455cc127f754d09905b6d23c173'
* commit '83548fe894cdb455cc127f754d09905b6d23c173':
  lavf: fix usage of AVIOContext.seekable

Merged-by: James Almer <jamrial@gmail.com>
2017-03-21 17:02:30 -03:00
Alex Converse 09317e3e06 ivfenc: Add VPX codec tags.
This fixes remuxing VPX from MP4 without manually overwriting the tag.
2016-09-10 16:40:47 -07:00
Derek Buitenhuis 6f69f7a8bf Merge commit '9200514ad8717c63f82101dc394f4378854325bf'
* commit '9200514ad8717c63f82101dc394f4378854325bf':
  lavf: replace AVStream.codec with AVStream.codecpar

This has been a HUGE effort from:
    - Derek Buitenhuis <derek.buitenhuis@gmail.com>
    - Hendrik Leppkes <h.leppkes@gmail.com>
    - wm4 <nfxjfg@googlemail.com>
    - Clément Bœsch <clement@stupeflix.com>
    - James Almer <jamrial@gmail.com>
    - Michael Niedermayer <michael@niedermayer.cc>
    - Rostislav Pehlivanov <atomnuker@gmail.com>

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-10 20:59:55 +01:00
Ronald S. Bultje 2e6636aa87 vp9: add superframe merging bitstream filter.
Fixes ticket 4313.
2016-03-11 11:19:14 -05:00
Anton Khirnov 9200514ad8 lavf: replace AVStream.codec with AVStream.codecpar
Currently, AVStream contains an embedded AVCodecContext instance, which
is used by demuxers to export stream parameters to the caller and by
muxers to receive stream parameters from the caller. It is also used
internally as the codec context that is passed to parsers.

In addition, it is also widely used by the callers as the decoding (when
demuxer) or encoding (when muxing) context, though this has been
officially discouraged since Libav 11.

There are multiple important problems with this approach:
    - the fields in AVCodecContext are in general one of
        * stream parameters
        * codec options
        * codec state
      However, it's not clear which ones are which. It is consequently
      unclear which fields are a demuxer allowed to set or a muxer allowed to
      read. This leads to erratic behaviour depending on whether decoding or
      encoding is being performed or not (and whether it uses the AVStream
      embedded codec context).
    - various synchronization issues arising from the fact that the same
      context is used by several different APIs (muxers/demuxers,
      parsers, bitstream filters and encoders/decoders) simultaneously, with
      there being no clear rules for who can modify what and the different
      processes being typically delayed with respect to each other.
    - avformat_find_stream_info() making it necessary to support opening
      and closing a single codec context multiple times, thus
      complicating the semantics of freeing various allocated objects in the
      codec context.

Those problems are resolved by replacing the AVStream embedded codec
context with a newly added AVCodecParameters instance, which stores only
the stream parameters exported by the demuxers or read by the muxers.
2016-02-23 17:01:58 +01:00
Michael Niedermayer 5c8467a07c avformat/ivfenc: fix division by zero
Fixes Ticket 5115

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-08 23:27:10 +01:00
Ronald S. Bultje 3a18d3fa04 ivfenc: write duration at end-of-stream.
At the beginning, the value is not initialized.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-12 13:56:50 +02:00
Victor Anjin 2db24cf746 ivfenc: incorrect fourcc for VP9 video
VP80 fourcc are writed for all contexts (without ctx->codec_tag)
how to reproduce the issue:
1) Get any vp9 video (for example  http://base-n.de/webm/out9.webm)
2) ffmpeg  -i out9.webm -vcodec copy out9.ivf
3) out9.ivf have VP80 fourcc at ivf header
The proposed fix solves this issue

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-16 13:06:35 +02:00
James Zern dea377fcc0 ivfenc: support VP9
libvpx tools accept vp9 ivf files

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-03 15:46:26 +02:00
Clément Bœsch 7308439158 lavf: Don't explicitly flush after each written packet in muxers
Since 596e5d4783, this is not necessary anymore. It also allows to
actually disable the flushing, improving write performance (but
possibly giving worse latency in real-time streaming).

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-16 22:17:33 +03:00
Clément Bœsch 8de9bb6e5e lavf: remove some flushing in write_packet muxers callbacks.
Since 4f112a8e3, this is not necessary anymore. Also, it allows to
actually disable the flushing.
2013-04-14 21:16:53 +02:00
Michael Niedermayer 7a72695c05 Merge commit '36ef5369ee9b336febc2c270f8718cec4476cb85'
* commit '36ef5369ee9b336febc2c270f8718cec4476cb85':
  Replace all CODEC_ID_* with AV_CODEC_ID_*
  lavc: add AV prefix to codec ids.

Conflicts:
	doc/APIchanges
	doc/examples/decoding_encoding.c
	doc/examples/muxing.c
	ffmpeg.c
	ffprobe.c
	ffserver.c
	libavcodec/8svx.c
	libavcodec/avcodec.h
	libavcodec/dnxhd_parser.c
	libavcodec/dvdsubdec.c
	libavcodec/error_resilience.c
	libavcodec/h263dec.c
	libavcodec/libvorbisenc.c
	libavcodec/mjpeg_parser.c
	libavcodec/mjpegenc.c
	libavcodec/mpeg12.c
	libavcodec/mpeg4videodec.c
	libavcodec/mpegvideo.c
	libavcodec/mpegvideo_enc.c
	libavcodec/pcm.c
	libavcodec/r210dec.c
	libavcodec/utils.c
	libavcodec/v210dec.c
	libavcodec/version.h
	libavdevice/alsa-audio-dec.c
	libavdevice/bktr.c
	libavdevice/v4l2.c
	libavformat/asfdec.c
	libavformat/asfenc.c
	libavformat/avformat.h
	libavformat/avidec.c
	libavformat/caf.c
	libavformat/electronicarts.c
	libavformat/flacdec.c
	libavformat/flvdec.c
	libavformat/flvenc.c
	libavformat/framecrcenc.c
	libavformat/img2.c
	libavformat/img2dec.c
	libavformat/img2enc.c
	libavformat/ipmovie.c
	libavformat/isom.c
	libavformat/matroska.c
	libavformat/matroskadec.c
	libavformat/matroskaenc.c
	libavformat/mov.c
	libavformat/movenc.c
	libavformat/mp3dec.c
	libavformat/mpeg.c
	libavformat/mpegts.c
	libavformat/mxf.c
	libavformat/mxfdec.c
	libavformat/mxfenc.c
	libavformat/nsvdec.c
	libavformat/nut.c
	libavformat/oggenc.c
	libavformat/pmpdec.c
	libavformat/rawdec.c
	libavformat/rawenc.c
	libavformat/riff.c
	libavformat/sdp.c
	libavformat/utils.c
	libavformat/vocenc.c
	libavformat/wtv.c
	libavformat/xmv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-08-07 22:45:46 +02:00
Anton Khirnov 36ef5369ee Replace all CODEC_ID_* with AV_CODEC_ID_* 2012-08-07 16:00:24 +02:00
Michael Niedermayer 2e0c360abd Merge remote-tracking branch 'qatar/master'
* qatar/master:
  cosmetics: Align muxer/demuxer declarations
  mpeg12: Do not change frame_pred_frame_dct flag and demote error into a warning
  avcodec: remove avcodec_guess_channel_layout()
  avutil: Add av_get_default_channel_layout()

Conflicts:
	doc/APIchanges
	libavcodec/mpeg12.c
	libavformat/cdg.c
	libavformat/matroskaenc.c
	libavformat/mpegts.c
	libavformat/nuv.c
	libavformat/wav.c
	libavutil/audioconvert.c
	libavutil/audioconvert.h
	libavutil/avutil.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-04-06 22:52:01 +02:00
Martin Storsjö 20234a4bd7 cosmetics: Align muxer/demuxer declarations
Also add missing trailing commas, break long codec_tag lines and
add spaces in codec_tag declarations.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-04-06 19:19:59 +03:00
Mans Rullgard 2912e87a6c Replace FFmpeg with Libav in licence headers
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-19 13:33:20 +00:00
Anton Khirnov b7f2fdde74 avio: rename put_flush_packet -> avio_flush
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-03-16 22:59:39 -04:00
Anton Khirnov 77eb5504d3 avio: avio: avio_ prefixes for put_* functions
In the name of consistency:
put_byte           -> avio_w8
put_<type>         -> avio_w<type>
put_buffer         -> avio_write

put_nbyte will be made private
put_tag will be merged with avio_put_str

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-02-21 14:25:15 -05:00
Anton Khirnov ae628ec1fd avio: rename ByteIOContext to AVIOContext.
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-02-20 08:37:15 -05:00
Anton Khirnov b2ed95ec48 Replace remaining occurrences of CODEC_TYPE_* with AVMEDIA_TYPE*
Tested to compile with lavc major bump.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-02-03 13:37:09 +00:00
Diego Elio Pettenò c6610a216e Prefix all _demuxer, _muxer, _protocol from libavformat and libavdevice.
This also lists the objects from those two libraries as internal (by adding
the ff_ prefix) so that they can then be hidden via linker scripts.
2011-01-26 22:10:09 +00:00
Reimar Döffinger 326851b9bc Add muxer for IVF format. 2011-01-17 21:11:51 +01:00