1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00
Commit Graph

1062 Commits

Author SHA1 Message Date
Paul B Mahol
d9a91d58a1 avformat/movenc: treat ALAC same as FLAC and write correct info
Fixes #7291.
2018-12-14 12:11:57 +01:00
kjeyapal@akamai.com
1d01ab399f avformat/movenc: Added an option to disable SIDX atom 2018-12-11 10:52:16 +05:30
Paul B Mahol
97d1ee437b avformat/movenc: get number of written bytes from bitstream writer
Update fate test.
2018-11-22 21:32:41 +01:00
Paul B Mahol
027f032bbc avformat/movenc: fix size calculation in mov_write_eac3_tag()
Otherwise it would assert when flushing bits.
2018-11-22 10:18:15 +01:00
Michael Niedermayer
52e62b0585 avformat/movenc: Remove unneeded variable from mov_find_codec_tag()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-10-07 03:03:09 +02:00
James Almer
edafb9f529 avformat/movenc: remove experimental checks for AV1 streams
The spec has been finalized.

Signed-off-by: James Almer <jamrial@gmail.com>
2018-09-09 17:26:09 -03:00
John Stebbins
4cfb01d6ae lavf/movenc: Fail when codec tag is invalid for format
Fixes ticket #6897

Signed-off-by: James Almer <jamrial@gmail.com>
2018-09-08 19:08:36 -03:00
John Stebbins
981178f3b0 lavf/movenc: Add GoPro metadata to permitted mp4 "codecs"
Signed-off-by: James Almer <jamrial@gmail.com>
2018-09-08 19:08:35 -03:00
Jan Ekström
1931761f18 avformat/movenc: implicitly enable negative CTS offsets for ismv
ISMV lacks any sort of edit list support, as well as tfxd is
effectively the PTS of the fragment for most intents and purposes.

Thus, if b-frames are requested without negative CTS offsets you
end up with N frames' worth of delay (tfxd PTS plus the CTS offset
of the first sample). Negative CTS offsets enable the first sample
to have CTS=DTS, and thus a/v desync due to b-frame reorder delay
is avoided.
2018-08-24 21:00:05 +03:00
James Almer
7890181d7e avformat/movenc: support Opus packets with more than 60ms of audio when writing the Sample Group Description
Since libopus 1.2, packets of sizes 80ms, 100ms and 120ms are allowed.

Fixes assertion failures when trying to mux such streams.

Signed-off-by: James Almer <jamrial@gmail.com>
2018-08-24 13:21:10 -03:00
James Almer
8d5604a69a avformat/av1: update ff_isom_write_av1c() to the latest revision of the spec
This will get ISOBMFF and Matroska up to date with the revised AV1 Codec
Configuration Box spec.
For now keep propagating raw OBUs as extradata until all libavcodec modules
are adapted to handle AV1CodecConfigurationRecord formatted extradata.

Tested-by: Thomas Daede <bztdlinux@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-08-17 15:09:02 -03:00
James Almer
9888a19db4 avformat/movenc: add support for AV1 streams
Signed-off-by: James Almer <jamrial@gmail.com>
2018-07-20 12:00:32 -03:00
Gyan Doshi
28ed68fa31 avformat/movenc: add reason for minf->hdlr in MOV only 2018-07-14 12:03:50 +05:30
Michael Niedermayer
fa19fbcf71 avformat/movenc: Write version 2 of audio atom if channels is not known
The version 1 needs the channel count and would divide by 0
Fixes: division by 0
Fixes: fpe_movenc.c_1108_1.ogg
Fixes: fpe_movenc.c_1108_2.ogg
Fixes: fpe_movenc.c_1108_3.wav

Found-by: #CHEN HONGXU# <HCHEN017@e.ntu.edu.sg>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-07-09 23:10:39 +02:00
Michael Niedermayer
3a2d21bc5f avformat/movenc: Check input sample count
Fixes: division by 0
Fixes: fpe_movenc.c_199_1.wav
Fixes: fpe_movenc.c_199_2.wav
Fixes: fpe_movenc.c_199_3.wav
Fixes: fpe_movenc.c_199_4.wav
Fixes: fpe_movenc.c_199_5.wav
Fixes: fpe_movenc.c_199_6.wav
Fixes: fpe_movenc.c_199_7.wav

