Commit Graph

792 Commits

Author SHA1 Message Date
Michael Niedermayer 4dc305d784 Merge commit '40ed1cbf147d09fc0894bee160f0b6b6d9159fc5'
* commit '40ed1cbf147d09fc0894bee160f0b6b6d9159fc5':
  movenc: Allow writing a DASH sidx atom at the start of files

Conflicts:
	libavformat/movenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-17 23:02:02 +01:00
Michael Niedermayer 3fa4351d6b Merge commit '3847f3ab58b3b74604807394247bf68827258103'
* commit '3847f3ab58b3b74604807394247bf68827258103':
  movenc: Add tfra entries for all tracks in a moof

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-17 22:24:05 +01:00
Michael Niedermayer 9e0b0c60bd Merge commit '2ded57371abead879bcee56da5131e5fac0d17ef'
* commit '2ded57371abead879bcee56da5131e5fac0d17ef':
  movenc: Add support for writing sidx atoms for DASH segments

Conflicts:
	Changelog
	libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-17 21:55:23 +01:00
Michael Niedermayer 1fddfaa282 Merge commit '2d9d6afb8d2f284f5e620ecc19f643d5cd3facb8'
* commit '2d9d6afb8d2f284f5e620ecc19f643d5cd3facb8':
  movenc: Factorize adding fragment info into a separate function

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-17 21:43:43 +01:00
Michael Niedermayer b96c1cd78b Merge commit '0f9eb9165bb7d7982fdedf64f6bcec856f1bedd6'
* commit '0f9eb9165bb7d7982fdedf64f6bcec856f1bedd6':
  movenc: Include empty tracks in iods when writing fragmented mp4

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-17 21:22:47 +01:00
Martin Storsjö 40ed1cbf14 movenc: Allow writing a DASH sidx atom at the start of files
This is mapped to the faststart flag (which in this case
perhaps should be called "shift and write index at the
start of the file"), which for fragmented files will
write a sidx index at the start.

When segmenting DASH into files, there's usually one sidx
at the start of each segment (although it's not clear to me
whether that actually is necessary). When storing all of it
in one file, the MPD doesn't necessarily need to describe
the individual segments, but the offsets of the fragments can be
fetched from one large sidx atom at the start of the file. This
allows creating files for the DASH ISO BMFF on-demand profile.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-17 16:17:07 +02:00
Martin Storsjö 3847f3ab58 movenc: Add tfra entries for all tracks in a moof
Previously only tfra entries were added for the first track in each moof.

The frag_info array used for tfra can also be used for writing
other kinds of fragment indexes, where it's more important to
include all tracks.

When the separate_moof option is enabled (as in ismv), we write
a separate moof for each track, so this doesn't make any difference
in that case.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-17 16:17:07 +02:00
Martin Storsjö 2ded57371a movenc: Add support for writing sidx atoms for DASH segments
A flag "dash" is added, which enables the necessary flags for
creating DASH compatible fragments.

When this is enabled, one sidx atom is written for each track
before every moof atom.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-17 16:16:46 +02:00
Martin Storsjö 2d9d6afb8d movenc: Factorize adding fragment info into a separate function
By calling this after writing the moof the first time (for
calculating the moof size), we can avoid intermediate storage
of tfrf_offset in MOVTrack.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-17 16:13:02 +02:00
Martin Storsjö 0f9eb9165b movenc: Include empty tracks in iods when writing fragmented mp4
When writing fragmented streams with an empty initial moov,
we won't have any samples in any tracks when writing the
moov atom, thus trust that any tracks that are added actually
will be present.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-17 16:12:02 +02:00
Michael Niedermayer 9ebfe38f38 Merge commit '9a5ac36b69ede4563e9ecd734141b12ea3280fbc'
* commit '9a5ac36b69ede4563e9ecd734141b12ea3280fbc':
  movenc: Require samples before trying to write edts

Conflicts:
	libavformat/movenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-08 11:41:29 +01:00
Michael Niedermayer 4342b346d2 Merge commit '8cb7b7b461b52898765b38e3eff68c0ce88347f3'
* commit '8cb7b7b461b52898765b38e3eff68c0ce88347f3':
  movenc: Avoid leaking locally allocated data when returning on errors

Conflicts:
	libavformat/movenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-08 11:08:57 +01:00
Michael Niedermayer 0bdc5db520 Merge commit '95a449d3ce8e15522df47a80a8a4593ea5c2b1bb'
* commit '95a449d3ce8e15522df47a80a8a4593ea5c2b1bb':
  movenc: Remove an outdated comment

Conflicts:
	libavformat/movenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-08 10:57:10 +01:00
Martin Storsjö 9a5ac36b69 movenc: Require samples before trying to write edts
This avoids a potential crash if writing a fragmented psp mp4
(which probably is only a hypothetical scenario).

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-08 11:14:21 +02:00
Martin Storsjö 8cb7b7b461 movenc: Avoid leaking locally allocated data when returning on errors
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-08 11:14:08 +02:00
Martin Storsjö 95a449d3ce movenc: Remove an outdated comment
QuickTime does support files with an empty initial movie
these days.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-08 11:13:37 +02:00
Michael Niedermayer c9a9a7a1fd Merge commit '9cbf70fa0e44613590b019cef1fe99aa3f3c5d9d'
* commit '9cbf70fa0e44613590b019cef1fe99aa3f3c5d9d':
  movenc: Write correct presentation timestamps in tfra

Conflicts:
	libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-08 01:04:04 +01:00
Michael Niedermayer 872c0bcd3c Merge commit 'e7d20f12c5eff5570cd897f3ce3a88456024036b'
* commit 'e7d20f12c5eff5570cd897f3ce3a88456024036b':
  movenc: Remove a now redundant check

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-08 00:32:52 +01:00
Michael Niedermayer 2893d1b36d Merge commit '1d8a0c1b43e58332a3a15c67d4adc161713cade8'
* commit '1d8a0c1b43e58332a3a15c67d4adc161713cade8':
  movenc: Allow to request not to use edit lists

Conflicts:
	libavformat/movenc.c

See: 537ef8bebf
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-08 00:22:42 +01:00
Martin Storsjö 9cbf70fa0e movenc: Write correct presentation timestamps in tfra
Previously we wrote decoding timestamps here, while the specs
say it should be presentation timestamps.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-07 14:50:06 +02:00
Martin Storsjö e7d20f12c5 movenc: Remove a now redundant check
When using the new first_trun flag instead of checking the track id,
we don't need to have a special case for the separate_moof flag
any longer.

This simplifies the complicated codepath ever so slightly.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-07 13:46:19 +02:00
Martin Storsjö 1d8a0c1b43 movenc: Allow to request not to use edit lists
In this case, shift tracks to start from zero instead (potentially
stretching the first sample in tracks that start later than the
first one).

Some software does not support edit lists at all, the adobe flash
player seems to be one of these. This results in AV sync errors when
edit lists are used to adjust AV sync.

Some players, such as QuickTime, don't respect the duration for
audio packets, so if an audio track starts later than the video
track and the first audio sample gets a duration longer than the
actual amount of data in it, the result will be out of sync.

Based on patches by Michael Niedermayer.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-07 12:11:46 +02:00
Michael Niedermayer 042eba52a5 Merge commit '91e8d2eb1f7bf3af949008b106ec1ca037b88b0e'
* commit '91e8d2eb1f7bf3af949008b106ec1ca037b88b0e':
  lavf: use the format context strict_std_compliance instead of the codec one

Conflicts:
	libavformat/mux.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-06 13:10:01 +01:00
Anton Khirnov 91e8d2eb1f lavf: use the format context strict_std_compliance instead of the codec one 2014-11-06 09:01:49 +01:00
Carl Eugen Hoyos e6b7246a68 lavf/movenc: Write G.726 bitrate to make the files decodable.
Fixes ticket #4069.
2014-11-03 00:38:13 +01:00
Michael Niedermayer dd2f868644 Merge commit 'aae6b3b918b4133b8cc2d1631196c1d406d0351a'
* commit 'aae6b3b918b4133b8cc2d1631196c1d406d0351a':
  movenc: Don't write any iso brands in ismv files

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-31 02:52:43 +01:00
Michael Niedermayer 77eff7a58a Merge commit 'c55d1d382cd41345a79782ace41f9b43f45dca9a'
* commit 'c55d1d382cd41345a79782ace41f9b43f45dca9a':
  movenc: Don't write any tfdt atom for ismv files

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-31 02:37:49 +01:00
Michael Niedermayer 61f1c96ef1 Merge commit '00c67fe1d0bc7c2ce49daac9c80ea39d5a663b73'
* commit '00c67fe1d0bc7c2ce49daac9c80ea39d5a663b73':
  movenc: Write a 0 duration in mdhd and tkhd for an empty initial moov

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-31 02:23:33 +01:00
Michael Niedermayer 8065a0cdbe Merge commit 'cf589faa5b7aed3bb38e08dcd00bd951e69686d1'
* commit 'cf589faa5b7aed3bb38e08dcd00bd951e69686d1':
  movenc: Add a flag for using default-base-is-moof in tfhd atoms

Conflicts:
	libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-31 01:46:25 +01:00
Martin Storsjö aae6b3b918 movenc: Don't write any iso brands in ismv files
We deviate slightly from the iso specs for these files.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-30 23:17:00 +02:00
Martin Storsjö c55d1d382c movenc: Don't write any tfdt atom for ismv files
The tfdt atom shouldn't be needed in those cases, we already
write tfxd atoms for ismv anyway, which is roughly equivalent.

This avoids having to declare the iso6 brand for ismv files.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-30 23:16:56 +02:00
Martin Storsjö 00c67fe1d0 movenc: Write a 0 duration in mdhd and tkhd for an empty initial moov
ISO/IEC 14496-12:2012/Cor 1:2013 is explicit about how this should be
handled. All zeros doesn't mean that the full file has got a zero
duration, only that the track samples described within the initial moov
have got zero duration. An all ones duration means an indeterminate
duration.

Keep writing a duration consisting of all ones for the ISM mode -
older windows media player versions won't play a file if this is
zero. (Newer windows media player versions play either version fine.)

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-30 23:16:50 +02:00
Michael Niedermayer 7f24e1e1a2 Merge commit '600d5ee6b12bad144756b0772319bb04796bc528'
* commit '600d5ee6b12bad144756b0772319bb04796bc528':
  movenc: Signal iso6 in compatible_brands when using tfdt

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-30 02:53:52 +01:00
Michael Niedermayer ad600e10da Merge commit '1e0b81abe86dc09dd34d60d57f92de5f12d65818'
* commit '1e0b81abe86dc09dd34d60d57f92de5f12d65818':
  movenc: Use a local variable consistently

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-30 02:37:03 +01:00
Michael Niedermayer 39cce77faf Merge commit 'b2b79eca6fae2466a53c5daa163a37e2474364fc'
* commit 'b2b79eca6fae2466a53c5daa163a37e2474364fc':
  movenc: Don't check the custom IO flag when using faststart

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-30 02:25:02 +01:00
Michael Niedermayer 647405d111 Merge commit '573b1de2d7f1db71030f91ecdded7d0bc071f6b6'
* commit '573b1de2d7f1db71030f91ecdded7d0bc071f6b6':
  movenc: Don't use track_id to decide which track is the first in a moof

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-30 02:17:54 +01:00
Martin Storsjö cf589faa5b movenc: Add a flag for using default-base-is-moof in tfhd atoms
Similarly to the omit_tfhd_offset flag added in e7bf085b, this
avoids writing absolute byte positions to the file, making them
more easily streamable.

This is a new feature from 14496-12:2012, so application support
isn't necessarily too widespread yet (support for it in libav was
added in 20f95f21f in July 2014).

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-29 23:04:04 +02:00
Martin Storsjö 600d5ee6b1 movenc: Signal iso6 in compatible_brands when using tfdt
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-29 23:03:52 +02:00
Martin Storsjö 1e0b81abe8 movenc: Use a local variable consistently
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-29 23:03:45 +02:00
Martin Storsjö b2b79eca6f movenc: Don't check the custom IO flag when using faststart
The custom IO flag actually never is set for muxers, only for
demuxers, so the check was pointless (unless a user intentionally
would set the flag to signal using custom IO).

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-29 23:02:02 +02:00
Martin Storsjö 573b1de2d7 movenc: Don't use track_id to decide which track is the first in a moof
If one track doesn't have any samples within a moof, no traf/trun
is written for it. When the omit_tfhd_offset flag is set, none
of the tfhd atoms have any base_data_offset set, and the implicit
offset (end of previous track fragment data, or start of the moof
for the first trun) is used.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-29 23:01:27 +02:00
Michael Niedermayer 99c26805e9 Merge commit 'c2c22c75cf89e2faab34d1ee1d392cfb065439ea'
* commit 'c2c22c75cf89e2faab34d1ee1d392cfb065439ea':
  movenc: Write tfdt atoms

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-14 22:03:51 +02:00
Martin Storsjö c2c22c75cf movenc: Write tfdt atoms
These allow getting the absolute start timestamp of a fragment
without reading preceding timestamps. This fixes sync between
tracks if starting from fragments in different streams that don't
align exactly.

