Commit Graph

869 Commits

Author SHA1 Message Date
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
Martin Storsjö
0c5e380c2c movenc: Don't rely on the fragment index for vc1 info gathering
The previous use of the mov->fragments field, for determining whether
written packets were part of the first fragment or not, didn't
work as intended when using the empty_moov flag.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-10 10:41:03 +02:00
Michael Niedermayer
ba0198a767 Merge commit '46d4d8575979a24a8d026d9805039b724e0e3e5f'
* commit '46d4d8575979a24a8d026d9805039b724e0e3e5f':
  movenc: Avoid writing separate flags for the first sample if not necessary

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-09 11:27:29 +01:00
Michael Niedermayer
e8821e74bb Merge commit '00d751d4fc20ec88d2cc2c9f39ec8b9e9c8cdeba'
* commit '00d751d4fc20ec88d2cc2c9f39ec8b9e9c8cdeba':
  movenc: Set tfhd default sample flags based on actual samples, if possible

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-09 11:15:12 +01:00
Martin Storsjö
46d4d85759 movenc: Avoid writing separate flags for the first sample if not necessary
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-09 10:36:12 +02:00
Martin Storsjö
00d751d4fc movenc: Set tfhd default sample flags based on actual samples, if possible
This avoids assuming that e.g. audio samples are marked as
sync samples.

This allows omitting the sample flags from trun, if the default
flags happen to be right for all the samples.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-09 10:36:02 +02:00
Michael Niedermayer
1468ff49df Merge commit '9731cf4001377fa2f75c279072cc2b0cbd57bf8e'
* commit '9731cf4001377fa2f75c279072cc2b0cbd57bf8e':
  movenc: Keep writing zero-entry stts atoms as intended

Conflicts:
	libavformat/movenc.c

See: 95165f7c1b
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-06 20:57:11 +01:00
Martin Storsjö
9731cf4001 movenc: Keep writing zero-entry stts atoms as intended
a876585215 had the unintended side effect of returning AVERROR(ENOMEM)
when track->entry is zero, while the code intentionally wants to
continue in that case.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-03-06 16:17:48 +02:00
Kevin Wheatley
45555a20c6 avformat/movenc: Add support for writing 'gama' atom to QuickTime .mov files.
As this is depricated it should not be on by default, it is only
supported for MOV containers, depends on avpriv_get_gamma_from_trc()

Enable by:

-movflags +write_gama

This will use the color_trc to supply a gamma value, if desired an
explicit value may be supplied using the -mov_gamma option supplying
a suitable floating point value, values <=1e-6 will not be written.

Signed-off-by: Kevin Wheatley <kevin.j.wheatley@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-05 12:26:37 +01:00
Michael Niedermayer
4ad7b8f64a avformat/movenc: mark write_colr as experimental
This way the flag can be flipped to a nowrite_colr, if people prefer that

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-04 22:36:23 +01:00
Derek Buitenhuis
a22032281c movenc: Write 'colr' box correctly for MP4
This also restricts it to MOV and MP4, since it is only
defined for those formats.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2015-02-27 14:06:02 +00:00
Kevin Wheatley
3664703780 avformat/movenc: Fix writing ACLR atoms for DNxHD
Using the copy codec ACLR atoms where incorrectly written

During the creation of the ACLR atom we are assuming the vos_data
contains the DNxHD header. This change makes this explicit and
ensures we don't over write the stream with the extra_data.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-24 16:54:02 +01:00
Michael Niedermayer
3518925a91 avformat/movenc: Check for memory allocation failures
Fixes CID1271049
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-22 20:20:13 +01:00
Kevin Wheatley
31c7c0e156 avformat/movenc: Move avid DNxHD padding to the correct spot
Outputting DNxHD into .mov containers 'corrupts' following atoms until end of stsd

ffmpeg and qtdump could not decode pasp/colr atoms in the files made by ffmpeg,
when outputting DNxHD due to the incorrect padding placement. Now we add the
padding in the correct place

Tidy up FATE changes due to padding changes.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-20 12:17:14 +01:00
Michael Niedermayer
9e008ed1b4 avformat/movenc: Fix use of uninitialized variable (ret)
Fixed CID1270823

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-18 16:33:15 +01:00
Michael Niedermayer
95165f7c1b avformat/movenc: Fix stts_entries allocation check
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-17 21:51:35 +01:00
Michael Niedermayer
80c5dc5610 Merge commit 'a8765852158ecb2ae34895fa35ff51dc95c186f9'
* commit 'a8765852158ecb2ae34895fa35ff51dc95c186f9':
  movenc: Check memory allocations

Conflicts:
	libavformat/movenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-17 21:50:08 +01:00
Hugo Beauzée-Luyssen
a876585215 movenc: Check memory allocations
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-02-17 12:16:43 -05:00
Kevin Wheatley
7fc33dca39 libavformat: DNxHD in .mov, switch unspecified color_range to mpeg
Avid prefers mpeg range [16-235] by default this change brings
ffmpeg into line with that. To obtain the old behaviour use
'-color_range jpeg' on the command line prior to the ouput
filename.

Signed-off-by: Kevin Wheatley <kevin.j.wheatley@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-10 16:46:12 +01:00
Carl Eugen Hoyos
a2bc8c5601 Fix standalone compilation of the mov muxer with --disable-optimizations.
Reported-by: Bernhard Döbler
2015-02-08 15:48:26 +01:00
Paul B Mahol
f705b1287b avformat/movenc: remove unneeded #include, there are no assert() only av_assert*
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-01-31 08:57:07 +00:00
Kevin Wheatley
7b6f419176 avformat/movenc: Add simplistic 'colr' tag writing support to mov container
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-26 17:49:50 +01:00
Michael Niedermayer
da048c6d24 avformat/movenc: Check failure of allocation of ctts_entries and propagate error
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-25 14:32:22 +01:00
Michael Niedermayer
47785b44b5 avformat/movenc: fix cleanup on insufficient reserved_moov_size
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-25 14:28:43 +01:00
Carl Eugen Hoyos
a5334d4081 Handle r10k endianess atom DpxE.
Fixes playback and remuxing of r10k_full-range_big-endian.mov.

Reported, analyzed and tested by Olaf Matthes, olaf matthes gmx de
2015-01-11 12:15:03 +01:00
Michael Niedermayer
6f838dee3c avformat/movenc: move variable to a more local block
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-10 04:50:50 +01:00
Michael Niedermayer
7824dc5150 avformat/movenc: workaround bug in "PathScale EKOPath(tm) Compiler Suite Version 4.0.12.1"
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-10 03:43:54 +01:00