Commit Graph

122 Commits

Author SHA1 Message Date
Martin Storsjö 456e93bfdd dashenc: Adjust the start time of a segment to the end of the previous segment
This is the same adjustment that the mp4 muxer does to the start
timestamp of fragments, since the timestamp of a sample in an mp4
file is implicit from the sum of earlier sample durations.

This avoids gaps in the timeline (which can stop dash.js from
playing it back), and makes sure the timestamp on the segmenter
level matches what the mp4 muxer actually writes into the segments.

This is only an issue if the AVPacket duration of the last
packet of a segment doesn't point to the actual start timestamp
of the next packet (the first in the next segment).

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-12-17 09:43:08 +02:00
Martin Storsjö 2f628d5943 dashenc: Write segment timelines properly if the timeline has gaps
Write a new start time if the duration of the previous segment
didn't match the start of the next one. Check that segments
actually are continuous before writing a repeat count.

This makes sure timestamps deduced from the timeline actually
match the real start timestamp as written in filenames (if
using a template containing $Time$).

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-12-17 09:42:30 +02:00
Michael Niedermayer 7ee5f764ee Merge commit 'e737a4aaafcb1d761b7f96043c2f83ce742c64ae'
* commit 'e737a4aaafcb1d761b7f96043c2f83ce742c64ae':
  dashenc: Change the duration fields to 64 bit

Conflicts:
	libavformat/dashenc.c

See: e65849a70b
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-11 02:03:47 +01:00
Martin Storsjö e737a4aaaf dashenc: Change the duration fields to 64 bit
For the last_duration field, it's mostly theoretical, but the
total_duration field more probably may need to actually be 64 bit.

Bug-Id: CID 1254944
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-12-10 22:51:51 +02:00
Michael Niedermayer 1397cb002d Merge commit 'fa8934d6d6a0bb290010bdf16265c40b331d56fb'
* commit 'fa8934d6d6a0bb290010bdf16265c40b331d56fb':
  dashenc: log file output progress in verbose mode

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-10 01:24:56 +01:00
Bryan Huh fa8934d6d6 dashenc: log file output progress in verbose mode
As the manifest/segments are flushed to disk, log to stderr the
progress, when in verbose logging mode

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-12-10 00:03:16 +02:00
Michael Niedermayer e65849a70b avformat/dashenc: make durations 64bit
Fix potential integer overflow
Fix CID1254944

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-07 20:07:26 +01:00
Michael Niedermayer f001a2bd34 Merge commit 'fcae9f212a6001d966c52dc22cd4b22e9851b428'
* commit 'fcae9f212a6001d966c52dc22cd4b22e9851b428':
  dashenc: Avoid a VLA-like construct

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-28 12:52:13 +01:00
Michael Niedermayer 5ce070c16c Merge commit 'a9d8d35e4833fc4dfbf557ce73c84e9ca6224427'
* commit 'a9d8d35e4833fc4dfbf557ce73c84e9ca6224427':
  dashenc: Add options to make segment names configurable

Conflicts:
	libavformat/dashenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-28 12:50:38 +01:00
Martin Storsjö fcae9f212a dashenc: Avoid a VLA-like construct
This fixes the build on compilers that interpreted the earlier
code as a variable length array (which we intentionally disallow).

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-28 11:55:42 +02:00
Bryan Huh a9d8d35e48 dashenc: Add options to make segment names configurable
This allows one to specify templated segment names for init-segments,
media-segments, and for the base-url in the case of single-file.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-28 10:48:15 +02:00
Michael Niedermayer 4ae1d6021b Merge commit '675ac56b7ee0f204963fde55295197c5df80aa91'
* commit '675ac56b7ee0f204963fde55295197c5df80aa91':
  Revert "lavf: Don't try to update files atomically with renames on windows"

Conflicts:
	libavformat/dashenc.c
	libavformat/hdsenc.c
	libavformat/internal.h
	libavformat/smoothstreamingenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-27 11:52:33 +01:00
Martin Storsjö 675ac56b7e Revert "lavf: Don't try to update files atomically with renames on windows"
This reverts commit b9d08c77a4.

After taking MoveFileEx into use, we can replace files with renames
on windows as well.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-27 09:29:47 +02:00
Michael Niedermayer 71ecfcf2d3 Merge commit 'b9d08c77a44390b0848c06f20bc0e9e951ba6a3c'
* commit 'b9d08c77a44390b0848c06f20bc0e9e951ba6a3c':
  lavf: Don't try to update files atomically with renames on windows

Conflicts:
	libavformat/dashenc.c
	libavformat/hdsenc.c
	libavformat/internal.h
	libavformat/smoothstreamingenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-25 02:14:15 +01:00
Martin Storsjö b9d08c77a4 lavf: Don't try to update files atomically with renames on windows
On windows, rename(2) will fail if the target file exists. On
unix this trick is used to make sure that people reading the file
either will get the full previous file, or the full new version
of the file, but no intermediate version.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-24 23:34:44 +02:00
Michael Niedermayer 9a57309665 Merge commit 'fe42f94ce1023f9c2f7e86404c60afcee5b078a9'
* commit 'fe42f94ce1023f9c2f7e86404c60afcee5b078a9':
  dashenc: Don't segment all video streams when one stream gets a keyframe

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-24 14:07:35 +01:00
Martin Storsjö fe42f94ce1 dashenc: Don't segment all video streams when one stream gets a keyframe
This makes sure that segments actually start at a keyframe (and
makes sure we don't split segments twice in a row, with one segment
consisting of only a handful of packets), when one stream uses b-frames
while another one doesn't.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-24 11:09:40 +02:00
Michael Niedermayer 9f0fd17c61 Merge commit 'f856d9c2f314c493c672dfb9c876da182525da3d'
* commit 'f856d9c2f314c493c672dfb9c876da182525da3d':
  dashenc: Don't require the stream bitrate to be known

Conflicts:
	libavformat/dashenc.c

See: 5f8fcdd448
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-23 01:34:05 +01:00
Martin Storsjö f856d9c2f3 dashenc: Don't require the stream bitrate to be known
Don't write any bitrate attribute if it isn't known. As long as one
doesn't want automatic bitrate switching, playback can work just
fine even if it isn't set.

If strict standard compliance is requested, this is still considered
an error, since the attribute is mandatory according to the spec.

Based on a patch by Rodger Combs.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-22 22:16:37 +02:00
Rodger Combs 5f8fcdd448 dashenc: degrade gracefully if a stream's bitrate is unavailable
If a stream's bitrate is not set, this attempts to use its rc_max_rate;
if neither is set, it avoids writing a bandwidth attribute at all.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-18 21:18:53 +01:00
Michael Niedermayer b5b15c4dd9 Merge commit 'fe5e6e34c05e274f98528be4f77f3c474473f977'
* commit 'fe5e6e34c05e274f98528be4f77f3c474473f977':
  lavf: Add an MPEG-DASH ISOFF segmenting muxer

Conflicts:
	Changelog
	libavformat/Makefile
	libavformat/allformats.c
	libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-17 22:13:50 +01:00
Martin Storsjö fe5e6e34c0 lavf: Add an MPEG-DASH ISOFF segmenting muxer
This is mostly to serve as a reference example on how to segment
the output from the mp4 muxer, capable of writing the segment
list in four different ways:
- SegmentTemplate with SegmentTimeline
- SegmentTemplate with implicit segments
- SegmentList with individual files
- SegmentList with one single file per track, and byte ranges

The muxer is able to serve live content (with optional windowing)
or create a static segmented MPD.

In advanced cases, users will probably want to do the segmenting
in their own application code.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-17 16:17:07 +02:00