https://github.com/kibotu/fastexoplayerseeker
Fast Seek for ExoPlayer
https://github.com/kibotu/fastexoplayerseeker
android exoplayer hacktoberfest scroll seek
Last synced: about 1 year ago
JSON representation
Fast Seek for ExoPlayer
- Host: GitHub
- URL: https://github.com/kibotu/fastexoplayerseeker
- Owner: kibotu
- License: apache-2.0
- Created: 2019-05-17T09:36:51.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-10-04T07:56:48.000Z (almost 7 years ago)
- Last Synced: 2025-03-27T18:21:38.993Z (over 1 year ago)
- Topics: android, exoplayer, hacktoberfest, scroll, seek
- Language: Kotlin
- Homepage:
- Size: 57.9 MB
- Stars: 45
- Watchers: 2
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[](https://www.paypal.me/janrabe/5) [](https://about.me/janrabe)
# FastExoPlayerSeeker [](https://jitpack.io/#kibotu/FastExoPlayerSeeker) [](https://jitpack.io/#kibotu/FastExoPlayerSeeker) [](https://jitpack.io/com/github/kibotu/FastExoPlayerSeeker/master-SNAPSHOT/javadoc/index.html) [](https://travis-ci.org/kibotu/FastExoPlayerSeeker) [](https://android-arsenal.com/api?level=15) [](https://docs.gradle.org/current/release-notes) [](https://kotlinlang.org/) [](https://raw.githubusercontent.com/kibotu/FastExoPlayerSeeker/master/LICENSE) [](https://developer.android.com/topic/libraries/support-library/refactor)
## Introduction
Adds fast seeking for exoplayer. (Note: it also depends on the amount of video encoding, mainly IDR Frames)

## How to install
```groovy
repositories {
maven {
url "https://jitpack.io"
}
}
dependencies {
implementation 'com.github.kibotu:FastExoPlayerSeeker:-SNAPSHOT'
}
```
## How to use
### Create Emitter
```kotlin
val emitter = SeekPositionEmitter()
emitter.seekFast(newSeekPosition)
```
### Create Observable
```kotlin
simpleExoPlayer.seekWhenReady(emitter)
.subscribe({
logv("seekTo=${it.first} isSeeking=${it.second}")
}, { loge("${it.message}") })
.addTo(subscriptions) // don't forget to dispose when you're done!
```
### FFMpeg
I've had good results increasing the amount if IDR frames using the following script which in term will help exoplayer snap to those sync frames and improve scrubbing.
```bash
#!/usr/bin/env bash
# change iframe rate
# https://gist.github.com/kibotu/27c5d665d19b9f782e6b4f26eff878b1
#
# https://ffmpeg.org/ffmpeg-formats.html#mov_002c-mp4_002c-ismv
# -movflags faststart
# Run a second pass moving the index (moov atom) to the beginning of the file. This operation can take a while, and will not work in various situations such as fragmented output, thus it is not enabled by default.
#
# -movflags rtphint
# Add RTP hinting tracks to the output file.
#
# -c:v libx264
# -c codec codec name
#
# -profile profile set profile
# Another optional setting is -profile:v which will limit the output to a specific H.264 profile.
# Omit this unless your target device only supports a certain profile (see Compatibility).
# Current profiles include: baseline, main, high, high10, high422, high444. Note that usage of -profile:v is incompatible with lossless encoding.
# https://trac.ffmpeg.org/wiki/Encode/H.264
# https://trac.ffmpeg.org/wiki/Encode/H.264#Compatibility
#
# -keyint_min E..V…. minimum interval between IDR-frames (from INT_MIN to INT_MAX) (default 25)
ffmpeg -i inputvide.mp4 -c:v libx264 -profile:v baseline -level 3.0 -x264opts keyint=10:min-keyint=10 -g 10 -movflags +faststart+rtphint -maxrate:v 4000k -bufsize:v 4500k outputvideo.mp4
```
## How to build
graldew clean build
### CI
gradlew clean assembleRelease test javadoc
#### Build Requirements
- JDK8
- Android Build Tools 29.0.2
- Android SDK 29
### Notes
Follow me on Twitter: [@wolkenschauer](https://twitter.com/wolkenschauer)
Let me know what you think: [jan.rabe@kibotu.net](mailto:jan.rabe@kibotu.net)
Contributions welcome!
### License
Copyright 2019 Jan Rabe
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.