Found-by: #CHEN HONGXU# <HCHEN017@e.ntu.edu.sg>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-07-08 00:55:49 +02:00
Michael Niedermayer
872ea3dfe5 avformat/movenc: Use mov->fc consistently for av_log()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-06-28 21:35:01 +02:00
Michael Niedermayer
95556e27e2 avformat/movenc: Do not pass AVCodecParameters in avpriv_request_sample
Fixes: out of array read
Fixes: ffmpeg_crash_8.avi

Found-by: Thuan Pham, Marcel Böhme, Andrew Santosa and Alexandru Razvan Caciulescu with AFLSmart
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-06-28 21:35:01 +02:00
Michael Niedermayer
ed22dc2221 avformat/movenc: Check that frame_types other than EAC3_FRAME_TYPE_INDEPENDENT have a supported substream id
Fixes: out of array access
Fixes: ffmpeg_bof_1.avi

Found-by: Thuan Pham, Marcel Böhme, Andrew Santosa and Alexandru Razvan Caciulescu with AFLSmart
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-06-28 21:35:01 +02:00
Gyan Doshi
deb9a04d54 avformat/movenc: allow hdlr name field to be empty
Both QTFF and the ISOBMFF standards allow it.

Fixes #7262
2018-06-21 11:33:00 +05:30
Gyan Doshi
830695be36 avformat/movenc: read track title from correct key
da9cc22d5b allowed the MOV muxer to relay a custom stream handler name,
whether populated from the input stream or user-set. However, the entry
key didn't match the key set by the MOV demuxer, so it wasn't
effective. Fixed.

Due to the change, four FATE refs have to be updated. Verified that the
target payload of the tests hasn't changed in terms of CRC.
2018-06-19 11:05:57 +05:30
Timo Teräs
2223811b01 avformat/movenc: fix recognization of cover image streams
For chapter images, the mov demux produces streams with disposition set
to attached_pic+timed_thumbnails. This patch fixes to properly recognize
streams that should be encoded as cover image (ones with only and only
attached_pic disposition set).

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-06-13 16:46:40 +02:00
Timo Teräs
12205d2c89 avformat/movenc: properly handle cover image codecs
Find codec tag for attached images using appropriate list of
supported image formats.

This fixes writing the cover image to m4v/m4a and other container
formats that do not allow these codecs as a track.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-06-13 16:46:40 +02:00
Vishwanath Dixit
5717cd80dc avformat/movenc: creating producer reference time (PRFT) box
The producer reference time box supplies relative wall-clock times
at which movie fragments, or files containing movie fragments
(such as segments) were produced.
The box is mainly useful in live streaming use cases. A media player
can parse the box and utilize the time fields to measure and improve
the latency during real time playout.
2018-05-29 09:32:11 +05:30
Timo Teräs
9af71b326f avformat/movenc: support writing iTunes cover image
Fixes https://trac.ffmpeg.org/ticket/2798

This makes movenc handle AV_DISPOSITION_ATTACHED_PIC and write
the associated pictures in iTunes cover atom. This corresponds
to how 'mov' demuxer parses and exposes the cover images when
reading.

Most of the existing track handling loops properly ignore
these 'virtual streams' as MOVTrack->entry is never incremented
for them. However, additional tests are added as needed to ignore
them.

Tested to produce valid output with:
  ffmpeg -i movie.mp4 -i thumb.jpg -disposition✌️1 attached_pic \
         -map 0 -map 1 -c copy movie-with-cover.mp4

The cover image is also copied correctly with:
  ffmpeg -i movie-with-cover.mp4 -map 0 -c copy out.mp4

AtomicParseley says that the attached_pic stream is properly
not visible in the main tracks of the file.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
2018-04-17 20:11:34 +01:00
James Almer
62bdbb5ce0 avformat/movenc: forbid muxing AV1 streams until the spec is finished
This prevents creating potentially broken files, as both the AV1 and
the AV1 in ISOMBFF specs are unfinished.

Signed-off-by: James Almer <jamrial@gmail.com>
2018-04-16 10:20:46 -03:00
Timo Teräs
62c1cfcc35 avformat/movenc: use correct iTunes copyright atom
Support for writing copyright metadata was added in commit bed4fc54c9
for 3GP, MOV and iTunes metadata. 3GP and MOV cases are formally
specified. However, iTunes format does not have specification, and
it seems to have been assumed that it would use the same atom as
MOV (both being Apple formats).

However, Apple uses 'cprt' atom for iTunes metadata (do note that
the iTunes 'cprt' encoding is generic iTunes ItemList atom, not
the 3GP 'cprt' encoding. These are also inside different parent
atoms).

Most references trying to document iTunes atoms mention only
the 'cprt' tag. See:
 - http://atomicparsley.sourceforge.net/mpeg-4files.html
 - http://mutagen.readthedocs.io/en/latest/api/mp4.html

Same applies to other software supporting this tag. Most of them
encode and decode only the 'cprt' atom.

ffmpeg mov demuxer supports both atoms in this context. There are
few pieces of other software that support similarly both 'cprt' and
the incorrect '\251cpy' atom in this context. I believe they do it in
order to read the ffmpeg encoded incorrect copyright atom.

In light of the above this changes the copyright atom to 'cprt' as
it seems to be supported univerally and is the correct atom to use.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-11 02:42:41 +02:00
Timo Teräs
53688b62ca avformat/movenc: add rtp_hinting_needed() helper function
This is shared test and this simplifies code a bit. Follow up
commit will have additional tests for this function.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-04 19:09:28 +02:00
Courtland Idstrom
65616bc191 lavf/movenc: write track title metadata for mov files
Track title (atom 'name') is a well defined user data atom for mov files. Existing code (for mp4) only writes title metadata if present.

Relevant reference docs:

  https://developer.apple.com/library/content/documentation/QuickTime/Reference/QTRef_AtomsResources/Content/QTRef_AtomsResources4.html#//apple_ref/doc/uid/TP40004285-DontLinkChapterID_1--udta-
  https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-63839
2018-03-22 20:59:16 +02:00
James Almer
935a9986fc avformat/movenc: move the concatenated eac3 packet reference
Simplifies code.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-03-15 20:37:33 -03:00
Vishwanath Dixit
a877d22d9a avformat/movenc: addition of flag to fragment at every frame
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-20 15:27:51 +01:00
James Almer
f7aacf4ab7 avformat/mov: add VP8 codec support
Demuxing only. Muxing is disabled as altref frame handling is not
defined in the spec, and there's no way to know the presence of
such frames during stream initialization.

Based on a patch by Steven Liu.

Fixes ticket #7000

Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-02-06 23:08:42 -03:00
Marton Balint
18ac642359 avformat: migrate to AVFormatContext->url
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-01-28 23:06:43 +01:00
Steven Robertson
2d131fc31b avformat/movenc: Add support for more colorspaces
With FCPX 10.4, Apple has expanded the set of colorspace, primaries,
and trc flags officially supported in QuickTime files. The expanded set
matches the codepoints used in ffmpeg and many other specs.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-12-15 00:08:56 +01:00
John Stebbins
00d454ed2c lavf/movenc: add sdtp (sample dependency) box
The sdtp is required by the AppleTV 4K in order to play 2160p60 video.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-12-02 19:14:34 +01:00
Dave Rice
8f4702a93f avformat/movenc: write clap atom for uncompressed yuv in mov
fixes 6145

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-11-20 02:40:45 +01:00
Dave Rice
1e5f923416 avformat/movenc: correct ImageDescription for uncompressed ycbcr
Per
https://developer.apple.com/library/content/technotes/tn2162/_index.html

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-11-20 02:40:45 +01:00
John Stebbins
ac922f942f lavf/movenc: allow writing avc3 sample entry type
The avc3 sample entry type is useful for adaptive streaming.  It permits
parameter sets to be written inline in the video stream.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-11-16 23:26:36 +01:00
James Almer
502050cb4c avformat/movenc: let avpriv_ac3_parse_header() allocate the AC3HeaderInfo struct
This removes sizeof(AC3HeaderInfo) from the ABI.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-11-01 11:55:13 -03:00
Lukas Stabe
d3f1b0d3d8 movenc: add m4b to ipod format extensions
m4b is commonly used as extension for m4a audiobook files.
The format is exactly the same. The only thing that differs
is the extension.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-10-30 01:09:40 +01:00
James Almer
e0250cf365 Merge commit '50a1c66cf6ab7eb683daaa9e2da3869fa3a54609'
* commit '50a1c66cf6ab7eb683daaa9e2da3869fa3a54609':
  ac3_parser: add a public function for parsing the data required by the demuxer

