sannies / mp4parser

A Java API to read, write and create MP4 files
Apache License 2.0
2.76k stars 568 forks source link

Can we trim video to B frame? #293

Open vxhviet opened 6 years ago

vxhviet commented 6 years ago

Hi every one.

I'm looking for a way to trim a video clip into a shorter one. I haven't had time to goes through all the code yet but based on my experience with MediaCodec it only play nicely with key frame. So I would like to ask whether mp4parser is able to trim a video clip at random position (B frames) that is not necessarily key frame?

Thanks a lot for your time.

guness commented 6 years ago

a bit late but seems no:

51

sannies commented 6 years ago

You can stop at a p frame - no problem. Stopping at b frame might cause minor distortions in the last 1or 2 frames OR they are not displayed. Remember: decoding order is not display order when b frames are in play. Just test it. BUT: You can only start at I frames. BUT2: Depending on your scenario you might cut to an I Frame before the actual desired starting point and use so called edit list boxes to instruct players to skip frames at the beginning

Am 08.03.2018 14:41 schrieb "Sinan Güneş" notifications@github.com:

a bit late but seems no:

51 (comment)

https://github.com/sannies/mp4parser/issues/51#issuecomment-75949025

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sannies/mp4parser/issues/293#issuecomment-371475839, or mute the thread https://github.com/notifications/unsubscribe-auth/AAKUDzPJSaJfR4gdcvVc25BtC7FN2aeSks5tcSbjgaJpZM4QuZyP .

guness commented 6 years ago

Thanks for clarifying. I think this info deserves to be documented (probably on README).