Skip to content

Commit

Permalink
Merge pull request #10 from svt/CS-3920
Browse files Browse the repository at this point in the history
Add profile to AudioStream, FfAudioStream.
  • Loading branch information
fhermansson authored Feb 16, 2023
2 parents c7e658a + dc3a7cd commit 6532473
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/main/kotlin/se/svt/oss/mediaanalyzer/MediaAnalyzer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ class MediaAnalyzer
channels = ffAudioStream.channels,
channelLayout = ffAudioStream.channel_layout,
samplingRate = ffAudioStream.sample_rate ?: audioTrack?.samplingRate,
bitrate = ffAudioStream.bit_rate ?: audioTrack?.bitrate
bitrate = ffAudioStream.bit_rate ?: audioTrack?.bitrate,
profile = ffAudioStream.profile
)
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/kotlin/se/svt/oss/mediaanalyzer/file/AudioStream.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ data class AudioStream(
val channels: Int,
val channelLayout: String?,
val samplingRate: Int?,
val bitrate: Long?
val bitrate: Long?,
val profile: String?
)
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,28 @@ class MediaAnalyzerIntegrationTest {
.hasDuration(2.621)
.hasSamplingRate(48000)
.hasBitrate(128104)
.hasProfile("LC")
}
@Test
fun testAudioHeAac() {
val file = javaClass.getResource("/he-aac_test.mp4").file

val audioFile = MediaAnalyzer()
.analyze(file) as AudioFile

assertThat(audioFile)
.hasFormat("MPEG-4")
.hasOverallBitrate(67625)
.hasDuration(5.000)

assertThat(audioFile.audioStreams).hasSize(1)
assertThat(audioFile.audioStreams.first())
.hasFormat("AAC")
.hasCodec("aac")
.hasChannels(2)
.hasDuration(5.000)
.hasSamplingRate(48000)
.hasBitrate(64183)
.hasProfile("HE-AAC")
}
}
Binary file added src/test/resources/he-aac_test.mp4
Binary file not shown.

0 comments on commit 6532473

Please sign in to comment.