This also is a prerequisite for producing DASH content.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-14 13:52:32 +03:00
Benoit Fouet f87134c7a1 avformat/movenc: add support for syncframes concatenation for E-AC-3.
E-AC-3 samples should contain 6 audio blocks, so concatenate syncframes
in order to achieve this.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-13 19:24:06 +02:00
Michael Niedermayer 094b3ce835 Merge commit 'e44ee1eb8db7393e9d43207c2e1812720e292e6d'
* commit 'e44ee1eb8db7393e9d43207c2e1812720e292e6d':
  movenc: Simplify code by using an existing local pointer

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-13 01:15:20 +02:00
Michael Niedermayer 20a66868a2 Merge commit 'dad12ce452a9d69c0d9d53c375003947d5f1b02e'
* commit 'dad12ce452a9d69c0d9d53c375003947d5f1b02e':
  movenc: Print a warning for an unhandled case of nonzero start dts with empty_moov

Conflicts:
	libavformat/movenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-13 01:10:13 +02:00
Michael Niedermayer ca5a77191b Merge commit 'dbb472cb2f2f799295a12b4922a6a8be2cccfdee'
* commit 'dbb472cb2f2f799295a12b4922a6a8be2cccfdee':
  movenc: Write edit lists for fragmented files as well, if necessary

Conflicts:
	libavformat/movenc.c

The default for writing EDTS for fragmented mp4 is left at disabled
this can be overridden via command line with -use_editlist
but EDTS + fragments still does not fully work, which is why it is
left disabled by default

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-13 01:02:36 +02:00
Michael Niedermayer 687cc836ea Merge commit '95ee4e2ce774e0339632d067161596bf3dadfc72'
* commit '95ee4e2ce774e0339632d067161596bf3dadfc72':
  movenc: Add some comments explaining subtle details in writing the edit lists

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-12 22:48:49 +02:00
Michael Niedermayer 031285dedf Merge commit '72f801619a1ae91969fee9a7d72519422433c998'
* commit '72f801619a1ae91969fee9a7d72519422433c998':
  movenc: Adjust edit lists to trim out parts of tracks with negative pts

Conflicts:
	libavformat/movenc.c

See: 66b45d8f7a
See: 14fd34d73b
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-12 22:39:17 +02:00
Martin Storsjö e44ee1eb8d movenc: Simplify code by using an existing local pointer
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-12 17:48:09 +03:00