Commit Graph

1030 Commits

Author SHA1 Message Date
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
John Stebbins e199d90da6 movenc: simplify codec_tag lookup
mux.c init_muxer() already sets codec_tag correctly in the cases
simplified here.

This also adds the capability to support alternative tags for the
same codec_id.

(cherry picked from commit f6f86f432f)
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2017-07-05 15:55:25 -04:00
John Stebbins 95f3c85976 movenc: use correct tag list for AVOutputFormat.codec_tag
ff_mp4_obj_type contains the wrong type of tags for
AVOutputFormat.codec_tag. AVOutputFormat.codec_tag is used to
validate AVCodecParameters.codec_tag so needs to be the same
type of tag.

Creates new tag lists for mp4 and ismv.  New tag lists support
same list of codecs found in ff_mp4_obj_type. psp uses the same
tag list as mp4 since these both use mp4_get_codec_tag to look up tags.

(cherry picked from commit 713efb2c0d)
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2017-07-04 15:49:34 -04:00
erankor 15bd309af8 movenc: encryption with time code track fix
instead of deciding whether to encrypt based on the encryption scheme,
decide according to whether cenc was initialized or not.
mov_create_timecode_track calls ff_mov_write_packet with a track that
doesn't have cenc initialized.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-28 03:05:59 +02:00
James Almer f8c73e8753 avformat/movenc: always check for new extradata on a packet
Don't just look at zero sized packets, and also check for AAC extradata
updates, in preparation for the following patches.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-05-24 20:27:59 -03:00
James Almer 5ff31babfc avformat/movenc: remove experimental check for VP9 streams
The muxer has been updated and is now complaint with the v1.0 of the spec.
2017-05-17 20:52:50 -03:00
Hendrik Leppkes 64ad44a381 movenc/isom: update vpcC box to version 1.0 of the specification
This brings our generation of the vpcC box up to date to version 1.0
of the VP Codec ISO Media File Format Binding.

Specifically, color/transfer properties are now written with values
based on ISO/IEC 23001-8, which is the same reference specification the
AVColor* enumerations are based on.
2017-05-16 01:53:05 +02:00
Lucas Cooper 77bc507f6f avformat/movenc: Explicitly address potential division by zero.
find_fps attempts to infer framerate from AVCodec's timebase. When this
results in a frame rate that isn't explicitly marked as supported in
av_timecode_check_frame_rate, find_fps returns the AVStream's
avg_frame_rate, which, per avformat.h, _may_ be set (or not).

mov_get_mpeg2_xdcam_codec_tag, mov_get_h264_codec_tag and
find_compressor attempt to call av_q2d on the return value of find_fps,
which in the above case, may result in division by zero and therefore,
an undefined frame rate when NaN is converted to int.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-04-29 03:54:31 +02:00
Matthew Gregan b905ba5bc1 avformat/movenc: Fix potential leak of sgpd_entries array.
Signed-off-by: Matthew Gregan <kinetik@flim.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-04-12 23:12:06 +02:00
Michael Niedermayer 6268f2ca7b avformat/movenc: Fix mix of declaration and statement
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-04-11 23:38:38 +02:00
Matthew Gregan 0c4d208296 avformat/movenc: Add experimental muxing support for Opus in ISO BMFF (MP4).
Based on the draft spec at http://vfrmaniac.fushizen.eu/contents/opus_in_isobmff.html

'-strict -2' is required to create files in this format.

Signed-off-by: Matthew Gregan <kinetik@flim.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-04-11 21:28:44 +02:00
James Almer d36a3f5a78 avformat/movenc: auto insert vp9_superframe bsf when needed
Experimental VP9 support was added to the muxer recently.

Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-04-10 10:26:44 -03:00
Clément Bœsch 549045254c Fix all -Wformat warnings raised by DJGPP 2017-03-29 14:49:29 +02:00
Clément Bœsch cd4d6cba12 lavf: fix usages of av_get_codec_tag_string() 2017-03-29 14:49:29 +02:00
James Almer 86dee47e39 avformat/movenc: allow st3d and sv3d mov atoms to be written in strict unofficial mode
They are unofficial extensions to the format for the time being, not
an experimental feature.
2017-03-27 18:54:42 -03:00
James Almer a715e5a276 avformat/movenc: restrict st3d and sv3d mov atoms to MODE_MP4 2017-03-27 18:53:52 -03:00
Aaron Colwell b4189590a5 movenc: Add support for writing st3d and sv3d boxes.
Signed-off-by: James Almer <jamrial@gmail.com>
2017-03-27 18:53:52 -03:00
wm4 ddef3d902f avformat, ffmpeg: deprecate old rotation API
The old "API" that signaled rotation as a metadata value has been
replaced by DISPLAYMATRIX side data quite a while ago.

There is no reason to make muxers/demuxers/API users support both. In
addition, the metadata API is dangerous, as user tags could "leak" into
it, creating unintended features or bugs.

ffmpeg CLI has to be updated to use the new API. In particular, we must
not allow to leak the "rotate" tag into the muxer. Some muxers will
catch this properly (like mov), but others (like mkv) can add it as
generic tag. Note applications, which use libavformat and assume the
old rotate API, will interpret such "rotate" user tags as rotate
metadata (which it is not), and incorrectly rotate the video.

The ffmpeg/ffplay tools drop the use of the old API for muxing and
demuxing, as all muxers/demuxers support the new API. This will mean
that the tools will not mistakenly interpret per-track "rotate" user
tags as rotate metadata. It will _not_ be treated as regression.

Unfortunately, hacks have been added, that allow the user to override
rotation by setting metadata explicitly, e.g. via

  -metadata:s:v:0 rotate=0

See references to trac #4560. fate-filter-meta-4560-rotate0 tests this.
It's easier to adjust the hack for supporting it than arguing for its
removal, so ffmpeg CLI now explicitly catches this case, and essentially
replaces the "rotate" value with a display matrix side data. (It would
be easier for both user and implementation to create an explicit option
for rotation.)

When the code under FF_API_OLD_ROTATE_API is disabled, one FATE
reference file has to be updated (because "rotate" is not exported
anymore).

Tested-by: Michael Niedermayer <michael@niedermayer.cc>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-27 13:20:27 +02: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
Jan Ekström 763e823754 movenc: add support for track names in ISML manifests
This enables having multiple tracks of the same type which would
be treated as different things by the media server (as opposed to
different bit rate versions of the same track). According to the
smooth streaming specification, just setting the systemLanguage
tag is not enough to note that a track with the same attributes
differs from another one.

Reviewed-by: Martin
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-12 20:18:32 +01:00
Carl Eugen Hoyos 74c576957a lavf/movenc: Remove two unused variables. 2017-02-10 12:40:43 +01:00
Diego Biurrun a25dac976a Use bitstream_init8() where appropriate 2017-02-07 18:27:21 +01:00
Anton Khirnov fd9212f2ed Mark some arrays that never change as const. 2017-02-01 10:42:59 +01:00
Alexandra Hájková a895292f27 mov: Convert to the new bitstream reader 2017-01-13 10:27:03 +01:00
Diego Biurrun 0b77a59336 Use correct printf conversion specifiers for POSIX integer types 2016-12-23 19:30:00 +01:00
Matthew Gregan 156fbbb562 avformat/movenc: Restrict experimental VP9 support to MODE_MP4.
Signed-off-by: Matthew Gregan <kinetik@flim.org>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-21 16:07:14 -03:00
Matthew Gregan 7dc4200c38 Add experimental muxing support for FLAC in ISO BMFF (MP4).
Based on the draft spec at https://git.xiph.org/?p=flac.git;a=blob;f=doc/isoflac.txt

'-strict experimental' is required to create files in this format.

Signed-off-by: Matthew Gregan <kinetik@flim.org>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-11-21 15:36:42 -03:00
Michael Niedermayer 709c87109d avformat/movenc: Check frame rate before use.
Fixes division by 0
This is similar to how avg_frame_rate is checked elsewhere
Fixes: 6d24add0455f41b1b45b7ba615cd46f3/asan_generic_dc34c3_5480_0a2ef411cae999b9871ed71a2e481b71.mov

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-11-17 19:03:41 +01:00
Hendrik Leppkes 4a485daa7f Merge commit '4f7723cb3b913c577842a5bb088c804ddacac8df'
* commit '4f7723cb3b913c577842a5bb088c804ddacac8df':
  movenc: Add an option for skipping writing the mfra/tfra/mfro trailer

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-11-17 14:54:51 +01:00
Hendrik Leppkes 8fad4b4e25 Merge commit '785c25443b56adb6dbbb78d68cccbd9bd4a42e05'
* commit '785c25443b56adb6dbbb78d68cccbd9bd4a42e05':
  movenc: Apply offsets on timestamps when peeking into interleaving queues

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-11-13 22:57:02 +01:00
Carl Eugen Hoyos 222f59afd1 lavf/movenc: Do not print an error when muxing gray8 rawvideo.
This was fixed in 9a27780821
2016-11-05 00:43:31 +01:00
Rodger Combs 42cb050a05
lavf/movenc+dashenc: add automatic bitstream filtering
This is disabled by default when the empty_moov flag is enabled
2016-10-24 03:53:23 -05:00
Rodger Combs e83d5d7e58
lavf/movenc: add deinit function 2016-10-24 03:53:22 -05:00