avpriv_ac3_parse_header() is left in place but without the
GetBitContext parameter, as the mov muxer requires a lot more fields
than just bitstream_id and frame_size from the AC3HeaderInfo struct.

Merged-by: James Almer <jamrial@gmail.com>
2017-10-27 18:15:37 -03:00
Jan Ekström
ffc58b2ce2 movenc: take packet dts shifting into mention in check_pkt
This FFmpeg-specific "fuzzer fix" was never perfect, but now it
stopped encoding of actual content with a big enough DTS shift.
This returns the function to its original state of results
before negative CTS offsets were added.

I remember dealing with this function before, but somehow had
forgotten about it during VDD. The test cases not tripping this
over also didn't help.
2017-10-04 13:09:29 +02:00
Martin Storsjö
07e4be7ec9 movenc: Add an option for enabling negative CTS offsets
This reduces the need for an edit list; streams that start with
e.g. dts=-1, pts=0 can be encoded as dts=0, pts=0 (which is valid
in mov/mp4) by shifting the dts values of all packets forward.
This avoids the need for edit lists for such streams (while they
still are needed for audio streams with encoder delay).

This eases conformance with the DASH-IF interoperability guidelines.

Signed-off-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-09-28 18:15:45 +02:00
James Almer
a447b75de8 avformat: replace all uses of av_copy_packet()
Signed-off-by: James Almer <jamrial@gmail.com>
2017-09-25 21:26:38 -03:00
James Almer
c100330a8f avformat/movenc: reindent after the previous commit 2017-08-09 23:15:38 -03:00
Sasi Inguva
e7e1fbc49b lavf/movenc.c: Set sgpd and sbgp atoms to represent decoder delay for AAC.
According to https://developer.apple.com/library/content/documentation/QuickTime/QTFF/QTFFAppenG/QTFFAppenG.html and ISO-IEC-14496-12 Section 10.1.1.1 and 10.1.1.3

Signed-off-by: Sasi Inguva <isasi@google.com>
Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-08-10 02:43:53 +02:00
Clément Bœsch
850a45aef1 lavf/movenc: support GPMF track (gpmd) remuxing
See https://github.com/gopro/gpmf-parser for more information on the
data stream itself.
2017-07-24 14:43:40 +02:00
Kieran O'Leary
264f6c6f95 movenc: Add 'keywords' metadata
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2017-07-13 13:34:01 +01:00
John Stebbins
369a3e111c movenc: allow alternative hvc1 h.265 codec tag
If AVCodecParameters.codec_tag is 'hvc1' use it instead of 'hev1' for
h.265 streams. QuickTime (and other Apple software) requires 'hvc1'.

(cherry picked from commit 84ab1cc437)
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2017-07-05 15:55:25 -04:00
John Stebbins
974d508e57 movenc: write correct format hvcc when tag is hvc1
(cherry picked from commit 1ea9b7fdf9)
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2017-07-05 15:55:25 -04:00
John Stebbins
38d808d72e movenc: move tags definitions to where they are used
(cherry picked from commit 1c64bae648)
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2017-07-05 15:55:25 -04:00