-
Notifications
You must be signed in to change notification settings - Fork 238
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
base: master
Are you sure you want to change the base?
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'm afraid of device compatibility because of flush() bug: #8 |
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. |
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). |
@ypresto I think this is a useful feature. Please consider to merge it. |
Without a doubt this is an interesting feature. Are there any plans of adding it in the future? |
@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. |
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.