-
Notifications
You must be signed in to change notification settings - Fork 240
Implement media time trim feature. #14
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
Conversation
Implement media time trim feature.
@ypresto, Can you consider this feature?
Perhaps some kind of interface to pass multiple, optional parameter is necessary.
I think builder pattern suits this.
I'm afraid of device compatibility because of flush() bug: #8
selsamman
commented
Jul 25, 2016
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.
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 😎 )
selsamman
commented
Jul 25, 2016
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 :-)
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.
changxiangzhong
commented
Sep 26, 2016
@ypresto I think this is a useful feature. Please consider to merge it.
sebadelcampo1
commented
Mar 15, 2017
Without a doubt this is an interesting feature. Are there any plans of adding it in the future?
strayerM
commented
Mar 16, 2017
@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
commented
May 31, 2019
I would also like to have this feature
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.