Commit Graph

916 Commits

Author SHA1 Message Date
Michael Niedermayer 6e249466cc avformat/movenc: Check that pkt duration is within 32bit range
Durations outside are not supported

Fixes Ticket5114
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-09 03:38:03 +01:00
Michael Niedermayer 389ce22b5f avformat/movenc: Use strict_std_compliance from the muxer layer instead of the encoder layer
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-12-30 20:06:04 +01:00
Hendrik Leppkes f95385dd58 Merge commit '5845a8273e4694e0254ad728970b82bb64fd8bc0'
* commit '5845a8273e4694e0254ad728970b82bb64fd8bc0':
  movenc: use the CPB props side data

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-12-17 13:50:36 +01:00
erankor 4469e8ebb2 movenc: support cenc (common encryption)
support writing encrypted mp4 using aes-ctr, conforming to ISO/IEC
23001-7.

3 new parameters were added:
- encryption_scheme - allowed values are none (default) and cenc-aes-ctr
- encryption_key - 128 bit encryption key (hex)
- encryption_kid - 128 bit encryption key identifier (hex)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-15 14:16:28 +01:00
Anton Khirnov 5845a8273e movenc: use the CPB props side data
Do not access the encoder options, since it makes no sense when the
AVStream codec context is not the encoding context.
2015-12-06 10:26:01 +01:00
Clément Bœsch 43ecec0f03 avformat: use AV_OPT_TYPE_BOOL in a bunch of places 2015-12-04 15:43:33 +01:00
Yann Coupin d89c4846e0 avformat/movenc: HE-AAC correct FourCC in ISML
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-04 03:52:25 +01:00
Derek Buitenhuis 64db3639af Merge commit 'ca489564ae150bc41764f175b88151d883e69ae0'
* commit 'ca489564ae150bc41764f175b88151d883e69ae0':
  movenc: add fallback audio track tref support

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2015-11-22 17:41:51 +00:00
Derek Buitenhuis 3e0daf0716 Merge commit 'bef3b1f59f036aba4a5fe599b2480f6bd9e6b280'
* commit 'bef3b1f59f036aba4a5fe599b2480f6bd9e6b280':
  movenc: Allow setting start_dts/start_cts before writing actual packets

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2015-11-18 16:40:16 +00:00
John Stebbins ca489564ae movenc: add fallback audio track tref support
This feature allows making associations between audio tracks
that apple players recognize.  E.g. when an ac3 track has a
tref that points to an aac track, devices that don't support
ac3 will automatically fall back to the aac track.

Apple used to *guess* these associations, but new products
(AppleTV 4) no longer guess and this association can only
be made explicitly now using the "fall" tref.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2015-11-18 11:38:03 +01:00
Derek Buitenhuis 6c9fb32ae4 Merge commit '09e431b9e3674804172e7b0a0f865b65ec09739a'
* commit '09e431b9e3674804172e7b0a0f865b65ec09739a':
  movenc: Assume streams starting at pts=0 for discontinuous fragments with editlists

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2015-11-17 14:55:22 +00:00
Martin Storsjö bef3b1f59f movenc: Allow setting start_dts/start_cts before writing actual packets
By writing a zero-sized packet, the caller can communicate the
start_dts/start_cts for the stream without actually writing
the first packet.

This allows doing random-access writing of fragments when the
start dts of the stream isn't zero, so that the edit list in the moov
is written based on timestamps from the nominal start time signaled
via the zero-sized packet, while the first proper packet written
corresponds to a later fragment.

To avoid potential unexpected behaviour, empty packets only set
start_dts if the frag_discont flag is set.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-11-11 22:53:31 +02:00
Martin Storsjö 09e431b9e3 movenc: Assume streams starting at pts=0 for discontinuous fragments with editlists
This allows producing fragments discontinously where the video
stream has b-frames (but starts at pts=0), but doesn't work for the
cases with audio with preroll.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-11-11 22:52:36 +02:00
Hendrik Leppkes 9ffc61b125 Merge commit '8ad5124b7ecf7f727724e270a7b4bb8c7bcbf6a4'
* commit '8ad5124b7ecf7f727724e270a7b4bb8c7bcbf6a4':
  movenc: Automatically flush after writing the initial moov

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-11-11 15:03:36 +01:00
Martin Storsjö 8ad5124b7e movenc: Automatically flush after writing the initial moov
In most other cases when writing fragmented mp4 files, the output
IO context is flushed after each fragment. Also flush it after
writing the initial moov, to have it behave in the same way.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-11-10 21:46:03 +02:00
Hendrik Leppkes c2f861ca42 Replace remaining occurances of av_free_packet with av_packet_unref 2015-10-27 14:35:30 +01:00
Hendrik Leppkes 368e521646 Merge commit '5ea5a24eb70646a9061b85af407fcbb5dd4f89fd'
* commit '5ea5a24eb70646a9061b85af407fcbb5dd4f89fd':
  movenc: Honor flush requests with delay_moov, when some tracks lack samples

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-10-27 12:46:21 +01:00
Martin Storsjö 5ea5a24eb7 movenc: Honor flush requests with delay_moov, when some tracks lack samples
This also makes sure that a fragmented file without the empty_moov
flag (i.e. with a non-empty initial moov fragment) actually gets
written, if some of the tracks turn out to not have any samples.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-10-23 10:37:49 +03:00
Andreas Cadhalpun 957f92729a avcodec: drop 2 suffix from avpriv_ac3_parse_header2
avpriv_ac3_parse_header was removed in commit 3dfb643.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2015-10-22 00:34:54 +02:00
Hendrik Leppkes b01891a9f0 Merge commit '948f3c19a8bd069768ca411212aaf8c1ed96b10d'
* commit '948f3c19a8bd069768ca411212aaf8c1ed96b10d':
  lavc: Make AVPacket.duration int64, and deprecate convergence_duration

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-09-29 15:22:52 +02:00
Michael Niedermayer 7404f3bdb9 lavc: Switch bitrate to 64bit unless compatibility with avconv was requested. 2015-09-15 18:02:43 +02:00
Hendrik Leppkes 1907e19d0c Merge commit '26ac22e5e7394346e9d59f800e7d4e91f4518d33'
* commit '26ac22e5e7394346e9d59f800e7d4e91f4518d33':
  movenc: Add a new flag for writing global sidx indexes for dash

Conflicts:
	libavformat/movenc.c
	libavformat/movenc.h

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-08-18 08:50:22 +02:00
Martin Storsjö 26ac22e5e7 movenc: Add a new flag for writing global sidx indexes for dash
The double meaning of the faststart flag (moving a moov atom
to the start of files, making them streamable, for non-fragmented
files, vs inserting a global sidx index at the start of files
for fragmented files) is confusing - see 40ed1cbf1 for
explanation of its origins.

Since the second meaning of the flag hasn't been part of any
libav release yet, just rename it to get rid of the confusion
without any extra deprecation (which wouldn't get rid of the
potential confusion, of users adding -movflags faststart
even for fragmented files, where it isn't needed for making
them "streamable").

This gets back the old behaviour, where -movflags faststart
doesn't have any effect for fragmented files.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-08-12 13:41:46 +03:00
Hendrik Leppkes 10ea06b3bb Merge commit '5f200bbf98efe50f63d0515b115d2ba8dae297bc'
* commit '5f200bbf98efe50f63d0515b115d2ba8dae297bc':
  movenc: Place the sidx index after the initial moov/mdat pair

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-08-10 11:24:30 +02:00
Hendrik Leppkes 7653ebfff6 Merge commit '83f254e65f938657a4dbec711e4c94252a72daf9'
* commit '83f254e65f938657a4dbec711e4c94252a72daf9':
  movenc: Rename reserved_moov_pos to reserved_header_pos

Conflicts:
	libavformat/movenc.c
	libavformat/movenc.h

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-08-10 11:23:21 +02:00
Hendrik Leppkes 6c52432b48 Merge commit '8e34089e265a6b01e1e3301e8864439d26793753'
* commit '8e34089e265a6b01e1e3301e8864439d26793753':
  movenc: Check that frag_info entries exist in mov_write_sidx_tag

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-08-10 11:20:09 +02:00
Martin Storsjö 5f200bbf98 movenc: Place the sidx index after the initial moov/mdat pair
For fragmented files with non-empty moov, with a fragment index
(sidx), place the index after the initial moov/mdat pair.

Previously, for this pathological case, the index was written
at the start of the file.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-08-10 09:46:14 +03:00
Martin Storsjö 83f254e65f movenc: Rename reserved_moov_pos to reserved_header_pos
The same field is also used for writing the sidx index header,
for fragmented files, when the faststart flag is used.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-08-10 09:46:07 +03:00
Martin Storsjö 8e34089e26 movenc: Check that frag_info entries exist in mov_write_sidx_tag
This fixes crashes with pathological cases when trying to write
a sidx index (via the -movflags faststart option, in combination
with fragmenting options), when no fragments actually have been
written. (This is possible if the empty_moov flag isn't used,
so that all actual packet data is written in the moov/mdat pair,
and no moof/mdat pairs have been written.)

In these pathological cases, no sidx should be written at all.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-08-10 09:46:03 +03:00
Michael Niedermayer 29d147c94d Merge commit '059a934806d61f7af9ab3fd9f74994b838ea5eba'
* commit '059a934806d61f7af9ab3fd9f74994b838ea5eba':
  lavc: Consistently prefix input buffer defines

Conflicts:
	doc/examples/decoding_encoding.c
	libavcodec/4xm.c
	libavcodec/aac_adtstoasc_bsf.c
	libavcodec/aacdec.c
	libavcodec/aacenc.c
	libavcodec/ac3dec.h
	libavcodec/asvenc.c
	libavcodec/avcodec.h
	libavcodec/avpacket.c
	libavcodec/dvdec.c
	libavcodec/ffv1enc.c
	libavcodec/g2meet.c
	libavcodec/gif.c
	libavcodec/h264.c
	libavcodec/h264_mp4toannexb_bsf.c
	libavcodec/huffyuvdec.c
	libavcodec/huffyuvenc.c
	libavcodec/jpeglsenc.c
	libavcodec/libxvid.c
	libavcodec/mdec.c
	libavcodec/motionpixels.c
	libavcodec/mpeg4videodec.c
	libavcodec/mpegvideo.c
	libavcodec/noise_bsf.c
	libavcodec/nuv.c
	libavcodec/nvenc.c
	libavcodec/options.c
	libavcodec/parser.c
	libavcodec/pngenc.c
	libavcodec/proresenc_kostya.c
	libavcodec/qsvdec.c
	libavcodec/svq1enc.c
	libavcodec/tiffenc.c
	libavcodec/truemotion2.c
	libavcodec/utils.c
	libavcodec/utvideoenc.c
	libavcodec/vc1dec.c
	libavcodec/wmalosslessdec.c
	libavformat/adxdec.c
	libavformat/aiffdec.c
	libavformat/apc.c
	libavformat/apetag.c
	libavformat/avidec.c
	libavformat/bink.c
	libavformat/cafdec.c
	libavformat/flvdec.c
	libavformat/id3v2.c
	libavformat/isom.c
	libavformat/matroskadec.c
	libavformat/mov.c
	libavformat/mpc.c
	libavformat/mpc8.c
	libavformat/mpegts.c
	libavformat/mvi.c
	libavformat/mxfdec.c
	libavformat/mxg.c
	libavformat/nutdec.c
	libavformat/oggdec.c
	libavformat/oggparsecelt.c
	libavformat/oggparseflac.c
	libavformat/oggparseopus.c
	libavformat/oggparsespeex.c
	libavformat/omadec.c
	libavformat/rawdec.c
	libavformat/riffdec.c
	libavformat/rl2.c
	libavformat/rmdec.c
	libavformat/rtpdec_latm.c
	libavformat/rtpdec_mpeg4.c
	libavformat/rtpdec_qdm2.c
	libavformat/rtpdec_svq3.c
	libavformat/sierravmd.c
	libavformat/smacker.c
	libavformat/smush.c
	libavformat/spdifenc.c
	libavformat/takdec.c
	libavformat/tta.c
	libavformat/utils.c
	libavformat/vqf.c
	libavformat/westwood_vqa.c
	libavformat/xmv.c
	libavformat/xwma.c
	libavformat/yop.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-27 23:15:19 +02:00
Vittorio Giovara 059a934806 lavc: Consistently prefix input buffer defines
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-27 15:24:59 +01:00
Michael Niedermayer a194298954 avformat/movenc: Drop redundant bit exact field from context
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-18 13:27:33 +02:00
compn 0054d5ac02 avformat/movenc: fix mime-types in movenc.c
https://developer.apple.com/library/ios/documentation/AppleApplications/Reference/SafariWebContent/CreatingContentforSafarioniPhone/CreatingContentforSafarioniPhone.html

says video/mp4

suggested by BBB on irc.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-07-09 02:17:35 +02:00
Michael Niedermayer cfcb9f5e36 Merge commit 'e95c7a61852cc5b9ce5445ff034b87553e61958a'
* commit 'e95c7a61852cc5b9ce5445ff034b87553e61958a':
  mov: Preserve the metadata even when bit-exactness is requested

Conflicts:
	libavformat/movenc.c
	tests/ref/vsynth/vsynth1-mpeg4
	tests/ref/vsynth/vsynth2-mpeg4

See: a17ee4117d
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-30 21:47:58 +02:00
Luca Barbato e95c7a6185 mov: Preserve the metadata even when bit-exactness is requested
Make sure to not write the custom `encoder` string in that case.

Bug-Id: 845
CC: libav-stable@libav.org
2015-06-30 15:34:38 +02:00
Michael Niedermayer f98c3ec5c6 avformat/movenc: Check return code of ff_iso8601_to_unix_time()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-21 04:18:08 +02:00
Michael Niedermayer 9e40bd50e1 avformat/movenc: Make static packed_size, const static
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-11 00:48:41 +02:00
Janne Grunau 529c05698e movenc: fixes a questionable valgrind uninitialized value warning
display_matrix_size is only initialized when av_stream_get_side_data()
returns a side data pointer. The code is safe since the only effect this
has is setting the display_matrix pointer to NULL which it was already
anyway.
2015-06-10 14:32:11 +02:00
Michael Niedermayer 627dd7fe7e avformat/movenc: Fix potential signed overflows
Fixes CID1302838

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-01 17:54:58 +02:00
Michael Niedermayer a3ec1d6abd avformat/movenc: Add loction/xyz support to allow copying data between mov files
Fixes Ticket4337

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-30 16:44:05 +02:00
Michael Niedermayer 061a592b9c avformat/movenc: Check that track_width_1616 fits within the available 32bit before storing it
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-29 12:54:37 +02:00
Michael Niedermayer 14bc570442 avformat/movenc: avoid floats in width/height/aspect ratio computations
This avoids the possibility for rounding/precision differences between platforms

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-29 12:46:58 +02:00
Michael Niedermayer 023040ed0d avformat/movenc: Allow muxing mp3 with samplerate < 16khz if the user sets strict to -1
Fixes Ticket4267

Approved-by: Baptiste Coudurier <baptiste.coudurier@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-27 01:47:59 +02:00
Michael Niedermayer 894d8cf418 avformat/movenc: Avoid floats & float rounding in tmcd nb_frames calculation
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-26 14:51:00 +02:00
Michael Niedermayer 0c3b4efc76 avformat/movenc: Remove float use from rgb_to_yuv()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-24 13:32:53 +02:00
Carl Eugen Hoyos 4fb3efd2c1 lavf/mov: Use AVCOL_SPC constants when checking color_space.
Suggested-by: Ronald Bultje
2015-05-21 01:04:57 +02:00
Carl Eugen Hoyos c4f864193f lavf/mov: Write colour matrix "6" for color_space bt470bg.
This matches the demuxer's behaviour.
2015-05-21 01:04:45 +02:00
Michael Niedermayer ad3c5ff347 Merge commit 'e0046bc9c96150fa06146ace9093f06857dd7b23'
* commit 'e0046bc9c96150fa06146ace9093f06857dd7b23':
  movenc: Write the make and model metadata keys for mov style files

Conflicts:
	libavformat/movenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-23 20:33:09 +01:00
Martin Storsjö e0046bc9c9 movenc: Write the make and model metadata keys for mov style files
These are essential allowing QuickTime to keep detecting content
as slow-motion - this allows preserving them on stream copy.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-23 12:43:35 +02:00
Michael Niedermayer 3c5c6870a7 avformat/movenc: avoid using uninitialized display_matrix_size
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-21 00:24:31 +01:00