Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClippingMediaSource: Provide easy way to set clipping start point to a keyframe #2347

Closed
jmgirven opened this issue Jan 18, 2017 · 2 comments
Assignees

Comments

@jmgirven
Copy link

I was testing the current dev-v2 branch of ExoPlayer and specifically the ClippingMediaSource functionality. I see in #1988 that @andrewlewis wrote:

To avoid buffering you therefore need to ensure that the clipping start point corresponds to a synchronization sample/key-frame.

Is there a utility function somewhere that, given a time in the video, calculates the nearest synchronization sample/key-frame? I would prefer to have seamless transitions than frame accurate start times.

@andrewlewis
Copy link
Collaborator

andrewlewis commented Jan 30, 2017

There is no utility function in ExoPlayer to do this at the moment I'm afraid. It might be possible to provide an alternative mode in ClippingMediaSource that will snap to the start point to a keyframe. That would likely be the most efficient way to do this, as then it won't be necessary to have a separate loading step to find the keyframe. The duration of the period would only be set in the Timeline after the keyframe position becomes known. (We probably won't get around to doing this for a while unless it's needed for something else.)

If you know what media will be played in advance you could construct a ClippingMediaSource with the right start time. There are lots of ways to find keyframes; I use a command like ffprobe stream.mp4 -show_packets -print_format compact | grep -Po 'pts_time=\K([0-9.]+)(?=\|.*flags=K_$)' | head -c -1 | tr '\n' ','.

@ojw28 ojw28 changed the title dev-v2 ClippingMediaSource -- Ensure keyframe ClippingMediaSource: Provide easy way to set clipping start point to a keyframe Jan 23, 2019
@tonihei
Copy link
Collaborator

tonihei commented Jul 10, 2019

Duplicate of #5501. The other enhancement tracks a more general feature which would solve this problem as well.

@tonihei tonihei closed this as completed Jul 10, 2019
@google google locked and limited conversation to collaborators Oct 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants