Commit Graph

895 Commits

Author SHA1 Message Date
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
Michael Niedermayer 750cf4e537 Merge commit 'cf18e777aed9f73011c7ab7cbab8003189d4b9d8'
* commit 'cf18e777aed9f73011c7ab7cbab8003189d4b9d8':
  movenc: write the display transform matrix

Conflicts:
	libavformat/movenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-20 01:10:06 +01:00
Anton Khirnov cf18e777ae movenc: write the display transform matrix 2015-03-19 21:02:59 +01:00
Michael Niedermayer b5448e66b0 Merge commit '67a2912307c3c08f2725ccae162cfe3426b80184'
* commit '67a2912307c3c08f2725ccae162cfe3426b80184':
  movenc: Don't assume that fragment durations in pts is equal to duration in dts

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-19 13:38:25 +01:00
Michael Niedermayer 25d7e3ad59 Merge commit '5c337353a2546416631a87de4881850d99141c39'
* commit '5c337353a2546416631a87de4881850d99141c39':
  movenc: Move sidx edit list timestamp adjustment into a block

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-19 13:26:47 +01:00
Michael Niedermayer 3602782429 Merge commit 'eee13d653953083553cceadbbedf6222ef78a006'
* commit 'eee13d653953083553cceadbbedf6222ef78a006':
  movenc: Only adjust the cts offset at the start of fragments if necessary

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-19 12:47:19 +01:00
Michael Niedermayer 4631d4bec3 Merge commit '5cf892d6946b19a87bcd00d6b76ce81f45960fdb'
* commit '5cf892d6946b19a87bcd00d6b76ce81f45960fdb':
  movenc: Write pts timestamps in tfxd, instead of dts timestamps

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-19 12:38:51 +01:00
Michael Niedermayer 00ad3432e1 Merge commit 'b81b0cc22b22413760423e239ea644c9afdbfa2d'
* commit 'b81b0cc22b22413760423e239ea644c9afdbfa2d':
  movenc: Set the last packet duration based on the next packet when autoflushing

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-19 12:38:29 +01:00
Michael Niedermayer 76fef5cd27 Merge commit '2889c5e16711770437f380f1bead5f72c6a0b17a'
* commit '2889c5e16711770437f380f1bead5f72c6a0b17a':
  movenc: Heuristically set the duration of the last sample in a fragment if not set

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-19 12:09:51 +01:00
Martin Storsjö 67a2912307 movenc: Don't assume that fragment durations in pts is equal to duration in dts
For strict CFR, they should be pretty much equal, but if the stream
is VFR, there can be a sometimes significant difference.

Calculate the pts duration separately, used in sidx atoms and for
tfrf/tfxd boxes in smooth streaming ismv files.

Also make sure to reduce the duration of sidx entries according to
edit lists.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-19 10:27:20 +02:00
Martin Storsjö 5c337353a2 movenc: Move sidx edit list timestamp adjustment into a block
When reading these values from track->frag_info, the same adjustment
has already been done.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-19 10:27:17 +02:00
Martin Storsjö eee13d6539 movenc: Only adjust the cts offset at the start of fragments if necessary
Adjusting it is only necessary when a sidx/tfrf/tfxd atom already has
been written for the previous fragment (since the sidx/tfrf/tfxd atoms
include the duration between the first pts of the previous fragment, to
the first pts of the new fragment).

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-19 10:27:15 +02:00
Martin Storsjö 5cf892d694 movenc: Write pts timestamps in tfxd, instead of dts timestamps
This matches what we write in tfra and tfrf since 9cbf70fa0e.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-19 10:27:12 +02:00
Martin Storsjö b81b0cc22b movenc: Set the last packet duration based on the next packet when autoflushing
When automatically flushing fragments based on set conditions
(fragmentation on keyframes, after some interval or byte size),
we already have the next packet for one stream - use this for setting
the duration of the last packet in the flushed fragment correctly.

This avoids having to adjust the timestamp of the first packet in
the new fragment since the last duration was unknown.

Unfortunately, this only works for automatic flushing (not for
caller-triggered flushing, like in the dash muxer), and only for the
one single track that triggered the flushing. The duration of the
last sample in all other tracks still is dependent on AVPacket
duration (or heuristics).

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-19 10:27:07 +02:00
Martin Storsjö 2889c5e167 movenc: Heuristically set the duration of the last sample in a fragment if not set
Even if this is a guess, it is way better than writing a zero duration
of the last sample in a fragment (because if the duration is zero,
the first sample of the next fragment will have the same timestamp
as the last sample in the previous one).

Since we normally don't require libavformat muxer users to set
the duration field in AVPacket, we probably can't strictly require
it here either, so don't log this as a strict warning, only as info.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-19 10:26:52 +02:00
Michael Niedermayer ae65cc7ed3 Merge commit '2cb9c2fc59c9267ad2631c07c81c188058502259'
* commit '2cb9c2fc59c9267ad2631c07c81c188058502259':
  movenc: Allow interleaving samples when writing fragmented files

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

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-16 23:30:13 +01:00
Michael Niedermayer 312eb0d66f Merge commit '50ff0c05b691524d1fd044a2f2eefb706932fc98'
* commit '50ff0c05b691524d1fd044a2f2eefb706932fc98':
  movenc: Support writing multiple trun atoms

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-16 21:53:02 +01:00
Martin Storsjö 2cb9c2fc59 movenc: Allow interleaving samples when writing fragmented files
This is incompatible with the omit_tfhd_offset flag (writing
position independent fragments with interleaving requires the
default_base_moof flag).

This makes the moof atoms slightly bigger, but can be better for
playback (improving locality of sample data in the mdat).

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-16 13:23:19 +02:00
Martin Storsjö 50ff0c05b6 movenc: Support writing multiple trun atoms
This is needed if all the data for one track isn't continuous
within the mdat. Normally we make sure all the data for one
track is continuous, but in new cases we will need to have
the samples interleaved.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-16 13:23:19 +02:00
Michael Niedermayer f8f324cc16 Merge commit '448c8cfe4c53e9e806effd8505b46d57fa707061'
* commit '448c8cfe4c53e9e806effd8505b46d57fa707061':
  movenc: Support setting fragment_index before the moov atom is written

Conflicts:
	libavformat/movenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-10 11:42:44 +01:00
Michael Niedermayer 8d026861f5 Merge commit '0c5e380c2c266d2e8a13c000cc527529db837f10'
* commit '0c5e380c2c266d2e8a13c000cc527529db837f10':
  movenc: Don't rely on the fragment index for vc1 info gathering

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-10 11:28:24 +01:00
Martin Storsjö 448c8cfe4c movenc: Support setting fragment_index before the moov atom is written
This way, the caller doesn't need to coordinate setting the option
after the moov atom has been written. The downside is that it is
no longer possible to use the option for checking whether the moov
atom already has been written, but a caller is able to keep track
of that by other means anyway.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-10 10:41:06 +02:00