Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
851134ec
authored
Mar 06, 2019
by
olly
Committed by
Oliver Woodman
Mar 15, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Derive Format.frameRate for MP4 videos
Issue: #5598 PiperOrigin-RevId: 237067179
parent
f35dbeb5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
8 deletions
library/core/src/main/java/com/google/android/exoplayer2/extractor/mp4/Mp4Extractor.java
library/core/src/test/assets/mp4/sample.mp4.0.dump
library/core/src/test/assets/mp4/sample.mp4.1.dump
library/core/src/test/assets/mp4/sample.mp4.2.dump
library/core/src/test/assets/mp4/sample.mp4.3.dump
library/core/src/main/java/com/google/android/exoplayer2/extractor/mp4/Mp4Extractor.java
View file @
851134ec
...
...
@@ -401,21 +401,27 @@ public final class Mp4Extractor implements Extractor, SeekMap {
for
(
int
i
=
0
;
i
<
trackCount
;
i
++)
{
TrackSampleTable
trackSampleTable
=
trackSampleTables
.
get
(
i
);
Track
track
=
trackSampleTable
.
track
;
long
trackDurationUs
=
track
.
durationUs
!=
C
.
TIME_UNSET
?
track
.
durationUs
:
trackSampleTable
.
durationUs
;
durationUs
=
Math
.
max
(
durationUs
,
trackDurationUs
);
Mp4Track
mp4Track
=
new
Mp4Track
(
track
,
trackSampleTable
,
extractorOutput
.
track
(
i
,
track
.
type
));
// Each sample has up to three bytes of overhead for the start code that replaces its length.
// Allow ten source samples per output sample, like the platform extractor.
int
maxInputSize
=
trackSampleTable
.
maximumSize
+
3
*
10
;
Format
format
=
track
.
format
.
copyWithMaxInputSize
(
maxInputSize
);
if
(
track
.
type
==
C
.
TRACK_TYPE_VIDEO
&&
trackDurationUs
>
0
&&
trackSampleTable
.
sampleCount
>
1
)
{
float
frameRate
=
trackSampleTable
.
sampleCount
/
(
trackDurationUs
/
1000000
f
);
format
=
format
.
copyWithFrameRate
(
frameRate
);
}
format
=
MetadataUtil
.
getFormatWithMetadata
(
track
.
type
,
format
,
udtaMetadata
,
mdtaMetadata
,
gaplessInfoHolder
);
mp4Track
.
trackOutput
.
format
(
format
);
durationUs
=
Math
.
max
(
durationUs
,
track
.
durationUs
!=
C
.
TIME_UNSET
?
track
.
durationUs
:
trackSampleTable
.
durationUs
);
if
(
track
.
type
==
C
.
TRACK_TYPE_VIDEO
&&
firstVideoTrackIndex
==
C
.
INDEX_UNSET
)
{
firstVideoTrackIndex
=
tracks
.
size
();
}
...
...
library/core/src/test/assets/mp4/sample.mp4.0.dump
View file @
851134ec
...
...
@@ -12,7 +12,7 @@ track 0:
maxInputSize = 36722
width = 1080
height = 720
frameRate =
-1.0
frameRate =
29.970028
rotationDegrees = 0
pixelWidthHeightRatio = 1.0
channelCount = -1
...
...
library/core/src/test/assets/mp4/sample.mp4.1.dump
View file @
851134ec
...
...
@@ -12,7 +12,7 @@ track 0:
maxInputSize = 36722
width = 1080
height = 720
frameRate =
-1.0
frameRate =
29.970028
rotationDegrees = 0
pixelWidthHeightRatio = 1.0
channelCount = -1
...
...
library/core/src/test/assets/mp4/sample.mp4.2.dump
View file @
851134ec
...
...
@@ -12,7 +12,7 @@ track 0:
maxInputSize = 36722
width = 1080
height = 720
frameRate =
-1.0
frameRate =
29.970028
rotationDegrees = 0
pixelWidthHeightRatio = 1.0
channelCount = -1
...
...
library/core/src/test/assets/mp4/sample.mp4.3.dump
View file @
851134ec
...
...
@@ -12,7 +12,7 @@ track 0:
maxInputSize = 36722
width = 1080
height = 720
frameRate =
-1.0
frameRate =
29.970028
rotationDegrees = 0
pixelWidthHeightRatio = 1.0
channelCount = -1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment