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

Implement media time trim feature. #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

CharlesLin99
Copy link

Add class MediaTrimTime to hold trim duration.
Apply start time by invoking seekTo of MediaExtractor.
In VideoTrackTranscoder and PassThroughTrackTranscoder, check the sample time and make it not pass the trim end time.

@CharlesLin99 CharlesLin99 reopened this Mar 4, 2016
@CharlesLin99
Copy link
Author

@ypresto, Can you consider this feature?

@ypresto
Copy link
Owner

ypresto commented Mar 24, 2016

Perhaps some kind of interface to pass multiple, optional parameter is necessary.
I think builder pattern suits this.

@ypresto
Copy link
Owner

ypresto commented Mar 24, 2016

I'm afraid of device compatibility because of flush() bug: #8

@selsamman
Copy link

@ypresto

I have a need for this capability as well. Can you clarify the similarity regarding the seek that is done in this PR vs the flush bug that you corrected by queuing output. Am happy to work on this. Obviously we don't want any device compatibility issues.

@ypresto
Copy link
Owner

ypresto commented Jul 25, 2016

@selsamman

flush() was used to seek to beginning of video after determining output format.
That's why I thought similar issues can happen on some devices.
If you have affected device (or one has similar SoC), it can be tested without problems.
(Or AWS device farm can be used. Power of money 😎 )

@ypresto ypresto mentioned this pull request Jul 25, 2016
@selsamman
Copy link

@ypresto

Sorry to be so dense here. If I understand the original problem it was that it was not cool to essentially do an extra partial extraction just to determine the input format and then reset everything and flush. Instead you had to determine the format on-the-fly as you were decoding and queue everything until the decoder ran long enough to provide that format info.

But I don't see any flush being done in this PR. It just does a seek. Is that somehow doing a flush under the covers? I am new to MediaCodec.

BTW thanks for pointing me to the AWS device farm. That could be a game changer :-)

@ypresto
Copy link
Owner

ypresto commented Jul 26, 2016

Ah, you're right, flush()ing is different than skipping leading frames (seeking).
I'm afraid that just skipping frames can cause another unexpected codec bug or not.
I'll test with device farm about it.

ypresto referenced this pull request in ergovia-devs/android-transcoder Aug 1, 2016
@changxiangzhong
Copy link

@ypresto I think this is a useful feature. Please consider to merge it.

@sebadelcampo1
Copy link

Without a doubt this is an interesting feature. Are there any plans of adding it in the future?

@strayerM
Copy link

@CharlesLin99 , Thank you very much for your code of trim feature, It's useful! @sebadelcampo1 You can change your code according to this pull request , but you should let the function "createAudioOutputFormat" of all classes that implements "MediaFormatStrategy" return null, because "AudioTrackTranscoder" class doesnt have trim feature.

@aweck
Copy link

aweck commented May 31, 2019

I would also like to have this feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants